treeShow() {
let oneLists = this.formItem.org_one.split(",");
let twoLists = this.formItem.org_two.split(",");
let threeLists = this.formItem.org_three.split(",");
let selectedLists = oneLists.concat(twoLists, threeLists);
let selectedNamesLists = [];
console.log(this.branchDatas)
this.selectedTreeList = this.branchDatas
console.log(this.selectedTreeList)
this.selectedTreeList.forEach(a => {
this.hx(a, selectedLists, selectedNamesLists)
})
this.selectedNames = selectedNamesLists.join(",");
},
hx(a, selectedLists, selectedNamesLists) {
let index = selectedLists.findIndex(item => item == a.organ_id)
if (index != -1) {
a.checked = true;
selectedNamesLists.push(a.depart_fullname);
} else {
a.checked = false
}
if (a.children && a.children.length) {
a.children.forEach(b => {
this.hx(b, selectedLists, selectedNamesLists)
})
}
},
递归实现 树结构数据回显
猜你喜欢
转载自blog.csdn.net/qq_43907534/article/details/132100272
今日推荐
周排行