Procházet zdrojové kódy

fix:窗帘暂停功能

chenzhen2 před 1 rokem
rodič
revize
0ab0bfa159

+ 3 - 3
src/apis/envmonitor.ts

@@ -63,7 +63,7 @@ export const getStatusHttp = (data: any) => {
 
 // 获取窗帘数据列表
 export const getObjectDataEqpGroupHttp = (params: any) => {
-  return https().request<RootObject<any>>(`${duoduoenvService}object/objectDataEqpGroup/query`, Method.POST, params, ContentType.json)
+  return https().request<RootObject<any>>(`${testApi}object/objectDataEqpGroup/query`, Method.POST, params, ContentType.json)
 }
 
 // 切换场景
@@ -278,8 +278,8 @@ export const querySpaceConditioners = (params: any) => {
  * 设备手动控制
  */
 export const setSpaceCondtioners = (data: any) => {
-  return post(`${duoduoenvService}ctrl/set`, data)
-  // return post(`${testApi}ctrl/set`, data)
+  // return post(`${duoduoenvService}ctrl/set`, data)
+  return post(`${testApi}ctrl/set`, data)
 }
 
 // 地图数据保存

+ 3 - 0
src/styles/comMedia.scss

@@ -91,4 +91,7 @@
   .main-right {
     width: 330px !important;
   }
+  .popup-content-small{
+    width: 375px !important;
+  }
 }

+ 7 - 0
src/styles/index.scss

@@ -180,6 +180,13 @@ div:focus {
   padding: 2.33vh 15px;
 }
 
+.popup-content-small {
+  height: 100%;
+  width: 450px;
+  // padding: 10px 15px;
+  padding: 2.33vh 15px;
+}
+
 .van-switch--on {
   background: $elActiveColor !important;
 }

+ 3 - 1
src/views/envmonitor/components/Curtain/CurtainOpening.vue

@@ -5,7 +5,7 @@
     </div>
     <div class="bright-box">
       <div class="bight-text">
-        <span>度</span>
+        <span>度</span>
         <span class="line"></span>
         <span>20%</span>
       </div>
@@ -124,6 +124,7 @@ export default defineComponent({
               left = left < 0 ? 0 : left;
               // debugger
               handBox.style.left = left + "px";
+              proxyData.itemWidth = left + barWidth / 2 + "px";
             }
           },
           swipeRight: function (e: any) {
@@ -135,6 +136,7 @@ export default defineComponent({
               left =
                 left >= sliderWidth - barWidth ? sliderWidth - barWidth : left;
               handBox.style.left = left + "px";
+              proxyData.itemWidth = left + barWidth / 2 + "px";
             }
           },
         });

+ 133 - 78
src/views/envmonitor/components/Curtain/index.vue

@@ -13,20 +13,23 @@
       <div class="curtain-right">
         <img
           v-if="
-            curtainData[0].equipmentType == 4 ||
-            curtainData[0].equipmentType == 5
+            curtainData[0].equipmentType !== 4 &&
+            curtainData[0].equipmentType !== 5
           "
-          :src="parseImgUrl('page-officehome', 'curtain_roll.svg')"
+          :src="parseImgUrl('page-officehome', 'curtain_new.svg')"
           alt=""
         />
         <img
           v-else
-          :src="parseImgUrl('page-officehome', 'curtain_new.svg')"
+          :src="parseImgUrl('page-officehome', 'curtain_roll.svg')"
           alt=""
         />
       </div>
     </div>
-    <div class="curtain-box">
+    <div
+      class="curtain-box"
+      v-if="curtainData.length && curtainData.length > 1"
+    >
       <div class="top-nav">
         <span
           :class="type == 'all' ? 'nav-active' : ''"
@@ -43,15 +46,22 @@
       </div>
     </div>
     <template v-if="type == 'all'">
-      <div class="line"></div>
+      <div
+        class="line"
+        v-if="curtainData.length && curtainData.length > 1"
+      ></div>
       <div class="top-control">
-        <div class="control-item" @click="openCurtainOpening(curtainData)">
+        <div
+          class="control-item"
+          v-if="curtainData[0].isOpenSet"
+          @click="openCurtainOpening(curtainData)"
+        >
           <img
             :src="parseImgUrl('page-officehome', 'curtain_opening.svg')"
             alt=""
           />
         </div>
-        <!--左-->
+        <!--左关-下关-->
         <div
           class="control-item"
           :class="allActive == 1 ? 'control-item-active' : ''"
@@ -60,8 +70,8 @@
           <template v-if="allActive !== 1">
             <img
               v-if="
-                curtainData[0].equipmentType == 4 ||
-                curtainData[0].equipmentType == 5
+                curtainData[0].equipmentType !== 4 &&
+                curtainData[0].equipmentType !== 5
               "
               :src="parseImgUrl('page-officehome', 'curtain_left.svg')"
               alt=""
@@ -75,29 +85,39 @@
           <span v-else>{{ count }}</span>
         </div>
 
-        <div class="control-item">
-          <!--暂停-->
+        <!--暂停-->
+        <div
+          class="control-item"
+          @click="openCurtainMain(3)"
+          v-if="curtainData[0].stopSet"
+        >
           <img
             :src="parseImgUrl('page-officehome', 'curtain_stop.svg')"
             alt=""
           />
         </div>
-        <!--右边-->
-        <div class="control-item">
-          <img
-            v-if="
-              curtainData[0].equipmentType == 4 ||
-              curtainData[0].equipmentType == 5
-            "
-            @click="openCurtainMain(1)"
-            :src="parseImgUrl('page-officehome', 'curtain_right.svg')"
-            alt=""
-          />
-          <img
-            v-else
-            :src="parseImgUrl('page-officehome', 'curtain_up.svg')"
-            alt=""
-          />
+        <!--右开-->
+        <div
+          class="control-item"
+          :class="allActive == 2 ? 'control-item-active' : ''"
+        >
+          <template v-if="allActive !== 2">
+            <img
+              v-if="
+                curtainData[0].equipmentType !== 4 &&
+                curtainData[0].equipmentType !== 5
+              "
+              @click="openCurtainMain(2)"
+              :src="parseImgUrl('page-officehome', 'curtain_right.svg')"
+              alt=""
+            />
+            <img
+              v-else
+              :src="parseImgUrl('page-officehome', 'curtain_up.svg')"
+              alt=""
+            />
+          </template>
+          <span v-else>{{ count }}</span>
         </div>
       </div>
     </template>
@@ -109,10 +129,16 @@
           <span>开度90%</span>
         </div>
         <div class="curtain-control top-control">
+          <div class="control-item" v-if="item.isOpenSet">
+            <img
+              :src="parseImgUrl('page-officehome', 'curtain_opening.svg')"
+              alt=""
+            />
+          </div>
           <!--左边-->
           <div class="control-item">
             <img
-              v-if="item.equipmentType == 4 || item.equipmentType == 5"
+              v-if="item.equipmentType !== 4 && item.equipmentType !== 5"
               :src="parseImgUrl('page-officehome', 'curtain_left.svg')"
               alt=""
             />
@@ -124,7 +150,7 @@
           </div>
 
           <!--暂停-->
-          <div class="control-item">
+          <div class="control-item" v-if="item.stopSet">
             <img
               :src="parseImgUrl('page-officehome', 'curtain_stop.svg')"
               alt=""
@@ -135,7 +161,7 @@
           <!--右边-->
           <div class="control-item">
             <img
-              v-if="item.equipmentType == 4 || item.equipmentType == 5"
+              v-if="item.equipmentType !== 4 && item.equipmentType !== 5"
               :src="parseImgUrl('page-officehome', 'curtain_right.svg')"
               alt=""
             />
@@ -160,7 +186,11 @@ import {
   toRefs,
   watch,
 } from "vue";
-import { getObjectDataEqpGroupHttp, setEquipeHttp } from "@/apis/envmonitor";
+import {
+  getObjectDataEqpGroupHttp,
+  setEquipeHttp,
+  setSpaceCondtioners,
+} from "@/apis/envmonitor";
 import { parseImgUrl } from "@/utils";
 import { Toast } from "vant";
 
@@ -225,19 +255,6 @@ export default defineComponent({
         getObjectDataEqpGroupHttp(params).then((res) => {
           const resData: any = res;
           proxyData.curtainData = resData.count ? resData.content : [];
-          for (let i = 0; i < proxyData.curtainData.length; i++) {
-            let item = proxyData.curtainData[i];
-            item.childDownFlag = false;
-            item.childUpFlag = false;
-            item.childCount = 2;
-            item.childCountText = "";
-            curtainData[0].isOpenSet = 1;
-            curtainData[0].isStop = 1;
-            curtainData[0].openValue = 20;
-            curtainData[1].isOpenSet = 0;
-            curtainData[0].equipmentType = 1;
-            curtainData[1].equipmentType = 5;
-          }
         });
       },
       checkCount() {
@@ -261,8 +278,40 @@ export default defineComponent({
       },
       // 调节总开关
       openCurtainMain(type: any) {
+        // type=1(关) type=2(开) type=3(暂停)
+        if (proxyData.allActive == type && proxyData.count !== 0) {
+          return;
+        }
         proxyData.allActive = type;
+        proxyData.count = 2;
         proxyData.countInterval();
+        proxyData.formateCurtainData(type);
+      },
+      // 处理窗帘数据
+      formateCurtainData(type: any) {
+        let data: any = [];
+        let value: any = 0;
+        if (type == 1) {
+          value = 0;
+        } else if (type == 2) {
+          value = 1;
+        } else {
+          value = 2;
+        }
+        proxyData.curtainData.map((item: any) => {
+          let obj: any = {
+            id: item.id,
+            code: "EquipSwitchSet",
+            value: value,
+          };
+          data.push(obj);
+        });
+        proxyData.changeCurtainStatus(data);
+      },
+      // 修改窗帘的状态
+      changeCurtainStatus(data: any) {
+        console.log("窗帘==", data);
+        setSpaceCondtioners(data).then((res) => {});
       },
     });
 
@@ -274,7 +323,7 @@ export default defineComponent({
       }
     });
     onMounted(() => {
-      // 获取空调信息
+      // 获取窗帘信息
       proxyData.getEqpGroup();
     });
     return {
@@ -362,38 +411,6 @@ export default defineComponent({
   border-top: 1px solid #e8ecf0;
 }
 
-.curtain-child {
-  .child-item {
-    display: flex;
-    justify-content: space-between;
-    padding-top: 16px;
-    padding-bottom: 16px;
-    padding-left: 20px;
-    padding-right: 20px;
-    border-top: 1px solid #e8ecf0;
-    .curtain-name {
-      .name {
-        font-family: "PingFang SC";
-        font-style: normal;
-        font-weight: 600;
-        font-size: 16px;
-        line-height: 22px;
-        color: #4d5262;
-      }
-      span {
-        display: block;
-        padding-top: 4px;
-        font-family: "PingFang SC";
-        font-style: normal;
-        font-weight: 400;
-        font-size: 14px;
-        line-height: 20px;
-        color: #c4c4c4;
-      }
-    }
-  }
-}
-
 .top-control {
   text-align: right;
   padding: 16px 20px;
@@ -406,6 +423,9 @@ export default defineComponent({
     height: 40px;
     background: #f1f4f6;
     border-radius: 50%;
+    &:active {
+      background: rgba(206, 159, 39, 0.4);
+    }
     img {
       position: absolute;
       width: 16px;
@@ -430,4 +450,39 @@ export default defineComponent({
     }
   }
 }
+
+.curtain-child {
+  .child-item {
+    display: flex;
+    justify-content: space-between;
+    padding-top: 16px;
+    padding-bottom: 16px;
+    padding-left: 20px;
+    padding-right: 20px;
+    border-top: 1px solid #e8ecf0;
+    .curtain-name {
+      .name {
+        font-family: "PingFang SC";
+        font-style: normal;
+        font-weight: 600;
+        font-size: 16px;
+        line-height: 22px;
+        color: #4d5262;
+      }
+      span {
+        display: block;
+        padding-top: 4px;
+        font-family: "PingFang SC";
+        font-style: normal;
+        font-weight: 400;
+        font-size: 14px;
+        line-height: 20px;
+        color: #c4c4c4;
+      }
+    }
+  }
+  .top-control {
+    padding: 0;
+  }
+}
 </style>

+ 8 - 8
src/views/envmonitor/index.vue

@@ -236,7 +236,7 @@
         :spaceId="spaceInfo.spaceId"
         :projectId="projectId"
       />
-      <!-- <Curtain
+      <Curtain
         :spaceId="spaceInfo.spaceId"
         id="curtainId"
         key="curtainKey"
@@ -244,16 +244,16 @@
         :userIsControl="userIsControl"
         v-if="spaceExistenceDevice.curtain && spaceInfo.spaceId"
         :projectId="projectId"
-      /> -->
+      />
 
-      <Curtain
+      <!-- <Curtain
         :spaceId="spaceInfo.spaceId"
         id="curtainId"
         key="curtainKey"
         :userIsControl="userIsControl"
         v-if="spaceExistenceDevice.curtain && spaceInfo.spaceId"
         :projectId="projectId"
-      />
+      /> -->
     </div>
     <!--加班场景-->
     <van-popup
@@ -339,7 +339,7 @@
       v-model:show="isLightColorFlag"
       position="right"
       :close-on-click-overlay="true"
-      class="popup-content"
+      class="popup-content-small"
       teleport="#app"
     >
       <div>
@@ -352,7 +352,7 @@
       v-model:show="isFloorHeatingTemp"
       position="right"
       :close-on-click-overlay="true"
-      class="popup-content"
+      class="popup-content-small"
       teleport="#app"
     >
       <div>
@@ -368,7 +368,7 @@
       v-model:show="isCurtainOpening"
       position="right"
       :close-on-click-overlay="true"
-      class="popup-content"
+      class="popup-content-small"
       teleport="#app"
     >
       <div>
@@ -403,7 +403,7 @@ import Air from "@/views/envmonitor/components/Air/index.vue";
 import FloorHeating from "@/views/envmonitor/components/FloorHeating/index.vue";
 import ManualIndex from "@/views/envmonitor/components/Air/manualIndex.vue";
 import Light from "@/views/envmonitor/components/Light/index.vue";
-import Curtain from "@/views/envmonitor/components/CurtainCopy/index.vue";
+import Curtain from "@/views/envmonitor/components/Curtain/index.vue";
 import CurtainOpening from "@/views/envmonitor/components/Curtain/CurtainOpening.vue";
 import TimeBox from "@/views/envmonitor/TimeBox.vue";
 import NavBar from "@/views/envmonitor/NavBar.vue";

+ 2 - 2
vue.config.js

@@ -116,13 +116,13 @@ module.exports = {
       },
       '/sgipad/test/': {
         // target: 'https://duoduoenv.sagacloud.cn',
-        target: 'http://192.168.88.10:52009',    // 永琪
+        target: 'http://192.168.88.4:52009',    // 永琪
         // target: 'http://192.168.4.54:52009', // 小静
         // target: 'http://192.168.16.168:52015',
         changeOrigin: true,
         pathRewrite: {
           '^/sgipad/test': ''
-        }
+        } 
       },
       '/sgipad/test1/': {
         // target: 'https://duoduoenv.sagacloud.cn',