Open
Description
public tree: TreeModel = {
value: 'All list',
children: []
};
getList() {
this.service.GeJson('Groups/GetParent').subscribe((res => {
if (res) {
res.forEach(element => {
this.service.GeJson('Groups/getSubGroup/' + element.GroupID).subscribe((su => {
let sub = su
if (sub.length == 0) {
this.tree.children.push({ value: element.GroupName, id: element.GroupID })
}
else {
var tmp = [];
tmp = new Array
sub.forEach(submb => {
tmp.push({ value: submb.GroupName, id: submb.GroupID })
});
this.tree.children.push({ value: element.GroupName, id: element.GroupID, children: tmp })
}
}))
});
}
}))
}