|
|
@ -175,41 +175,24 @@ export default { |
|
|
|
}) |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
getArea(arr) { |
|
|
|
let newArr = []; |
|
|
|
if (arr != undefined && arr.length > 0) { |
|
|
|
newArr = arr.map(item => { |
|
|
|
if (item.children != undefined && item.children.length > 0) { |
|
|
|
this.getArea(item.children); |
|
|
|
} |
|
|
|
return item; |
|
|
|
}); |
|
|
|
} |
|
|
|
return newArr; |
|
|
|
}, |
|
|
|
getCommunity(arr) { |
|
|
|
if (arr != undefined && arr.length > 0) { |
|
|
|
arr.forEach(async (item) => { |
|
|
|
let communityList = await this.getListByParentId("1", item.deptId); |
|
|
|
this.apartmentList = [...this.apartmentList,...communityList] |
|
|
|
if (item.children != undefined && item.children.length > 0) { |
|
|
|
this.getCommunity(item.children); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
getTree(){ |
|
|
|
getdeptList().then((res) => { |
|
|
|
getdeptList().then(async (res) => { |
|
|
|
this.deptOptions = this.handleTree( |
|
|
|
res.data, |
|
|
|
"deptId", |
|
|
|
"parentId", |
|
|
|
"children", |
|
|
|
3 |
|
|
|
2 |
|
|
|
); |
|
|
|
const areaLst = this.getArea(this.deptOptions[0].children) |
|
|
|
this.getCommunity(areaLst) |
|
|
|
console.log(this.deptOptions,'this.deptOptions'); |
|
|
|
|
|
|
|
const deptInfo = this.deptOptions[0].children[0] |
|
|
|
const newArr = this.deptOptions.map(item => ({ |
|
|
|
name: item.deptName, |
|
|
|
})) |
|
|
|
this.apartmentList = newArr |
|
|
|
// this.deptOptions = await this.getListByParentId("1", deptInfo.deptId); |
|
|
|
// console.log(this.deptOptions); |
|
|
|
}); |
|
|
|
}, |
|
|
|
// 三级联动通用接口 |
|
|
@ -303,7 +286,7 @@ export default { |
|
|
|
console.log(this.deptOptions); |
|
|
|
|
|
|
|
this.form.apartmentName = e.name |
|
|
|
this.form.apartmentId = e.id |
|
|
|
this.form.apartmentId = this.deptOptions.find(item=>item.deptName === e.name).deptId |
|
|
|
}, |
|
|
|
handleQuestionSelect(e){ |
|
|
|
this.form.questionName = e.dictLabel |
|
|
|