From 87b9dc98e7fd2b0dd5013ef8f8ba46018c8747f2 Mon Sep 17 00:00:00 2001 From: mk <2403457699@qq.com> Date: Mon, 24 Mar 2025 17:53:19 +0800 Subject: [PATCH] =?UTF-8?q?bug#1963=E8=87=AA=E5=8A=A8=E6=A3=80=E6=9F=A5?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=BB=9F=E8=AE=A1=E6=9D=A1=E4=BB=B6=E5=87=BA?= =?UTF-8?q?=E7=8E=B0=E9=94=99=E8=AF=AF=E3=80=82=E6=95=B0=E6=8D=AE=E4=B8=8D?= =?UTF-8?q?=E5=9B=9E=E6=98=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/smartExcel/cpts/export-search.vue | 160 +++++++++--------- .../base/smartExcel/cpts/export-view.vue | 2 +- 2 files changed, 85 insertions(+), 77 deletions(-) diff --git a/src/views/modules/base/smartExcel/cpts/export-search.vue b/src/views/modules/base/smartExcel/cpts/export-search.vue index 506444937..d6342d1ad 100644 --- a/src/views/modules/base/smartExcel/cpts/export-search.vue +++ b/src/views/modules/base/smartExcel/cpts/export-search.vue @@ -13,7 +13,7 @@ :props="orgOptionProps" :show-all-levels="false" @change="handleChangeAgency" - clearable :disabled="disabled"> + clearable >
@@ -43,7 +43,7 @@ clearable style="margin-left: 5px" class="u-item-width-buildcascader" - :disabled="changeVDisabled" + :disabled=" disabled" @clear="handleClearBuild" @change="handleChangeB"> { + this.$nextTick( async ()=>{ if(this.infoObj){ this.form = this.infoObj; + if(this.infoObj.agencyId){ + await this.getOrgTreeList() + this.cascaderAgencyId =this.findParentIds(this.orgOptions, this.infoObj.agencyId); + await this.getValiheList() + await this.getBuildList() + await this.getUniList() + await this.getHouseList() + } } }) }, methods: { - + findParentIds(tree, targetId, parentIds = []) { + for (let node of tree) { + if (node.agencyId === targetId) { + return parentIds; + } + if (node.subAgencyList) { + const result = this.findParentIds(node.subAgencyList, targetId, [...parentIds, node.agencyId]); + if (result) { + return result; + } + } + } + return null; + }, handleCategoryChange(newVal, oldVal) { console.log(newVal, oldVal,"slkdfjlfj"); let formCopy = JSON.parse(JSON.stringify(this.form)); @@ -1162,91 +1182,79 @@ export default { if (item.columnName === val) item.isChange = true }) }, - getOrgTreeList() { - this.$http - .post('/gov/org/customeragency/agencygridtree', {}) - .then(({ data: res }) => { - if (res.code !== 0) { - return this.$message.error(res.msg) - } else { - this.orgOptions = [] - this.orgOptions.push(res.data) - } - }) - .catch(() => { - return this.$message.error('网络错误') - }) + async getOrgTreeList() { + try { + const { data: res } = await this.$http.post('/gov/org/customeragency/agencygridtree', {}); + if (res.code !== 0) { + return this.$message.error(res.msg); + } + this.orgOptions = []; + this.orgOptions.push(res.data); + } catch (error) { + return this.$message.error('网络错误'); + } }, loadmore() { this.optionsVPageNo++; this.getValiheList(); }, - getValiheList() { - this.$http - .post('/actual/base/communityQuarters/listQuartersOptions', { + async getValiheList() { + try { + const { data: res } = await this.$http.post('/actual/base/communityQuarters/listQuartersOptions', { gridId: this.form.agencyId, agencyId: this.$store.state.user.agencyId, pageNo: this.optionsVPageNo, pageSize: 20 // agencyId: user.agencyId - }) - .then(({ data: res }) => { - if (res.code !== 0) { - return this.$message.error(res.msg) - } else { - this.optionsV = [...this.optionsV, ...res.data]; - } - }) - .catch(() => { - return this.$message.error('网络错误') - }) + }); + if (res.code !== 0) { + return this.$message.error(res.msg); + } + this.optionsV = [...this.optionsV, ...res.data]; + } catch (error) { + return this.$message.error('网络错误'); + } }, - getBuildList() { - this.$http - .post('/actual/base/communityBuilding/buildingoption', { + async getBuildList() { + try { + const { data: res } = await this.$http.post('/actual/base/communityBuilding/buildingoption', { quartersId: this.form.villageId - }) - .then(({ data: res }) => { - if (res.code !== 0) { - return this.$message.error(res.msg) - } else { - this.optionsB = res.data - } - }) - .catch(() => { - return this.$message.error('网络错误') - }) + }); + if (res.code !== 0) { + return this.$message.error(res.msg); + } + this.optionsB = res.data; + } catch (error) { + return this.$message.error('网络错误'); + } }, - getUniList() { - this.$http - .post('/actual/base/communityBuildingUnit/unitoption', { + async getUniList() { + try { + const { data: res } = await this.$http.post('/actual/base/communityBuildingUnit/unitoption', { buildingId: this.form.buildId - }) - .then(({ data: res }) => { - if (res.code !== 0) { - return this.$message.error(res.msg) - } else { - this.optionsD = res.data - } - }) - .catch(() => { - return this.$message.error('网络错误') - }) + }); + if (res.code !== 0) { + return this.$message.error(res.msg); + } + this.optionsD = res.data; + } catch (error) { + return this.$message.error('网络错误'); + } }, - getHouseList() { - this.$http - .post('/actual/base/communityHouse/houseoption', { buildingId: this.form.buildId, unitId: this.form.unitId }) - .then(({ data: res }) => { - if (res.code !== 0) { - return this.$message.error(res.msg) - } else { - this.optionsH = res.data - } - }) - .catch(() => { - return this.$message.error('网络错误') - }) + async getHouseList() { + try { + const { data: res } = await this.$http.post('/actual/base/communityHouse/houseoption', { + buildingId: this.form.buildId, + unitId: this.form.unitId + }); + if (res.code !== 0) { + return this.$message.error(res.msg); + } + this.optionsH = res.data; + } catch (error) { + return this.$message.error('网络错误'); + } }, getTreeData(data) { if (!Array.isArray(data)) return []; diff --git a/src/views/modules/base/smartExcel/cpts/export-view.vue b/src/views/modules/base/smartExcel/cpts/export-view.vue index 603816ea3..555cf3f84 100644 --- a/src/views/modules/base/smartExcel/cpts/export-view.vue +++ b/src/views/modules/base/smartExcel/cpts/export-view.vue @@ -509,7 +509,7 @@ export default { this.currentTable = newArrar.filter(item => item.status == '1'); if(list){ if(this.currentTable[0].data.length <= list.length){ - luckysheet.insertRow(this.currentTable[0].data.length, { number: list.length - this.currentTable[0].data.length + 5 }); + luckysheet.insertRow(this.currentTable[0].data.length, { number: list.length - this.currentTable[0].data.length + 5 }); }else if(list.length !== 0 && this.currentTable[0].data.length !== 1){ luckysheet.deleteRow(list.length, this.currentTable[0].data.length ) }