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

167 lines
4.8 KiB
Vue
Raw Normal View History

2022-04-26 14:17:48 +08:00
<template>
<div class="MonitorAddView">
2022-04-27 14:59:25 +08:00
<div class="containter">
2022-04-27 17:38:43 +08:00
<div class="type" v-if="status == 3 || status == 4 || status == 0">
<div><span style="color: #FF4466">*</span>风险因素</div>
2022-04-27 14:59:25 +08:00
<div>
<AiSelect dict="fpRiskType" v-model="riskType" />
</div>
2022-04-26 14:17:48 +08:00
</div>
2022-04-27 14:59:25 +08:00
<div class="type" v-if="status == 1">
<div><span style="color: #FF4466">*</span>风险消除方式</div>
<div>
<AiSelect dict="fpRiskEliminationMethod" v-model="riskEliminationMethod" />
</div>
2022-04-26 14:17:48 +08:00
</div>
2022-04-27 14:59:25 +08:00
<div class="remark">
<div class="title"><span style="display: inline-block;width: 8px;"></span>备注说明</div>
<u-input v-model="opinion" type="textarea" placeholder="请输入备注说明" height="200" :maxlength="500"></u-input>
</div>
<div class="remark">
<div class="title"><span style="display: inline-block;width: 8px;"></span>图片<span style="color: #999999;font-size: 14px;">(最多9张)</span></div>
<div style="padding-bottom: 20px; box-sizing: border-box;">
<AiUploader :def.sync="file" multiple placeholder="上传图片" :limit="9" action="/admin/file/add2"></AiUploader>
</div>
2022-04-26 14:17:48 +08:00
</div>
</div>
<div class="btn" @click="submit">提交</div>
</div>
</template>
<script>
export default {
name: 'MonitorAddView',
data() {
return {
riskType: '',
opinion: '',
pass: '',
file: [],
filesList: [],
riskEliminationMethod: '',
status: '',
}
},
onLoad(o) {
this.$dict.load('fpRiskType')
this.pass = o.pass,
this.id = o.id
this.status = o.status
},
2022-04-26 16:21:47 +08:00
onShow() {
2022-04-27 17:38:43 +08:00
document.title = (this.status == 3 || this.status == 4 ) && this.pass ==''? '申请纳入监测': this.status == 1 && this.pass ==''? '申请解除风险' : this.status == 1 && this.pass ==1? '解除风险': (this.status == 4 || this.status==3) && this.pass == 1? '纳入监测':''
2022-04-26 16:21:47 +08:00
},
2022-04-26 14:17:48 +08:00
methods: {
submit() {
2022-04-28 18:00:04 +08:00
var url = ''
var params = {
2022-06-13 21:54:22 +08:00
pass: this.pass || '',
opinion: this.opinion,
files: this.filesList,
id: this.id,
riskType: this.riskType,
riskEliminationMethod: this.riskEliminationMethod,
}
// 0待纳入、1监测中、2待解除、3已解除、4已驳回
2022-04-29 13:19:06 +08:00
if(this.pass == 1) { // 网格长
2022-06-13 21:54:22 +08:00
if(this.status == 1) {
if(!this.riskEliminationMethod) {
2022-04-29 15:52:11 +08:00
return this.$u.toast('请选择风险消除方式')
}
2022-04-29 13:19:06 +08:00
url = '/app/apppreventionreturntopoverty/relieve' // 解除
2022-06-13 21:54:22 +08:00
} else if (this.status == 3 || this.status == 4) {
2022-04-29 15:52:11 +08:00
if(!this.riskType) {
return this.$u.toast('请选择风险因素')
2022-06-13 09:57:52 +08:00
}
2022-04-29 13:19:06 +08:00
url = `/app/apppreventionreturntopoverty/examine` // 纳入监测
2022-04-27 17:38:43 +08:00
}
2022-06-13 21:54:22 +08:00
}
if (this.pass == '') { // 网格员
2022-04-29 16:01:01 +08:00
if(this.status == '0' || this.status == '3' || this.status == '4') {
2022-04-27 15:28:44 +08:00
if(!this.riskType) {
2022-04-29 15:52:11 +08:00
return this.$u.toast('请选择风险因素')
2022-04-26 16:04:01 +08:00
}
2022-04-27 15:28:44 +08:00
}
if(this.status == '1') {
if(!this.riskEliminationMethod) {
return this.$u.toast('请选择风险消除方式')
2022-04-26 16:04:01 +08:00
}
2022-04-27 15:28:44 +08:00
}
if(this.file.length > 0) {
var files = []
this.file.map(item => {
files.push(item.id)
})
this.filesList = files.join(',')
}
2022-06-13 09:57:52 +08:00
if(this.status == 0 || this.status == 3 || this.status == 4) {
2022-04-29 13:19:06 +08:00
url = `/app/apppreventionreturntopoverty/examine` // 纳入监测申请
2022-04-28 18:00:04 +08:00
} else {
2022-04-29 13:19:06 +08:00
url = `/app/apppreventionreturntopoverty/relieve` // 消除申请
2022-04-28 18:00:04 +08:00
}
}
2022-04-28 18:10:44 +08:00
var formData = new FormData()
2022-04-28 18:00:04 +08:00
for (let key in params) {
2022-06-13 21:54:22 +08:00
formData.append(key, params[key])
2022-04-28 18:00:04 +08:00
}
this.$http.post(url , formData).then(res => {
2022-06-13 21:54:22 +08:00
if (res.code === 0) {
this.$u.toast('提交成功')
uni.$emit('reload')
setTimeout(() => {
uni.navigateBack({
delta: 2
})
},600)
}
})
2022-04-26 14:17:48 +08:00
}
},
}
</script>
<style lang="scss" scoped>
.MonitorAddView {
2022-04-27 14:59:25 +08:00
.containter {
padding-bottom: 112px;
box-sizing: border-box;
}
2022-04-26 14:17:48 +08:00
.type {
display: flex;
justify-content: space-between;
height: 112px;
line-height: 112px;
background: #FFF;
padding: 0 32px;
box-sizing: border-box;
}
.remark {
margin-top: 16px;
background: #FFF;
padding: 0 32px;
box-sizing: border-box;
.title {
padding: 30px 0 15px 0;
}
}
::v-deep .ai-uploader .fileList .default {
width: 160px;
height: 160px;
}
.btn {
width: 100%;
height: 112px;
line-height: 112px;
text-align: center;
background: #3192F4;
color: #FFFFFF;
position: fixed;
bottom: 0;
left: 0;
}
}
2022-06-13 09:57:52 +08:00
</style>