Przeglądaj źródła

传感器实时数据

JX.LI 2 lat temu
rodzic
commit
5b60a4f7c6
1 zmienionych plików z 25 dodań i 8 usunięć
  1. 25 8
      src/views/monitor.vue

+ 25 - 8
src/views/monitor.vue

@@ -96,7 +96,7 @@
                 :class="{on:listCurrentIndex2 == index}" v-on:click="dropLocation(item.latitude,item.longitude,index)">
                 <div class="d-l-l-text">
                   <i class="iconfont sj-icon-jkzx icon-sxt"></i>
-                  <h4>{{ item.cameraName }}</h4><h4 v-html="cgqData"></h4>
+                  <h4>{{ item.cameraName }}</h4><h4 v-if="onChuan" v-html="cgqData[index]"></h4>
                 </div>
               </div>
             </div>
@@ -212,7 +212,7 @@
         rightDeptName: undefined,
         visuForestCloudCameraBOListSearch: [],
         // 部门名称
-        cgqData:'',
+        cgqData:[],
         deptName: undefined,
         deptId: '',
         // 部门树选项
@@ -288,6 +288,19 @@
     methods: {
       setcgqValue:function(){
         let that=this
+        for (let i = 0; i < that.visuForestCloudCameraBOListSearch.length; i++) {
+          var color = "green";
+          var value = Math.random();
+          var up = "▲";
+          var down = "▼";
+          if (value > 0.5) {
+            color = "red";
+            value = value + "" + up;
+          } else {
+            value = value + "" + down;
+          }
+          that.cgqData.push("<span style='color:" + color + "'>" + value + "</span>")
+        }
         setInterval(function() {
           var color = "green";
           var value = Math.random();
@@ -299,10 +312,13 @@
           } else {
             value = value + "" + down;
           }
-          that.cgqData =  "<span style='color:" + color + "'>" + value + "</span>";
-        }, 1000)
+          that.cgqData.push("<span style='color:" + color + "'>" + value + "</span>")
+          if(that.cgqData.length>that.visuForestCloudCameraBOListSearch.length){
+            console.log(that.cgqData)
+            that.cgqData.splice(0, 1)
+          }
+        }, 5000)
       },
-
       /* 电视墙替换开始 */
       showTVWall(channelCode, channelName) {
         let tvListJson = [
@@ -400,9 +416,6 @@
         this.getDlblistBydeptId()
       },
       chuanClick() {
-        this.onLa = false
-        this.onShe = false
-        this.onChuan = true
         this.localMark = 'chuan'
         this.placeholderMsg = "请输入传感器名称"
         this.getSensorListByDeptId()
@@ -517,6 +530,7 @@
 
                 markersList.push(markersMap);
               }
+              that.setcgqValue()
               setTimeout(() => {
                 that.$refs.supermap.clearM();
               that.$refs.supermap.clearMRadius()
@@ -528,6 +542,9 @@
               that.$refs.supermap.clearMRadius()
               }, 2000);
             }
+          that.onLa = false
+          that.onShe = false
+          that.onChuan = true
           })
           .catch(function(error) {
             console.error(error);