Selaa lähdekoodia

fix:手动控制功能修改

chenzhen2 1 vuosi sitten
vanhempi
commit
9e4c69815f

+ 3 - 3
src/views/envmonitor/components/Air/ChildAirControl.vue

@@ -2,7 +2,7 @@
   <div class="air">
     <div class="child-title">{{ airData.localName }}</div>
     <div class="child-box">
-      <div class="air-control">
+      <div class="air-control" v-if="airData.boundPoint && airData.boundPoint.tempSetBound" >
         <div class="air-title">
           <div>温度设定</div>
           <div></div>
@@ -25,7 +25,7 @@
           </div>
         </div>
       </div>
-      <div class="air-control">
+      <div class="air-control" v-if="airData.boundPoint && airData.boundPoint.gearSetBound">
         <div class="air-title">
           <div>风速</div>
           <div></div>
@@ -79,7 +79,7 @@
           </div>
         </div>
       </div>
-      <div class="air-control">
+      <div class="air-control" v-if="airData.boundPoint && airData.boundPoint.modeSetBound">
         <div class="air-title">
           <div>模式</div>
           <div></div>

+ 160 - 148
src/views/envmonitor/components/Air/manualIndex.vue

@@ -41,134 +41,137 @@
       <div v-else></div>
       <Switch
         class="switch-btn"
-        v-if="navType == 'all'"
+        v-if="navType == 'all' && airData.boundPoint && airData.boundPoint.switchSetBound "
         :size="23"
         inactive-color="rgba(196, 196, 196, 0.4)"
         @click="airChange"
         :model-value="airData.isOpen"
-      />
+        />
     </div>
-    <div class="line" v-if="airData.isOpen"></div>
+    
     <!--温度调节的box-->
-    <div class="main-temp" v-if="navType == 'all' && airData.isOpen">
-      <div class="com-control com-control-padding">
-        <div class="temp-slider" id="sliderId">
-          <div class="slider-bar" id="barId">
-            <div class="bar-temp">{{ realTemp }}℃</div>
-            <div
-              class="bar-circle"
-              style="border: 2px solid rgba(255, 255, 255, 1)"
-              id="handId"
-            ></div>
-          </div>
-          <div class="temp-left" id="tempManualLeftId">
-            {{ airData.minTempSet }}
-          </div>
-          <div class="temp-right">
-            {{ airData.maxTempSet }}
-          </div>
-        </div>
-      </div>
-      <div class="com-control">
-        <div class="control-box">
-          <div class="volume-box">
-            <div class="number">
-              <span
-                v-for="(item, index) in windGearArr"
-                :class="airData.gear === item ? 'number-active' : ''"
-                :key="'volume' + index"
-                >{{ item }}</span
-              >
-            </div>
-            <div class="text">风量调节</div>
-          </div>
-          <div class="volume-icon">
-            <div
-              class="icon-item"
-              :style="{
-                opacity: airData.gear <= 1 ? '0.6' : 1,
-              }"
-              @click="changeZongAir('gear', 'windLow')"
-            >
-              <img :src="parseImgUrl('ipdImages', 'wind_small.svg')" />
-            </div>
-            <div
-              class="icon-item"
-              :style="{ opacity: airData.gear >= 3 ? '0.6' : 1 }"
-              @click="changeZongAir('gear', 'windUp')"
-            >
-              <img :src="parseImgUrl('ipdImages', 'wind_big.svg')" />
-            </div>
-            <div
-              class="icon-item"
-              @click="changeZongAir('gear', 'auto')"
-              :class="airData.isAutoGear ? 'active-color' : ''"
-            >
-              <img :src="parseImgUrl('ipdImages', 'A.svg')" />
+    <template v-if="airData.boundPoint && (airData.boundPoint.tempSetBound || airData.boundPoint.gearSetBound || airData.boundPoint.modeSetBound)">
+      <div class="line" v-if="airData.isOpen"></div>
+      <div class="main-temp" v-if="navType == 'all' && airData.isOpen">
+          <div class="com-control com-control-padding" v-if="airData.boundPoint && airData.boundPoint.tempSetBound" >
+            <div class="temp-slider" id="sliderId">
+              <div class="slider-bar" id="barId">
+                <div class="bar-temp">{{ realTemp }}℃</div>
+                <div
+                  class="bar-circle"
+                  style="border: 2px solid rgba(255, 255, 255, 1)"
+                  id="handId"
+                ></div>
+              </div>
+              <div class="temp-left" id="tempManualLeftId">
+                {{ airData.minTempSet }}
+              </div>
+              <div class="temp-right">
+                {{ airData.maxTempSet }}
+              </div>
             </div>
           </div>
-        </div>
-      </div>
-      <div class="com-control">
-        <div class="control-box">
-          <div class="volume-box">
-            <div class="model">
-              {{
-                airData.workMode == 1
-                  ? "制冷"
-                  : airData.workMode == 2
-                  ? "制热"
-                  : "通风"
-              }}
+          <div class="com-control" v-if="airData.boundPoint && airData.boundPoint.gearSetBound">
+            <div class="control-box">
+              <div class="volume-box">
+                <div class="number">
+                  <span
+                    v-for="(item, index) in windGearArr"
+                    :class="airData.gear === item ? 'number-active' : ''"
+                    :key="'volume' + index"
+                    >{{ item }}</span
+                  >
+                </div>
+                <div class="text">风量调节</div>
+              </div>
+              <div class="volume-icon">
+                <div
+                  class="icon-item"
+                  :style="{
+                    opacity: airData.gear <= 1 ? '0.6' : 1,
+                  }"
+                  @click="changeZongAir('gear', 'windLow')"
+                >
+                  <img :src="parseImgUrl('ipdImages', 'wind_small.svg')" />
+                </div>
+                <div
+                  class="icon-item"
+                  :style="{ opacity: airData.gear >= 3 ? '0.6' : 1 }"
+                  @click="changeZongAir('gear', 'windUp')"
+                >
+                  <img :src="parseImgUrl('ipdImages', 'wind_big.svg')" />
+                </div>
+                <div
+                  class="icon-item"
+                  @click="changeZongAir('gear', 'auto')"
+                  :class="airData.isAutoGear ? 'active-color' : ''"
+                >
+                  <img :src="parseImgUrl('ipdImages', 'A.svg')" />
+                </div>
+              </div>
             </div>
-            <div class="text">模式设定</div>
           </div>
-          <div class="volume-icon">
-            <div
-              class="icon-item"
-              :class="airData.workMode === 1 ? 'active-color' : ''"
-              @click="changeZongAir('mode', 1)"
-            >
-              <img
-                :src="
-                  airData.workMode === 1
-                    ? parseImgUrl('ipdImages', 'aircoldblue.svg')
-                    : parseImgUrl('ipdImages', 'aircoldblack.svg')
-                "
-              />
-            </div>
-            <div
-              class="icon-item"
-              :class="airData.workMode === 2 ? 'active-color' : ''"
-              @click="changeZongAir('mode', 2)"
-            >
-              <img
-                :src="
-                  airData.workMode === 2
-                    ? parseImgUrl('ipdImages', 'airsunred.svg')
-                    : parseImgUrl('ipdImages', 'airsunblack.svg')
-                "
-              />
-            </div>
+          <div class="com-control" v-if="airData.boundPoint && airData.boundPoint.modeSetBound">
+            <div class="control-box">
+              <div class="volume-box">
+                <div class="model">
+                  {{
+                    airData.workMode == 1
+                      ? "制冷"
+                      : airData.workMode == 2
+                      ? "制热"
+                      : "通风"
+                  }}
+                </div>
+                <div class="text">模式设定</div>
+              </div>
+              <div class="volume-icon">
+                <div
+                  class="icon-item"
+                  :class="airData.workMode === 1 ? 'active-color' : ''"
+                  @click="changeZongAir('mode', 1)"
+                >
+                  <img
+                    :src="
+                      airData.workMode === 1
+                        ? parseImgUrl('ipdImages', 'aircoldblue.svg')
+                        : parseImgUrl('ipdImages', 'aircoldblack.svg')
+                    "
+                  />
+                </div>
+                <div
+                  class="icon-item"
+                  :class="airData.workMode === 2 ? 'active-color' : ''"
+                  @click="changeZongAir('mode', 2)"
+                >
+                  <img
+                    :src="
+                      airData.workMode === 2
+                        ? parseImgUrl('ipdImages', 'airsunred.svg')
+                        : parseImgUrl('ipdImages', 'airsunblack.svg')
+                    "
+                  />
+                </div>
 
-            <div
-              class="icon-item"
-              :class="airData.workMode === 3 ? 'active-color' : ''"
-              @click="changeZongAir('mode', 3)"
-            >
-              <img
-                :src="
-                  airData.workMode === 3
-                    ? parseImgUrl('ipdImages', 'aircloudgreen.svg')
-                    : parseImgUrl('ipdImages', 'aircloudblack.svg')
-                "
-              />
+                <div
+                  class="icon-item"
+                  :class="airData.workMode === 3 ? 'active-color' : ''"
+                  @click="changeZongAir('mode', 3)"
+                >
+                  <img
+                    :src="
+                      airData.workMode === 3
+                        ? parseImgUrl('ipdImages', 'aircloudgreen.svg')
+                        : parseImgUrl('ipdImages', 'aircloudblack.svg')
+                    "
+                  />
+                </div>
+              </div>
             </div>
           </div>
-        </div>
       </div>
-    </div>
-
+    </template>
+    
     <!--子设备-->
     <div class="air-child" v-if="navType == 'child'">
       <div
@@ -179,8 +182,9 @@
       >
         <div class="open-title">
           <div class="open-temp-box">
-            <span>{{ childItem.tempSet }}<sup>°C</sup></span>
-            <div class="text-box" v-if="childItem.workMode == 2">
+            <span>{{ childItem.tempSet? childItem.tempSet:'--' }}<sup>°C</sup></span>
+            <template v-if="childItem.boundPoint && childItem.boundPoint.modeSetBound">
+              <div class="text-box" v-if="childItem.workMode == 2">
               <img :src="parseImgUrl('ipdImages', 'hot-small.svg')" alt="" />
               <span>制热模式</span>
             </div>
@@ -195,8 +199,11 @@
               />
               <span>通风模式</span>
             </div>
+            </template>
+            
           </div>
           <Switch
+            v-if="childItem.boundPoint && childItem.boundPoint.switchSetBound"
             @click.stop="changeChildItemAir('switch', childItem, 'switch')"
             :model-value="childItem.isOpen"
             class="child-switch"
@@ -209,6 +216,7 @@
             {{ childItem.localName }}
           </div>
           <img
+           v-if="childItem.boundPoint && (childItem.boundPoint.tempSetBound || childItem.boundPoint.gearSetBound || childItem.boundPoint.modeSetBound)"
             :class="childItem.isOpen ? '' : 'img-disabled'"
             :src="lightColorImg"
             alt=""
@@ -230,7 +238,7 @@ import {
   onUnmounted,
   onBeforeMount,
   onBeforeUnmount,
-  nextTick,
+  nextTick
 } from "vue";
 import { Switch, Dialog, Toast } from "vant";
 import { swiper } from "@/utils/swiper";
@@ -243,7 +251,7 @@ export default defineComponent({
     temperature: {
       // 空调基本信息
       type: Number,
-      default: () => 0,
+      default: () => 0
     },
     // hasAir: {
     //   // 有无空调
@@ -253,33 +261,33 @@ export default defineComponent({
     airVolumes: {
       // 风量信息
       type: Array,
-      default: () => [],
+      default: () => []
     },
     projectId: {
       type: String,
-      default: () => "",
+      default: () => ""
     },
     spaceId: {
       type: String,
-      default: () => "",
+      default: () => ""
     },
     userIsControl: {
       type: Boolean,
-      default: () => false,
+      default: () => false
     },
     forceOverTimeFlag: {
       type: Boolean,
-      default: () => false,
+      default: () => false
     },
     seviceEquipmentList: {
       // 是否走服务定制的设备
       type: Array,
-      default: () => [],
-    },
+      default: () => []
+    }
   },
   components: {
     Switch,
-    [Dialog.Component.name]: Dialog.Component,
+    [Dialog.Component.name]: Dialog.Component
   },
   setup(props, contx) {
     const propsVal = props;
@@ -295,8 +303,9 @@ export default defineComponent({
       isAutoGear: 0,
       workMode: 0, //1=cold(制冷);2=hot(制热);3=wind(通风)
       gear: 0, //  风量
+      boundPoint: {}, // 开关 档位 温度 模式点位
       isOpen: false, // 空调开关 true 是开
-      runStatus: 0, // 查询设备的真实状态
+      runStatus: 0 // 查询设备的真实状态
     };
     const feedbackTimer: any = null;
     const airTimer: any = null;
@@ -344,7 +353,7 @@ export default defineComponent({
         remark: [],
         nowImg: "",
         toWhere: "",
-        designTemperature: 0,
+        designTemperature: 0
       },
       checkNav(type: any = "all") {
         proxyData.navType = type;
@@ -458,19 +467,19 @@ export default defineComponent({
         if (!handBox) {
           return;
         }
-        handBox.addEventListener("touchstart", function (e: any) {
+        handBox.addEventListener("touchstart", function(e: any) {
           barLeft = isNaN(parseInt(barBox.style.left))
             ? 0
             : parseInt(barBox.style.left);
           isMove = true;
         });
-        handBox.addEventListener("touchend", function (e: any) {
+        handBox.addEventListener("touchend", function(e: any) {
           isMove = false;
           proxyData.changeZongAir("temp", proxyData.realTemp);
           proxyData.airTemp = proxyData.realTemp;
         });
         swiper(handBox, {
-          swipeLeft: function (e: any) {
+          swipeLeft: function(e: any) {
             if (isMove) {
               barLeft = Math.abs(barLeft);
               let moveRealX: any = Math.abs(e.mation.moveX - e.mation.startX);
@@ -481,7 +490,7 @@ export default defineComponent({
               proxyData.realTemp = Math.round(proxyData.realTemp);
             }
           },
-          swipeRight: function (e: any) {
+          swipeRight: function(e: any) {
             if (isMove) {
               barLeft = Math.abs(barLeft);
               let moveRealX: any = Math.abs(e.mation.moveX - e.mation.startX);
@@ -491,7 +500,7 @@ export default defineComponent({
               proxyData.realTemp = Math.round(proxyData.realTemp);
               barBox.style.left = left + proxyData.sliderPading + "px";
             }
-          },
+          }
         });
       },
       // 定时获取空调状态
@@ -507,7 +516,8 @@ export default defineComponent({
           proxyData.airTimer = null;
         }
         proxyData.airTimer = setTimeout(() => {
-          if (!proxyData.distroyFlag) {  // 销毁是同事销毁http请求
+          if (!proxyData.distroyFlag) {
+            // 销毁是同事销毁http请求
             if (!proxyData.loadingNum) {
               proxyData.getAirInfo();
             }
@@ -628,7 +638,7 @@ export default defineComponent({
       changeChildItemAir(btnType: any, childItem: any, symbol: any) {
         const domAirOpen = !childItem.isOpen;
         let isExeSpaceTime: Boolean = proxyData.checkDeviceIsExeSpaceTime([
-          childItem,
+          childItem
         ]);
         if (
           proxyData.forceOverTimeFlag &&
@@ -653,7 +663,7 @@ export default defineComponent({
           let obj: any = {
             id: childItem.id, //类型:String  必有字段  备注:设备id
             code: childItem.switchCode, //类型:String  必有字段  备注:编码 EquipSwtichSet
-            value: childItem.isOpen ? "1" : "0", //类型:String  必有字段  备注:值 0
+            value: childItem.isOpen ? "1" : "0" //类型:String  必有字段  备注:值 0
           };
           arr.push(obj);
         } else if (btnType === "temp") {
@@ -672,7 +682,7 @@ export default defineComponent({
           let obj: any = {
             id: childItem.id, //类型:String  必有字段  备注:设备id
             code: childItem.tempSetCode, //类型:String  必有字段  备注:编码 EquipSwtichSet
-            value: childItem.tempSet, //类型:String  必有字段  备注:值 0
+            value: childItem.tempSet //类型:String  必有字段  备注:值 0
           };
           arr.push(obj);
           proxyData.childDisabled(childItem, arr);
@@ -701,7 +711,7 @@ export default defineComponent({
           let obj: any = {
             id: childItem.id, //类型:String  必有字段  备注:设备id
             code: childItem.gearCode, //类型:String  必有字段  备注:编码 EquipSwtichSet
-            value: childItem.isAutoGear ? 4 : childItem.gear, //类型:String  必有字段  备注:值 0
+            value: childItem.isAutoGear ? 4 : childItem.gear //类型:String  必有字段  备注:值 0
           };
           arr.push(obj);
         } else if (btnType === "model") {
@@ -719,7 +729,7 @@ export default defineComponent({
           let obj: any = {
             id: childItem.id, //类型:String  必有字段  备注:设备id
             code: childItem.modeSetCode, //类型:String  必有字段  备注:编码 EquipSwtichSet
-            value: childItem.workMode, //类型:String  必有字段  备注:值 0
+            value: childItem.workMode //类型:String  必有字段  备注:值 0
           };
           arr.push(obj);
         }
@@ -733,7 +743,7 @@ export default defineComponent({
       // 改变设备状态
       setSpaceCondtioners(data: any) {
         setSpaceCondtioners(data)
-          .then((res) => {
+          .then(res => {
             // proxyData.setLoadingNumber();
             proxyData.loadinngEnd();
           })
@@ -753,7 +763,7 @@ export default defineComponent({
           let obj: any = {
             id: item.id, //类型:String  必有字段  备注:设备id
             code: item[equpObj.codeKey], //类型:String  必有字段  备注:编码 EquipSwtichSet
-            value: equpObj.value, //类型:String  必有字段  备注:值 0
+            value: equpObj.value //类型:String  必有字段  备注:值 0
           };
           data.push(obj);
         });
@@ -857,7 +867,7 @@ export default defineComponent({
           let obj: any = {
             id: item.id, //类型:String  必有字段  备注:设备id
             code: item.switchCode, //类型:String  必有字段  备注:编码 EquipSwtichSet
-            value: proxyData.airData.isOpen ? "1" : "0", //类型:String  必有字段  备注:值 0
+            value: proxyData.airData.isOpen ? "1" : "0" //类型:String  必有字段  备注:值 0
           };
           data.push(obj);
         });
@@ -868,6 +878,7 @@ export default defineComponent({
       formateSetChildStatus() {
         proxyData.equipList.map((item: any) => {
           item.isOpen = item.runStatus === 1 ? true : false;
+          item.boundPoint = item.boundPoint || {};
         });
       },
       // 初始化滚动
@@ -951,13 +962,13 @@ export default defineComponent({
       // 空调信息airTemp的修改
       getAirInfo(isAddTimer: any = 0) {
         const paramObj = {
-          spaceId: proxyData.spaceId,
+          spaceId: proxyData.spaceId
           // spaceId: props.spaceId,//'Sp110108025564f438d7fef64eea8202a6462f1bbcce' 空间id
         };
         //wx.showLoading();
         let str: any = setQueryConfig(paramObj);
         querySpaceConditioners(str)
-          .then((res) => {
+          .then(res => {
             let data: any = res.data || {};
             proxyData.firstLoadingAir = false;
             proxyData.loadingAir = false;
@@ -969,6 +980,7 @@ export default defineComponent({
             proxyData.airData.isAutoGear = data.isAutoGear;
             proxyData.airData.gear = data.gear || 0;
             proxyData.airData.workMode = data.workMode;
+            proxyData.airData.boundPoint = data.boundPoint || {};
             proxyData.equipList = data.equipList;
             // proxyData.equipList.push(data.equipList[0]);
             // 设置子设备的状态
@@ -986,7 +998,7 @@ export default defineComponent({
               proxyData.getAirInfoToTimer();
             }
           });
-      },
+      }
     });
     watch(
       [() => props, () => props.spaceId],
@@ -1006,7 +1018,7 @@ export default defineComponent({
       },
       {
         deep: true,
-        immediate: true,
+        immediate: true
       }
     );
     onBeforeUnmount(() => {
@@ -1024,9 +1036,9 @@ export default defineComponent({
       // 获取空调信息
     });
     return {
-      ...toRefs(proxyData),
+      ...toRefs(proxyData)
     };
-  },
+  }
 });
 </script>
 <style lang="scss" scoped>