Browse Source

居民拓展信息编辑时没有清空

v1.1
mk 1 year ago
parent
commit
0afb2e00a1
  1. 63
      src/views/components/editResi.vue
  2. 5
      src/views/components/resiExpand/editExpand.vue

63
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 {

5
src/views/components/resiExpand/editExpand.vue

@ -69,7 +69,7 @@
<template v-else-if="itemk.itemType == 'cascader1'">
<el-cascader v-model="form[itemj.id].partyOrgId" :props="casProps"
:options="itemk.opction" class="list_item_width_1" clearable size="small"
@change="handlePartyOrgCascadarChange" @change.native="handleFormChange(itemj.id,itemk.formName,itemk.itemType)"></el-cascader>
@change="handlePartyOrgCascadarChange" ></el-cascader>
</template>
<template v-else-if="itemk.itemType == 'number'">
@ -233,6 +233,8 @@ export default {
},
showForm() {
this.$nextTick(() => {
// console.log(this.formList,'formList');
// console.log(this.form,'form');
const promises = this.formList.forEach((item) => {
item.form.map(async (group) => {
return group.children.reduce(async (accPromise, item) => {
@ -276,6 +278,7 @@ export default {
handlePartyOrgCascadarChange(selectedNode) {
this.form.parymemberInfoDto.partyOrgId = selectedNode[selectedNode.length - 1];
this.handleFormChange('parymemberInfoDto','partyOrgId','cascader1')
},
async handleNextOrgTreeClick(node, resolve) {
await this.getTreeChildenList(node, resolve)

Loading…
Cancel
Save