|
@@ -467,6 +467,7 @@
|
|
} else {
|
|
} else {
|
|
// this.chart.option.title.text = node.label;
|
|
// this.chart.option.title.text = node.label;
|
|
}
|
|
}
|
|
|
|
+ node.collapsed = false;
|
|
this.graph.changeData(JSON.parse(JSON.stringify(node)));
|
|
this.graph.changeData(JSON.parse(JSON.stringify(node)));
|
|
this.graph.fitView([140,40,20,40]);
|
|
this.graph.fitView([140,40,20,40]);
|
|
},
|
|
},
|
|
@@ -486,13 +487,14 @@
|
|
if (res.code === '0') {
|
|
if (res.code === '0') {
|
|
let arr = [];
|
|
let arr = [];
|
|
// that.chart.height = res.data.length * 100 + 'px';
|
|
// that.chart.height = res.data.length * 100 + 'px';
|
|
- arr = that.treeDataUtil(res.data, '');
|
|
|
|
|
|
+ arr = that.treeDataUtil1(res.data, '1');
|
|
|
|
+ console.log(arr);
|
|
// arr = that.getParentNodes(res.data, 1)
|
|
// arr = that.getParentNodes(res.data, 1)
|
|
arr[0].style = {
|
|
arr[0].style = {
|
|
fill: '#f79646'
|
|
fill: '#f79646'
|
|
};
|
|
};
|
|
arr[0].id = '1';
|
|
arr[0].id = '1';
|
|
- arr[0].collapsed = false,
|
|
|
|
|
|
+ arr[0].collapsed = false;
|
|
that.chart.option.series[0].data = arr;
|
|
that.chart.option.series[0].data = arr;
|
|
// that.setGraphical();
|
|
// that.setGraphical();
|
|
that.createGraphic();
|
|
that.createGraphic();
|
|
@@ -749,6 +751,80 @@
|
|
that.loading = false;
|
|
that.loading = false;
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+ treeDataUtil1(treeData, id) {
|
|
|
|
+ let that = this;
|
|
|
|
+ let data = [];
|
|
|
|
+ let children = [];
|
|
|
|
+ let children1 = [];
|
|
|
|
+ let i = 0;
|
|
|
|
+ let k = 0;
|
|
|
|
+ let j = 0;
|
|
|
|
+ let g = 0;
|
|
|
|
+ let name = '';
|
|
|
|
+ let style = {};
|
|
|
|
+ let labelCfg = {};
|
|
|
|
+ switch (id.toString().split("-").length) {
|
|
|
|
+ case 2:
|
|
|
|
+ style = {
|
|
|
|
+ fill: '#e6b9b8',
|
|
|
|
+ };
|
|
|
|
+ break;
|
|
|
|
+ case 3:
|
|
|
|
+ style = {
|
|
|
|
+ fill: '#ffff66',
|
|
|
|
+ };
|
|
|
|
+ break;
|
|
|
|
+ case 4:
|
|
|
|
+ style = {
|
|
|
|
+ fill: '#d9d9d9',
|
|
|
|
+ };
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ break;
|
|
|
|
+ };
|
|
|
|
+ for (let item of treeData) {
|
|
|
|
+ i++;
|
|
|
|
+ if(item.children !== null) {
|
|
|
|
+ if(id === ''){
|
|
|
|
+ children = that.treeDataUtil1(item.children,i);
|
|
|
|
+ } else{
|
|
|
|
+ children = that.treeDataUtil1(item.children,id+'-'+ i);
|
|
|
|
+ }
|
|
|
|
+ name = item.createMan;
|
|
|
|
+ }
|
|
|
|
+ if(name===''){
|
|
|
|
+ name = item.createMan;
|
|
|
|
+ }
|
|
|
|
+ if(item.fileName != null && item.createMan === name) {
|
|
|
|
+ g++;
|
|
|
|
+ children.push({
|
|
|
|
+ id: id + '-' + (children.length+1),
|
|
|
|
+ label: item.fileName,
|
|
|
|
+ value: item.fileUrl,
|
|
|
|
+ children: [],
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ if( i < treeData.length-1 && treeData[i].createMan === name){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ data.push({
|
|
|
|
+ collapsed: true,
|
|
|
|
+ id: id + '-' + i,
|
|
|
|
+ nodeType: 'node',
|
|
|
|
+ isCollapsed: true,
|
|
|
|
+ label: item.createMan,
|
|
|
|
+ children: children,
|
|
|
|
+ style: style,
|
|
|
|
+ labelCfg: labelCfg,
|
|
|
|
+ });
|
|
|
|
+ children = [];
|
|
|
|
+ name = '';
|
|
|
|
+ }
|
|
|
|
+ for (let ch of data) {
|
|
|
|
+ ch.id = ch.id.slice(2);
|
|
|
|
+ }
|
|
|
|
+ return data;
|
|
|
|
+ },
|
|
},
|
|
},
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|