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: {} })