modelSystemView.js
3.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
var vm = new Vue({
el: '#app',
data() {
return {
bsm: '',
tableData: [
{
id: 1,
txmc: '基础指标',
operate: true,
children: [
{
id: 11,
txmc: '基础指标体系1',
operate: false,
},
{
id: 12,
txmc: '基础指标体系2',
operate: false,
},
{
id: 13,
txmc: '基础指标体系3',
operate: false,
},
]
}
],
}
},
mounted () {
this.getURLData()
this.showEcharts()
},
methods: {
getURLData () {
this.bsm = this.getURLParameter('bsm');
console.log('bsm=', this.bsm)
},
getURLParameter(name) {
return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search)||[,""])[1].replace(/\+/g, '%20'))||null;
},
showEcharts () {
var myChart = echarts.init(document.getElementById('chart'));
myChart.showLoading();
axios.get(CONF_NEWGHSC_SERVERURL + "/zbtxgl/getZbtxXq",{
params: {'bsm': this.bsm}
}).then(res => {
let data = res.data.data
myChart.hideLoading();
echarts.util.each(data.children, function (datum, index) {
index % 2 === 0 && (datum.collapsed = true);
});
myChart.setOption(option = {
tooltip: {
trigger: 'item',
triggerOn: 'mousemove'
},
series: [
{
type: 'tree',
data: [data],
top: '1%',
left: '7%',
bottom: '1%',
right: '20%',
symbolSize: 7,
label: {
position: 'left',
verticalAlign: 'middle',
align: 'right',
fontSize: 9
},
leaves: {
label: {
position: 'right',
verticalAlign: 'middle',
align: 'left'
}
},
expandAndCollapse: true,
animationDuration: 550,
animationDurationUpdate: 750
}
]
});
})
},
goBack () {
window.location.href='widget.html'
}
},
computed: {}
})