return{
  expandTable:{},

}

getOrgTree () {
this.$Request.get('api/groups/tree', {}).then(res => {
console.log(res);
if (res && res.code === 0) {
if (Array.isArray(res.data)) {

this.orgTree = res.data.map(org => this.mapTree(org));
// this.orgTree.push({
// title: '无',
// label: '无',
// value: 0,
// })
}
}
});
},


mapTree (org) {
const haveChildren = Array.isArray(org.children) && org.children.length > 0;
let expand = false;
if(this.expandTable[org.id+'']!==null &&this.expandTable[org.id+'']!==undefined ){
expand = this.expandTable[org.id+''];
}
return {
title: org.groupName,
label: org.groupName,
value: org.id,
data: {...org},
expand,
children: haveChildren ? org.children.map(i => this.mapTree(i)) : []
};
},


onToggleExpand(data){
this.expandTable[data.value+''] = data.expand;
},

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-08
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-04-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-09
  • 2021-10-02
相关资源
相似解决方案