diff --git a/src/assets/scss/pages/resiInfo.scss b/src/assets/scss/pages/resiInfo.scss index 1262f0e2f..e1fcf212e 100644 --- a/src/assets/scss/pages/resiInfo.scss +++ b/src/assets/scss/pages/resiInfo.scss @@ -89,6 +89,7 @@ position: relative; padding-bottom: 16px; .editBtn{ + z-index: 10; position: absolute; right: 16px; top: 16px; diff --git a/src/views/components/editResi.vue b/src/views/components/editResi.vue index 5f633d469..a7efbb988 100644 --- a/src/views/components/editResi.vue +++ b/src/views/components/editResi.vue @@ -44,7 +44,7 @@ - + - + @@ -91,7 +91,7 @@ + v-if="form.familyInfoDto && form.familyInfoDto.marriage == 'chuhun' || form.familyInfoDto.marriage == 'zaihun' || form.familyInfoDto.marriage == 'fuhun'"> @@ -404,16 +404,15 @@ 取消 - 保存 - 提交并补充家庭人员信息 + 保存 + 提交并补充家庭人员信息 - + @@ -428,6 +427,8 @@ export default { data() { return { loading: true, + + houseType: true, formList: [], orgOptions: [], orgOptionProps: { @@ -926,7 +927,7 @@ export default { id: 'specialSupportDto', children: [ - {//0 + { label: "特扶类别", itemType: "select1", formName: "specialSupportType", @@ -1057,7 +1058,6 @@ export default { await this.getDicts() await this.getOrgTreeList() await this.getResiDetail() - this.loading = false; }, methods: { getResiDetail() { @@ -1079,6 +1079,37 @@ export default { this.form.baseInfoDto.idNum = this.$route.params.idNum; this.form.baseInfoDto.mobile = this.$route.params.mobile; + if (!res.data.data.familyInfoDto) { + this.form.familyInfoDto = { + marriage: null,//婚姻状况 + spouseSituation: null,//配偶情况 + elderlyFlag: null,//有无赡养人 + elderlyRelation: null,//与赡养人关系 + dependantMobile: null,//赡养人联系电话 + } + } + if (!res.data.data.religionDto) { + this.form.religionDto = { + religion: null,//宗教信仰 + } + } + if (!res.data.data.workInfoDto) { + this.form.workInfoDto = { + careerStatus: null,//就业状况 + workUnit: null,//工作单位 + occupation: null,//职业 + } + } + if (!res.data.data.eduInfoDto) { + this.form.eduInfoDto = { + cultureLevel: null + } + } + if (!res.data.data.specialDto) { + this.form.specialDto = { + specialCategoryCodes: [] + } + } for (const key in this.form.baseInfoDto.categoryInfo) { if (this.form.baseInfoDto.categoryInfo[key] === 1 && this.incidence[key] || (this.form.baseInfoDto.categoryInfo.partyFlag == 1 && key === 'partyFlag')) { const formId = key === 'partyFlag' ? 'parymemberInfoDto' : key; @@ -1099,6 +1130,7 @@ export default { } } } + console.log(this.footerInputList); return Promise.all(promises); } else if (res.data.code >= 8000) { this.$message.error(res.data.msg); @@ -1109,6 +1141,8 @@ export default { .catch((err) => { console.log(err); }); + this.loading = false; + }, async getDicts() { try { @@ -1396,13 +1430,13 @@ export default { }, async submitForm(house) { try { - let url = '/actual/base/residentBaseInfo/update' + let url = this.houseType ? '/actual/base/residentBaseInfo/update' : '/actual/base/residentBaseInfo/save'; let parm = { ...this.form } let { code, data, msg } = await requestPost(url, parm) if (code == 0) { - if (house!= 'house') { + if (house != 'house') { this.$message.success('保存成功'); this.$refs['editForm'].resetFields(); this.handlerCancle(); @@ -1410,10 +1444,12 @@ export default { this.$message.success('保存成功'); let homeArr = JSON.parse(JSON.stringify(this.form.resideInfoDtos)); this.$refs['editForm'].resetFields(); - this.form.resideInfoDtos = homeArr + this.form.resideInfoDtos = homeArr; + this.removeIdKey(this.form) + this.houseType = false } - - }else if(code >= 8000){ + + } else if (code >= 8000) { this.$message.error(msg); } } @@ -1421,57 +1457,105 @@ export default { this.$message.error(msg); } }, + 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) { - console.log(value); - if (value == 1) { - value = 'parymemberInfoDto' - this.form.baseInfoDto.categoryInfo.partyFlag = 1; - } else if (value == 0) { - this.form.baseInfoDto.categoryInfo.partyFlag = 0; - this.form.parymemberInfoDto = null - this.$nextTick(() => { - this.$refs['resiExpand'].formList = this.$refs['resiExpand'].formList.filter(item => item.formId !== 'parymemberInfoDto'); - }) + // 设置 partyFlag + if (value === 1 || value === 0 || value === 2) { + this.form.baseInfoDto.categoryInfo.partyFlag = value; + value = value === 1 ? 'parymemberInfoDto' : value; + if (value === 0 || value === 2) { + this.form.parymemberInfoDto = null; + this.footerInputList.forEach(item => { + if (item.id === 'parymemberInfoDto') { + item.children.forEach(child => { + child.value = child.itemType === "checkbox" ? [] : null; + }); + } + }); - } else if (value == 2) { - this.form.baseInfoDto.categoryInfo.partyFlag = 2; - this.form.parymemberInfoDto = null - this.$nextTick(() => { - this.$refs['resiExpand'].formList = this.$refs['resiExpand'].formList.filter(item => item.formId !== 'parymemberInfoDto'); - }) + this.$nextTick(() => { + this.$refs['resiExpand'].formList = this.$refs['resiExpand'].formList.filter(item => item.formId !== 'parymemberInfoDto'); + }); + } } - if (index != 3 && index) { + + // 设置特殊处理逻辑 + if (index !== 3 && index) { this.form.baseInfoDto.categoryInfo[value] = event ? 1 : 0; - } else if (index == 3) { + } else if (index === 3) { if (event) { this.form.baseInfoDto.categoryInfo.specialCrowdFlag = 1; this.form.specialDto.specialCategoryCodes.push(value); } else { - this.form.specialDto.specialCategoryCodes = this.form.specialDto.specialCategoryCodes.filter(item => item != value); + this.form.specialDto.specialCategoryCodes = this.form.specialDto.specialCategoryCodes.filter(item => item !== value); } } + + // 处理 incidence if (this.incidence[value]) { if (event) { this.$nextTick(() => { this.$refs['resiExpand'].formList.push({ - 'form': [this.footerInputList.find(item => item.id === this.incidence[value].formId)], 'title': this.incidence[value].title, formId: this.incidence[value].formId + form: [this.footerInputList.find(item => item.id === this.incidence[value].formId)], + title: this.incidence[value].title, + formId: this.incidence[value].formId }); this.$refs['resiExpand'].formType = this.incidence[value].formType; - this.$refs['resiExpand'].showForm() + this.$refs['resiExpand'].showForm(); }); } else { this.$refs['resiExpand'].formList = this.$refs['resiExpand'].formList.filter(item => item.formId !== this.incidence[value].formId); - // delete this.$refs['resiExpand'].form[this.incidence[value].formType]; - delete this.form[this.incidence[value].formType] - // console.log(this.form, '父组件取消'); - } + this.footerInputList.forEach(item => { + if (item.id === this.incidence[value].formId) { + item.children.forEach(child => { + child.value = child.itemType === "checkbox" ? [] : null; + }); + } + }); + delete this.form[this.incidence[value].formType]; + } } }, + // 提交扩展信息 - submitExpand(_form) { - this.form = { ...this.form, ..._form }; - // console.log(this.form, '父组件提交'); + submitExpand(_form, { changId, changPid, changType }) { + if (changType == 'checkbox') { + this.form[changPid][changId] = []; + this.form[changPid][changId].push(..._form[changPid][changId]) + } else { + if (!this.form[changPid]) { + this.$set(this.form, changPid, {}); + } + this.$set(this.form[changPid], changId, _form[changPid][changId]); + } + for (let i in this.footerInputList) { + if (this.footerInputList[i].id === changPid) { + for (let index in this.footerInputList[i].children) { + const formName = this.footerInputList[i].children[index].formName; + const formData = this.form[changPid]; + if (formData && Object.keys(formData).includes(formName)) { + this.footerInputList[i].children[index].value = formData[formName] || null; + } + + } + } + } }, }, components: { stafftag, resiExpand }, diff --git a/src/views/components/resiExpand/editExpand.vue b/src/views/components/resiExpand/editExpand.vue index 46e3ce45a..a0fae7b2c 100644 --- a/src/views/components/resiExpand/editExpand.vue +++ b/src/views/components/resiExpand/editExpand.vue @@ -10,58 +10,68 @@ + + + + + + + +