Explorar el Código

修改socket 监控中心

JX.LI hace 2 años
padre
commit
b4c4b04c3e
Se han modificado 2 ficheros con 33 adiciones y 3 borrados
  1. 7 1
      src/components/vBottomMenu.vue
  2. 26 2
      src/views/monitor.vue

+ 7 - 1
src/components/vBottomMenu.vue

@@ -533,7 +533,13 @@ export default {
       this.deptOptionsLiandong = response.data
     })
   },
-
+destroyed() { //离开页面关闭Socket连接
+  if (this.websock) {
+    clearInterval(this.setIntervalWesocketPush)
+    this.websock.close()
+    this.websock = null
+  }
+},
   mounted() {
     this.websockSid.userId=Cookies.get("userId")
   },

+ 26 - 2
src/views/monitor.vue

@@ -220,8 +220,8 @@ export default {
     this.bottomMenuList() //获取底部公共组件消息和任务
     this.getTreeselect()
     this.deptId = Cookies.get("deptId")
-    // this.getSensorListByDeptId()
-    // this.getDlblistBydeptId()
+    this.getSensorListByDeptId()
+    this.getDlblistBydeptId()
     this.selectDeviceType()
   },
   data() {
@@ -399,6 +399,30 @@ export default {
           console.error(error);
         });
     },
+    // 大喇叭
+    getDlblistBydeptId() {
+      let that = this;
+      let markersList = [];
+      getDlblistBydeptId(that.deptId).then(function (res) {
+        that.loudspeakerNum = res.data.length
+      
+      })
+        .catch(function (error) {
+          console.error(error);
+        });
+    },
+    // 传感器
+    getSensorListByDeptId() {
+      let that = this;
+      let markersList = [];
+      getSensorListByDeptId(that.deptId).then(function (res) {
+        that.sensorNum = res.data.length
+      
+      })
+        .catch(function (error) {
+          console.error(error);
+        });
+    },
     // 传感器
     getSensorListByDeptId() {
       let that = this;