wangzhe 9 月之前
父節點
當前提交
9f58890f70
共有 1 個文件被更改,包括 81 次插入5 次删除
  1. 81 5
      src/views/zdsz/bigscreen/index.vue

+ 81 - 5
src/views/zdsz/bigscreen/index.vue

@@ -142,6 +142,7 @@
     components: {},
     data() {
       return {
+        intervalArr:[], // eCharts 防鬼畜
         queryParams:{
           // time: formatTimestampToDateString(new Date()), // 当日日期
           time: '', // 昨日日期
@@ -403,9 +404,24 @@
             }
           ]
         };
-        if (option && typeof option === "object") {
+        if(option){
+          myChart.clear();
           myChart.setOption(option);
         }
+        if(this.intervalArr.includes("施工进度统计")){
+          return;
+        }
+        this.intervalArr.push("施工进度统计");
+        let dataLength = option.series[0].data.length;
+        let currentIndex = -1;
+        setInterval(function () {
+          currentIndex = (currentIndex + 1) % dataLength;
+          myChart.dispatchAction({
+            type: 'showTip',
+            seriesIndex: 0,
+            dataIndex: currentIndex
+          });
+        }, 2000); // 每隔 2000 毫秒切换一次
       },
       echartsLeft_2(){
 
@@ -597,9 +613,24 @@
             // },
           ]
         };
-        if (option && typeof option === "object") {
+        if(option){
+          myChart.clear();
           myChart.setOption(option);
         }
+        if(this.intervalArr.includes("今日施工数")){
+          return;
+        }
+        this.intervalArr.push("今日施工数");
+        let dataLength = option.series[0].data.length;
+        let currentIndex = -1;
+        setInterval(function () {
+          currentIndex = (currentIndex + 1) % dataLength;
+          myChart.dispatchAction({
+            type: 'showTip',
+            seriesIndex: 0,
+            dataIndex: currentIndex
+          });
+        }, 2000); // 每隔 2000 毫秒切换一次
       },
       echartsRight_2(data){
         let names = ['民用工程', '工业工程', '市政工程', '碰口作业', '基建工程', '顶管工程'];
@@ -797,9 +828,24 @@
             },
           ],
         };
-        if (option && typeof option === "object") {
+        if(option){
+          myChart.clear();
           myChart.setOption(option);
         }
+        if(this.intervalArr.includes("今日使用人数")){
+          return;
+        }
+        this.intervalArr.push("今日使用人数");
+        let dataLength = option.series[0].data.length;
+        let currentIndex = -1;
+        setInterval(function () {
+          currentIndex = (currentIndex + 1) % dataLength;
+          myChart.dispatchAction({
+            type: 'showTip',
+            seriesIndex: 0,
+            dataIndex: currentIndex
+          });
+        }, 2000); // 每隔 2000 毫秒切换一次
       },
       echartsBottom_1(data){
         let names = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
@@ -837,9 +883,24 @@
             }
           ]
         };
-        if (option && typeof option === "object") {
+        if(option){
+          myChart.clear();
           myChart.setOption(option);
         }
+        if(this.intervalArr.includes("各个区今日施工数")){
+          return;
+        }
+        this.intervalArr.push("各个区今日施工数");
+        let dataLength = option.series[0].data.length;
+        let currentIndex = -1;
+        setInterval(function () {
+          currentIndex = (currentIndex + 1) % dataLength;
+          myChart.dispatchAction({
+            type: 'showTip',
+            seriesIndex: 0,
+            dataIndex: currentIndex
+          });
+        }, 2000); // 每隔 2000 毫秒切换一次
       },
       echartsBottom_2(data){
         let names = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
@@ -877,9 +938,24 @@
             }
           ]
         };
-        if (option && typeof option === "object") {
+        if(option){
+          myChart.clear();
           myChart.setOption(option);
         }
+        if(this.intervalArr.includes("各个区今日旧改施工数")){
+          return;
+        }
+        this.intervalArr.push("各个区今日旧改施工数");
+        let dataLength = option.series[0].data.length;
+        let currentIndex = -1;
+        setInterval(function () {
+          currentIndex = (currentIndex + 1) % dataLength;
+          myChart.dispatchAction({
+            type: 'showTip',
+            seriesIndex: 0,
+            dataIndex: currentIndex
+          });
+        }, 2000); // 每隔 2000 毫秒切换一次
       },
       echartsMap() {
         let myChart = echarts.init(document.getElementById('echartsMap'));