|
|
|
@ -114,17 +114,17 @@ |
|
|
|
<span class="info-title-2">管理范围: </span> |
|
|
|
<span>{{ formData.rangeName || "--" }}</span> |
|
|
|
</div> |
|
|
|
|
|
|
|
<el-form-item label-width="100px" |
|
|
|
label="管理范围" |
|
|
|
prop="rangeList" |
|
|
|
v-else> |
|
|
|
|
|
|
|
<el-cascader ref="cascaderUnit" |
|
|
|
class="width-two" |
|
|
|
v-model="formData.rangeList" |
|
|
|
:options="optionsRange" |
|
|
|
@change="handleChangeRange" |
|
|
|
:props="rangeProps" |
|
|
|
:props="{ multiple: true,checkStrictly: true, emitPath: true, children: 'subAgencyList', label: 'agencyName', value: 'agencyId'}" |
|
|
|
:disabled="formType==='detail'" |
|
|
|
clearable /> |
|
|
|
|
|
|
|
@ -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,10 +223,18 @@ 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 |
|
|
|
}, |
|
|
|
@ -388,6 +395,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 () { |
|
|
|
|