Pārlūkot izejas kodu

fix:窗帘状态修改

chenzhen2 1 gadu atpakaļ
vecāks
revīzija
07dff11996

+ 3 - 3
public/images/page-officehome/curtain_left.svg

@@ -1,4 +1,4 @@
-<svg width="17" height="17" viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg">
-<path fill-rule="evenodd" clip-rule="evenodd" d="M15.5065 4.33979C15.2461 4.07944 14.824 4.07944 14.5637 4.33979L11.0748 7.82861C10.5541 8.34931 10.5541 9.19353 11.0748 9.71423L14.5637 13.203C14.824 13.4634 15.2461 13.4634 15.5065 13.203C15.7668 12.9427 15.7668 12.5206 15.5065 12.2602L12.0176 8.77142L15.5065 5.2826C15.7668 5.02225 15.7668 4.60014 15.5065 4.33979Z" fill="#626C78"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M2.04341 4.48628C2.30376 4.22593 2.72587 4.22593 2.98622 4.48628L6.32861 7.82867C6.84931 8.34937 6.84931 9.19359 6.32861 9.71429L2.98622 13.0567C2.72587 13.317 2.30376 13.317 2.04341 13.0567C1.78306 12.7963 1.78306 12.3742 2.04341 12.1139L5.3858 8.77148L2.04341 5.42909C1.78306 5.16874 1.78306 4.74663 2.04341 4.48628Z" fill="#626C78"/>
+<svg width="25" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path fill-rule="evenodd" clip-rule="evenodd" d="M22.716 5.85246C22.3255 5.46194 21.6923 5.46194 21.3018 5.85246L16.0685 11.0857C15.2875 11.8667 15.2875 13.1331 16.0685 13.9141L21.3018 19.1473C21.6923 19.5379 22.3255 19.5379 22.716 19.1473C23.1065 18.7568 23.1065 18.1237 22.716 17.7331L17.4828 12.4999L22.716 7.26668C23.1065 6.87615 23.1065 6.24299 22.716 5.85246Z" fill="#626C78"/>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M2.52141 6.07219C2.91193 5.68167 3.5451 5.68167 3.93562 6.07219L8.94921 11.0858C9.73026 11.8668 9.73026 13.1332 8.94921 13.9142L3.93562 18.9278C3.5451 19.3183 2.91193 19.3183 2.52141 18.9278C2.13088 18.5373 2.13088 17.9041 2.52141 17.5136L7.535 12.5L2.52141 7.4864C2.13088 7.09588 2.13088 6.46271 2.52141 6.07219Z" fill="#626C78"/>
 </svg>

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 3 - 3
public/images/page-officehome/curtain_opening.svg


+ 6 - 6
public/images/page-officehome/curtain_right.svg

@@ -1,11 +1,11 @@
-<svg width="17" height="17" viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg">
-<g clip-path="url(#clip0_2414_60089)">
-<path fill-rule="evenodd" clip-rule="evenodd" d="M11.8969 4.33979C12.1572 4.07944 12.5793 4.07944 12.8397 4.33979L16.3285 7.82861C16.8492 8.34931 16.8492 9.19353 16.3285 9.71423L12.8397 13.203C12.5793 13.4634 12.1572 13.4634 11.8969 13.203C11.6365 12.9427 11.6365 12.5206 11.8969 12.2602L15.3857 8.77142L11.8969 5.2826C11.6365 5.02225 11.6365 4.60014 11.8969 4.33979Z" fill="#626C78"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M5.65278 4.48628C5.39243 4.22593 4.97032 4.22593 4.70997 4.48628L1.36758 7.82867C0.846876 8.34937 0.846876 9.19359 1.36758 9.71429L4.70997 13.0567C4.97032 13.317 5.39243 13.317 5.65278 13.0567C5.91313 12.7963 5.91313 12.3742 5.65278 12.1139L2.31038 8.77148L5.65278 5.42909C5.91313 5.16874 5.91313 4.74663 5.65278 4.48628Z" fill="#626C78"/>
+<svg width="25" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+<g clip-path="url(#clip0_2414_59417)">
+<path fill-rule="evenodd" clip-rule="evenodd" d="M17.6351 5.85246C18.0256 5.46194 18.6588 5.46194 19.0493 5.85246L24.2825 11.0857C25.0636 11.8667 25.0636 13.1331 24.2825 13.9141L19.0493 19.1473C18.6588 19.5379 18.0256 19.5379 17.6351 19.1473C17.2446 18.7568 17.2446 18.1237 17.6351 17.7331L22.8683 12.4999L17.6351 7.26668C17.2446 6.87615 17.2446 6.24299 17.6351 5.85246Z" fill="#626C78"/>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M8.26896 6.07219C7.87844 5.68167 7.24527 5.68167 6.85475 6.07219L1.84116 11.0858C1.06011 11.8668 1.06011 13.1332 1.84116 13.9142L6.85475 18.9278C7.24527 19.3183 7.87844 19.3183 8.26896 18.9278C8.65948 18.5373 8.65948 17.9041 8.26896 17.5136L3.25537 12.5L8.26896 7.4864C8.65948 7.09588 8.65948 6.46271 8.26896 6.07219Z" fill="#626C78"/>
 </g>
 <defs>
-<clipPath id="clip0_2414_60089">
-<rect width="16" height="16" fill="white" transform="translate(0.661621 0.437988)"/>
+<clipPath id="clip0_2414_59417">
+<rect width="24" height="24" fill="white" transform="translate(0.782227)"/>
 </clipPath>
 </defs>
 </svg>

+ 3 - 3
public/images/page-officehome/curtain_stop.svg

@@ -1,4 +1,4 @@
-<svg width="11" height="11" viewBox="0 0 11 11" fill="none" xmlns="http://www.w3.org/2000/svg">
-<rect x="0.995117" y="0.104492" width="1.33333" height="10.6667" rx="0.666667" fill="#626C78"/>
-<rect x="8.99463" y="0.104492" width="1.33333" height="10.6667" rx="0.666667" fill="#626C78"/>
+<svg width="25" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg">
+<rect x="5.11572" y="4" width="2" height="16" rx="1" fill="#626C78"/>
+<rect x="17.1157" y="4" width="2" height="16" rx="1" fill="#626C78"/>
 </svg>

+ 5 - 4
src/apis/envmonitor.ts

@@ -63,7 +63,8 @@ export const getStatusHttp = (data: any) => {
 
 // 获取窗帘数据列表
 export const getObjectDataEqpGroupHttp = (params: any) => {
-  return https().request<RootObject<any>>(`${testApi}object/objectDataEqpGroup/query`, Method.POST, params, ContentType.json)
+  // return https().request<RootObject<any>>(`${testApi}object/objectDataEqpGroup/query`, Method.POST, params, ContentType.json)
+  return https().request<RootObject<any>>(`${duoduoenvService}object/objectDataEqpGroup/query`, Method.POST, params, ContentType.json)
 }
 
 // 切换场景
@@ -275,11 +276,11 @@ 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)
 }
 
 // 地图数据保存

+ 4 - 2
src/utils/index.ts

@@ -160,7 +160,7 @@ export const formatDate = function (split: string = 'YYYYMMDD', date: any = new
   // //分钟
   const Minutes = dates.getMinutes() < 10 ? '0' + dates.getMinutes() : dates.getMinutes()
   // //秒
-  // const Seconds = dates.getSeconds() < 10 ? '0' + dates.getSeconds() : dates.getSeconds()
+  const Seconds = dates.getSeconds() < 10 ? '0' + dates.getSeconds() : dates.getSeconds()
   //返回数据格式
   if (split === 'YYYY年MM月DD日') {
     return year + '年' + month + '月' + day + '日'
@@ -172,8 +172,10 @@ export const formatDate = function (split: string = 'YYYYMMDD', date: any = new
     return year + '-' + month + '-' + day
   } else if (split === 'YYYY.MM.DD HH:mm') {
     return year + '.' + month + "." + day + " " + Hours + ":" + Minutes
+  } else if (split === 'YYYY.MM.DD HH:mm:ss') {
+    return year + '.' + month + "." + day + " " + Hours + ":" + Minutes + ":" + Seconds
   }
-  {
+  else {
     return year + '' + month + '' + day
   }
 }

+ 74 - 13
src/views/envmonitor/components/Curtain/CurtainOpening.vue

@@ -1,18 +1,24 @@
 <template>
   <div class="curtain-temp">
     <div class="curtain-tep-top">
-      <span>窗帘</span>
+      <span>
+        {{
+          curtainData && curtainData.length > 1 ? "窗帘" : curtainObj.name
+        }}</span
+      >
     </div>
     <div class="bright-box">
       <div class="bight-text">
-        <span>开度</span>
+        <span>设定开度</span>
         <span class="line"></span>
-        <span>{{ apertureVal }}%</span>
+        <span class="text-aper">{{ apertureVal }}%</span>
       </div>
       <div class="curtain-control">
         <div class="bight-slider" id="curtainSlider1">
           <div class="item-now" :style="{ width: itemWidth }"></div>
           <div class="slider-bar" id="curtainHandld1"></div>
+          <div class="temp-left">关</div>
+          <div class="temp-right">开</div>
         </div>
       </div>
     </div>
@@ -26,13 +32,15 @@
       >
         <template v-if="activeIndex != 1">
           <img
+            class="curtain-left-icon"
             v-if="
-              curtainObj.equipmentType == 4 || curtainObj.equipmentType == 5
+              curtainObj.equipmentType != 4 && curtainObj.equipmentType != 5
             "
             :src="parseImgUrl('page-officehome', 'curtain_left.svg')"
             alt=""
           />
           <img
+            class="curtain-down-icon"
             v-else
             :src="parseImgUrl('page-officehome', 'curtain_down.svg')"
             alt=""
@@ -49,7 +57,7 @@
         @click="openCurtainMain(3)"
         :class="activeIndex == 3 ? 'control-item-active' : ''"
       >
-        <img :src="parseImgUrl('page-officehome', 'curtain_stop.svg')" alt="" />
+        <img class="curtain-stop-icon" :src="parseImgUrl('page-officehome', 'curtain_stop.svg')" alt="" />
         <span class="title">暂停</span>
       </div>
 
@@ -63,18 +71,19 @@
         <template v-if="activeIndex != 2">
           <img
             v-if="
-              curtainObj.equipmentType == 4 || curtainObj.equipmentType == 5
+              curtainObj.equipmentType != 4 && curtainObj.equipmentType != 5
             "
             :src="parseImgUrl('page-officehome', 'curtain_right.svg')"
             alt=""
           />
           <img
             v-else
+            class="curtain-up-icon"
             :src="parseImgUrl('page-officehome', 'curtain_up.svg')"
             alt=""
           />
         </template>
-        <span  class="count-num" v-else>{{ count }}</span>
+        <span class="count-num" v-else>{{ count }}</span>
         <span class="title">打开</span>
       </div>
     </div>
@@ -113,6 +122,7 @@ export default defineComponent({
     let timeTemp: any = null;
     let curtainObj: any = {};
     let interval: any = {};
+    let curtainItem:any=''
     const proxyData = reactive({
       lampSw: false,
       itemWidth: "0%",
@@ -122,6 +132,7 @@ export default defineComponent({
       parseImgUrl: parseImgUrl,
       curtainObj: curtainObj,
       curtainData: props.curtainData,
+      curtainItem:curtainItem,
       //亮度滑块滑动
       endBoxSwiper() {
         let handBox: any = document.querySelector("#curtainHandld1");
@@ -227,9 +238,11 @@ export default defineComponent({
           // 开度
           value = proxyData.apertureVal;
         }
+        console.log("proxyData.curtainData==", proxyData.curtainData);
         proxyData.curtainData.map((item: any) => {
           let obj: any = {
-            id: item.id,
+            id: item.equipId,
+            // id:'Eq110108025995ec5bdc23fc47a0a9d8debb150d18eb',
             code: type == 4 ? "EquipOpeningSet" : "EquipSwitchSet",
             value: value,
           };
@@ -253,6 +266,7 @@ export default defineComponent({
     onBeforeUnmount(() => {});
     onMounted(() => {
       proxyData.curtainObj = proxyData.curtainData[0];
+      // console.log("加载了")
       proxyData.barSwiperInit();
     });
     return {
@@ -293,12 +307,20 @@ export default defineComponent({
         color: #1b2129;
       }
       .line {
+        display: inline-block;
+        vertical-align: middle;
         width: 1px;
         margin-left: 12px;
         margin-right: 12px;
-        height: 22px;
+        height: 14px;
         border-left: 1px solid #e1e5eb;
       }
+      .text-aper{
+        display: inline-block;
+        vertical-align: middle;
+        font-family: "Persagy";
+        font-weight: 400;
+      }
     }
     .curtain-control {
       .bight-slider {
@@ -336,6 +358,29 @@ export default defineComponent({
           #c8d6ff 100%
         );
       }
+      .temp-left,
+      .temp-right {
+        position: absolute;
+        top: 50%;
+        transform: translateY(-50%);
+        font-family: "Persagy";
+        font-style: normal;
+        font-weight: 400;
+        font-size: 14px;
+        width: 32px;
+        line-height: 20px;
+        text-align: right;
+        color: #626c78;
+      }
+      .temp-left {
+        left: 0px;
+        padding-left: 8px;
+      }
+      .temp-right {
+        right: 0px;
+        padding-right: 8px;
+        text-align: left;
+      }
     }
 
     .curtain-control-padding {
@@ -361,16 +406,32 @@ export default defineComponent({
         position: absolute;
         left: 50%;
         top: 50%;
-        // width: 16px;
-        // height: 16px;
+        width: 24px;
+        height: 24px;
         transform: translate(-50%, -50%);
       }
+      // .curtain-down-icon{
+      //   width: 18px;
+      //   height: 18px;
+      // }
+      // .curtain-stop-icon{
+      //   width: 14px;
+      //   height: 16px;
+      // }
+      // .curtain-up-icon{
+      //   width: 18px;
+      //   height: 18px;
+      // }
       .title {
         position: absolute;
-        bottom: -30px !important;
-        left: 8px !important;
+        font-family: 'PingFang SC';
+        bottom: -28px !important;
+        font-weight: 400;
+        left: 13px !important;
         display: block;
         z-index: 333;
+        font-size: 14px;
+        color: #626C78;
       }
     }
 

+ 60 - 9
src/views/envmonitor/components/Curtain/index.vue

@@ -57,6 +57,7 @@
           @click="openCurtainOpening(curtainData)"
         >
           <img
+            class="curtain-opening-icon"
             :src="parseImgUrl('page-officehome', 'curtain_opening.svg')"
             alt=""
           />
@@ -126,7 +127,7 @@
       <div class="child-item" :key="item.id" v-for="item in curtainData">
         <div class="curtain-name">
           <div class="name">{{ item.name }}</div>
-          <span>开度{{ item.openValue }}%</span>
+          <span v-if="item.isOpenSet">开度{{ item.openValue }}%</span>
         </div>
         <div class="curtain-control top-control">
           <div
@@ -215,7 +216,7 @@ import {
   setEquipeHttp,
   setSpaceCondtioners,
 } from "@/apis/envmonitor";
-import { parseImgUrl } from "@/utils";
+import { formatDate, parseImgUrl } from "@/utils";
 import { Toast } from "vant";
 
 export default defineComponent({
@@ -239,6 +240,7 @@ export default defineComponent({
     let projectId: any = props.projectId;
     let type: any = "all";
     let interval: any = {};
+    let oldTime: any = null;
     const proxyData = reactive({
       curtainData: curtainData,
       userIsControl: props.userIsControl,
@@ -250,7 +252,6 @@ export default defineComponent({
       curtainOpen: false,
       curtainClose: false,
       parseImgUrl: parseImgUrl,
-      timer: timer,
       // 开度弹窗
       activeIndex: 0,
       // 打开开度弹窗
@@ -339,7 +340,7 @@ export default defineComponent({
         let value: any = proxyData.formateValue(type);
         proxyData.curtainData.map((item: any) => {
           let obj: any = {
-            id: item.id,
+            id: item.equipId,
             code: "EquipSwitchSet",
             value: value,
           };
@@ -350,7 +351,12 @@ export default defineComponent({
       // 修改窗帘的状态
       changeCurtainStatus(data: any) {
         console.log("窗帘==", data);
-        setSpaceCondtioners(data).then((res) => {});
+        setSpaceCondtioners(data).then((res) => {
+          proxyData.oldTime = formatDate("YYYY.MM.DD HH:mm:ss");
+          if (!proxyData.timer) {
+            proxyData.updateGroupPeing();
+          }
+        });
       },
       // 单个窗帘操作
       openCurtainClid(item: any, type: any) {
@@ -360,7 +366,8 @@ export default defineComponent({
         item.activeIndex = type;
         let data: any = [];
         let obj: any = {
-          id: item.id,
+          id: item.equipId,
+          // id: "Eq110108025995ec5bdc23fc47a0a9d8debb150d18eb",
           code: "EquipSwitchSet",
           value: proxyData.formateValue(type),
         };
@@ -369,6 +376,43 @@ export default defineComponent({
         proxyData.countChildInterval(item);
         proxyData.changeCurtainStatus(data);
       },
+      oldTime: oldTime,
+      timer: timer,
+      clearTimer() {
+        clearInterval(proxyData.timer);
+        proxyData.timer = null;
+      },
+      // 更新窗帘的开度
+      updateGroupPeing() {
+        // debugger
+        proxyData.timer = setInterval(() => {
+          let nowTime: any = formatDate("YYYY.MM.DD HH:mm:ss");
+          if (proxyData.oldTime) {
+            let secondTimeDiff: any = proxyData.getTimeDifference(
+              proxyData.oldTime,
+              nowTime
+            );
+            // console.log("secondTimeDiff==",secondTimeDiff)
+            if (secondTimeDiff > 60) {
+              proxyData.getEqpGroup();
+              proxyData.clearTimer();
+            }
+          } else {
+            proxyData.oldTime = formatDate("YYYY.MM.DD HH:mm:ss");
+          }
+        }, 1000);
+      },
+      //计算时间差-分钟
+      getTimeDifference(Stime: any, Ttime: any) {
+        // debugger
+        let startDate: any = new Date(Stime);
+        let stopDate: any = new Date(Ttime);
+        let startTime: any = startDate.getTime();
+        let stopTime: any = stopDate.getTime();
+        let cTime: any = Number(stopTime) - Number(startTime);
+        let secondTime: any = cTime / 1000;
+        return parseInt(secondTime);
+      },
     });
 
     watch(props, (newProps: any) => {
@@ -378,7 +422,10 @@ export default defineComponent({
         proxyData.userIsControl = newProps.userIsControl;
       }
     });
-    onBeforeUnmount(() => {});
+    onBeforeUnmount(() => {
+      proxyData.clearTimer();
+      clearInterval(proxyData.interval);
+    });
     onMounted(() => {
       // 获取窗帘信息
       proxyData.getEqpGroup();
@@ -485,12 +532,16 @@ export default defineComponent({
     }
     img {
       position: absolute;
-      // width: 16px;
-      // height: 16px;
+      width: 16px;
+      height: 16px;
       left: 50%;
       top: 50%;
       transform: translate(-50%, -50%);
     }
+    .curtain-opening-icon {
+      width: 20px;
+      height: 20px;
+    }
   }
 
   .control-item-active {

+ 13 - 4
src/views/envmonitor/index.vue

@@ -240,6 +240,7 @@
         :spaceId="spaceInfo.spaceId"
         id="curtainId"
         key="curtainKey"
+        ref="curtainRef"
         @showCurtainOpening="showCurtainOpening"
         :userIsControl="userIsControl"
         v-if="spaceExistenceDevice.curtain && spaceInfo.spaceId"
@@ -368,11 +369,15 @@
       v-model:show="isCurtainOpening"
       position="right"
       :close-on-click-overlay="true"
+      @click-overlay="closeCurtainOpening"
       class="popup-content-small"
       teleport="#app"
     >
-      <div>
-        <curtain-opening :curtainData="curtainData"></curtain-opening>
+      <div v-if="isCurtainOpening">
+        <curtain-opening
+          v-if="isCurtainOpening"
+          :curtainData="curtainData"
+        ></curtain-opening>
       </div>
     </van-popup>
   </div>
@@ -531,7 +536,7 @@ export default defineComponent({
       airConditioner: false,
       bodySensor: false,
     };
-    let childRef: any = {};
+    let curtainRef: any = {};
     // let mapRef: any = {}
     let intervalTimer: any = null;
     const workInfo: any = {};
@@ -704,7 +709,7 @@ export default defineComponent({
       showSpaceTip: false,
       mapOpacity: 0,
       opacityV: 1,
-      childRef: childRef,
+      curtainRef: curtainRef,
       hideTopImg: false,
       isBottom: false,
       isScrool: false,
@@ -897,6 +902,10 @@ export default defineComponent({
         proxyData.curtainData = curtainData;
         proxyData.isCurtainOpening = true;
       },
+      closeCurtainOpening() {
+        console.log("被点击了");
+        proxyData.curtainRef.updateGroupPeing();
+      },
       closeContactDailog() {
         proxyData.isShowContact = false;
       },