Quellcode durchsuchen

fix:灯模块的功能优化

chenzhen2 vor 1 Jahr
Ursprung
Commit
43f8875326
2 geänderte Dateien mit 24 neuen und 8 gelöschten Zeilen
  1. 13 3
      src/views/envmonitor/components/Light/index.vue
  2. 11 5
      src/views/envmonitor/index.vue

+ 13 - 3
src/views/envmonitor/components/Light/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="light" v-if="lampList && lampList.length">
+  <div class="light" v-if="showLight && lampList && lampList.length">
     <!--如果有子设备-->
     <div class="light-top">
       <div class="light-desc">
@@ -133,6 +133,10 @@ export default defineComponent({
       type: Boolean,
       default: () => false,
     },
+    showLight: {
+      type: Boolean,
+      default: () => false,
+    },
     seviceEquipmentList: {
       // 是否走服务定制的设备
       type: Array,
@@ -148,6 +152,7 @@ export default defineComponent({
     let lightParams: any = [];
     const proxyData = reactive({
       seviceEquipmentList: props.seviceEquipmentList,
+      showLight: props.showLight,
       spaceId: props.spaceId,
       controlMode: props.controlMode,
       userIsControl: props.userIsControl,
@@ -553,17 +558,21 @@ export default defineComponent({
       (newProps: any, oldProps: any) => {
         // debugger
         if (newProps[0]) {
+          proxyData.showLight = newProps[0].showLight;
           proxyData.userIsControl = newProps[0].userIsControl;
           proxyData.controlMode = newProps[0].controlMode;
           proxyData.forceOverTimeFlag = newProps[0].forceOverTimeFlag;
           proxyData.seviceEquipmentList = newProps[0].seviceEquipmentList;
         }
 
-        if (newProps[1] && newProps[1] != oldProps[1]) {
+        if (newProps[1] && oldProps[1] && newProps[1] != oldProps[1]) {
           // 空间id改变的重新获取值调用接口
+          console.log("灯模块的spaceId变化了");
+          // 清除原始数据
           proxyData.clearLightStatusTimer();
-          proxyData.spaceId = newProps[1];
           proxyData.showFlag = false;
+          proxyData.lampList = [];
+          proxyData.spaceId = newProps[1];
           proxyData.getLampList();
         }
       },
@@ -577,6 +586,7 @@ export default defineComponent({
       proxyData.clearLightStatusTimer();
     });
     onMounted(() => {
+      // proxyData.clearLightStatusTimer();
       proxyData.getLampList();
     });
     return {

+ 11 - 5
src/views/envmonitor/index.vue

@@ -144,6 +144,7 @@
         <!--自动控制的加班 start-->
         <WorkConfig
           v-if="roomType === '开放' && isWork && controlMode !== 1"
+          key="workCkey"
           :workkArr="workkArr"
           @closeWork="closeWork"
           @triggerWork="triggerWork"
@@ -153,6 +154,7 @@
         <!--手动控制的加班 start-->
         <template v-if="roomType === '开放' && isWork && controlMode === 1">
           <ManualConfig
+            key="manualckey"
             :workkArr="workkArr"
             @closeWork="closeWork"
             @triggerWork="triggerWork"
@@ -173,6 +175,7 @@
       <!--空调手动控制 start-->
       <manual-index
         v-if="controlMode == 1 && spaceExistenceDevice.airConditioner"
+        key="manualKey"
         @triggerWork="triggerWork"
         :seviceEquipmentList="seviceEquipmentList"
         :forceOverTimeFlag="forceOverTimeFlag"
@@ -189,6 +192,7 @@
       <Air
         v-if="controlMode != 1 && spaceExistenceDevice.airConditioner"
         id="airId"
+        key="airKey"
         @triggerWork="triggerWork"
         :forceOverTimeFlag="forceOverTimeFlag"
         @updateAirTemp="updateAirTemp"
@@ -202,13 +206,15 @@
       />
       <!--空调自动控制 end-->
       <Light
-        v-if="spaceExistenceDevice.light && spaceInfo.spaceId"
+        v-if="spaceInfo.spaceId"
+        :showLight="spaceExistenceDevice.light"
         :forceOverTimeFlag="forceOverTimeFlag"
         :controlMode="controlMode"
         :seviceEquipmentList="seviceEquipmentList"
         @triggerWork="triggerWork"
         @showLightColorCtrol="showLightColorCtrol"
         id="lightId"
+        key="lightKey"
         :userIsControl="userIsControl"
         :spaceId="spaceInfo.spaceId"
         :projectId="projectId"
@@ -216,8 +222,9 @@
       <Curtain
         :spaceId="spaceInfo.spaceId"
         id="curtainId"
+        key="curtainKey"
         :userIsControl="userIsControl"
-        v-if="spaceExistenceDevice.curtain"
+        v-if="spaceExistenceDevice.curtain && spaceInfo.spaceId"
         :projectId="projectId"
       />
     </div>
@@ -1751,12 +1758,12 @@ export default defineComponent({
         proxyData.getSpaceInfo();
         // 动态获取场景配置
         proxyData.querySpaceSceneConfig();
+        // 获取空间下展示的那些设备类(窗帘,灯,空调))
+        proxyData.getEquipments();
         // 获取空间下受控设备
         proxyData.getSpaceEquipList();
         // 查询加班记录
         proxyData.queryCustomAndScenceTimer(0);
-        // 获取空间下展示的那些设备类(窗帘,灯,空调))
-        proxyData.getEquipments();
       },
       /**
        *删除参数
@@ -1834,7 +1841,6 @@ export default defineComponent({
         proxyData.isWork = false;
         proxyData.roomType = "";
         proxyData.officeData.temperature = "";
-        proxyData.spaceExistenceDevice = spaceExistenceDevice;
         proxyData.seviceEquipmentList = [];
         proxyData.workkArr = [];
         //  切换空间的时候把加班按钮平板