dedsudiyu 10 months ago
parent
commit
1a79a4416e
1 changed files with 125 additions and 22 deletions
  1. 125 22
      src/views/emergencyManagement/performEvacuation/performEvacuationData.vue

+ 125 - 22
src/views/emergencyManagement/performEvacuation/performEvacuationData.vue

@@ -38,27 +38,21 @@
               </div>
             </div>
             <!--空调-->
-            <div class="controls-for-box" v-for="(item,index) in controlsList" :key="index" v-if="item.hardwareTypeKey == 'airConditioner'">
+            <div class="controls-for-box-one" 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 class="for-title-button-box" @click="dialogOpen(item)">操作</div>
               </div>
               <!--空调-->
               <div class="for-button-box">
+                <p :class="item.switchType==1?'colorOpen':'colorOff'">{{item.switchType == 1?'开启':(item.switchType == 0?'关闭':'')}}</p>
+                <p :class="item.switchType==1?'colorOpen':'colorOff'" v-for="(minItem,minIndex) in infraredControllerData.functionList"
+                   :key="minItem.value" v-if="minItem.value == item.functionType">{{minItem.label}}</p>
+                <p :class="item.switchType==1?'colorOpen':'colorOff'" v-for="(minItem,minIndex) in infraredControllerData.orderList"
+                   :key="minItem.value" v-if="minItem.value == item.orderType">{{minItem.label}}</p>
               </div>
             </div>
             <div class="null-box" v-if="!controlsList[0]">
@@ -433,6 +427,7 @@
     laboratoryExitRelayCloseLight,laboratoryPlanCloseRiskPlan } from "@/api/emergencyManagement/index";
   import { laboratoryBigViewSelectTriggerInfo } from "@/api/commonality/permission";
   import mpegtsVideo from '@/components/mpegtsVideo/mpegtsVideo.vue'
+  import { iotHardwareOperatingHardware } from '@/api/commonality/permission'
   export default {
     name: 'performEvacuationData',
     components: {
@@ -523,13 +518,14 @@
         planOpic:'lab/risk/plan/change',
         planClient:{},
         /****************** 红外控制器相关 ******************/
-        infraredControllerType:true,
+        infraredControllerType:false,
         infraredControllerTitle:"",
         infraredControllerForm:{
-          name:'空调控制器空调控制器空调控制器空调控制器空调控制器空调控制器',//设备名称
-          switchType:1,//0.关 1.开
-          functionType:'1', //1.制冷 2.制热 3.通风
-          orderType:18, //温度指令
+          name:null,//设备名称
+          switchType:null,//0.关 1.开
+          functionType:null, //1.制冷 2.制热 3.通风
+          orderType:null, //温度指令
+          hardwareNo:null, //设备编号
         },
         infraredControllerData:{
           functionList:[
@@ -1003,6 +999,18 @@
         iotBigViewHardwareFindByType({subjectId:this.checkSubId}).then(response => {
           response.data.forEach((item)=>{
             item.exceptionIcon = item.exceptionIcon?window.location.href.split('://')[0]+'://'+localStorage.getItem('fileBrowseEnvironment')+item.exceptionIcon:null;
+            if(item.hardwareTypeKey == 'airConditioner'){
+              if(item.reservedThree.indexOf('-') != -1){
+                let list = item.reservedThree.split('-');
+                item.switchType = list[0]?list[0]:'';
+                item.functionType = list[1]?list[1]:'';
+                item.orderType = list[2]?list[2]:'';
+              }else{
+                item.switchType = '';
+                item.functionType = '';
+                item.orderType = '';
+              }
+            }
           })
           this.$set(this,'controlsList',response.data);
         })
@@ -1568,7 +1576,14 @@
             let list = JSON.parse(JSON.stringify(this.controlsList))
             list.forEach((item)=>{
               if(item.hardwareNo == data.hardwareNo){
-                item.operatingState = data.operatingState;
+                if(item.hardwareTypeKey == 'airConditioner'){
+                  let list = data.command.split('-');
+                  item.switchType = list[0]?list[0]:'';
+                  item.functionType = list[1]?list[1]:'';
+                  item.orderType = list[2]?list[2]:'';
+                }else{
+                  item.operatingState = data.operatingState;
+                }
               }
             })
             this.$set(this,'controlsList',list);
@@ -1758,9 +1773,19 @@
         this.$set(this,'infraredControllerType',false);
       },
       //弹层开启
-      dialogOpen(){
-        this.dialogFormReset();
+      dialogOpen(item){
+        if(!controlsRestrictVerify('performEvacuation')){
+          this.msgError('没有相关操作权限,请联系管理员')
+          return
+        }
         this.$set(this,'infraredControllerTitle','空调控制');
+        this.$set(this,'infraredControllerForm',{
+          name:item.hardwareName,
+          switchType:parseInt(item.switchType),
+          functionType:item.switchType == 0 ? 1 : parseInt(item.functionType),
+          orderType:item.switchType == 1 && item.functionType !=3 ? parseInt(item.orderType):18,
+          hardwareNo:item.hardwareNo,
+        });
         this.$set(this,'infraredControllerType',true);
       },
       dialogSubmit(){
@@ -1774,7 +1799,16 @@
         }else if(this.infraredControllerForm.switchType == 0){
           text = '0';
         }
-        console.log('text',text)
+        let switchData = {
+          hardwareNo:this.infraredControllerForm.hardwareNo,
+          command:text
+        };
+        iotHardwareOperatingHardware(switchData).then(response => {
+          if(response.code==200){
+            this.msgSuccess("操作成功")
+            this.$set(this,'infraredControllerType',false);
+          }
+        });
       },
       //开关切换
       switchTypeButton(){
@@ -1915,6 +1949,75 @@
                 }
               }
             }
+            .controls-for-box-one{
+              padding:6px 0;
+              border-top:1px dashed #24D1F9;
+              .for-title-box{
+                display: flex;
+                .for-title-img-box{
+                  width:53px;
+                  height:53px;
+                  //栅格布局居中
+                  display: grid;
+                  align-items: center;
+                  justify-items: center;
+                  overflow: hidden;
+                  background: url("../../../assets/ZDimages/emergencyManagement/img_znkz_bg.png");
+                  .svg-img{
+                    display: block;
+                    width:28px;
+                    height:28px;
+                    color:#24D1F9;
+                  }
+                }
+                .for-title-name-box{
+                  font-size:20px;
+                  color:#24D1F9;
+                  line-height:53px;
+                  /*单行省略号*/
+                  display:block;
+                  overflow:hidden;
+                  text-overflow:ellipsis;
+                  white-space:nowrap;
+                  flex:1;
+                  margin:0 28px;
+                }
+                .for-title-button-box{
+                  width:72px;
+                  height:32px;
+                  color:#24d1f9;
+                  border:1px solid #24d1f9;
+                  border-radius:20px;
+                  text-align: center;
+                  line-height:30px;
+                  cursor: pointer;
+                  margin:7px;
+                  font-size:14px;
+                }
+              }
+              .for-button-box{
+                margin-top:10px;
+                display: flex;
+                padding-left:22px;
+                p{
+                  width:100px;
+                  font-size:14px;
+                  height:30px;
+                  line-height:30px;
+                  margin-right:10px;
+                  border-radius:4px;
+                  text-align: center;
+                }
+                .colorOpen{
+                  color: #24D1F9;
+                  border:1px solid #24D1F9;
+                }
+                .colorOff{
+                  color: #999;
+                  border:1px solid #999;
+                }
+              }
+            }
             .null-box{
               position: absolute;
               left:50%;