diff --git a/src/views/components/editResi.vue b/src/views/components/editResi.vue index a75a8ba0d..1023fedab 100644 --- a/src/views/components/editResi.vue +++ b/src/views/components/editResi.vue @@ -1584,12 +1584,14 @@ export default { title: "志愿者", }, }, + formCopy:null }; }, async created() { // await this.getDicts() // await this.getOrgTreeList() // await this.getResiDetail() + this.formCopy = JSON.parse(JSON.stringify(this.form)); }, async activated() { this.resiId = this.$route.query.id; @@ -2029,21 +2031,21 @@ export default { }); }, handleClickSubmit(house) { - this.$refs["editForm"].validate((valid) => { - if (valid) { - this.form.resideInfoDtos.forEach((item) => { - delete item.optionsV; - delete item.optionsB; - delete item.optionsH; - delete item.optionsD; - }); - delete this.form.integrityData; - this.submitForm(house); - } - }); + this.$refs["editForm"].validate((valid) => { + if (valid) { + this.form.resideInfoDtos.forEach((item) => { + delete item.optionsV; + delete item.optionsB; + delete item.optionsH; + delete item.optionsD; + }); + delete this.form.integrityData; + this.submitForm(house); + } + }); }, async submitForm(house) { - this.btnLoading = false; + this.btnLoading = true try { let url = this.houseType ? "/actual/base/residentBaseInfo/update" @@ -2061,8 +2063,19 @@ export default { this.$message.success("保存成功"); let homeArr = JSON.parse(JSON.stringify(this.form.resideInfoDtos)); this.$refs["editForm"].resetFields(); + this.form = this.formCopy; this.form.resideInfoDtos = homeArr; - this.removeIdKey(this.form); + for (let key in this.form.baseInfoDto.categoryInfo) { + if (this.form.baseInfoDto.categoryInfo[key] === 1) { + this.form.baseInfoDto.categoryInfo[key] = 0; + } + } + this.$refs["resiExpand"].formList = []; + this.footerInputList.forEach((item) => { + item.children.forEach((child) => { + child.value = child.itemType === "checkbox" ? [] : null; + }); + }); this.houseType = false; } } else if (code >= 8000) { @@ -2074,26 +2087,6 @@ export default { this.btnLoading = false; } }, - removeIdKey(obj) { - if (!obj || typeof obj !== "object") { - return; - } - for (const key in obj) { - if (obj.hasOwnProperty(key)) { - if (typeof obj[key] === "object") { - this.removeIdKey(obj[key]); - } - if ( - key === "id" || - key === "resiId" || - key === "createdTime" || - key === "updatedTime" - ) { - delete obj[key]; - } - } - } - }, showDialog({ index, value }, event) { // 设置 partyFlag @@ -2148,7 +2141,6 @@ export default { }); this.$refs["resiExpand"].formType = this.incidence[value].formType; this.$refs["resiExpand"].showForm(); - console.log(this.form, "tianjiawanzujian"); }); } else { this.$refs["resiExpand"].formList = this.$refs[ @@ -2172,6 +2164,7 @@ export default { // 提交扩展信息 submitExpand(_form, { changId, changPid, changType }) { if (changType == "checkbox") { + this.form[changPid] = {}; this.form[changPid][changId] = []; this.form[changPid][changId].push(..._form[changPid][changId]); } else { diff --git a/src/views/components/resiExpand/editExpand.vue b/src/views/components/resiExpand/editExpand.vue index 7e7b2af48..9b7cd86db 100644 --- a/src/views/components/resiExpand/editExpand.vue +++ b/src/views/components/resiExpand/editExpand.vue @@ -69,7 +69,7 @@