dedsudiyu hace 11 meses
padre
commit
b4ec1e0d78

+ 4 - 4
.env.production

@@ -19,15 +19,15 @@ VUE_APP_VERSION_DIFFERENCE_FIELD = 'kuangYeDaXue_nanHu'
 # ####################外网接口配置####################
 
 # 1.8外网地址
-VUE_APP_BASE_API = 'lab.zjznai.com/nwsuaf/api'
+# VUE_APP_BASE_API = 'lab.zjznai.com/nwsuaf/api'
 
 # 43外网地址
-# VUE_APP_BASE_API = '192.168.1.43/api'
+VUE_APP_BASE_API = '192.168.1.43/api'
 
 # ####################内网接口配置####################
 
 # 1.8内网地址
-VUE_APP_BASE_LOCAL_API = '192.168.1.8/api'
+# VUE_APP_BASE_LOCAL_API = '192.168.1.8/api'
 # 43内网地址
-# VUE_APP_BASE_LOCAL_API = '192.168.1.43/api'
+VUE_APP_BASE_LOCAL_API = '192.168.1.43/api'
 

+ 84 - 216
src/layout/components/AppMain.vue

@@ -1,13 +1,8 @@
 <template>
   <section class="app-main">
-    <div class="app-main-top-text-box" v-if="textType">
+    <div class="perform-evacuation-app-main-box" v-if="planType">
       <p>{{text}}</p>
-      <p @click="buttonClick">查看</p>
-    </div>
-    <div class="app-main-top-text-box-two" :class="workType == 1?'work-color-a':(workType == 2?'work-color-b':'')" v-if="!textType&&(workType == 1 || workType == 2)">
-      <p>{{textWork}}</p>
-      <p @click="goWorkPage">立即完成</p>
-      <p class="el-icon-circle-close" @click="workClickOff"></p>
+      <p @click="goPage">查看</p>
     </div>
     <transition name="fade-transform" mode="out-in">
       <!--<keep-alive :include="cachedViews">-->
@@ -18,8 +13,7 @@
 </template>
 
 <script>
-  import { selectTriggerInfo } from '@/api/commonality/noPermission'
-  import store from '@/store'
+  import { laboratoryBigViewSelectTriggerInfo } from "@/api/commonality/permission";
   import mqtt from 'mqtt'
 export default {
   name: 'AppMain',
@@ -34,104 +28,77 @@ export default {
   },
   data() {
     return {
-      //MQTT请求参数-传感器
-      mtopic:"lab/riskPlan/trigger/notice",
-      mtopicTwo:"manage/work"+localStorage.getItem('userId'),
-      textType:false,
-      closePlan:false,
-      text:"",
-      textWork:"",
-      workType:"",
-      userType:"",
-      buttonId:"",
-      buildingId:"",
-      address:"",
-      buildId:null,
-      floorId:null,
-      subId:null,
-      groupId:null,
+      //预案MQTT
+      planOpic:'lab/risk/plan/change',
+      planClient:{},
+      //预案文字
+      text:'',
+      planType:false,
+      planData:[],
     }
   },
   created() {
   },
   mounted(){
-    this.userType = localStorage.getItem('userType')
-    //暂时去掉
-    // if( this.userType != 22 && this.versionField() != 'xiBeiNongLinDaXue'){
-    //   this.selectTriggerInfo();
-    //   this.subscriptionMQTT();
-    // }
+    this.offPlanMQTT('on');
+    this.laboratoryBigViewSelectTriggerInfo();
   },
   methods:{
-    workClickOff(){
-      this.workType = "";
-    },
-    goWorkPage(){
+    //预案-MQTT连接
+    offPlanMQTT(type){
       let self = this;
-      const h = this.$createElement;
-      this.$msgbox({
-        title: '',
-        message: h('p', null, [
-          h('p', { style:'font-size:16px;margin:20px 0;' }, self.textWork),
-        ]),
-        showCancelButton: true,
-        confirmButtonText: '完成',
-        cancelButtonText: '取消',
-        beforeClose: (action, instance, done) => {
-          if (action === 'confirm') {
-            //执行
-            this.$router.push({
-              path: "/laboratory/gradeManageWork"
-            })
-            done();
-          } else {
-            //取消
-            done();
+      if(self.planClient.unsubscribe){
+        self.planClient.unsubscribe(self.planOpic, error => {
+          if (error) {
+            // console.log('mqtt关闭连接错误:', error)
           }
-        }
-      }).then(action => {
-        //成功回掉
-      });
+        })
+        self.planClient.end();
+        this.$set(this,'planClient',{});
+      }
+      //判断传入参数如果存在 发起一次新的连接
+      if(type){
+        this.planMQTT();
+      }
     },
-    //MQTT订阅
-    subscriptionMQTT(){
+    //预案-MQTT订阅
+    planMQTT(){
       let self = this;
-      this.client = mqtt.connect(localStorage.getItem('mqttUrl'), {
+      this.planClient = mqtt.connect(localStorage.getItem('mqttUrl'), {
         username: localStorage.getItem('mqttUser'),
-        password: localStorage.getItem('mqttPassword')
+        password:localStorage.getItem('mqttPassword')
       });
-      this.client.on("connect", e =>{
-        //连接成功
-        this.client.subscribe(this.mtopic, (err) => {
+      this.planClient.on("connect", e =>{
+        this.planClient.subscribe(self.planOpic, (err) => {
           if (!err) {
-            //"警报通道订阅成功:" + this.mtopic
-          }
-        });
-        this.client.subscribe(this.mtopicTwo, (err) => {
-          if (!err) {
-            //"工作通道订阅成功:" + this.mtopicTwo
+            console.log("预案-订阅成功:" + self.planOpic);
+          }else{
+            // console.log("预案-连接错误:" + err);
           }
         });
       });
-      this.client.on("message", (topic, message) => {
+      this.planClient.on("message", (topic, message) => {
         if (message){
-          let data = JSON.parse(message)
-          if(topic == this.mtopic){
-            //报警
-            self.selectTriggerInfo();
-          }
-          if(topic == this.mtopicTwo){
-            //工作通知
-            this.textWork = data.message;
-            this.workType = data.type;
-          }
+          console.log('预案-message',message);
+          //获取预案数据
+          this.laboratoryBigViewSelectTriggerInfo();
         }
       });
     },
-    //执行按钮
-    buttonClick(){
+    //查询当前正在发生的预案
+    laboratoryBigViewSelectTriggerInfo(){
       let self = this;
-      if(this.$route.path == '/emergencyManagement/newPerformEvacuation'){
+      laboratoryBigViewSelectTriggerInfo().then(response => {
+        if(response.data[0]){
+          this.$set(this,'planData',response.data);
+          this.$set(this,'text',response.data[1]?'有多个实验室发生预案':'有实验室发生预案');
+          this.$set(this,'planType',true);
+        }
+      })
+    },
+    goPage(){
+      let self = this;
+      if(this.$route.path == '/emergencyManagement/performEvacuation'){
         return
       }
       const h = this.$createElement;
@@ -148,11 +115,11 @@ export default {
           if (action === 'confirm') {
             //执行
             this.$router.push({
-              path: "/emergencyManagement/newPerformEvacuation",
+              path: "/emergencyManagement/performEvacuation",
               query: {
-                buildId: self.buildId,
-                floorId:self.floorId,
-                subId:self.subId,
+                buildId: self.planData[0].buildId,
+                floorId: self.planData[0].floorId,
+                type:2,
               }
             })
             done();
@@ -165,51 +132,12 @@ export default {
         //成功回掉
       });
     },
-    //查询当前用户下的预案触发数据
-    selectTriggerInfo(){
-      let self = this;
-      selectTriggerInfo().then(response => {
-        //预案发生时候,存储值用于实验室配置传感器状态
-        let arr=[];
-        if(response.data){
-          arr=JSON.stringify(response.data)
-        }
-        localStorage.setItem('selectTriggerList',arr)
-        if(response.data[0]){
-          this.$set(this,'text',response.data.length>1?'有多个实验室发生预案':'有实验室发生预案');
-          this.$set(this,'buildId',response.data[0].buildId);
-          this.$set(this,'floorId',response.data[0].floorId);
-          this.$set(this,'subId',response.data[0].subId);
-          this.$set(this,'groupId',response.data[0].groupId);
-          if(response.data[0].riskAttribute == 1){
-            this.$set(this,'closePlan',true);
-          }
-          this.$set(this,'textType',true);
-          //没有火焰预案并且没有查看过
-          for(let i=0;i<response.data.length;i++){
-            if(response.data[i].riskAttribute != '1'&&response.data[i].ifCheck != '1'){
-              //如果就在应急预案页面责终止跳转
-              if(self.$route.path == '/emergencyManagement/newPerformEvacuation' || self.$route.path == '/newEvacuationBigData'){
-                return
-              }
-              this.$router.push({
-                path: "/emergencyManagement/newPerformEvacuation",
-                query: {
-                  buildId: response.data[i].buildId,
-                  floorId:response.data[i].floorId,
-                  subId:response.data[i].subId,
-                  groupId:response.data[i].groupId,
-                }
-              })
-              return
-            }
-          }
-        }else{
-          this.$set(this,'textType',false);
-        }
-      })
-    },
-  }
+  },
+  beforeDestroy() {
+    //清除MQTT
+    let self = this;
+    self.offPlanMQTT();
+  },
 }
 </script>
 
@@ -222,6 +150,28 @@ export default {
   flex:1;
   display: flex;
   flex-direction: column;
+  .perform-evacuation-app-main-box{
+    background: rgba(255,0,0,0.2);
+    margin:0 20px 0 10px;
+    border-radius:10px;
+    padding:0 0 0 20px;
+    display: flex;
+    /*height:40px;*/
+    /*margin:0 20px 0 10px;*/
+    /*display: flex;*/
+    p:nth-child(1){
+      flex:1;
+      line-height:40px;
+      color:red;
+    }
+    p:nth-child(2){
+      line-height:40px;
+      width:80px;
+      color:#0045AF;
+      cursor: pointer;
+      text-align: center;
+    }
+  }
 }
 .work-color-a{
   background: rgba(30,144,255,0.2);
@@ -235,88 +185,6 @@ export default {
     color:#FF0000;
   }
 }
-.app-main-top-text-box-two{
-  margin:10px 20px 0 10px;
-  border-radius:10px;
-  padding:0 0 0 20px;
-  display: flex;
-  p{
-    line-height:60px;
-    font-size:16px;
-    margin:0;
-  }
-  p:nth-child(1){
-    flex:1;
-  }
-  p:nth-child(2){
-    width:100px;
-    cursor: pointer;
-  }
-  p:nth-child(3){
-    font-size:22px;
-    margin-right:20px;
-    cursor: pointer;
-  }
-}
-.app-main-top-text-box{
-  background: rgba(255,0,0,0.2);
-  margin:10px 20px 0 10px;
-  border-radius:10px;
-  padding:0 0 0 20px;
-  display: flex;
-  p{
-    line-height:60px;
-    font-size:16px;
-    margin:0;
-  }
-  p:nth-child(1){
-    flex:1;
-    color:#FF0000;
-  }
-  p:nth-child(2){
-    width:100px;
-    color:#0045AF;
-    cursor: pointer;
-    text-align: center;
-  }
-  p:nth-child(3){
-    color:#0045AF;
-    text-align: center;
-    width:30px;
-    font-weight:500;
-  }
-  p:nth-child(4){
-    width:100px;
-    color:#0045AF;
-    cursor: pointer;
-    text-align: center;
-  }
-}
-.app-main-position-max-box{
-  position: fixed;
-  height:100%;
-  width:100%;
-  background: rgba(0,0,0,0.2);
-  z-index: 100;
-  .app-main-position-big-box{
-    .app-main-position-box{
-      position: absolute;
-      top: 50%;
-      left: 50%;
-      background: #fff;
-      width:500px;
-      height:300px;
-      margin-left:-250px;
-      margin-top:-150px;
-      border-radius:10px;
-      box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
-      .app-main-position-box-bottom-button-box{
-        display: flex;
-      }
-    }
-  }
-}
-
 .fixed-header+.app-main {
   padding-top: 50px;
 }

+ 2 - 0
src/store/modules/user.js

@@ -109,6 +109,8 @@ const user = {
           if(res){
             let user = res.data.userInfo
             let avatar = user.avatar == "" ? require("@/assets/ZDimages/basicsModules/tx_cion.png") : user.avatar;
+            //操作权限存储
+            localStorage.setItem('controlsRestrict',res.data.roleKeys?res.data.roleKeys:[])
             commit('SET_NAME', user.userName)
             commit('SET_AVATAR', avatar)
             localStorage.setItem('user',JSON.stringify(user));

+ 20 - 6
src/utils/index.js

@@ -5,12 +5,12 @@ import { parseTime } from './ruoyi'
  */
 export function formatDate(cellValue) {
   if (cellValue == null || cellValue == "") return "";
-  var date = new Date(cellValue) 
+  var date = new Date(cellValue)
   var year = date.getFullYear()
   var month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
-  var day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate() 
-  var hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours() 
-  var minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes() 
+  var day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
+  var hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours()
+  var minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
   var seconds = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
   return year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds
 }
@@ -330,7 +330,7 @@ export function makeMap(str, expectsLowerCase) {
     ? val => map[val.toLowerCase()]
     : val => map[val]
 }
- 
+
 export const exportDefault = 'export default '
 
 export const beautifierConf = {
@@ -387,4 +387,18 @@ export function camelCase(str) {
 export function isNumberStr(str) {
   return /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g.test(str)
 }
- 
+
+/*            操作权限验证
+* str 为权限字符 用于匹配操作角色的字符
+* str === performEvacuation   应急疏散操作权限
+* str === checkGentle         安全检查
+*/
+export function controlsRestrictVerify(str) {
+  if(str){
+    let controlsRestrict = localStorage.getItem('controlsRestrict');
+    return controlsRestrict.indexOf(str) != -1;
+  }else{
+    return false
+  }
+}
+

+ 78 - 52
src/views/emergencyManagement/performEvacuation/performEvacuationData.vue

@@ -392,6 +392,7 @@
 </template>
 <script>
   import mqtt from 'mqtt'
+  import { controlsRestrictVerify} from '@/utils/index'
   import { laboratoryBigViewGetBuildByBigView, laboratoryBigViewGetFloorByBigView,
     laboratoryExitLineGetRedisEvacuation,laboratoryExitLineExecuteEvacuation,
     laboratoryExitLineEndEvacuation,laboratoryBigViewOnLineUserList,
@@ -560,18 +561,18 @@
           this.iotBigViewDeviceFindByType();
           //查询实验室危险源
           this.laboratoryBigViewHazardCensus();
-          //MQTT相关
-          this.offHardwareMQTT('on')
-          this.offSensorMQTT('on')
-          this.offLightMQTT('on')
-          //判断是否已有链接
-          if(!this.evacuateClient.unsubscribe){
-            this.offEvacuateMQTT('on');
-          }
-          //判断是否已有链接
-          if(!this.planClient.unsubscribe){
-            this.offPlanMQTT('on');
-          }
+        }
+        //MQTT相关
+        this.offHardwareMQTT('on')
+        this.offSensorMQTT('on')
+        this.offLightMQTT('on')
+        //判断是否已有链接
+        if(!this.evacuateClient.unsubscribe){
+          this.offEvacuateMQTT('on');
+        }
+        //判断是否已有链接
+        if(!this.planClient.unsubscribe){
+          this.offPlanMQTT('on');
         }
       },
       //楼栋选中方法
@@ -663,6 +664,22 @@
               this.$set(this.mapData,'width',obj.maxWidth);
               this.$set(this.mapData,'height',obj.maxHeight);
               this.$set(this.mapData,'zoomData',obj.zoomData);
+              //标记第一间实验室
+              let subNum = 0;
+              for(let x=0;x<list.length;x++){
+                if(list[x].subId != -1 &&list[x].type == 1){
+                  subNum++
+                  this.$set(this,'subName',list[x].subName);
+                  this.$set(this,'roomNum',list[x].roomNum);
+                  this.$set(this,'checkSubId',list[x].subId);
+                  break
+                }
+              }
+              if(subNum == 0){
+                this.$set(this,'subName','');
+                this.$set(this,'roomNum','');
+                this.$set(this,'checkSubId','');
+              }
               this.$set(this,'mapList',JSON.parse(JSON.stringify(list)));
               this.$set(this,'shadeMapList',JSON.parse(JSON.stringify(list)));
               this.$set(this,'mapType',true);
@@ -708,10 +725,16 @@
               this.$set(this,'mapType',false);
               this.$set(this,'planMapList',[]);
             }
-            //获取报警数据
-            this.laboratoryBigViewSelectTriggerInfo();
-            //获取疏散数据
-            this.laboratoryExitLineGetRedisEvacuation();
+
+
+            // 等待配置与字段获取到后跳转
+            Promise.all([
+              //获取路由判断权限
+              this.laboratoryBigViewSelectTriggerInfo(),
+              this.laboratoryExitLineGetRedisEvacuation(),
+            ]).then((result)=>{
+              this.buttonSubject();
+            }).catch((error) => {})
           }
         })
       },
@@ -789,23 +812,6 @@
               }
             }
           }
-          if(num == 0){
-            let checkNum = 0;
-            for(let x=0;x<self.mapList.length;x++){
-              if(self.mapList[x].subId != -1 &&self.mapList[x].type == 1){
-                this.$set(this,'subName',self.mapList[x].subName);
-                this.$set(this,'roomNum',self.mapList[x].roomNum);
-                this.$set(this,'checkSubId',self.mapList[x].subId);
-                checkNum++
-                break
-              }
-            }
-            if (checkNum == 0){
-              this.$set(this,'subName','');
-              this.$set(this,'roomNum','');
-              this.$set(this,'checkSubId',null);
-            }
-          }
           //浮层实验室预案标记
           for(let o=0;o<self.shadeMapList.length;o++){
             if(self.shadeMapList[o].type == 1){
@@ -827,7 +833,7 @@
             })
           })
           this.$set(this,'planSensorList',planSensorList);
-          this.buttonSubject();
+
           this.$forceUpdate();
         })
       },
@@ -839,7 +845,6 @@
           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++){
@@ -856,19 +861,28 @@
                   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(self.mapList[o].type == 3){
+                let age = 0;
+                for(let i=0;i<response.data.doorPointNames.length;i++){
                   if(response.data.doorPointNames[i] == self.mapList[o].key){
-                    self.mapList[o].roomCheckType = true;
+                    age++
                   }
                 }
+                self.mapList[o].roomCheckType = age != 0;
               }
             }
-            this.$forceUpdate();
           }else{
             this.$set(this,'evacuationType',false);
+            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++){
+                  self.mapList[o].lightList[x].openType = false;
+                }
+              }
+              if(self.mapList[o].type == 3){
+                self.mapList[o].roomCheckType = false;
+              }
+            }
           }
         });
       },
@@ -924,7 +938,7 @@
       },
       //查询实验室硬件
       iotBigViewHardwareFindByType(){
-        iotBigViewHardwareFindByType({subId:this.checkSubId}).then(response => {
+        iotBigViewHardwareFindByType({subjectId:this.checkSubId}).then(response => {
           this.$set(this,'controlsList',response.data);
         })
       },
@@ -1022,6 +1036,10 @@
       },
       //喇叭播放文字
       iotBigViewSpeakerPlayText(){
+        if(!controlsRestrictVerify('performEvacuation')){
+          this.msgError('没有相关操作权限,请联系管理员')
+          return
+        }
         if(!this.loudspeakerInput){
           this.msgError('请输入内容')
           return
@@ -1254,6 +1272,10 @@
       //开始/结束疏散按钮
       evacuationButton(){
         let self = this;
+        if(!controlsRestrictVerify('performEvacuation')){
+          this.msgError('没有相关操作权限,请联系管理员')
+          return
+        }
         if(this.evacuationType){
           //结束疏散
           this.$set(this,'shadeText','是否结束疏散?');
@@ -1337,6 +1359,10 @@
       },
       //遮罩层开关/弹层提示确认
       shadeButton(type,text){
+        if(!controlsRestrictVerify('performEvacuation')){
+          this.msgError('没有相关操作权限,请联系管理员')
+          return
+        }
         if(type == 1){
           this.$set(this,'shadeType',1);
         }else if(type == 2){
@@ -1377,7 +1403,7 @@
             }
             laboratoryExitLineEndEvacuation(obj).then(response => {
               this.$set(this,'shadeType',0);
-              this.laboratoryBigViewGetFloorByBigView();
+              this.laboratoryExitLineGetRedisEvacuation();
             })
           }else if(this.shadeType == 5){
             //结束预案
@@ -1461,7 +1487,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);
             }
@@ -1507,7 +1533,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);
             }
@@ -1556,7 +1582,7 @@
         this.evacuateClient.on("connect", e =>{
           this.evacuateClient.subscribe(self.evacuateOpic, (err) => {
             if (!err) {
-              console.log("疏散-订阅成功:" + self.evacuateOpic);
+              // console.log("疏散-订阅成功:" + self.evacuateOpic);
             }else{
               // console.log("疏散-连接错误:" + err);
             }
@@ -1564,8 +1590,8 @@
         });
         this.evacuateClient.on("message", (topic, message) => {
           if (message){
-            //获取当前楼层数据
-            this.laboratoryBigViewGetFloorByBigView();
+            //获取疏散数据
+            this.laboratoryExitLineGetRedisEvacuation();
           }
         });
       },
@@ -1596,7 +1622,7 @@
         this.lightClient.on("connect", e =>{
           this.lightClient.subscribe(self.lightOpic+self.floorId, (err) => {
             if (!err) {
-              console.log("疏散灯-订阅成功:" + self.lightOpic+self.floorId);
+              // console.log("疏散灯-订阅成功:" + self.lightOpic+self.floorId);
             }else{
               // console.log("疏散灯-连接错误:" + err);
             }
@@ -1644,7 +1670,7 @@
         this.planClient.on("connect", e =>{
           this.planClient.subscribe(self.planOpic, (err) => {
             if (!err) {
-              console.log("预案-订阅成功:" + self.evacuateOpic);
+              // console.log("预案-订阅成功:" + self.planOpic);
             }else{
               // console.log("预案-连接错误:" + err);
             }
@@ -1652,8 +1678,8 @@
         });
         this.planClient.on("message", (topic, message) => {
           if (message){
-            //获取当前楼层数据
-            this.laboratoryBigViewGetFloorByBigView();
+            //获取预案数据
+            this.laboratoryBigViewSelectTriggerInfo();
           }
         });
       },

+ 32 - 22
src/views/emergencyManagement/performEvacuation/performEvacuationHome.vue

@@ -300,7 +300,7 @@
           page:1,
           pageSize:3,
         });
-        //获取楼层数据
+        //获取楼层布局数据
         this.laboratoryBigViewGetFloorByBigView();
         //获取楼层-总人数;
         this.laboratoryBigViewOnLineUserList();
@@ -485,7 +485,7 @@
               this.$set(this,'mapType',false);
               this.$set(this,'planMapList',[]);
             }
-            //获取预列表
+            //获取预列表
             this.laboratoryBigViewSelectTriggerInfo();
             //获取疏散数据
             this.laboratoryExitLineGetRedisEvacuation();
@@ -570,28 +570,37 @@
                   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++
-                        }
+                      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(self.mapList[o].type == 3){
+                let age = 0;
+                for(let i=0;i<response.data.doorPointNames.length;i++){
                   if(response.data.doorPointNames[i] == self.mapList[o].key){
-                    self.mapList[o].roomCheckType = true;
+                    age++
                   }
                 }
+                self.mapList[o].roomCheckType = age != 0;
+              }
+            }
+          }else{
+            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++){
+                  self.mapList[o].lightList[x].openType = false;
+                }
+              }
+              if(self.mapList[o].type == 3){
+                self.mapList[o].roomCheckType = false;
               }
             }
-            this.$forceUpdate();
           }
+          this.$forceUpdate();
         });
       },
       //获取楼层-智能物联设备列表;
@@ -865,7 +874,7 @@
         this.evacuateClient.on("connect", e =>{
           this.evacuateClient.subscribe(self.evacuateOpic, (err) => {
             if (!err) {
-              console.log("疏散-订阅成功:" + self.evacuateOpic);
+              // console.log("疏散-订阅成功:" + self.evacuateOpic);
             }else{
               // console.log("疏散-连接错误:" + err);
             }
@@ -873,9 +882,9 @@
         });
         this.evacuateClient.on("message", (topic, message) => {
           if (message){
-            console.log('疏散-message');
-            //获取当前楼层数据
-            this.laboratoryBigViewGetFloorByBigView();
+            // console.log('疏散-message');
+            //获取疏散数据
+            this.laboratoryExitLineGetRedisEvacuation();
           }
         });
       },
@@ -906,7 +915,7 @@
         this.lightClient.on("connect", e =>{
           this.lightClient.subscribe(self.lightOpic+self.floorId, (err) => {
             if (!err) {
-              console.log("疏散灯-订阅成功:" + self.lightOpic+self.floorId);
+              // console.log("疏散灯-订阅成功:" + self.lightOpic+self.floorId);
             }else{
               // console.log("疏散灯-连接错误:" + err);
             }
@@ -914,8 +923,9 @@
         });
         this.lightClient.on("message", (topic, message) => {
           if (message){
-            console.log('疏散灯-message',message);
+            // console.log('疏散灯-message',message);
             let data = JSON.parse(message)
+            // console.log('疏散灯-data',data);
             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++){
@@ -955,7 +965,7 @@
         this.planClient.on("connect", e =>{
           this.planClient.subscribe(self.planOpic, (err) => {
             if (!err) {
-              console.log("预案-订阅成功:" + self.evacuateOpic);
+              // console.log("预案-订阅成功:" + self.planOpic);
             }else{
               // console.log("预案-连接错误:" + err);
             }
@@ -963,9 +973,9 @@
         });
         this.planClient.on("message", (topic, message) => {
           if (message){
-            console.log('预案-message',message);
-            //获取当前楼层数据
-            this.laboratoryBigViewGetFloorByBigView();
+            // console.log('预案-message',message);
+            //获取预案数据
+            this.laboratoryBigViewSelectTriggerInfo();
           }
         });
       },