Bläddra i källkod

监控中心传感器数值

王通 2 år sedan
förälder
incheckning
87378c49cf
2 ändrade filer med 40 tillägg och 16 borttagningar
  1. 39 15
      src/components/supermap-2.5d.vue
  2. 1 1
      src/views/monitor.vue

+ 39 - 15
src/components/supermap-2.5d.vue

@@ -80,6 +80,10 @@ export default {
         this.markerboxEntityRadius = []
       }
     },
+    mapShow() {
+      this.mapshow = false,
+        clearInterval(this.timer)
+    },
     //移除之前添加的线
     clearTwoC() {
       if (this.connectBoxEntityTwo != null) {
@@ -348,24 +352,44 @@ export default {
     /**
      *鼠标左击事件是原来的气泡
      */
+    /**
+     *鼠标左击事件是原来的气泡
+     */
     createLeftClickDescription() {
       let that = this;
-      that.handler.setInputAction(function (movement) {
-          that.pick = that.viewer.scene.pick(movement.position);
-          if (that.pick && that.pick) {
-            let id = Cesium.defaultValue(that.viewer.scene.pick(movement.position).id, that.viewer.scene.pick(
-              movement.position).primitive.id);
-
-            let html = id._description;
-            if (html != undefined && html._value != null && html._value != '') {
-              that.bindPopupHtml = html
-              that.mapshow = true
-            } else {
-              that.mapshow = false
-            }
+      that.handler.setInputAction(function(movement) {
+        that.pick = that.viewer.scene.pick(movement.position);
+        if (that.pick && that.pick) {
+          let id = Cesium.defaultValue(that.viewer.scene.pick(movement.position).id, that.viewer.scene.pick(
+            movement.position).primitive.id);
+          let html = id._description;
+          clearInterval(that.timer)
+          if (html != undefined && html._value != null && html._value != '' && html != 'cgq') {
+            that.bindPopupHtml = html
+            that.mapshow = true
+          } else if (html == 'cgq') {
+            that.timer = setInterval(function() {
+              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.bindPopupHtml = "<span style='color:" + color + "'>当前传感器数值: " + value + "</span>";
+            }, 1000)
+            that.mapshow = true
           } else {
             that.mapshow = false
+            clearInterval(that.timer)
           }
+        } else {
+          that.mapshow = false
+          clearInterval(that.timer)
+        }
       }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
     },
     /**
@@ -384,7 +408,7 @@ export default {
         }
       }, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
     },
-    
+
     /**
      * 落点定位
      */
@@ -489,4 +513,4 @@ export default {
     opacity: 0;
     transform: translateY(-10rem);
   }
-</style>
+</style>

+ 1 - 1
src/views/monitor.vue

@@ -459,7 +459,7 @@
                   lng: 124.59,
                   lat: 43.02,
                   icon: "marker",
-                  bindPopupHtml: "",
+                  bindPopupHtml: "cgq",
                   click: "",
                   parameter: "",
                   name: i,