dedsudiyu месяцев назад: 11
Родитель
Сommit
5a5dbbfc64

+ 21 - 16
src/views/chemicalManage/basicManagement/chemicalsCabinetManage/addPage.vue

@@ -198,8 +198,8 @@
         userOptions:[],
         userOptionsArr:[],//临时存储管理员数组
         openOptions:[
-          {label:'无锁',value:'1'},
-          {label:'智能锁',value:'2'},
+          {label:'无锁',value:1},
+          {label:'智能锁',value:2},
           // {label:'钥匙柜',value:'3'},
         ],
         lockOptions:[],
@@ -236,7 +236,7 @@
               doorName:'默认柜门1',
               doorLayers:'',
               cabinetAdminModelList:[],
-              unlockingMethod:'1',
+              unlockingMethod:1,
               cabinetLockList:[],
               cabinetLattice:[],
               userOptions:[],
@@ -314,6 +314,7 @@
         if(this.propsData.cabinetId){
           let obj = JSON.parse(JSON.stringify(this.propsData))
           let newData = {
+            cabinetId:obj.cabinetId,
             cabinetName:obj.cabinetName,
             deptId:obj.deptId,
             deptName:obj.deptName,
@@ -333,20 +334,24 @@
               userOptions:[],
               userNameOptions:[],
             };
-            item.cabinetLockVoList.forEach((bigItem)=>{
-              minObj.cabinetLockList.push(bigItem.lockId)
-            })
-            item.cabinetAdminVoList.forEach((minItem)=>{
-              minObj.cabinetAdminModelList.push(minItem.userId)
-              minObj.userOptions.push({
-                userId:minItem.userId,
-                userName:minItem.userName,
+            if(item.cabinetLockVoList){
+              item.cabinetLockVoList.forEach((bigItem)=>{
+                minObj.cabinetLockList.push(bigItem.lockId)
               })
-              minObj.userNameOptions.push({
-                userId:minItem.userId,
-                userName:minItem.userName,
+            }
+            if(item.cabinetAdminVoList){
+              item.cabinetAdminVoList.forEach((minItem)=>{
+                minObj.cabinetAdminModelList.push(minItem.userId)
+                minObj.userOptions.push({
+                  userId:minItem.userId,
+                  userName:minItem.userName,
+                })
+                minObj.userNameOptions.push({
+                  userId:minItem.userId,
+                  userName:minItem.userName,
+                })
               })
-            })
+            }
             newData.cabinetDoorModelList.push(minObj);
           })
           this.subOptions=[{subId:obj.subId,subName:obj.subName,}]
@@ -617,7 +622,7 @@
             doorName:'默认柜门'+Number(this.newData.cabinetDoorModelList.length+1),
             doorLayers:'',
             cabinetAdminModelList:this.safeIdList,
-            unlockingMethod:'1',
+            unlockingMethod:1,
             cabinetLockList:[],
             cabinetLattice:'',
             userOptions:this.safeList,

+ 1 - 2
src/views/chemicalManage/useLedger/index.vue

@@ -37,10 +37,9 @@
             <p class="page-add-common-style-button"
                style="float: right;"
                @click="searchToggle"
-               v-hasPermiRouter="['demo:demo:add']"
             >{{searchType?'简单搜索':'高级搜索'}}</p>
             <el-form-item style="float: right;">
-              <export-component :exportConfig="exportConfig" v-hasPermiRouter="['demo:demo:demo']"></export-component>
+              <export-component :exportConfig="exportConfig" v-hasPermiRouter="['chemical:useRecord:export']"></export-component>
             </el-form-item>
           </div>
           <div v-if="searchType">

+ 112 - 25
src/views/emergencyManagement/performEvacuation/performEvacuationData.vue

@@ -485,6 +485,9 @@
         //疏散
         evacuateOpic:"lab/floor/exit/line",
         evacuateClient:{},
+        //预案
+        planOpic:'lab/risk/plan/change',
+        planClient:{},
       }
     },
     created () {
@@ -560,10 +563,15 @@
           //MQTT相关
           this.offHardwareMQTT('on')
           this.offSensorMQTT('on')
+          this.offLightMQTT('on')
           //判断是否已有链接
           if(!this.evacuateClient.unsubscribe){
             this.offEvacuateMQTT('on');
           }
+          //判断是否已有链接
+          if(!this.planClient.unsubscribe){
+            this.offPlanMQTT('on');
+          }
         }
       },
       //楼栋选中方法
@@ -831,6 +839,7 @@
           floorId:this.floorId,
         }
         laboratoryExitLineGetRedisEvacuation(obj).then(response => {
+          console.log('response.data',response.data);
           if(response.data.doorPointNames){
             this.$set(this,'evacuationType',true);
             for(let o=0;o<self.mapList.length;o++){
@@ -1425,7 +1434,7 @@
         });
       },
       /*********************************** MQTT相关 *********************************/
-      //智能控制-MQTT连接
+      //硬件开关-MQTT连接
       offHardwareMQTT(type){
         let self = this;
         if(self.hardwareClient.unsubscribe){
@@ -1442,7 +1451,7 @@
           this.hardwareMQTT();
         }
       },
-      //智能控制-MQTT订阅
+      //硬件开关-MQTT订阅
       hardwareMQTT(){
         let self = this;
         this.hardwareClient = mqtt.connect(localStorage.getItem('mqttUrl'), {
@@ -1452,7 +1461,7 @@
         this.hardwareClient.on("connect", e =>{
           this.hardwareClient.subscribe(self.hardwareOpic+self.checkSubId, (err) => {
             if (!err) {
-              // console.log("智能控制-订阅成功:" + self.hardwareOpic+self.checkSubId);
+              console.log("智能控制-订阅成功:" + self.hardwareOpic+self.checkSubId);
             }else{
               // console.log("智能控制-连接错误:" + err);
             }
@@ -1471,7 +1480,7 @@
           }
         });
       },
-      //智能监测-MQTT连接
+      //传感器-MQTT连接
       offSensorMQTT(type){
         let self = this;
         if(self.sensorClient.unsubscribe){
@@ -1488,7 +1497,7 @@
           this.sensorMQTT();
         }
       },
-      //智能监测-MQTT订阅
+      //传感器-MQTT订阅
       sensorMQTT(){
         let self = this;
         this.sensorClient = mqtt.connect(localStorage.getItem('mqttUrl'), {
@@ -1498,7 +1507,7 @@
         this.sensorClient.on("connect", e =>{
           this.sensorClient.subscribe(self.sensorOpic+self.checkSubId, (err) => {
             if (!err) {
-              // console.log("智能监测-订阅成功:" + self.sensorOpic+self.checkSubId);
+              console.log("智能监测-订阅成功:" + self.sensorOpic+self.checkSubId);
             }else{
               // console.log("智能监测-连接错误:" + err);
             }
@@ -1520,7 +1529,7 @@
           }
         });
       },
-      //智能监测-MQTT连接
+      //疏散-MQTT连接
       offEvacuateMQTT(type){
         let self = this;
         if(self.evacuateClient.unsubscribe){
@@ -1537,7 +1546,7 @@
           this.evacuateMQTT();
         }
       },
-      //智能监测-MQTT订阅
+      //疏散-MQTT订阅
       evacuateMQTT(){
         let self = this;
         this.evacuateClient = mqtt.connect(localStorage.getItem('mqttUrl'), {
@@ -1549,36 +1558,114 @@
             if (!err) {
               console.log("疏散-订阅成功:" + self.evacuateOpic);
             }else{
-              console.log("疏散-连接错误:" + err);
+              // console.log("疏散-连接错误:" + err);
             }
           });
         });
         this.evacuateClient.on("message", (topic, message) => {
           if (message){
-            console.log('message')
+            //获取当前楼层数据
+            this.laboratoryBigViewGetFloorByBigView();
+          }
+        });
+      },
+      //疏散灯-MQTT连接
+      offLightMQTT(type){
+        let self = this;
+        if(self.lightClient.unsubscribe){
+          self.lightClient.unsubscribe(self.lightOpic+self.floorId, error => {
+            if (error) {
+              // console.log('mqtt关闭连接错误:', error)
+            }
+          })
+          self.lightClient.end();
+          this.$set(this,'lightClient',{});
+        }
+        //判断传入参数如果存在 发起一次新的连接
+        if(type){
+          this.lightMQTT();
+        }
+      },
+      //疏散灯-MQTT订阅
+      lightMQTT(){
+        let self = this;
+        this.lightClient = mqtt.connect(localStorage.getItem('mqttUrl'), {
+          username: localStorage.getItem('mqttUser'),
+          password:localStorage.getItem('mqttPassword')
+        });
+        this.lightClient.on("connect", e =>{
+          this.lightClient.subscribe(self.lightOpic+self.floorId, (err) => {
+            if (!err) {
+              console.log("疏散灯-订阅成功:" + self.lightOpic+self.floorId);
+            }else{
+              // console.log("疏散灯-连接错误:" + err);
+            }
+          });
+        });
+        this.lightClient.on("message", (topic, message) => {
+          if (message){
             let data = JSON.parse(message)
-            console.log('data',data)
-            // let data = JSON.parse(message)
-            // let list = JSON.parse(JSON.stringify(this.monitorList))
-            // list.forEach((item)=>{
-            //   data.forEach((minItem)=>{
-            //     if(item.deviceNo == minItem.deviceNo){
-            //       item.deviceValue = minItem.deviceValue;
-            //       item.online = minItem.online;
-            //     }
-            //   })
-            // })
-            // this.$set(this,'monitorList',list);
+            for(let i=0;i<self.mapList.length;i++){
+              if(self.mapList[i].type == 2){
+                for(let o=0;o<self.mapList[i].lightList.length;o++){
+                  if(data.hardwareNo == self.mapList[i].lightList[o].configName){
+                    self.$set(self.mapList[i].lightList[o],'openType',data.operatingState);
+                  }
+                }
+              }
+            }
+          }
+        });
+      },
+      //预案-MQTT连接
+      offPlanMQTT(type){
+        let self = this;
+        if(self.planClient.unsubscribe){
+          self.planClient.unsubscribe(self.planOpic, error => {
+            if (error) {
+              // console.log('mqtt关闭连接错误:', error)
+            }
+          })
+          self.planClient.end();
+          this.$set(this,'planClient',{});
+        }
+        //判断传入参数如果存在 发起一次新的连接
+        if(type){
+          this.planMQTT();
+        }
+      },
+      //预案-MQTT订阅
+      planMQTT(){
+        let self = this;
+        this.planClient = mqtt.connect(localStorage.getItem('mqttUrl'), {
+          username: localStorage.getItem('mqttUser'),
+          password:localStorage.getItem('mqttPassword')
+        });
+        this.planClient.on("connect", e =>{
+          this.planClient.subscribe(self.planOpic, (err) => {
+            if (!err) {
+              console.log("预案-订阅成功:" + self.evacuateOpic);
+            }else{
+              // console.log("预案-连接错误:" + err);
+            }
+          });
+        });
+        this.planClient.on("message", (topic, message) => {
+          if (message){
+            //获取当前楼层数据
+            this.laboratoryBigViewGetFloorByBigView();
           }
         });
       },
     },
     beforeDestroy() {
-      //清除定时器
+      //清除MQTT
       let self = this;
-      self.hardwareMQTT();
-      self.sensorMQTT();
+      self.offHardwareMQTT();
+      self.offSensorMQTT();
       self.offEvacuateMQTT();
+      self.offLightMQTT();
+      self.offPlanMQTT();
     },
   }
 </script>

+ 202 - 2
src/views/emergencyManagement/performEvacuation/performEvacuationHome.vue

@@ -205,8 +205,11 @@
   </div>
 </template>
 <script>
-  import { laboratoryBigViewGetBuildByBigView,laboratoryBigViewGetFloorByBigView,laboratoryBigViewHazardCensus,
-    iotBigViewStatisticsHardwareDeviceType,iotBigViewDeviceList,laboratoryBigViewOnLineUserList } from "@/api/emergencyManagement/index";
+  import mqtt from 'mqtt'
+  import { laboratoryBigViewGetBuildByBigView,laboratoryBigViewGetFloorByBigView,
+    laboratoryBigViewHazardCensus, iotBigViewStatisticsHardwareDeviceType,
+    iotBigViewDeviceList,laboratoryBigViewOnLineUserList,
+    laboratoryExitLineGetRedisEvacuation } from "@/api/emergencyManagement/index";
   import { laboratoryBigViewSelectTriggerInfo } from "@/api/commonality/permission";
   import mpegtsVideo from '@/components/mpegtsVideo/mpegtsVideo.vue'
   export default {
@@ -257,6 +260,15 @@
         checkSubId:null,
         //优先显示的提示
         checkPlanId:null,
+        //疏散灯
+        lightOpic:"iot/hardware/evacuationLight/floor/",
+        lightClient:{},
+        //疏散
+        evacuateOpic:"lab/floor/exit/line",
+        evacuateClient:{},
+        //预案
+        planOpic:'lab/risk/plan/change',
+        planClient:{},
       }
     },
     created () {
@@ -298,6 +310,15 @@
         this.iotBigViewDeviceList();
         //获取楼层-危险源统计;
         this.laboratoryBigViewHazardCensus();
+        this.offLightMQTT('on')
+        //判断是否已有链接
+        if(!this.evacuateClient.unsubscribe){
+          this.offEvacuateMQTT('on');
+        }
+        //判断是否已有链接
+        if(!this.planClient.unsubscribe){
+          this.offPlanMQTT('on');
+        }
       },
       //切换楼层
       clickFloor(item,index){
@@ -466,6 +487,8 @@
             }
             //获取预警列表
             this.laboratoryBigViewSelectTriggerInfo();
+            //获取疏散数据
+            this.laboratoryExitLineGetRedisEvacuation();
           }
         })
       },
@@ -532,6 +555,45 @@
           this.$forceUpdate();
         })
       },
+      //查询当前楼栋楼层下发生的疏散数据
+      laboratoryExitLineGetRedisEvacuation(){
+        let self = this;
+        let obj = {
+          buildId:this.buildId,
+          floorId:this.floorId,
+        }
+        laboratoryExitLineGetRedisEvacuation(obj).then(response => {
+          if(response.data.doorPointNames){
+            for(let o=0;o<self.mapList.length;o++){
+              if(self.mapList[o].type == 2){
+                for(let x=0;x<self.mapList[o].lightList.length;x++){
+                  let num = 0;
+                  for(let i=0;i<response.data.lightPointSet.length;i++){
+                    if(response.data.lightPointSet[i]){//处理后端返回的异常的NULL
+                      if(self.mapList[o].type == 2){
+                        if(self.mapList[o].lightList[x].key == response.data.lightPointSet[i].key){
+                          num++
+                        }
+                      }
+                    }
+                  }
+                  self.mapList[o].lightList[x].openType = num != 0;
+                }
+              }
+            }
+            for(let i=0;i<response.data.doorPointNames.length;i++){
+              for(let o=0;o<self.mapList.length;o++){
+                if(self.mapList[o].type == 3){
+                  if(response.data.doorPointNames[i] == self.mapList[o].key){
+                    self.mapList[o].roomCheckType = true;
+                  }
+                }
+              }
+            }
+            this.$forceUpdate();
+          }
+        });
+      },
       //获取楼层-智能物联设备列表;
       iotBigViewStatisticsHardwareDeviceType(){
         iotBigViewStatisticsHardwareDeviceType({floorId:this.floorId}).then(response => {
@@ -775,6 +837,137 @@
         try{m+=s1.split(".")[1].length}catch(e){}
         try{m+=s2.split(".")[1].length}catch(e){}
         return Number(s1.replace(".",""))*Number(s2.replace(".",""))/Math.pow(10,m)
+      },/*********************************** MQTT相关 *********************************/
+      //疏散-MQTT连接
+      offEvacuateMQTT(type){
+        let self = this;
+        if(self.evacuateClient.unsubscribe){
+          self.evacuateClient.unsubscribe(self.evacuateOpic, error => {
+            if (error) {
+              // console.log('mqtt关闭连接错误:', error)
+            }
+          })
+          self.evacuateClient.end();
+          this.$set(this,'evacuateClient',{});
+        }
+        //判断传入参数如果存在 发起一次新的连接
+        if(type){
+          this.evacuateMQTT();
+        }
+      },
+      //疏散-MQTT订阅
+      evacuateMQTT(){
+        let self = this;
+        this.evacuateClient = mqtt.connect(localStorage.getItem('mqttUrl'), {
+          username: localStorage.getItem('mqttUser'),
+          password:localStorage.getItem('mqttPassword')
+        });
+        this.evacuateClient.on("connect", e =>{
+          this.evacuateClient.subscribe(self.evacuateOpic, (err) => {
+            if (!err) {
+              console.log("疏散-订阅成功:" + self.evacuateOpic);
+            }else{
+              // console.log("疏散-连接错误:" + err);
+            }
+          });
+        });
+        this.evacuateClient.on("message", (topic, message) => {
+          if (message){
+            console.log('疏散-message');
+            //获取当前楼层数据
+            this.laboratoryBigViewGetFloorByBigView();
+          }
+        });
+      },
+      //疏散灯-MQTT连接
+      offLightMQTT(type){
+        let self = this;
+        if(self.lightClient.unsubscribe){
+          self.lightClient.unsubscribe(self.lightOpic+self.floorId, error => {
+            if (error) {
+              // console.log('mqtt关闭连接错误:', error)
+            }
+          })
+          self.lightClient.end();
+          this.$set(this,'lightClient',{});
+        }
+        //判断传入参数如果存在 发起一次新的连接
+        if(type){
+          this.lightMQTT();
+        }
+      },
+      //疏散灯-MQTT订阅
+      lightMQTT(){
+        let self = this;
+        this.lightClient = mqtt.connect(localStorage.getItem('mqttUrl'), {
+          username: localStorage.getItem('mqttUser'),
+          password:localStorage.getItem('mqttPassword')
+        });
+        this.lightClient.on("connect", e =>{
+          this.lightClient.subscribe(self.lightOpic+self.floorId, (err) => {
+            if (!err) {
+              console.log("疏散灯-订阅成功:" + self.lightOpic+self.floorId);
+            }else{
+              // console.log("疏散灯-连接错误:" + err);
+            }
+          });
+        });
+        this.lightClient.on("message", (topic, message) => {
+          if (message){
+            console.log('疏散灯-message',message);
+            let data = JSON.parse(message)
+            for(let i=0;i<self.mapList.length;i++){
+              if(self.mapList[i].type == 2){
+                for(let o=0;o<self.mapList[i].lightList.length;o++){
+                  if(data.hardwareNo == self.mapList[i].lightList[o].configName){
+                    self.$set(self.mapList[i].lightList[o],'openType',data.operatingState);
+                  }
+                }
+              }
+            }
+          }
+        });
+      },
+      //预案-MQTT连接
+      offPlanMQTT(type){
+        let self = this;
+        if(self.planClient.unsubscribe){
+          self.planClient.unsubscribe(self.planOpic, error => {
+            if (error) {
+              // console.log('mqtt关闭连接错误:', error)
+            }
+          })
+          self.planClient.end();
+          this.$set(this,'planClient',{});
+        }
+        //判断传入参数如果存在 发起一次新的连接
+        if(type){
+          this.planMQTT();
+        }
+      },
+      //预案-MQTT订阅
+      planMQTT(){
+        let self = this;
+        this.planClient = mqtt.connect(localStorage.getItem('mqttUrl'), {
+          username: localStorage.getItem('mqttUser'),
+          password:localStorage.getItem('mqttPassword')
+        });
+        this.planClient.on("connect", e =>{
+          this.planClient.subscribe(self.planOpic, (err) => {
+            if (!err) {
+              console.log("预案-订阅成功:" + self.evacuateOpic);
+            }else{
+              // console.log("预案-连接错误:" + err);
+            }
+          });
+        });
+        this.planClient.on("message", (topic, message) => {
+          if (message){
+            console.log('预案-message',message);
+            //获取当前楼层数据
+            this.laboratoryBigViewGetFloorByBigView();
+          }
+        });
       },
       //退出全屏
       exitfull() {
@@ -802,6 +995,13 @@
         }
       },
     },
+    beforeDestroy() {
+      //清除MQTT
+      let self = this;
+      self.offEvacuateMQTT();
+      self.offLightMQTT();
+      self.offPlanMQTT();
+    },
   }
 </script>
 <style scoped lang="scss">