有name存在的是父级数据,再根据deptCode相同来匹配到同类子集的数据放到父级里面
this.getFatherData = this.list.filter((ele,index) => {
console.log(ele)
return ele.name
})
console.log(this.getFatherData,4444)
this.getFatherData.forEach((ele)=>{
ele.children= this.list.filter((element)=>{
return element.deptCode === ele.deptCode && !element.name
})
})