From 900fbb7b9a0ed69b1f39dfd3ee1d9de62529fa2b Mon Sep 17 00:00:00 2001 From: mk <2403457699@qq.com> Date: Mon, 9 Oct 2023 15:11:37 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A4=BE=E5=8C=BA=E8=87=AA=E6=9F=A5=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2,=E7=A4=BE=E5=8C=BA=E8=87=AA=E6=9F=A5=E6=8A=A5?= =?UTF-8?q?=E5=91=8A=E8=AF=A6=E6=83=85,=E6=A5=BC=E9=95=BF=E5=8D=95?= =?UTF-8?q?=E5=85=83=E9=95=BF=E7=AE=A1=E7=90=86=E8=8C=83=E5=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../residentManagement/louzhang/addForm.vue | 59 +++++-- .../communitySelfInsp/followUpDetail.vue | 159 +++++++++--------- .../satisfaction/communitySelfInsp/index.vue | 6 +- 3 files changed, 130 insertions(+), 94 deletions(-) diff --git a/src/views/modules/base/residentManagement/louzhang/addForm.vue b/src/views/modules/base/residentManagement/louzhang/addForm.vue index 49e4faff7..d93f4d96f 100644 --- a/src/views/modules/base/residentManagement/louzhang/addForm.vue +++ b/src/views/modules/base/residentManagement/louzhang/addForm.vue @@ -114,17 +114,17 @@ 管理范围: {{ formData.rangeName || "--" }} + - @@ -176,7 +176,7 @@ export default { rangeProps: { multiple: true, checkStrictly: true, - // emitPath: true, + emitPath: true, children: 'subAgencyList', label: 'agencyName', value: 'agencyId' @@ -212,12 +212,10 @@ export default { methods: { async initForm (type, row) { this.formType = type; - if (this.formType === 'add') { } else { this.startLoading(); - this.categorizedResiId = row.categorizedResiId await this.getDetail(); if (this.formData.agencyId) { @@ -225,11 +223,19 @@ export default { } this.endLoading(); } - - - - }, + filterByLevel(data, levels) { + let result = []; + for (let item of data) { + if (levels.includes(item.level)) { + result.push(item); + } + if (item.subAgencyList) { + result = result.concat(this.filterByLevel(item.subAgencyList, levels)); + } + } + return result; + }, async getDetail () { const url = `/actual/base/resiCategorized/buildingUnitChief/detail/${this.categorizedResiId}`; @@ -272,7 +278,6 @@ export default { handleChangeRange (val) { - }, async getGridList () { const { user } = this.$store.state @@ -318,13 +323,15 @@ export default { if (res.code !== 0) { return this.$message.error(res.msg) } else { - - this.optionsRange = res.data + console.log(res.data); + this.optionsRange = this.filterByLevel(res.data, ['quarter', 'building', 'unit']); + this.processOptions(this.optionsRange); } }) - .catch(() => { - this.dataListLoading = false - return this.$message.error('网络错误') + .catch((error) => { + this.dataListLoading = false; + console.error("Error details:", error); // 打印错误详细信息 + return this.$message.error('网络错误'); }) this.dataListLoading = false }, @@ -389,6 +396,28 @@ export default { resetData () { this.formData = {}; }, + processOptions(options) { + options.forEach(item => { + if (item.level === "quarter") { + item.disabled = true; // 禁用第一层 + } else if (item.level === "building") { + item.disabled = false; // 启用第二层 + } else if (item.level === "unit") { + item.disabled = false; // 启用第三层 + + // 如果存在第四层,禁用它 + if (item.subAgencyList) { + item.subAgencyList.forEach(fourthLevel => { + fourthLevel.disabled = true; // 禁用第四层 + }); + } + } + + if (item.subAgencyList) { + this.processOptions(item.subAgencyList); + } + }); + }, // 开启加载动画 startLoading () { loading = Loading.service({ diff --git a/src/views/modules/satisfaction/communitySelfInsp/followUpDetail.vue b/src/views/modules/satisfaction/communitySelfInsp/followUpDetail.vue index ab54c6c00..da10eb4c4 100644 --- a/src/views/modules/satisfaction/communitySelfInsp/followUpDetail.vue +++ b/src/views/modules/satisfaction/communitySelfInsp/followUpDetail.vue @@ -1,8 +1,7 @@