Files
dvcp_v2_wxcp_app/src/apps/AppMonitoringObject/MonitorAddLog.vue

169 lines
3.3 KiB
Vue
Raw Normal View History

2022-03-24 14:29:32 +08:00
<template>
<div class="form">
<div class="form-item form-item__textarea">
<div class="form-item__title">
<em>*</em>
2022-03-31 11:14:42 +08:00
<h2>{{type == 1 ? '帮扶内容' : '走访内容'}}</h2>
2022-03-24 14:29:32 +08:00
</div>
2022-03-31 11:14:42 +08:00
<textarea maxlength="500" v-model="detail" :placeholder="type == 1 ? '请输入帮扶内容' : '请输入走访内容'"></textarea>
2022-03-29 11:38:51 +08:00
<div class="hint">{{ detail.length }}/500</div>
2022-03-24 14:29:32 +08:00
</div>
<div class="form-item form-item__imgs">
<div class="form-item__title">
<h2>图片</h2>
<i>最多9张</i>
</div>
<div>
2022-03-26 17:04:42 +08:00
<AiUploader :def.sync="files" multiple placeholder="上传图片" :limit="9" action="/admin/file/add2"></AiUploader>
2022-03-24 14:29:32 +08:00
</div>
</div>
<div class="btn" @click="submit">提交</div>
</div>
</template>
<script>
export default {
data() {
return {
detail: '',
pid: '',
2022-03-29 14:44:14 +08:00
files: [],
2022-03-31 11:14:42 +08:00
id: '',
type: ''
2022-03-24 14:29:32 +08:00
}
},
onLoad(query) {
this.pid = query.pid
2022-03-31 11:14:42 +08:00
this.type = query.type
2022-03-29 14:44:14 +08:00
if(query.id) {
this.id = query.id
this.getInfo()
}
},
onShow() {
2022-03-31 14:24:29 +08:00
if(this.type == 1) {
document.title = this.id ? '编辑帮扶日志' : '添加帮扶日志'
}else {
document.title = this.id ? '编辑走访日志' : '添加走访日志'
}
2022-03-24 14:29:32 +08:00
},
methods: {
2022-03-29 14:44:14 +08:00
getInfo() {
this.$http.post(`/app/apppreventionreturntopovertylog/queryDetailById?id=${this.id}`).then(res => {
if (res.code == 0) {
this.detail = res.data.detail
this.files = res.data.files || []
}
})
},
2022-03-24 14:29:32 +08:00
submit() {
if (!this.detail) {
return this.$u.toast('请输入帮扶内容')
}
this.$http.post('/app/apppreventionreturntopovertylog/addOrUpdate', {
detail: this.detail,
2022-03-26 16:55:09 +08:00
files: this.files,
2022-03-24 14:29:32 +08:00
pid: this.pid,
2022-03-31 11:14:42 +08:00
id: this.id,
type: this.type
2022-03-24 14:29:32 +08:00
}).then(res => {
if (res.code === 0) {
2022-03-29 10:27:14 +08:00
this.$u.toast('提交成功')
2022-03-24 14:29:32 +08:00
uni.$emit('reload')
2022-03-29 10:27:14 +08:00
setTimeout(() => {
uni.navigateBack({
delta: 1
})
}, 300)
2022-03-24 14:29:32 +08:00
}
})
}
}
}
</script>
<style lang="scss">
.form {
padding-bottom: 120px;
div {
margin-bottom: 16px;
background: #fff;
}
.form-item {
padding: 32px;
.form-item__title {
display: flex;
align-items: center;
margin-bottom: 34px;
em {
margin-right: 4px;
font-style: normal;
color: #FF4466;
}
h2 {
color: #333333;
font-weight: normal;
font-size: 32px;
}
i {
color: #999999;
font-size: 28px;
font-style: normal;
}
}
textarea {
width: 100%;
}
}
.form-type {
display: flex;
align-items: center;
justify-content: space-between;
height: 112px;
padding: 0 32px;
h2 {
font-weight: normal;
color: #333333;
font-size: 32px;
}
span {
color: #999999;
font-size: 28px;
}
}
.btn {
position: fixed;
left: 0;
bottom: 0;
z-index: 11;
width: 100%;
height: 112px;
line-height: 112px;
margin: 0;
text-align: center;
color: #FFFFFF;
font-size: 32px;
background: #3192F4;
}
2022-03-29 11:38:51 +08:00
.hint{
text-align: right;
color: #999;
}
2022-03-24 14:29:32 +08:00
}
</style>