Browse Source

fix: 平板的手动控制

chenzhen2 2 years ago
parent
commit
464c9e4b2d
2 changed files with 116 additions and 14 deletions
  1. 1 0
      src/styles/_variables.scss
  2. 115 14
      src/views/envmonitor/components/Air/manualIndex.vue

+ 1 - 0
src/styles/_variables.scss

@@ -25,6 +25,7 @@ $darkGray: #889aa4;
 $loginBg: #2d3a4b;
 $loginCursorColor: #fff;
 $elActiveColor: #CE9F27;
+$elDisabledColor: #C4C4C4;
 $elCircle: rgba(226, 208, 160, 1);
 $elBg: #F5F5F5;
 $elActive4: rgba(206, 159, 39, 0.4);

+ 115 - 14
src/views/envmonitor/components/Air/manualIndex.vue

@@ -60,10 +60,18 @@
             <div class="text">风量调节</div>
           </div>
           <div class="volume-icon">
-            <div class="icon-item" @click="changeZongAir('gear', 'windLow')">
+            <div
+              class="icon-item"
+              :style="{ opacity: airData.gear <= 1 ? '0.6' : 1 }"
+              @click="changeZongAir('gear', 'windLow')"
+            >
               <img :src="parseImgUrl('ipdImages', 'wind_small.png')" />
             </div>
-            <div class="icon-item" @click="changeZongAir('gear', 'windUp')">
+            <div
+              class="icon-item"
+              :style="{ opacity: airData.gear >= 3 ? '0.6' : 1 }"
+              @click="changeZongAir('gear', 'windUp')"
+            >
               <img :src="parseImgUrl('ipdImages', 'wind_big.png')" />
             </div>
             <div
@@ -145,6 +153,8 @@
         <div class="open-title">
           <span>{{ childItem.localName }}</span>
           <Switch
+            @click="airChange"
+            :model-value="childItem.isOpen"
             class="child-switch"
             inactive-color="rgba(196, 196, 196, 0.4)"
             size="25px"
@@ -154,21 +164,46 @@
           <div class="adjust-item">
             <van-icon
               name="arrow-up"
-              @click="changeItemAir('temp', childItem)"
+              :class="
+                childItem.tempSet <= airData.minTempSet ? 'disable-color' : ''
+              "
+              @click="changeChildItemAir('temp', childItem, 'down')"
               class="adjust-icon"
             />
             <span class="adjust-text">{{ childItem.tempSet }}</span>
-            <van-icon name="arrow-down" class="adjust-icon" />
+            <van-icon
+              name="arrow-down"
+              :class="
+                childItem.tempSet >= airData.maxTempSet ? 'disable-color' : ''
+              "
+              @click="changeChildItemAir('temp', childItem, 'up')"
+              class="adjust-icon"
+            />
             <span class="adjust-title">温度</span>
           </div>
           <div class="adjust-item">
-            <van-icon name="arrow-up" class="adjust-icon" />
+            <van-icon
+              name="arrow-up"
+              :class="childItem.gear <= 1 ? 'disable-color' : ''"
+              @click="changeChildItemAir('gear', childItem, 'down')"
+              class="adjust-icon"
+            />
             <span class="adjust-text">{{ childItem.gear }}</span>
-            <van-icon name="arrow-down" class="adjust-icon" />
+            <van-icon
+              name="arrow-down"
+              :class="childItem.gear >= 3 ? 'disable-color' : ''"
+              @click="changeChildItemAir('gear', childItem, 'up')"
+              class="adjust-icon"
+            />
             <span class="adjust-title">档位</span>
           </div>
           <div class="adjust-item">
-            <van-icon name="arrow-up" class="adjust-icon" />
+            <van-icon
+              name="arrow-up"
+              :class="childItem.workMode <= 1 ? 'disable-color' : ''"
+              @click="changeChildItemAir('model', childItem, 'down')"
+              class="adjust-icon"
+            />
             <span class="adjust-text">
               {{
                 childItem.workMode == 1
@@ -178,7 +213,12 @@
                   : "通风"
               }}
             </span>
-            <van-icon name="arrow-down" class="adjust-icon" />
+            <van-icon
+              name="arrow-down"
+              :class="childItem.workMode >= 3 ? 'disable-color' : ''"
+              @click="changeChildItemAir('model', childItem, 'up')"
+              class="adjust-icon"
+            />
             <span class="adjust-title">模式</span>
           </div>
         </div>
@@ -458,21 +498,72 @@ export default defineComponent({
         proxyData.cotrolLoading = false;
       },
       // 子设备降低温度
-      changeItemAir(btnType: any, childItem: any) {
+      changeChildItemAir(btnType: any, childItem: any, symbol: any) {
         proxyData.loadingStart();
+        let arr: any = [];
         if (btnType === "temp") {
-          if (childItem.tempSet <= proxyData.airData.minTempSet) {
+          if (
+            childItem.tempSet <= proxyData.airData.minTempSet ||
+            childItem.tempSet >= proxyData.airData.maxTempSet
+          ) {
             return;
           }
-          childItem.tempSet = childItem.tempSet - 0.5;
+          if (symbol === "up") {
+            childItem.tempSet = childItem.tempSet + 0.5;
+          } else if (symbol === "down") {
+            childItem.tempSet = childItem.tempSet - 0.5;
+          }
+
           let obj: any = {
             id: childItem.id, //类型:String  必有字段  备注:设备id
             code: childItem.tempSetCode, //类型:String  必有字段  备注:编码 EquipSwtichSet
             value: childItem.tempSet, //类型:String  必有字段  备注:值 0
           };
+          arr.push(obj);
+        } else if (btnType === "gear") {
+          if (symbol === "up") {
+            if (childItem.gear >= 3) {
+              return;
+            }
+            childItem.gear++;
+          } else if (symbol === "down") {
+            if (childItem.gear <= 1) {
+              return;
+            }
+            childItem.gear--;
+          }
+          let obj: any = {
+            id: childItem.id, //类型:String  必有字段  备注:设备id
+            code: childItem.gearCode, //类型:String  必有字段  备注:编码 EquipSwtichSet
+            value: childItem.gear, //类型:String  必有字段  备注:值 0
+          };
+          arr.push(obj);
+        } else if (btnType === "model") {
+          if (symbol === "up") {
+            if (childItem.workMode >= 3) {
+              return;
+            }
+            childItem.workMode++;
+          } else if (symbol === "down") {
+            if (childItem.workMode <= 1) {
+              return;
+            }
+            childItem.workMode--;
+          }
+          let obj: any = {
+            id: childItem.id, //类型:String  必有字段  备注:设备id
+            code: childItem.modeSetCode, //类型:String  必有字段  备注:编码 EquipSwtichSet
+            value: childItem.workMode, //类型:String  必有字段  备注:值 0
+          };
+          arr.push(obj);
         }
-        if (!proxyData.cotrolLoading) {
-        }
+        console.log("====");
+        console.log(arr);
+
+        // if (!proxyData.cotrolLoading) {
+        //   console.log("====")
+        //   console.log(arr)
+        // }
       },
       // 改变设备状态
       setSpaceCondtioners(data: any) {
@@ -529,7 +620,12 @@ export default defineComponent({
         // 设备状态处理
         proxyData.setSpaceCondtioners(data);
       },
-
+      // 设置子设备的状态
+      formateSetChildStatus() {
+        proxyData.equipList.map((item: any) => {
+          item.isOpen = item.runStatus === 1 ? true : false;
+        });
+      },
       // 空调信息airTemp
       getAirInfo() {
         const paramObj = {
@@ -553,6 +649,8 @@ export default defineComponent({
             proxyData.airData.gear = data.gear;
             proxyData.airData.workMode = data.workMode;
             proxyData.equipList = data.equipList;
+            // 设置子设备的状态
+            proxyData.formateSetChildStatus();
             // 设置当前温度的位置
             proxyData.setBarNowPerstion();
             if (proxyData.airData.isOpen) {
@@ -690,6 +788,9 @@ export default defineComponent({
           padding-top: 10px;
           font-size: 18px;
         }
+        .disable-color {
+          color: $elDisabledColor;
+        }
       }
     }
   }