From dac7a87287798507d63b72c5086fbcaa1d172476 Mon Sep 17 00:00:00 2001 From: mk <2403457699@qq.com> Date: Sat, 2 Sep 2023 17:53:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=8E=E4=BF=9D=E4=BA=BA=E5=91=98=E8=81=94?= =?UTF-8?q?=E8=B0=83,=E5=85=9A=E5=91=98bug,=E5=85=9A=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=A0=B7=E5=BC=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../subsistenceAllowance/addForm.vue | 90 ++++++++++++++++--- .../subsistenceAllowance.vue | 44 ++++++--- .../communityParty/members/memberList.vue | 69 +++++++++++--- .../communityParty/partyOrg/orgTree.vue | 6 +- 4 files changed, 175 insertions(+), 34 deletions(-) diff --git a/src/views/modules/base/residentManagement/subsistenceAllowance/addForm.vue b/src/views/modules/base/residentManagement/subsistenceAllowance/addForm.vue index 114f5d374..1cc1e6cd2 100644 --- a/src/views/modules/base/residentManagement/subsistenceAllowance/addForm.vue +++ b/src/views/modules/base/residentManagement/subsistenceAllowance/addForm.vue @@ -11,6 +11,26 @@ :rules="dataRule" class="div_form" > + + +
+ 所属组织: + {{ formData.agencyName || "--" }} +
+ + + + +
+
@@ -340,10 +360,6 @@ export default { props: { - formType:{ - type:String, - default:'add' - }, source: { //展示来源:manage 管理平台 visiual 可视化平台 type: String, @@ -352,9 +368,16 @@ }, data() { + let orgOptionProps = { + multiple: false, + value: 'agencyId', + label: 'agencyName', + children: 'subAgencyList', + checkStrictly: true + } return { + formType:'', btnDisable: false, - formData: { name: "", idType: null, @@ -373,8 +396,11 @@ occupation: "", retireTime: "", remark: "", - agencyId: this.$store.state.user.agencyId, + agencyId:'', }, + agencyIdTemp:[], + orgOptionProps , + orgOptions: [], genderList, binaryOptionList, dataRule: { @@ -400,8 +426,9 @@ watch: {}, components: {}, - async created() { - await this.getDicts(); + created() { + this.getDicts(); + this.getOrgTreeList() }, async mounted() { this.startLoading(); @@ -418,8 +445,9 @@ const url = `/actual/base/resiCategorized/subsistenceAllowance/detail/${categorizedResiId}`; const { data, code, msg } = await requestGet(url); if (code === 0) { - console.log(data); this.formData = { ...data }; + await this.setAgencyIdFromLastLayerId(data.agencyId) + console.log(this.agencyIdTemp); } else { this.$message.error(msg); } @@ -491,6 +519,48 @@ resetData() { this.formData = {}; }, + getOrgTreeList () { + this.$http + .post('/gov/org/customeragency/agencygridtree', {}) + .then(({ data: res }) => { + if (res.code !== 0) { + return this.$message.error(res.msg) + } else { + console.log('获取组织树成功', res.data) + this.orgOptions = [] + this.orgOptions.push(res.data) + } + }) + .catch(() => { + return this.$message.error('网络错误') + }) + }, + findPathInOptions(agencyId, options) { + console.log(agencyId,options); + for (let i = 0; i < options.length; i++) { + console.log(options[i]); + if (options[i].agencyId === agencyId) { + console.log(agencyId); + return [agencyId]; + } else if (options[i].subAgencyList) { + const pathFromChild = this.findPathInOptions(agencyId, options[i].subAgencyList +); + if (pathFromChild.length) { + return [options[i].agencyId].concat(pathFromChild); + } + } + } + return []; + }, + + async setAgencyIdFromLastLayerId(lastLayerId) { + console.log(lastLayerId,'事件'); + this.agencyIdTemp = await this.findPathInOptions(lastLayerId, this.orgOptions); + }, + handleChangeAgency(val){ + this.formData.agencyId = val[val.length -1] + console.log(this.formData.agencyId); + }, // 开启加载动画 startLoading() { loading = Loading.service({ @@ -509,7 +579,7 @@ }; -