anxiaoxia 1 місяць тому
батько
коміт
d92ed5b9b6

+ 2 - 1
src/hooks/useDeviceControl.js

@@ -3,7 +3,8 @@ const COMMAND_MAPPINGS = {
   air: {
     isOpen: item => ({ code: item.switchCode, value: val => (val ? 1 : 0) }),
     tempSet: item => ({ code: item.tempSetCode, value: val => val }),
-    gear: item => ({ code: item.gearCode, value: val => val })
+    gear: item => ({ code: item.gearCode, value: val => val }),
+    auto: item => ({ code: item.gearCode, value: val => (val = 4) })
   },
   lamp: {
     // isOpen: () => ({ code: 'EquipSwitchSet', value: val => (val ? 1 : 0) }),

+ 7 - 3
src/views/envmonitor/taiguv1/components/Air/AirMore.vue

@@ -323,13 +323,17 @@ const handle = (type, data, all) => {
     }
     data.isAutoGear = false
   } else if (type === 'auto') {
-    data.gear = 4
     data.isAutoGear = true
   }
-  if (all == 'all') {
+
+  if (all == 'all' && type =='auto') {
+    setAirStatus('auto', all)
+  }else if (all == 'all' && type !=='auto') {
     setAirStatus('gear', all)
-  } else {
+  }else if(all == 'single' && type !=='auto'){
     sigleAirChange('gear', data, all)
+  }else if (all == 'single' && type == 'auto') {
+    sigleAirChange('auto', data, all)
   }
 }
 

+ 24 - 23
src/views/envmonitor/taiguv1/components/Air/index.vue

@@ -20,11 +20,9 @@
       <div class="air-info">
         <div class="left">
           <div class="text">{{ $t(`air.空调`) }}</div>
-          <div class="status">{{$t('air.' + airSwitchStatus.statusText) }}</div>
-        </div>
-        <div class="temp" v-if="airData.isOpen">
-          {{ airData.tempSet || 16}}<sup>℃</sup>
+          <div class="status">{{ $t('air.' + airSwitchStatus.statusText) }}</div>
         </div>
+        <div class="temp" v-if="airData.isOpen">{{ airData.tempSet || 16 }}<sup>℃</sup></div>
       </div>
       <!--温度⏭️-->
       <div class="temp-box" id="sliderAirId" v-if="airData.isOpen">
@@ -53,7 +51,7 @@
           <div class="control-item" :ref="setRef" data-type="plus" @click.prevent.stop="handle('plus')">
             <img class="icon" :src="buttonStates.plus ? AddIconActive : AddIcon" />
           </div>
-          <div class="control-item"   @click.prevent.stop="handle('auto')">
+          <div class="control-item" @click.prevent.stop="handle('auto')">
             <img class="icon" :src="airData.isAutoGear ? AutoIconActive : AutoIcon" />
           </div>
         </div>
@@ -132,9 +130,17 @@ watch(
 )
 const compareStatus = data => {
   let { minTempSet, maxTempSet } = airData.value
-//   console.log('debugger')
+  const updateAirData = () => {
+    airData.value = {
+      ...data,
+      isOpen: data.runStatus === 1,
+      minTempSet,
+      maxTempSet
+    }
+  }
   if (allAirStatus.value.all) {
-    if (allAirStatus.value.all.lastSwitchStatus == data.runStatus) {
+    const { lastSwitchStatus } = allAirStatus.value.all
+    if (lastSwitchStatus == data.runStatus) {
       store.dispatch('taiguv1/setAirStatus', {
         id: 'all',
         status: {
@@ -142,27 +148,20 @@ const compareStatus = data => {
           lastSwitchStatus: null
         }
       })
-      airData.value = {
-        ...data,
-        isOpen: data.runStatus == 1,
-        minTempSet,
-        maxTempSet
-      }
+      updateAirData()
+    } else if (lastSwitchStatus === null) {
+      console.log('debugger')
+      updateAirData()
     } else {
       airData.value = {
         ...data,
-        isOpen: allAirStatus.value.all.lastSwitchStatus,
+        isOpen: lastSwitchStatus,
         minTempSet,
         maxTempSet
       }
     }
   } else {
-    airData.value = {
-      ...data,
-      isOpen: data.runStatus == 1,
-      minTempSet,
-      maxTempSet
-    }
+    updateAirData()
   }
   emit('getStatus', airData.value.isOpen)
 }
@@ -207,7 +206,7 @@ const handleTouchStart = event => {
   const type = button.dataset.type
   button.classList.add('active')
   buttonStates.value[type] = true
-  
+
   setTimeout(() => {
     button.classList.remove('active')
     buttonStates.value[type] = false
@@ -227,17 +226,19 @@ const handle = type => {
       airData.value.gear = 0
     }
     airData.value.isAutoGear = false
+    setAirStatus('gear')
   } else if (type === 'plus') {
     airData.value.gear += 1
     if (airData.value.gear > 3) {
       airData.value.gear = 3
     }
     airData.value.isAutoGear = false
+    setAirStatus('gear')
   } else if (type === 'auto') {
-    airData.value.gear = 4
+  // TODO:自动风量
     airData.value.isAutoGear = true
+    setAirStatus('auto')
   }
-  setAirStatus('gear')
 }
 
 const setAirStatus = type => {

+ 215 - 238
src/views/envmonitor/taiguv1/components/Curtain/CurtainMore.vue

@@ -1,273 +1,250 @@
 <template>
-    <div class="more-box">
-        <div class="light-more-top">
-            <div class="left">
-                <div class="light-box">
-                    <img
-                        :src="curtainIcon"
-                        alt=""
-                    />
-                </div>
-            </div>
-            <div class="right">
-                <div
-                    class="control_all"
-                    :class="topActive ? 'active' : ''"
-                    @click="handle('all',1,'开启中','EquipOnSet')"
-                >{{ $t(`common.全开`) }}</div>
-                <div
-                    class="control_all"
-                    :class="downActive ? 'active' : ''"
-                    @click="handle('all',0,'关闭中','EquipOffSet')"
-                >{{ $t(`common.全关`) }}</div>
-            </div>
+  <div class="more-box">
+    <div class="light-more-top">
+      <div class="left">
+        <div class="light-box">
+          <img :src="curtainIcon" alt="" />
         </div>
-        <div class="control_status">{{ controlStatus ? $t(`curtains.${controlStatus}`) : '' }}</div>
-        <div class="light-bottom">
-            <div
-                class="item-box"
-                v-for="(item, index) in childCurtains"
-                :key="item.id"
-            >
-                <div class="name">{{ item.localName }}</div>
-                <div class="control-box">
-                    <div
-                        class="control"
-                        @click="handle('child',1,'开启中','EquipOnSet',item.id)"
-                    >
-                        <img :src="item.isActive && item.activeButton === 1 ? UpActiveIcon : UpUnActiveIcon" alt="">
-                    </div>
-                    <div
-                        class="control"
-                        @click="handle('child',2,'暂停中','StopSet',item.id)"
-                    >
-                        <img :src="item.isActive && item.activeButton === 2 ? StopActiveIcon : StopUnActiveIcon" alt="">
-                    </div>
-                    <div
-                        class="control"
-                        @click="handle('child',0,'关闭中','EquipOffSet',item.id)"
-                    >
-                        <img :src="item.isActive && item.activeButton === 0 ? DownActiveIcon : DownUnActiveIcon" alt="">
-                    </div>
-                </div>
-            </div>
+      </div>
+      <div class="right">
+        <div class="control_all" :class="topActive ? 'active' : ''" @click="handle('all', 1, '开启中', 'EquipOnSet')">
+          {{ $t(`common.全开`) }}
         </div>
+        <div class="control_all" :class="downActive ? 'active' : ''" @click="handle('all', 0, '关闭中', 'EquipOffSet')">
+          {{ $t(`common.全关`) }}
+        </div>
+      </div>
+    </div>
+    <div class="control_status">{{ controlStatus ? $t(`curtains.${controlStatus}`) : '' }}</div>
+    <div class="light-bottom">
+      <div class="item-box" v-for="item in childCurtains" :key="item.id">
+        <div class="name">{{ item.localName }}</div>
+        <div class="control-box">
+          <div class="control" @click="handle('child', 1, '开启中', 'EquipOnSet', item.id)">
+            <img :src="item.isActive && item.activeButton === 1 ? UpActiveIcon : UpUnActiveIcon" alt="" />
+          </div>
+          <div class="control" @click="handle('child', 2, '暂停中', 'StopSet', item.id)">
+            <img :src="item.isActive && item.activeButton === 2 ? StopActiveIcon : StopUnActiveIcon" alt="" />
+          </div>
+          <div class="control" @click="handle('child', 0, '关闭中', 'EquipOffSet', item.id)">
+            <img :src="item.isActive && item.activeButton === 0 ? DownActiveIcon : DownUnActiveIcon" alt="" />
+          </div>
+        </div>
+      </div>
     </div>
+  </div>
 </template>
 
 <script setup>
-import { httpSetEnv } from '@/apis/taiguv1';
-import curtainIcon from '@/assets/taiguv1/svg/Curtain_card_active_icon.svg';
-import DownActiveIcon from '@/assets/taiguv1/svg/down_active_icon.svg';
-import DownUnActiveIcon from '@/assets/taiguv1/svg/down_icon.svg';
-import StopActiveIcon from '@/assets/taiguv1/svg/stop_active_icon.svg';
-import StopUnActiveIcon from '@/assets/taiguv1/svg/stop_icon.svg';
-import UpActiveIcon from '@/assets/taiguv1/svg/up_active_icon.svg';
-import UpUnActiveIcon from '@/assets/taiguv1/svg/up_icon.svg';
-import { ref, watch } from "vue";
+import { httpSetEnv } from '@/apis/taiguv1'
+import curtainIcon from '@/assets/taiguv1/svg/Curtain_card_active_icon.svg'
+import DownActiveIcon from '@/assets/taiguv1/svg/down_active_icon.svg'
+import DownUnActiveIcon from '@/assets/taiguv1/svg/down_icon.svg'
+import StopActiveIcon from '@/assets/taiguv1/svg/stop_active_icon.svg'
+import StopUnActiveIcon from '@/assets/taiguv1/svg/stop_icon.svg'
+import UpActiveIcon from '@/assets/taiguv1/svg/up_active_icon.svg'
+import UpUnActiveIcon from '@/assets/taiguv1/svg/up_icon.svg'
+import { ref, watch } from 'vue'
 const props = defineProps({
-    currentCurtains: {
-        type: Array,
-        default: () => []
-    }
+  currentCurtains: {
+    type: Array,
+    default: () => []
+  }
 })
 const childCurtains = ref([])
 const controlStatus = ref('')
 const topActive = ref(false)
 const downActive = ref(false)
 let timer = null // 添加timer变量
-let btnTimer = null;
-const setEnnv = (type,value,code,curentID )=>{
-    const paramsData = []
-    if (type === 'all') {
-        childCurtains.value.forEach((item) => {
-            paramsData.push({
-                id:item.id,
-                value,
-                code
-            })
-        })
-    }else{
-        let paramsObj = {
-            id:curentID,
-            value,
-            code
-        }
-        paramsData.push(paramsObj)
+let btnTimer = null
+const setEnnv = (type, value, code, curentID) => {
+  const paramsData = []
+  if (type === 'all') {
+    childCurtains.value.forEach(item => {
+      paramsData.push({
+        id: item.id,
+        value,
+        code
+      })
+    })
+  } else {
+    let paramsObj = {
+      id: curentID,
+      value,
+      code
     }
-    httpSetEnv(paramsData)
+    paramsData.push(paramsObj)
+  }
+  httpSetEnv(paramsData)
 }
-const handle = (type, status, name,code, curentID) => {
-    controlStatus.value = name;
-    // 清除之前的定时器
-    if (timer) {
-        clearTimeout(timer);
-    }
-    if (btnTimer) {
-        clearTimeout(btnTimer);
-    }
-    // 设置新的定时器并保存引用
-    timer = setTimeout(() => {
-        controlStatus.value = '';
-    }, 3000);
-    if (type === 'all') {
-        if (status === 1) {
-            topActive.value = true;
-        } else {
-            downActive.value = true;
-        }
-        btnTimer = setTimeout(() => {
-            topActive.value = false;
-            downActive.value = false;
-        }, 100);
-        setEnnv(type,status,code )
+const handle = (type, status, name, code, curentID) => {
+  controlStatus.value = name
+  // 清除之前的定时器
+  if (timer) {
+    clearTimeout(timer)
+  }
+  if (btnTimer) {
+    clearTimeout(btnTimer)
+  }
+  // 设置新的定时器并保存引用
+  timer = setTimeout(() => {
+    controlStatus.value = ''
+  }, 3000)
+  if (type === 'all') {
+    if (status === 1) {
+      topActive.value = true
     } else {
-        setEnnv(type,status,code,curentID)
-        childCurtains.value.forEach((item) => {
-
-            if (item.id === curentID) {
-                item.activeButton = status;
-                item.isActive = true;
-            } else {
-                item.isActive = false;
-                item.activeButton = null;
-            }
-        })
-        btnTimer = setTimeout(() => {
-            childCurtains.value.forEach(item => {
-                item.isActive = false;
-                item.activeButton = null;
-            });
-        }, 1000);
+      downActive.value = true
     }
-};
-watch(
-   ()=>props.currentCurtains,
-   (newVal) => {
-    childCurtains.value = JSON.parse(JSON.stringify(newVal));
-    childCurtains.value.forEach(item=>{
+    btnTimer = setTimeout(() => {
+      topActive.value = false
+      downActive.value = false
+    }, 100)
+    setEnnv(type, status, code)
+  } else {
+    setEnnv(type, status, code, curentID)
+    childCurtains.value.forEach(item => {
+      if (item.id === curentID) {
+        item.activeButton = status
+        item.isActive = true
+      } else {
+        item.isActive = false
+        item.activeButton = null
+      }
+    })
+    btnTimer = setTimeout(() => {
+      childCurtains.value.forEach(item => {
         item.isActive = false
         item.activeButton = null
-    })  
-    },
-   { immediate: true } 
+      })
+    }, 1000)
+  }
+}
+watch(
+  () => props.currentCurtains,
+  newVal => {
+    childCurtains.value = JSON.parse(JSON.stringify(newVal))
+    childCurtains.value.forEach(item => {
+      item.isActive = false
+      item.activeButton = null
+    })
+  },
+  { immediate: true }
 )
-
 </script>
 <style lang="scss" scoped>
 .more-box {
-    .light-more-top {
+  .light-more-top {
+    display: flex;
+    align-items: center;
+    .left {
+      margin-right: 36px;
+      .light-box {
+        width: 110px;
+        height: 110px;
+        background: rgba(255, 255, 255, 0.4);
+        border-radius: 50%;
+        text-align: center;
+        margin-right: 27px;
+        img {
+          width: 36px;
+          height: 36px;
+          margin: 0 auto;
+          margin-top: 37px;
+        }
+      }
+    }
+    .right {
+      height: 92px;
+      display: flex;
+      flex-direction: column;
+      justify-content: space-between;
+      .control_all {
         display: flex;
+        width: 100px;
+        height: 40px;
+        padding: 8px 12px;
+        justify-content: center;
         align-items: center;
-        .left {
-            margin-right: 36px;
-            .light-box {
-                width: 110px;
-                height: 110px;
-                background: rgba(255, 255, 255, 0.4);
-                border-radius: 50%;
-                text-align: center;
-                margin-right: 27px;
-                img {
-                    width: 36px;
-                    height: 36px;
-                    margin: 0 auto;
-                    margin-top: 37px;
-                }
-            }
-        }
-        .right {
-            height: 92px;
-            display: flex;
-            flex-direction: column;
-            justify-content: space-between;
-            .control_all {
-                display: flex;
-                width: 100px;
-                height: 40px;
-                padding: 8px 12px;
-                justify-content: center;
-                align-items: center;
-                gap: 12px;
-                border-radius: 50px;
-                background: #e1e1df;
-                box-shadow: 0px 10px 20px 0px rgba(0, 0, 0, 0.05);
-                color: #001428;
-                text-align: center;
-                font-family: "PingFang SC";
-                font-size: 14px;
-                font-style: normal;
-                font-weight: 400;
-                line-height: 18px; /* 128.571% */
-                letter-spacing: 0.56px;
-            }
-            .control_all.active {
-                background: rgba(255, 255, 255, 1);
-                box-shadow: 0px 10px 20px 0px rgba(0, 20, 40, 0.1);
-            }
-        }
+        gap: 12px;
+        border-radius: 50px;
+        background: #e1e1df;
+        box-shadow: 0px 10px 20px 0px rgba(0, 0, 0, 0.05);
+        color: #001428;
+        text-align: center;
+        font-family: 'PingFang SC';
+        font-size: 14px;
+        font-style: normal;
+        font-weight: 400;
+        line-height: 18px; /* 128.571% */
+        letter-spacing: 0.56px;
+      }
+      .control_all.active {
+        background: rgba(255, 255, 255, 1);
+        box-shadow: 0px 10px 20px 0px rgba(0, 20, 40, 0.1);
+      }
     }
-    .control_status {
-        margin-top: 12px;
-        width: 110px;
-        height: 22px;
+  }
+  .control_status {
+    margin-top: 12px;
+    width: 110px;
+    height: 22px;
+    color: var(--Blue, #001428);
+    text-align: center;
+    /* Chi/Body Large */
+    font-family: 'PingFang SC';
+    font-size: 16px;
+    font-style: normal;
+    font-weight: 300;
+    line-height: normal;
+    letter-spacing: 0.32px;
+  }
+  .light-bottom {
+    margin-top: 36px;
+    .item-box {
+      display: flex;
+      width: 300px;
+      height: 84px;
+      padding: 20px 23px 24px 24px;
+      justify-content: space-between;
+      align-items: center;
+      /* card shadow */
+      box-shadow: 0px 10px 20px 0px rgba(0, 20, 40, 0.05);
+      border-radius: 24px 24px 44px 24px;
+      background: rgba(255, 255, 255, 0.2);
+      margin-bottom: 12px;
+      .name {
+        //styleName: Chi/Body Regular;
         color: var(--Blue, #001428);
-        text-align: center;
-        /* Chi/Body Large */
-        font-family: "PingFang SC";
-        font-size: 16px;
+        font-family: 'PingFang SC';
+        font-size: 14px;
         font-style: normal;
-        font-weight: 300;
+        font-weight: 400;
         line-height: normal;
-        letter-spacing: 0.32px;
-    }
-    .light-bottom {
-        margin-top: 36px;
-        .item-box {
-            display: flex;
-            width: 300px;
-            height: 84px;
-            padding: 20px 23px 24px 24px;
-            justify-content: space-between;
-            align-items: center;
-            /* card shadow */
-            box-shadow: 0px 10px 20px 0px rgba(0, 20, 40, 0.05);
-            border-radius: 24px 24px 44px 24px;
-            background: rgba(255, 255, 255, 0.2);
-            margin-bottom: 12px;
-            .name {
-                //styleName: Chi/Body Regular;
-                color: var(--Blue, #001428);
-                font-family: "PingFang SC";
-                font-size: 14px;
-                font-style: normal;
-                font-weight: 400;
-                line-height: normal;
-                letter-spacing: 0.28px;
-            }
-            .control-box {
-                display: flex;
-                justify-content: space-between;
-                align-items: center;
-                .control {
-                    display: flex;
-                    width: 36px;
-                    height: 36px;
-                    justify-content: center;
-                    align-items: center;
-                    margin-left: 10px;
-                    // img{
-                    //     width: 17px;
-                    //     height: 17px; 
-                    // }
-                   
-                }
-            }
-        }
-        .light-box-active {
-            background: rgba(255, 255, 255, 0.6);
+        letter-spacing: 0.28px;
+      }
+      .control-box {
+        display: flex;
+        justify-content: space-between;
+        align-items: center;
+        .control {
+          display: flex;
+          width: 36px;
+          height: 36px;
+          justify-content: center;
+          align-items: center;
+          margin-left: 10px;
+          // img{
+          //     width: 17px;
+          //     height: 17px;
+          // }
         }
+      }
+    }
+    .light-box-active {
+      background: rgba(255, 255, 255, 0.6);
     }
+  }
 }
 </style>
 <

+ 196 - 198
src/views/envmonitor/taiguv1/components/Curtain/index.vue

@@ -1,243 +1,241 @@
 <template>
-    <div
-        class="volumn-box"
-        :class="isOpen ? 'active' : ''"
-    >
-        <div>
-
-            <div class="top">
-                <img
-                    :src="isOpen ? CurtainCardIcon : CurtainCardUnActiveIcon"
-                    alt=""
-                />
-            </div>
-            <div class="filter-box" v-if="curtainsList.length > 1">
-                <div
-                    class="filter-item"
-                    @click="searchMore"
-                >
-                    <img
-                        :src="FilterIcon"
-                        alt=""
-                    />
-                </div>
-            </div>
+  <div class="volumn-box" :class="isOpen ? 'active' : ''">
+    <div>
+      <div class="top">
+        <img :src="isOpen ? CurtainCardIcon : CurtainCardUnActiveIcon" alt="" />
+      </div>
+      <div class="filter-box" v-if="curtainsList.length > 1">
+        <div class="filter-item" @click="searchMore">
+          <img :src="FilterIcon" alt="" />
         </div>
-        <div class="bottom">
-            <div class="text">{{ $t(`curtains.窗帘`) }}</div>
-            <div class="status">{{ controlStatus ? $t(`curtains.${controlStatus}`) :''}}</div>
-            <div class="control-box">
-                <div
-                    v-for="item in controlName"
-                    :key="item.value"
-                >
-                    <div
-                        class="control-item"
-                        @click.stop="handle(item.value, item.status,item.code)"
-                    >
-                        <img
-                            :src="item.isActive ? item.iconActive : item.iconUnActive"
-                            alt=""
-                        >
-                    </div>
-
-                </div>
-            </div>
+      </div>
+    </div>
+    <div class="bottom">
+      <div class="text">{{ $t(`curtains.窗帘`) }}</div>
+      <div class="status">{{ controlStatus ? $t(`curtains.${controlStatus}`) : '' }}</div>
+      <div class="control-box">
+        <div v-for="item in controlName" :key="item.value">
+          <div class="control-item" @click.stop="handle(item.value, item.status, item.code)">
+            <img :src="item.isActive ? item.iconActive : item.iconUnActive" alt="" />
+          </div>
         </div>
+      </div>
     </div>
+  </div>
 </template>
 
 <script setup>
-import { httpSetEnv } from '@/apis/taiguv1';
-import CurtainCardIcon from '@/assets/taiguv1/svg/Curtain_card_active_icon.svg';
-import CurtainCardUnActiveIcon from '@/assets/taiguv1/svg/Curtain_card_unactive_icon.svg';
-import DownActiveIcon from '@/assets/taiguv1/svg/down_active_icon.svg';
-import DownUnActiveIcon from '@/assets/taiguv1/svg/down_icon.svg';
-import FilterIcon from '@/assets/taiguv1/svg/filter_icon.svg';
-import StopActiveIcon from '@/assets/taiguv1/svg/stop_active_icon.svg';
-import StopUnActiveIcon from '@/assets/taiguv1/svg/stop_icon.svg';
-import UpActiveIcon from '@/assets/taiguv1/svg/up_active_icon.svg';
-import UpUnActiveIcon from '@/assets/taiguv1/svg/up_icon.svg';
-import { onBeforeUnmount, onMounted, ref, watch } from "vue";
+import { httpSetEnv } from '@/apis/taiguv1'
+import CurtainCardIcon from '@/assets/taiguv1/svg/Curtain_card_active_icon.svg'
+import CurtainCardUnActiveIcon from '@/assets/taiguv1/svg/Curtain_card_unactive_icon.svg'
+import DownActiveIcon from '@/assets/taiguv1/svg/down_active_icon.svg'
+import DownUnActiveIcon from '@/assets/taiguv1/svg/down_icon.svg'
+import FilterIcon from '@/assets/taiguv1/svg/filter_icon.svg'
+import StopActiveIcon from '@/assets/taiguv1/svg/stop_active_icon.svg'
+import StopUnActiveIcon from '@/assets/taiguv1/svg/stop_icon.svg'
+import UpActiveIcon from '@/assets/taiguv1/svg/up_active_icon.svg'
+import UpUnActiveIcon from '@/assets/taiguv1/svg/up_icon.svg'
+import { onBeforeUnmount, onMounted, ref, watch } from 'vue'
 const controlStatus = ref('')
 const controlName = ref([
-    { isActive: false, name: '上', value: 1, status: '开启中', code: 'EquipOnSet', iconActive: UpActiveIcon, iconUnActive: UpUnActiveIcon },
-    { isActive: false, name: '停', value: 2, status: '暂停中', code: 'StopSet', iconActive: StopActiveIcon, iconUnActive: StopUnActiveIcon },
-    { isActive: false, name: '下', value: 0, status: '关闭中', code: 'EquipOffSet', iconActive: DownActiveIcon, iconUnActive: DownUnActiveIcon },
+  {
+    isActive: false,
+    name: '上',
+    value: 1,
+    status: '开启中',
+    code: 'EquipOnSet',
+    iconActive: UpActiveIcon,
+    iconUnActive: UpUnActiveIcon
+  },
+  {
+    isActive: false,
+    name: '停',
+    value: 2,
+    status: '暂停中',
+    code: 'StopSet',
+    iconActive: StopActiveIcon,
+    iconUnActive: StopUnActiveIcon
+  },
+  {
+    isActive: false,
+    name: '下',
+    value: 0,
+    status: '关闭中',
+    code: 'EquipOffSet',
+    iconActive: DownActiveIcon,
+    iconUnActive: DownUnActiveIcon
+  }
 ])
 const isOpen = ref(true)
 const isActive = ref(false)
 const emit = defineEmits(['showMore'])
 const searchMore = () => {
-    emit("showMore", 'curtain', true);
+  emit('showMore', 'curtain', true)
 }
 let timer = null // 添加timer变量
-let btnTimer = null;
+let btnTimer = null
 const curtainsList = ref([])
 const handle = (value, status, code) => {
-    controlStatus.value = status;
-    // 下发指令
-    setEnv(value, code)
-    if (btnTimer) {
-        clearTimeout(btnTimer);
-    }
-    controlName.value.forEach(item => {
-        if (item.value === value) {
-            item.isActive = true;
-            btnTimer = setTimeout(() => {
-                item.isActive = false;
-            }, 700);
-        } else {
-            item.isActive = false;
-        }
-    });
-
-    if (timer) {
-        clearTimeout(timer);
+  controlStatus.value = status
+  // 下发指令
+  setEnv(value, code)
+  if (btnTimer) {
+    clearTimeout(btnTimer)
+  }
+  controlName.value.forEach(item => {
+    if (item.value === value) {
+      item.isActive = true
+      btnTimer = setTimeout(() => {
+        item.isActive = false
+      }, 700)
+    } else {
+      item.isActive = false
     }
-    // 设置新的定时器并保存引用
-    timer = setTimeout(() => {
-        controlStatus.value = '';
-    }, 3000);
+  })
 
+  if (timer) {
+    clearTimeout(timer)
+  }
+  // 设置新的定时器并保存引用
+  timer = setTimeout(() => {
+    controlStatus.value = ''
+  }, 3000)
 }
 const props = defineProps({
-    currentCurtains: {
-        type: Array,
-        default: () => []
-    }
+  currentCurtains: {
+    type: Array,
+    default: () => []
+  }
 })
 
 const setEnv = (value, code) => {
-    let paramsData = []
-    curtainsList.value.forEach(item => {
-        paramsData.push({
-            id: item.id,
-            value,
-            code
-        })
+  let paramsData = []
+  curtainsList.value.forEach(item => {
+    paramsData.push({
+      id: item.id,
+      value,
+      code
     })
-    httpSetEnv(paramsData)
+  })
+  httpSetEnv(paramsData)
 }
 watch(
-    () => props.currentCurtains,
-    (newVal) => {
-        curtainsList.value = JSON.parse(JSON.stringify(newVal));
-
-    },
-    { immediate: true }
-);
+  () => props.currentCurtains,
+  newVal => {
+    curtainsList.value = JSON.parse(JSON.stringify(newVal))
+  },
+  { immediate: true }
+)
 watch(
-    () => props.modeType,
-    (newVal) => {
-        if (newVal) {
-            httpSetEnv(curtainsList.value);
-        }
-        // 场景切换了,需要设置环境
-    },
-    { immediate: true }
-);
-
-onBeforeUnmount(() => { });
-onMounted(() => { });
+  () => props.modeType,
+  newVal => {
+    if (newVal) {
+      httpSetEnv(curtainsList.value)
+    }
+    // 场景切换了,需要设置环境
+  },
+  { immediate: true }
+)
 
+onBeforeUnmount(() => {})
+onMounted(() => {})
 </script>
 <style lang="scss" scoped>
 .volumn-box {
-    box-sizing: border-box;
+  box-sizing: border-box;
+  display: flex;
+  flex-direction: column;
+  justify-content: space-between;
+  padding: 16px;
+  width: 100%;
+  height: 100%;
+  border-radius: 24px 24px 44px 24px;
+  background: rgba(255, 255, 255, 0.2);
+  backdrop-filter: blur(40px);
+  box-shadow: 0px 10px 20px 0px rgba(0, 20, 40, 0.1);
+
+  .filter-box {
+    margin-top: 10px;
+    display: flex;
+    justify-content: flex-end;
+    gap: 10px;
+    .filter-item {
+      display: flex;
+      width: 36px;
+      height: 36px;
+      justify-content: center;
+      align-items: center;
+      gap: 10px;
+      flex-shrink: 0;
+      border-radius: 60px;
+      background: var(--White-White-40, rgba(255, 255, 255, 0.4));
+    }
+  }
+  .top {
     display: flex;
-    flex-direction: column;
     justify-content: space-between;
-    padding: 16px;
-    width: 100%;
-    height: 100%;
-    border-radius: 24px 24px 44px 24px;
-    background: rgba(255, 255, 255, 0.2);
-    backdrop-filter: blur(40px);
-    box-shadow: 0px 10px 20px 0px rgba(0, 20, 40, 0.1);
-
-    .filter-box {
-        margin-top: 10px;
-        display: flex;
-        justify-content: flex-end;
-        gap: 10px;
-        .filter-item {
-            display: flex;
-            width: 36px;
-            height: 36px;
-            justify-content: center;
-            align-items: center;
-            gap: 10px;
-            flex-shrink: 0;
-            border-radius: 60px;
-            background: var(--White-White-40, rgba(255, 255, 255, 0.4));
-        }
+    align-items: center;
+    img {
+      width: 30px;
+      height: 30px;
     }
-    .top {
+  }
+  .bottom {
+    .text {
+      //styleName: Chi/Body Large;
+      font-family: PingFang SC;
+      font-size: 16px;
+      font-weight: 300;
+      line-height: 22px;
+      letter-spacing: 0.02em;
+      text-align: left;
+      text-underline-position: from-font;
+      text-decoration-skip-ink: none;
+      color: rgba(255, 255, 255, 1);
+      padding-bottom: 2px;
+    }
+    .status {
+      //styleName: Chi/Body XS;
+      height: 15px;
+      margin-bottom: 8px;
+      color: var(--Grey, #74808d);
+      font-family: 'PingFang SC';
+      font-size: 11px;
+      font-style: normal;
+      font-weight: 400;
+      line-height: normal;
+      letter-spacing: 0.22px;
+    }
+    .control-box {
+      width: 100%;
+      display: flex;
+      justify-content: space-between;
+      .control-item {
         display: flex;
-        justify-content: space-between;
         align-items: center;
-        img {
-            width: 30px;
-            height: 30px;
-        }
-    }
-    .bottom {
-        .text {
-            //styleName: Chi/Body Large;
-            font-family: PingFang SC;
-            font-size: 16px;
-            font-weight: 300;
-            line-height: 22px;
-            letter-spacing: 0.02em;
-            text-align: left;
-            text-underline-position: from-font;
-            text-decoration-skip-ink: none;
-            color: rgba(255, 255, 255, 1);
-            padding-bottom: 2px;
-        }
-        .status {
-            //styleName: Chi/Body XS;
-            height: 15px;
-            margin-bottom: 8px;
-            color: var(--Grey, #74808d);
-            font-family: "PingFang SC";
-            font-size: 11px;
-            font-style: normal;
-            font-weight: 400;
-            line-height: normal;
-            letter-spacing: 0.22px;
-        }
-        .control-box {
-            width: 100%;
-            display: flex;
-            justify-content: space-between;
-            .control-item {
-                display: flex;
-                align-items: center;
-                justify-content: center;
-                width: 36px;
-                height: 36px;
-                // img {
-                //     width: 17px;
-                //     height: 17px;
-                // }
-            }
-        }
+        justify-content: center;
+        width: 36px;
+        height: 36px;
+        // img {
+        //     width: 17px;
+        //     height: 17px;
+        // }
+      }
     }
+  }
 }
 .active {
-    background: rgba(255, 255, 255, 0.8);
-    backdrop-filter: blur(40px);
-    box-shadow: 0px 10px 20px 0px rgba(0, 20, 40, 0.1);
+  background: rgba(255, 255, 255, 0.8);
+  backdrop-filter: blur(40px);
+  box-shadow: 0px 10px 20px 0px rgba(0, 20, 40, 0.1);
 
-    .bottom {
-        .text {
-            color: rgba(0, 20, 40, 1);
-        }
-        .status {
-            color: rgba(116, 128, 141, 1);
-        }
+  .bottom {
+    .text {
+      color: rgba(0, 20, 40, 1);
+    }
+    .status {
+      color: rgba(116, 128, 141, 1);
     }
+  }
 }
 </style>

+ 201 - 223
src/views/envmonitor/taiguv1/components/Lamp/index.vue

@@ -1,64 +1,38 @@
 <template>
-    <div
-        class="volumn-box"
-        :class="lampData.isOpen ? 'active' : ''"
-    >
-        <div>
-            <div class="top">
-                <img
-                    :src="parseImgUrl('taiguv1/envmonitor', lampData.isOpen ? 'active/lamp.svg' : 'lamp.svg')"
-                    alt=""
-                />
-                <div class="top-right">
-                    <SwitchButton
-                        :loading="allLampStatus.all?.loading"
-                        @click.stop
-                        v-model="lampData.isOpen"
-                        @change="setLampStatus('isOpen')"
-                    />
-                </div>
-            </div>
-            <div class="filter-box">
-                <div
-                    class="filter-item"
-                    @click="searchMore"
-                >
-                    <img
-                        :src="FilterIcon"
-                        alt=""
-                    />
-                </div>
-            </div>
+  <div class="volumn-box" :class="lampData.isOpen ? 'active' : ''">
+    <div>
+      <div class="top">
+        <img :src="parseImgUrl('taiguv1/envmonitor', lampData.isOpen ? 'active/lamp.svg' : 'lamp.svg')" alt="" />
+        <div class="top-right">
+          <SwitchButton
+            :loading="allLampStatus.all?.loading"
+            @click.stop
+            v-model="lampData.isOpen"
+            @change="setLampStatus('isOpen')" />
         </div>
+      </div>
+      <div class="filter-box">
+        <div class="filter-item" @click="searchMore">
+          <img :src="FilterIcon" alt="" />
+        </div>
+      </div>
+    </div>
 
-        <div class="bottom">
-            <div class="bottom-box">
-                <div class="bottom-left">
-                    <div class="text">{{ $t(`lamp.光照`) }}</div>
-                    <div class="status">{{ $t(`lamp.${lampData.lampStatusText}`) }}</div>
-                </div>
+    <div class="bottom">
+      <div class="bottom-box">
+        <div class="bottom-left">
+          <div class="text">{{ $t(`lamp.光照`) }}</div>
+          <div class="status">{{ $t(`lamp.${lampData.lampStatusText}`) }}</div>
+        </div>
 
-                <div
-                    class="bottom-right"
-                    v-if="lampData.isOpen"
-                >
-                    {{ lampData.brightValue||0 }} <sup>%</sup>
-                </div>
-            </div>
+        <div class="bottom-right" v-if="lampData.isOpen">{{ lampData.brightValue || 0 }} <sup>%</sup></div>
+      </div>
 
-            <div
-                class="lamp-slider"
-                v-if="lampData.isOpen"
-            >
-                <Slider
-                    v-model="lampData.brightValue"
-                    :min="min"
-                    :max="max"
-                    @onEnd="setLampStatus('bright')"
-                ></Slider>
-            </div>
-        </div>
+      <div class="lamp-slider" v-if="lampData.isOpen">
+        <Slider v-model="lampData.brightValue" :min="min" :max="max" @onEnd="setLampStatus('bright')"></Slider>
+      </div>
     </div>
+  </div>
 </template>
 
 <script setup>
@@ -75,21 +49,21 @@ const emit = defineEmits(['getStatus', 'showMore'])
 
 // 接收父组件传递的开关状态
 const props = defineProps({
-    lampStatus: {
-        type: Object,
-        default: () => {
-            return {
-                isOpen: false,
-                brightValue: 0
-            }
-        }
-    },
-    equipList: {
-        type: Array,
-        default: () => {
-            return []
-        }
+  lampStatus: {
+    type: Object,
+    default: () => {
+      return {
+        isOpen: false,
+        brightValue: 0
+      }
     }
+  },
+  equipList: {
+    type: Array,
+    default: () => {
+      return []
+    }
+  }
 })
 
 const store = useStore()
@@ -97,188 +71,192 @@ const deviceControl = useDeviceControl()
 const allLampStatus = computed(() => store.state.taiguv1.lampSwitchStatus)
 
 const searchMore = () => {
-    emit('showMore', 'lamp', true)
+  emit('showMore', 'lamp', true)
 }
 
 const lampData = ref({
-    isOpen: false,
-    brightValue: 0
+  isOpen: false,
+  brightValue: 0
 })
 
 watch(
-    () => props.lampStatus,
-    (newVal, oldVal) => {
-        if (!newVal) {
-            return
-        }
-        compareStatus(newVal)
-    },
-    { deep: true } // 添加深度监听
+  () => props.lampStatus,
+  (newVal, oldVal) => {
+    if (!newVal) {
+      return
+    }
+    compareStatus(newVal)
+  },
+  { deep: true } // 添加深度监听
 )
 
 const compareStatus = data => {
-    if (allLampStatus.value.all) {
-        if (allLampStatus.value.all.lastSwitchStatus == data.isOpen) {
-            store.dispatch('taiguv1/setLampStatus', {
-                id: 'all',
-                status: {
-                    loading: false,
-                    lastSwitchStatus: null
-                }
-            })
-            lampData.value = {
-                ...data,
-                isOpen: data.isOpen
-            }
-        } else {
-            lampData.value = {
-                ...data,
-                isOpen: allLampStatus.value.all.lastSwitchStatus
-            }
+  const updateLampData = () => {
+    lampData.value = {
+      ...data,
+      isOpen: data.isOpen
+    }
+  }
+  if (allLampStatus.value.all) {
+    if (allLampStatus.value.all.lastSwitchStatus == data.isOpen) {
+      store.dispatch('taiguv1/setLampStatus', {
+        id: 'all',
+        status: {
+          loading: false,
+          lastSwitchStatus: null
         }
+      })
+      updateLampData()
+    } else if (allLampStatus.value.all.lastSwitchStatus === null) {
+      updateLampData()
     } else {
-        lampData.value = {
-            ...data,
-            isOpen: data.isOpen
-        }
+      lampData.value = {
+        ...data,
+        isOpen: allLampStatus.value.all.lastSwitchStatus
+      }
+    }
+  } else {
+    lampData.value = {
+      ...data,
+      isOpen: data.isOpen
     }
-    emit('getStatus', lampData.value.isOpen)
+  }
+  emit('getStatus', lampData.value.isOpen)
 }
 
 const setLampStatus = type => {
-    if (type == 'isOpen') {
-        store.dispatch('taiguv1/setLampStatus', {
-            id: 'all',
-            status: {
-                loading: true,
-                lastSwitchStatus: lampData.value.isOpen
-            }
-        })
-    }
-    const params = deviceControl.assemblyLampCommand(lampData.value[type], type, props.equipList)
-    deviceControl.sendCommands(params)
+  if (type == 'isOpen') {
+    store.dispatch('taiguv1/setLampStatus', {
+      id: 'all',
+      status: {
+        loading: true,
+        lastSwitchStatus: lampData.value.isOpen
+      }
+    })
+  }
+  const params = deviceControl.assemblyLampCommand(lampData.value[type], type, props.equipList)
+  deviceControl.sendCommands(params)
 
-    emit('getStatus', lampData.value.isOpen)
+  emit('getStatus', lampData.value.isOpen)
 }
 </script>
 <style lang="scss" scoped>
 .volumn-box {
-    box-sizing: border-box;
+  box-sizing: border-box;
+  display: flex;
+  flex-direction: column;
+  justify-content: space-between;
+  padding: 16px;
+  width: 100%;
+  height: 100%;
+  border-radius: 24px 24px 44px 24px;
+  background-color: rgba(255, 255, 255, 0.2);
+  backdrop-filter: blur(40px);
+  box-shadow: 0px 10px 20px 0px rgba(0, 20, 40, 0.1);
+  .top {
     display: flex;
-    flex-direction: column;
     justify-content: space-between;
-    padding: 16px;
-    width: 100%;
-    height: 100%;
-    border-radius: 24px 24px 44px 24px;
-    background-color: rgba(255, 255, 255, 0.2);
-    backdrop-filter: blur(40px);
-    box-shadow: 0px 10px 20px 0px rgba(0, 20, 40, 0.1);
-    .top {
-        display: flex;
-        justify-content: space-between;
-        align-items: center;
-        img {
-            width: 30px;
-            height: 30px;
-        }
+    align-items: center;
+    img {
+      width: 30px;
+      height: 30px;
     }
-    .filter-box {
-        margin-top: 10px;
-        display: flex;
-        justify-content: flex-end;
-        gap: 10px;
-        .filter-item {
-            display: flex;
-            width: 36px;
-            height: 36px;
-            justify-content: center;
-            align-items: center;
-            gap: 10px;
-            flex-shrink: 0;
-            border-radius: 60px;
-            background: var(--White-White-40, rgba(255, 255, 255, 0.4));
-        }
+  }
+  .filter-box {
+    margin-top: 10px;
+    display: flex;
+    justify-content: flex-end;
+    gap: 10px;
+    .filter-item {
+      display: flex;
+      width: 36px;
+      height: 36px;
+      justify-content: center;
+      align-items: center;
+      gap: 10px;
+      flex-shrink: 0;
+      border-radius: 60px;
+      background: var(--White-White-40, rgba(255, 255, 255, 0.4));
     }
-    .bottom {
-        .bottom-box {
-           
-            flex: 1;
-            display: flex;
-            justify-content: space-between;
-        }
-        .text {
-            width: 100%;
-            //styleName: Chi/Body Large;
-            font-family: PingFang SC;
-            font-size: 16px;
-            font-weight: 300;
-            line-height: 22px;
-            letter-spacing: 0.02em;
-            text-align: left;
-            text-underline-position: from-font;
-            text-decoration-skip-ink: none;
-            color: rgba(255, 255, 255, 1);
-            padding-bottom: 2px;
-        }
-        .status {
-            width: 100%;
-            //styleName: Chi/Body XS;
-            font-family: PingFang SC;
-            font-size: 11px;
-            font-weight: 400;
-            line-height: 14px;
-            letter-spacing: 0.02em;
-            color: rgba(255, 255, 255, 0.4);
-        }
-        .bottom-right {
-            text-align: center;
-            color: var(--Blue, #001428);
-            /* En/H2 */
-            font-family: Jost;
-            font-size: 20px;
-            font-style: normal;
-            font-weight: 300;
-            line-height: normal;
-            width: 50px;
-            height: 30px;
-            // color: var(--Blue, #001428);
-            align-self: end;
-            line-height: 100%;
-            display: flex;
-            align-items: center;
-            justify-content: end;
-        }
-        .lamp-slider {
-            background: rgba(255, 255, 255, 0.6);
-            width: 100%;
-            height: 34px;
-            border-radius: 12px;
-        }
+  }
+  .bottom {
+    .bottom-box {
+      flex: 1;
+      display: flex;
+      justify-content: space-between;
+    }
+    .text {
+      width: 100%;
+      //styleName: Chi/Body Large;
+      font-family: PingFang SC;
+      font-size: 16px;
+      font-weight: 300;
+      line-height: 22px;
+      letter-spacing: 0.02em;
+      text-align: left;
+      text-underline-position: from-font;
+      text-decoration-skip-ink: none;
+      color: rgba(255, 255, 255, 1);
+      padding-bottom: 2px;
+    }
+    .status {
+      width: 100%;
+      //styleName: Chi/Body XS;
+      font-family: PingFang SC;
+      font-size: 11px;
+      font-weight: 400;
+      line-height: 14px;
+      letter-spacing: 0.02em;
+      color: rgba(255, 255, 255, 0.4);
     }
-    // .switch-btn {
-    //     // margin-top: 0;
-    //     // width: 50px !important;
-    //     // height: 28px !important;
-    //     // border: none;
-    // }
+    .bottom-right {
+      text-align: center;
+      color: var(--Blue, #001428);
+      /* En/H2 */
+      font-family: Jost;
+      font-size: 20px;
+      font-style: normal;
+      font-weight: 300;
+      line-height: normal;
+      width: 50px;
+      height: 30px;
+      // color: var(--Blue, #001428);
+      align-self: end;
+      line-height: 100%;
+      display: flex;
+      align-items: center;
+      justify-content: end;
+    }
+    .lamp-slider {
+      background: rgba(255, 255, 255, 0.6);
+      width: 100%;
+      height: 34px;
+      border-radius: 12px;
+    }
+  }
+  // .switch-btn {
+  //     // margin-top: 0;
+  //     // width: 50px !important;
+  //     // height: 28px !important;
+  //     // border: none;
+  // }
 }
 .active {
-    background: rgba(255, 255, 255, 0.8);
-    backdrop-filter: blur(40px);
-    box-shadow: 0px 10px 20px 0px rgba(0, 20, 40, 0.1);
+  background: rgba(255, 255, 255, 0.8);
+  backdrop-filter: blur(40px);
+  box-shadow: 0px 10px 20px 0px rgba(0, 20, 40, 0.1);
 
-    .bottom {
-        .text {
-            color: rgba(0, 20, 40, 1);
-        }
-        .status {
-            color: rgba(116, 128, 141, 1);
-        }
-        .bottom-right {
-            font-family: Jost;
-            color: rgba(0, 20, 40, 1);
-        }
+  .bottom {
+    .text {
+      color: rgba(0, 20, 40, 1);
+    }
+    .status {
+      color: rgba(116, 128, 141, 1);
+    }
+    .bottom-right {
+      font-family: Jost;
+      color: rgba(0, 20, 40, 1);
     }
+  }
 }
 </style>

+ 14 - 4
src/views/envmonitor/taiguv1/components/Screen/index.vue

@@ -26,6 +26,7 @@
                 {{$t(`screen.无线投屏`)}}
             </div>
             <div
+                 v-if="roomInfo.name !=='ROOM NAIAD' && roomInfo.name !=='ROOM METIS'"
                 class="btn"
                 :class="screenData.runStatus == 3 ? 'btn-active' : ''"
                 @click="setScreenStatus('runStatus',3)"
@@ -56,11 +57,15 @@ const props = defineProps({
         default: () => {
             return []
         }
-    }
+    },
+    roomInfo: {
+        type: Object,
+        default: () => { }
+    },
 })
 const allScreenStatus = computed(() => store.state.taiguv1.screenSwitchStatus)
 const screenData = ref({
-    runStatus: 1
+    runStatus: 2
 })
 watch(
     () => props.screenStatus,
@@ -68,10 +73,15 @@ watch(
         if (!newVal) {
             return
         }
-        screenData.value = {...newVal}
+        screenData.value = { ...newVal }
     },
     { deep: true } // 添加深度监听
 )
+watch(
+    // 
+    () => props.roomInfo,
+    { immediate: true } // 添加深度监听
+)
 const deviceControl = useDeviceControl()
 
 const setScreenStatus = (type, value) => {
@@ -88,7 +98,7 @@ const setScreenStatus = (type, value) => {
     const equipListFirst = props.equipList[0]
     equipListFirst.inCloudSet = value
     //  console.log(equipListFirst,'equipListFirst');
-     
+
     const params = deviceControl.assemblyScreenCommand(screenData.value[type], type, equipListFirst)
     deviceControl.sendCommands(params)
 }

Різницю між файлами не показано, бо вона завелика
+ 655 - 714
src/views/envmonitor/taiguv1/index.vue