Browse Source

解决刷新系统集成成果页面js报错bug

LXXXY 5 years ago
parent
commit
f336b94e33
1 changed files with 21 additions and 18 deletions
  1. 21 18
      src/components/point/report/integrateStatistics.vue

+ 21 - 18
src/components/point/report/integrateStatistics.vue

@@ -4,7 +4,7 @@
     <div class="statistics-chart">
       <div class="chart-title">表号功能号总数量:{{ pointData.tabFuncNumSum }}</div>
       <hr style="width:90%" />
-      <div ref="loopchart" class="chart"></div>
+      <div ref="loopchart" class="chart" id="loopchart"></div>
       <div class="chart-title" style="padding-left:10%;">目前可能断数的数量:{{ pointData.disConn }}</div>
       <hr style="width:80%" />
       <div style="padding:15px 10%;line-height:2;">
@@ -20,7 +20,7 @@
     <div class="statistics-chart" style="border-top:5px solid #eee;">
       <div class="chart-title">共包含原始点位:{{ originalPoint }} 个</div>
       <hr style="width:90%" />
-      <div ref="barchart" class="chart" :style="{height:barChartData.length * 120 + 'px'}"></div>
+      <div ref="barchart" class="chart" id="barchart" :style="{height:barChartData.length * 120 + 'px'}"></div>
     </div>
     <!-- 点位/表号共更好对应总览 -->
     <pointTabOverview ref="overviewDialog"></pointTabOverview>
@@ -145,21 +145,24 @@ export default {
           ]
         };
 
-        //实例化
-        this.loopChart = echarts.init(this.$refs.loopchart);
-        //设置参数并加载
-        this.loopChart.setOption(loopOption);
-        //消除高亮
-        this.loopChart.on('mouseover', function (param) {
-          if (param.dataIndex == 1) {
-            loopOption.series[0].emphasis.itemStyle.color = 'rgb(233, 233, 235)';
-            that.loopChart.setOption(loopOption);
-          }
-          else {
-            loopOption.series[0].emphasis.itemStyle.color = 'rgb(121, 187, 255)';
-            that.loopChart.setOption(loopOption);
-          }
-        });
+        setTimeout(() => {
+          //实例化
+          that.loopChart = echarts.init(document.getElementById("loopchart"));
+          //设置参数并加载
+          that.loopChart.setOption(loopOption);
+          //消除高亮
+          that.loopChart.on('mouseover', function (param) {
+            if (param.dataIndex == 1) {
+              loopOption.series[0].emphasis.itemStyle.color = 'rgb(233, 233, 235)';
+              that.loopChart.setOption(loopOption);
+            }
+            else {
+              loopOption.series[0].emphasis.itemStyle.color = 'rgb(121, 187, 255)';
+              that.loopChart.setOption(loopOption);
+            }
+          });
+        }, 100);
+
       })
 
       //获取条形图数据
@@ -235,7 +238,7 @@ export default {
         /* 条形图高度随数量变化,延时初始化 */
         let that = this;
         setTimeout(() => {
-          that.barChart = echarts.init(that.$refs.barchart);
+          that.barChart = echarts.init(document.getElementById("barchart"));
           that.barChart.setOption(barOption);
         }, 100);
       });