From e04d95d7d983d8e72c18e8400076111812dec112 Mon Sep 17 00:00:00 2001 From: hey7845 Date: Sat, 25 Dec 2021 13:15:44 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B6=8B=E5=8A=BF=E5=9B=BE=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/sound/road/trend/index.vue | 53 ++++++++++++++++------------ 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/src/views/sound/road/trend/index.vue b/src/views/sound/road/trend/index.vue index 19db703..6c62932 100644 --- a/src/views/sound/road/trend/index.vue +++ b/src/views/sound/road/trend/index.vue @@ -114,30 +114,39 @@ // 趋势图 drawTrend() { getTrendChart(this.queryParams).then( res => { - this.trendData = res.data.data - this.chartColumn = markRaw(echarts.init(document.getElementById('chartColumn'))) - this.chartColumn.setOption({ - tooltip: { - trigger: 'axis', - axisPointer: { - type: 'cross', - crossStyle: { - color: '#999' - } + console.log('res', res); + if (res.data.code == 0) { + this.trendData = res.data.data + this.initChart() + } else { + this.$message.error(res.data.msg) + } + }) + }, + initChart() { + echarts.init(document.getElementById("chartColumn")).dispose(); + this.chartColumn = markRaw(echarts.init(document.getElementById('chartColumn'))) + this.chartColumn.setOption({ + tooltip: { + trigger: 'axis', + axisPointer: { + type: 'cross', + crossStyle: { + color: '#999' } - }, - toolbox: { - feature: { - saveAsImage: { - show: true - } + } + }, + toolbox: { + feature: { + saveAsImage: { + show: true } - }, - legend: this.trendData.legend, - xAxis: this.trendData.xAxis, - yAxis: this.trendData.yAxis, - series: this.trendData.series - }) + } + }, + legend: this.trendData.legend, + xAxis: this.trendData.xAxis, + yAxis: this.trendData.yAxis, + series: this.trendData.series }) } }