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

142 lines
3.4 KiB
Vue
Raw Normal View History

2022-03-24 14:29:32 +08:00
<template>
2022-08-15 18:39:33 +08:00
<div class="MonitorAddLog">
<AiGroup v-if="isBangFu">
<AiItem label="帮扶类型" required>
<AiSelect dict="fpAssistanceMeasures" v-model="operationDesc"/>
</AiItem>
</AiGroup>
<!--走访日志-->
<AiGroup v-else>
<AiItem label="走访日期" required>
<AiDate v-model="createDate"/>
</AiItem>
</AiGroup>
<AiGroup>
<AiItem :label="isBangFu ? '帮扶内容' : '走访内容'" required topLabel>
<textarea maxlength="500" v-model="detail" :placeholder="isBangFu ? '请输入帮扶内容' : '请输入走访内容'"></textarea>
<div class="hint">{{ detail.length }}/500</div>
</AiItem>
</AiGroup>
<AiGroup>
<AiItem label="图片" topLabel>
<span slot="sub" class="color-999" v-text="`最多9张`"/>
2022-03-26 17:04:42 +08:00
<AiUploader :def.sync="files" multiple placeholder="上传图片" :limit="9" action="/admin/file/add2"></AiUploader>
2022-08-15 18:39:33 +08:00
</AiItem>
</AiGroup>
2022-03-24 14:29:32 +08:00
<div class="btn" @click="submit">提交</div>
</div>
</template>
<script>
export default {
2022-08-15 18:39:33 +08:00
name: "MonitorAddLog",
2022-03-24 14:29:32 +08:00
data() {
return {
detail: '',
pid: '',
2022-03-29 14:44:14 +08:00
files: [],
2022-03-31 11:14:42 +08:00
id: '',
2022-04-26 10:59:43 +08:00
type: '',
operationDesc: '',
2022-04-27 10:17:50 +08:00
flag: false,
2022-08-15 18:39:33 +08:00
createDate: ""
2022-03-24 14:29:32 +08:00
}
},
2022-08-15 18:39:33 +08:00
computed: {
isBangFu: v => v.type == 1
},
2022-03-24 14:29:32 +08:00
onLoad(query) {
2022-04-26 10:59:43 +08:00
this.$dict.load('fpAssistanceMeasures')
2022-03-24 14:29:32 +08:00
this.pid = query.pid
2022-03-31 11:14:42 +08:00
this.type = query.type
2022-08-15 18:39:33 +08:00
if (query.id) {
2022-03-29 14:44:14 +08:00
this.id = query.id
this.getInfo()
2022-08-15 18:39:33 +08:00
}else{
this.createDate = this.$dateFormat(this.$dayjs())
2022-03-29 14:44:14 +08:00
}
},
onShow() {
2022-08-15 18:39:33 +08:00
if (this.isBangFu) {
2022-03-31 14:39:17 +08:00
document.title = this.id ? '编辑帮扶措施' : '添加帮扶措施'
2022-08-15 18:39:33 +08:00
} else {
2022-03-31 14:24:29 +08:00
document.title = this.id ? '编辑走访日志' : '添加走访日志'
}
2022-06-13 09:57:52 +08:00
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) {
2022-04-27 10:19:43 +08:00
this.operationDesc = res.data.operationDesc
2022-03-29 14:44:14 +08:00
this.detail = res.data.detail
this.files = res.data.files || []
}
})
},
2022-03-24 14:29:32 +08:00
submit() {
2022-08-15 18:39:33 +08:00
if (this.flag) return
if (this.isBangFu) {
2022-04-27 15:07:38 +08:00
if (!this.operationDesc) {
return this.$u.toast('请选择帮扶类型')
}
if (!this.detail) {
return this.$u.toast('请输入帮扶内容')
}
} else {
if (!this.detail) {
return this.$u.toast('请输入走访内容')
}
2022-03-24 14:29:32 +08:00
}
2022-06-13 09:57:52 +08:00
2022-04-27 10:17:50 +08:00
this.flag = true
2022-03-24 14:29:32 +08:00
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,
2022-04-26 10:59:43 +08:00
type: this.type,
operationDesc: this.operationDesc
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-06-13 09:57:52 +08:00
2022-03-24 14:29:32 +08:00
}
})
}
}
}
</script>
<style lang="scss">
2022-08-15 18:39:33 +08:00
.MonitorAddLog {
2022-03-24 14:29:32 +08:00
padding-bottom: 120px;
2022-06-13 09:57:52 +08:00
2022-03-24 14:29:32 +08:00
.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
2022-08-15 18:39:33 +08:00
.hint {
2022-03-29 11:38:51 +08:00
text-align: right;
color: #999;
}
2022-03-24 14:29:32 +08:00
}
</style>