dedsudiyu 11 months ago
parent
commit
b16c917011

+ 22 - 10
src/views/chemicalManage/basicManagement/chemicalsCabinetManage/addPage.vue

@@ -484,19 +484,31 @@
         this.subOptions.forEach((item)=>{
           if(item.subId == val){
             this.$set(this.newData, 'subName', item.subName)
-            if (item.oneSafeId){
-              idList.push(item.oneSafeId)
+            if (item.adminId){
+              idList.push(item.adminId)
               list.push({
-                userId:item.oneSafeId,
-                userName:item.oneSafeName,
+                userId:item.adminId,
+                userName:item.adminName,
               })
             }
-            if (item.twoSafeId){
-              idList.push(item.twoSafeId)
-              list.push({
-                userId:item.twoSafeId,
-                userName:item.twoSafeName,
-              })
+            if (item.oneSafeId){
+              if(item.adminId != item.oneSafeId){
+                idList.push(item.oneSafeId)
+                list.push({
+                  userId:item.oneSafeId,
+                  userName:item.oneSafeName,
+                })
+              }else{
+                if(item.twoSafeId){
+                  if(item.adminId != item.twoSafeId){
+                    idList.push(item.twoSafeId)
+                    list.push({
+                      userId:item.twoSafeId,
+                      userName:item.twoSafeName,
+                    })
+                  }
+                }
+              }
             }
           }
         })

+ 225 - 5
src/views/emergencyManagement/performEvacuation/performEvacuationData.vue

@@ -16,7 +16,29 @@
             <p>智能控制</p>
           </div>
           <div class="content-controls-for-box scrollbar-box" :class="!controlsList[0]?'content-null-box':''">
-            <div class="controls-for-box" v-for="(item,index) in controlsList" :key="index">
+            <!--非空调-->
+            <div class="controls-for-box" v-for="(item,index) in controlsList" :key="index" v-if="item.hardwareTypeKey != 'airConditioner'">
+              <div class="for-title-box">
+                <div class="for-title-img-box">
+                  <svg-icon v-if="item.exceptionIcon" class="svg-img" :icon-class="item.exceptionIcon"/>
+                </div>
+                <p class="for-title-name-box">{{item.hardwareName}}</p>
+                <div class="for-title-button-box">
+                  <el-switch
+                    class="switch"
+                    @click.native="changeIsNeedCaptcha(item)"
+                    v-model="item.operatingState"
+                    :active-value="false"
+                    :inactive-value="true"
+                    active-text="关闭"
+                    inactive-text="开启"
+                    disabled>
+                  </el-switch>
+                </div>
+              </div>
+            </div>
+            <!--空调-->
+            <div class="controls-for-box" v-for="(item,index) in controlsList" :key="index" v-if="item.hardwareTypeKey == 'airConditioner'">
               <div class="for-title-box">
                 <div class="for-title-img-box">
                   <svg-icon v-if="item.exceptionIcon" class="svg-img" :icon-class="item.exceptionIcon"/>
@@ -36,7 +58,7 @@
                 </div>
               </div>
               <!--空调-->
-              <div class="for-button-box" v-if="item.hardwareTypeKey == 'airConditioner'">
+              <div class="for-button-box">
               </div>
             </div>
             <div class="null-box" v-if="!controlsList[0]">
@@ -369,6 +391,7 @@
   </div>
 </template>
 <script>
+  import mqtt from 'mqtt'
   import { laboratoryBigViewGetBuildByBigView, laboratoryBigViewGetFloorByBigView,
     laboratoryExitLineGetRedisEvacuation,laboratoryExitLineExecuteEvacuation,
     laboratoryExitLineEndEvacuation,laboratoryBigViewOnLineUserList,
@@ -415,6 +438,8 @@
         controlsList:[],
         //智能监测
         monitorList:[],
+        //传感器报警数据
+        planSensorList:[],
         //危险源
         dangerList:{
           nameList: [],
@@ -447,6 +472,19 @@
         shadeType:0,
         shadeText:'',
         shadeData:{},
+        /****************** MQTT相关 ******************/
+        //硬件MQTT
+        hardwareOpic:"iot/hardware/all/sub/",
+        hardwareClient:{},
+        //传感器
+        sensorOpic:"iot/device/sensor/sub/",
+        sensorClient:{},
+        //疏散灯
+        lightOpic:"iot/hardware/evacuationLight/floor/",
+        lightClient:{},
+        //疏散
+        evacuateOpic:"lab/floor/exit/line",
+        evacuateClient:{},
       }
     },
     created () {
@@ -519,6 +557,13 @@
           this.iotBigViewDeviceFindByType();
           //查询实验室危险源
           this.laboratoryBigViewHazardCensus();
+          //MQTT相关
+          this.offHardwareMQTT('on')
+          this.offSensorMQTT('on')
+          //判断是否已有链接
+          if(!this.evacuateClient.unsubscribe){
+            this.offEvacuateMQTT('on');
+          }
         }
       },
       //楼栋选中方法
@@ -532,11 +577,15 @@
       },
       //获取楼栋数据
       getBuild(){
+        let self = this;
         laboratoryBigViewGetBuildByBigView({type:2}).then(response => {
           if(response.data[0]){
             this.$set(this,'buildOptions',response.data);
             //获取楼层数据
             this.getFloor();
+            // setTimeout(function (){
+            //   self.offEvacuateMQTT('on');
+            // },5000)
           }
         })
       },
@@ -761,6 +810,15 @@
               self.$set(self.shadeMapList[o],'planType',num != 0);
             }
           }
+          //传感器
+          let planSensorList = [];
+          response.data.forEach((item)=>{
+            let list = JSON.parse(item.triggerUploadData)
+            list.forEach((minItem)=>{
+              planSensorList.push(minItem.deviceNo)
+            })
+          })
+          this.$set(this,'planSensorList',planSensorList);
           this.buttonSubject();
           this.$forceUpdate();
         })
@@ -885,9 +943,16 @@
       },
       //查询实验室传感器
       iotBigViewDeviceFindBySubId(){
+        let self = this;
         iotBigViewDeviceFindBySubId({subId:this.checkSubId}).then(response => {
           response.data.forEach((item)=>{
-            item.type = false;
+            let num = 0;
+            self.planSensorList.forEach((minItem)=>{
+              if(item.deviceNo == minItem){
+                num++
+              }
+            })
+            item.type = num != 0;
           })
           this.$set(this,'monitorList',response.data);
         })
@@ -1334,7 +1399,7 @@
       //应急疏散时-开灯
       laboratoryExitRelayOpenLight(){
         let obj = {
-          buildId:this.buildingId,
+          buildId:this.buildId,
           floorId:this.floorId,
           pointName:this.shadeData.key
         };
@@ -1348,7 +1413,7 @@
       //应急疏散时-关灯
       laboratoryExitRelayCloseLight(){
         let obj = {
-          buildId:this.buildingId,
+          buildId:this.buildId,
           floorId:this.floorId,
           pointName:this.shadeData.key
         };
@@ -1359,6 +1424,161 @@
           }
         });
       },
+      /*********************************** MQTT相关 *********************************/
+      //智能控制-MQTT连接
+      offHardwareMQTT(type){
+        let self = this;
+        if(self.hardwareClient.unsubscribe){
+          self.hardwareClient.unsubscribe(self.hardwareOpic+self.checkSubId, error => {
+            if (error) {
+              // console.log('mqtt关闭连接错误:', error)
+            }
+          })
+          self.hardwareClient.end();
+          this.$set(this,'hardwareClient',{});
+        }
+        //判断传入参数如果存在 发起一次新的连接
+        if(type){
+          this.hardwareMQTT();
+        }
+      },
+      //智能控制-MQTT订阅
+      hardwareMQTT(){
+        let self = this;
+        this.hardwareClient = mqtt.connect(localStorage.getItem('mqttUrl'), {
+          username: localStorage.getItem('mqttUser'),
+          password:localStorage.getItem('mqttPassword')
+        });
+        this.hardwareClient.on("connect", e =>{
+          this.hardwareClient.subscribe(self.hardwareOpic+self.checkSubId, (err) => {
+            if (!err) {
+              // console.log("智能控制-订阅成功:" + self.hardwareOpic+self.checkSubId);
+            }else{
+              // console.log("智能控制-连接错误:" + err);
+            }
+          });
+        });
+        this.hardwareClient.on("message", (topic, message) => {
+          if (message){
+            let data = JSON.parse(message)
+            let list = JSON.parse(JSON.stringify(this.controlsList))
+            list.forEach((item)=>{
+              if(item.hardwareNo == data.hardwareNo){
+                item.operatingState = data.operatingState;
+              }
+            })
+            this.$set(this,'controlsList',list);
+          }
+        });
+      },
+      //智能监测-MQTT连接
+      offSensorMQTT(type){
+        let self = this;
+        if(self.sensorClient.unsubscribe){
+          self.sensorClient.unsubscribe(self.sensorOpic+self.checkSubId, error => {
+            if (error) {
+              // console.log('mqtt关闭连接错误:', error)
+            }
+          })
+          self.sensorClient.end();
+          this.$set(this,'sensorClient',{});
+        }
+        //判断传入参数如果存在 发起一次新的连接
+        if(type){
+          this.sensorMQTT();
+        }
+      },
+      //智能监测-MQTT订阅
+      sensorMQTT(){
+        let self = this;
+        this.sensorClient = mqtt.connect(localStorage.getItem('mqttUrl'), {
+          username: localStorage.getItem('mqttUser'),
+          password:localStorage.getItem('mqttPassword')
+        });
+        this.sensorClient.on("connect", e =>{
+          this.sensorClient.subscribe(self.sensorOpic+self.checkSubId, (err) => {
+            if (!err) {
+              // console.log("智能监测-订阅成功:" + self.sensorOpic+self.checkSubId);
+            }else{
+              // console.log("智能监测-连接错误:" + err);
+            }
+          });
+        });
+        this.sensorClient.on("message", (topic, message) => {
+          if (message){
+            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);
+          }
+        });
+      },
+      //智能监测-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')
+            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);
+          }
+        });
+      },
+    },
+    beforeDestroy() {
+      //清除定时器
+      let self = this;
+      self.hardwareMQTT();
+      self.sensorMQTT();
+      self.offEvacuateMQTT();
     },
   }
 </script>

+ 1 - 12
src/views/emergencyManagement/performEvacuation/performEvacuationHome.vue

@@ -104,8 +104,6 @@
                      :style="'width:'+item.width+'px;height:'+item.height+'px;left:'+item.left+'px;top:'+item.top+'px;'"
                      v-for="(item,index) in planMapList" :key="item.subId" v-if="item.planType">
                   <div class="plan-top-button-box">
-                    <p></p>
-                    <p class="el-icon-close" @click="offPlanShade(index)"></p>
                   </div>
                   <div class="plan-time-box">
                     <img src="@/assets/ZDimages/emergencyManagement/icon_dp_bjsj.png">
@@ -1089,16 +1087,7 @@
                   z-index:100;
                   background: url("../../../assets/ZDimages/emergencyManagement/img_bg_yatk.png");
                   .plan-top-button-box{
-                    display: flex;
-                    p:nth-child(1){
-                      flex:1;
-                    }
-                    p:nth-child(2){
-                      font-size:14px;
-                      color:#fff;
-                      cursor: pointer;
-                      margin:9px 12px 0 0 ;
-                    }
+                    height:22px;
                   }
                   .plan-time-box{
                     display: flex;

+ 31 - 27
src/views/integratedManagement/laboratoryManagement/layoutManagement/buildingDetails.vue

@@ -221,9 +221,9 @@
                          placeholder="请选择房间" style="width:380px;">
                 <el-option
                   v-for="item in configList"
-                  :key="item.roomId"
-                  :label="item.roomName"
-                  :value="item.roomId">
+                  :key="item.hardwareNo"
+                  :label="item.hardwareName"
+                  :value="item.hardwareNo">
                 </el-option>
               </el-select>
             </el-radio-group>
@@ -449,6 +449,10 @@
             {required: true, message: '请输入状态参数', trigger: 'blur'},
             { required: true, message: "请输入状态参数", validator: this.spaceJudgment, trigger: "blur" }
           ],
+          configName:[
+            {required: true, message: '请选择疏散灯', trigger: 'blur'},
+            { required: true, message: "请选择疏散灯", validator: this.spaceJudgment, trigger: "blur" }
+          ],
           state:[
             {required: true, message: '请选择指示灯类型', trigger: 'blur'},
             { required: true, message: "请选择指示灯类型", validator: this.spaceJudgment, trigger: "blur" }
@@ -517,16 +521,16 @@
                 if( obj.mapList[i].lightList[o].type == 'light'){
                   let minObj = {
                     pointName:obj.mapList[i].lightList[o].key,
-                    relayType:obj.mapList[i].lightList[o].relayType,
+                    configName:obj.mapList[i].lightList[o].configName,
                     state:obj.mapList[i].lightList[o].state,
                   }
-                  if(obj.mapList[i].lightList[o].relayType == 1 || obj.mapList[i].lightList[o].relayType == 3){
-                    minObj.relayCode = obj.mapList[i].lightList[o].relayCode
-                    minObj.relayBit = obj.mapList[i].lightList[o].relayBit
-                  }else if(obj.mapList[i].lightList[o].relayType == 2){
-                    minObj.configName = obj.mapList[i].lightList[o].configName
-                    minObj.configStatus = obj.mapList[i].lightList[o].configStatus
-                  }
+                  // if(obj.mapList[i].lightList[o].relayType == 1 || obj.mapList[i].lightList[o].relayType == 3){
+                  //   minObj.relayCode = obj.mapList[i].lightList[o].relayCode
+                  //   minObj.relayBit = obj.mapList[i].lightList[o].relayBit
+                  // }else if(obj.mapList[i].lightList[o].relayType == 2){
+                  //   minObj.configName = obj.mapList[i].lightList[o].configName
+                  //   minObj.configStatus = obj.mapList[i].lightList[o].configStatus
+                  // }
                   lightList.push(minObj);
                 }
               }
@@ -603,16 +607,16 @@
           this.$set(this,'dialogIndex',index)
           this.$set(this,'dialogMinIndex',minIndex)
           let obj = {
-            relayType:item.relayType?item.relayType:3,
+            configName:item.configName?item.configName:3,
             state:item.state?item.state:"",
           }
-          if(obj.relayType == 1 || obj.relayType == 3){
-            obj.relayCode = item.relayCode?item.relayCode:"";
-            obj.relayBit = item.relayBit?item.relayBit:"";
-          }else if(obj.relayType == 2){
-            obj.configName = item.configName?item.configName:"";
-            obj.configStatus = item.configStatus?item.configStatus:"";
-          }
+          // if(obj.relayType == 1 || obj.relayType == 3){
+          //   obj.relayCode = item.relayCode?item.relayCode:"";
+          //   obj.relayBit = item.relayBit?item.relayBit:"";
+          // }else if(obj.relayType == 2){
+          //   obj.configName = item.configName?item.configName:"";
+          //   obj.configStatus = item.configStatus?item.configStatus:"";
+          // }
           this.$set(this,'dialogForm',JSON.parse(JSON.stringify(obj)));
           //等待写
         }else if(item.type == 'door'){
@@ -676,15 +680,15 @@
                 this.$set(this.mapList[this.dialogIndex],'subName',self.dialogForm.roomType != '-99'?this.dialogForm.subName:"");
                 this.dialogOpen = false;
               }else if(this.dialogOpenType == 6){
-                this.$set(this.mapList[this.dialogIndex].lightList[this.dialogMinIndex],'relayType',this.dialogForm.relayType);
+                this.$set(this.mapList[this.dialogIndex].lightList[this.dialogMinIndex],'configName',this.dialogForm.configName);
                 this.$set(this.mapList[this.dialogIndex].lightList[this.dialogMinIndex],'state',this.dialogForm.state);
-                if(this.dialogForm.relayType == 1 || this.dialogForm.relayType == 3){
-                  this.$set(this.mapList[this.dialogIndex].lightList[this.dialogMinIndex],'relayCode',this.dialogForm.relayCode);
-                  this.$set(this.mapList[this.dialogIndex].lightList[this.dialogMinIndex],'relayBit',this.dialogForm.relayBit);
-                }else if(this.dialogForm.relayType == 2){
-                  this.$set(this.mapList[this.dialogIndex].lightList[this.dialogMinIndex],'configName',this.dialogForm.configName);
-                  this.$set(this.mapList[this.dialogIndex].lightList[this.dialogMinIndex],'configStatus',this.dialogForm.configStatus);
-                }
+                // if(this.dialogForm.relayType == 1 || this.dialogForm.relayType == 3){
+                //   this.$set(this.mapList[this.dialogIndex].lightList[this.dialogMinIndex],'relayCode',this.dialogForm.relayCode);
+                //   this.$set(this.mapList[this.dialogIndex].lightList[this.dialogMinIndex],'relayBit',this.dialogForm.relayBit);
+                // }else if(this.dialogForm.relayType == 2){
+                //   this.$set(this.mapList[this.dialogIndex].lightList[this.dialogMinIndex],'configName',this.dialogForm.configName);
+                //   this.$set(this.mapList[this.dialogIndex].lightList[this.dialogMinIndex],'configStatus',this.dialogForm.configStatus);
+                // }
                 this.dialogOpen = false;
               }
             }

+ 10 - 1
src/views/integratedManagement/personnelManage/post/index.vue

@@ -315,10 +315,19 @@ export default {
     },
     /** 提交按钮 */
     submitForm: function() {
+      let self = this;
       this.$refs["form"].validate(valid => {
         if (valid) {
           let obj = JSON.parse(JSON.stringify(this.form))
-          obj.roleIds = obj.roleIds+'';
+          let roleList = [];
+          obj.roleIds.forEach((item)=>{
+            self.optionselectList.forEach((minItem)=>{
+              if(item == minItem.roleId){
+                roleList.push(item);
+              }
+            })
+          })
+          obj.roleIds = roleList+'';
           if (this.form.postId != undefined) {
             systemPostUpdate(obj).then(response => {
               this.msgSuccess("修改成功");