diff --git a/src/apps/AppMonitoringObject/Add.vue b/src/apps/AppMonitoringObject/Add.vue index 3f0b34b4..10a64e71 100644 --- a/src/apps/AppMonitoringObject/Add.vue +++ b/src/apps/AppMonitoringObject/Add.vue @@ -1,11 +1,11 @@ @@ -482,8 +482,6 @@ export default { houseIdNumber: '', }, $areaId: '', - isEdit: false, - id: '', girdInfo: {}, photo: [], userList: [], @@ -513,11 +511,13 @@ export default { }, computed: { ...mapState(['user']), + isEdit(){ + return !!this.$route.query.id + } }, watch: { userList: { handler: function (v) { - this.isEdit = true; let {name, idNumber, currentAreaId, currentAreaName} = v?.[0] || {} this.form = {...this.form, name, idNumber, currentAreaId, currentAreaName} this.form.sex = this.idCardNoUtil.getIdCardInfo(idNumber)?.sex @@ -545,8 +545,8 @@ export default { }, onShow() { - document.title = this.$route.query.id ? '编辑监测对象' : '添加监测对象' - if (this.$route.query.id) { + document.title = this.isEdit ? '编辑监测对象' : '添加监测对象' + if (this.isEdit) { this.flag = true this.getInfo(this.$route.query.id) } @@ -589,7 +589,7 @@ export default { // phone: '请输入联系方式', // currentAreaId: '请选择现住址', - if (!id) { + if (!this.isEdit) { if (!this.form.objectType) { return this.$u.toast('请选择监测对象类型') } @@ -699,7 +699,7 @@ export default { getInfo(id) { this.$http.post(`/app/apppreventionreturntopoverty/queryDetailById?id=${id}`).then(res => { - if (res.code === 0) { + if (res?.data) { res.data.basicsCheckList = res.data.basicsCheck.split(',') res.data.basicsCheckList.map((item, index) => { this.basicsCheckList[index].checked = true