瀏覽代碼

fix: pad手动控制加班的bug修改

chenzhen2 2 年之前
父節點
當前提交
979beea287

+ 52 - 10
src/styles/comMedia.scss

@@ -1,42 +1,84 @@
-@media screen  and (min-width: 0px) and (max-width: 414px) {
+@media screen and (min-width: 0px) and (max-width: 414px) {
+  .choice-space {
     .space-box {
       width: 100% !important;
     }
   }
-  @media screen and (min-width: 414px) and (max-width: 640px) {
+
+}
+
+@media screen and (min-width: 414px) and (max-width: 640px) {
+  .choice-space {
     .space-box {
       width: 50% !important;
     }
   }
-  @media screen and (min-width: 640px) and (max-width: 1200px) {
+
+}
+
+@media screen and (min-width: 640px) and (max-width: 1200px) {
+  .choice-space {
     .space-box {
       width: 33.33% !important;
     }
   }
-  @media screen and (min-width: 1200px) and (max-width: 1440px) {
+
+}
+
+@media screen and (min-width: 1200px) and (max-width: 1440px) {
+  .choice-space {
     .space-box {
       width: 25% !important;
     }
   }
-  @media screen and (min-width: 1440px){
+
+}
+
+@media screen and (min-width: 1440px) {
+  .choice-space {
     .space-box {
       width: 20% !important;
     }
   }
 
-  
-  @media screen  and (min-width: 0px) and (max-width: 585px) {
+}
+
+
+@media screen and (min-width: 0px) and (max-width: 585px) {
+  .scene-config {
     .time-btn-small {
       width: 68px !important;
     }
   }
-  @media screen  and (min-width: 585px) and (max-width: 700px) {
+
+}
+
+@media screen and (min-width: 585px) and (max-width: 700px) {
+  .scene-config {
     .time-btn-small {
       width: 58px !important;
     }
   }
-  @media screen  and (min-width: 700px) and (max-width: 860px) {
+
+}
+
+@media screen and (min-width: 700px) and (max-width: 860px) {
+  .scene-config {
     .time-btn-small {
       width: 48px !important;
     }
-  }
+  }
+
+}
+
+@media screen and (max-width: 640px) {
+  .popup-content {
+    padding: 2.33vh 20px !important;
+  }
+}
+
+@media screen and (min-width: 640px) {
+  .popup-content {
+    padding: 2.33vh 15px !important;
+  }
+}

+ 3 - 2
src/styles/index.scss

@@ -1,6 +1,7 @@
 @import "font";
 @import 'svgicon';
 @import 'reset';
+@import "~@/styles/comMedia.scss";
 
 /* Global scss */
 * {
@@ -174,8 +175,8 @@ div:focus {
 .popup-content {
   height: 100%;
   width: 500px;
-  padding: 10px 20px;
-  // padding: 2.33vh 20px;
+  // padding: 10px 15px;
+  padding: 2.33vh 15px;
 }
 
 .van-switch--on {

+ 6 - 7
src/utils/index.ts

@@ -539,19 +539,18 @@ export const formateTimeContinuous: any = function (index: any = 1,
   startTime: any,
   endTime: any,
   type: any = 1, data: any = [], that: any) {
+  let todayDate: any = new Date()
+  let tomorrowData = new Date(todayDate.setTime(todayDate.getTime() + 24 * 60 * 60 * 1000))
   let nowDate: any = formatDate("YYYY-MM-DD");
+  let tomorrowDate: any = formatDate("YYYY-MM-DD", tomorrowData);
   data.map((item: any) => {
     // debugger
     let date: any = formatDateStr(item.date);
     let week: any = getWeekDate(new Date(date).getDay());
-    // console.log("dfff")
-    // console.log(nowDate)
-    // console.log(date)
-    // if (date == nowDate) {
-    //   item.week = "今天";
-    // }
     if (date == nowDate) {
-      week = '今天'
+      week = '今日'
+    } else if (date == tomorrowDate) {
+      week = '次日'
     }
     item.week = week;
   });

+ 1 - 1
src/views/choiceSpace/choiceSpace.vue

@@ -545,7 +545,7 @@ export default defineComponent({
 });
 </script>
 <style lang="scss" scoped>
-@import "~@/styles/comMedia.scss";
+// @import "~@/styles/comMedia.scss";
 .choice-space {
   width: 100%;
   height: 100%;

+ 6 - 0
src/views/envmonitor/components/Air/manualIndex.vue

@@ -631,6 +631,12 @@ export default defineComponent({
       },
       // 子设备降低温度
       changeChildItemAir(btnType: any, childItem: any, symbol: any) {
+        const domAirOpen = !childItem.isOpen;
+        if (proxyData.forceOverTimeFlag && domAirOpen) {
+          //需要强制加班
+          contx.emit("triggerWork", 2,childItem);
+          return;
+        }
         if (!childItem.isOpen && btnType !== "switch") {
           return;
         }

+ 20 - 19
src/views/envmonitor/components/Light/index.vue

@@ -26,24 +26,25 @@
       </div>
     </div>
     <!--灯控制按钮-->
-    <div
-      class="light-control"
-      v-for="(item, index) in lampList"
-      :key="item.id"
-      v-if="showFlag && isShowChildLight"
-    >
-      <div class="control-title">
-        {{ item.localName }}
+    <template v-if="showFlag && isShowChildLight">
+      <div
+        class="light-control"
+        v-for="(item, index) in lampList"
+        :key="item.id"
+      >
+        <div class="control-title">
+          {{ item.localName }}
+        </div>
+        <Switch
+          active-color="$elActiveColor"
+          :disabled="!userIsControl"
+          v-model="item.switch"
+          @click="eqChange('main', item, index)"
+          inactive-color="rgba(196, 196, 196, 0.2)"
+          class="switch-btn"
+        />
       </div>
-      <Switch
-        active-color="$elActiveColor"
-        :disabled="!userIsControl"
-        v-model="item.switch"
-        @click="eqChange('main', item, index)"
-        inactive-color="rgba(196, 196, 196, 0.2)"
-        class="switch-btn"
-      />
-    </div>
+    </template>
   </div>
 </template>
 
@@ -158,7 +159,7 @@ export default defineComponent({
           if (type === "allLamp") {
             if (proxyData.forceOverTimeFlag && proxyData.lampSw) {
               // 强制加班开灯
-              contx.emit("triggerWork",3);
+              contx.emit("triggerWork", 3);
               return;
             }
             //  总开关按钮所有灯
@@ -174,7 +175,7 @@ export default defineComponent({
           } else {
             if (proxyData.forceOverTimeFlag && item.switch) {
               // 强制加班开灯
-              contx.emit("triggerWork");
+              contx.emit("triggerWork", 3, item);
               return;
             }
             //当前要执行的灯的操作

+ 122 - 66
src/views/envmonitor/components/ManualWork/index.vue

@@ -53,7 +53,7 @@
       </div>
     </div>
     <!--预约的设备 start-->
-    <div class="device-title">
+    <div class="device-title" v-if="isLight || isAir">
       <span class="line"></span>
       <span class="text">预约开启设备</span>
       <span class="line"></span>
@@ -68,6 +68,7 @@
           >
             <div
               class="device-row"
+              :style="{ width: airNum == 1 ? '98%' : '48%' }"
               v-if="item.equipmentCategory !== 'SELTLT'"
               @click="checkEquipment(item)"
             >
@@ -94,10 +95,11 @@
           >
             <div
               class="device-row"
+              :style="{ width: lightNum == 1 ? '98%' : '48%' }"
               v-if="item.equipmentCategory === 'SELTLT'"
               @click="checkEquipment(item)"
             >
-              <span>{{ item.name }}</span>
+              <span>{{ item.localName }}</span>
               <img
                 :src="
                   item.isCheck
@@ -111,7 +113,7 @@
         </div>
       </template>
 
-      <div class="device-tip">
+      <div class="device-tip" v-if="isLight || isAir">
         <span>计费方式:</span>
         <p>
           <span> * </span>
@@ -187,6 +189,10 @@ export default defineComponent({
       type: Number,
       default: () => 1,
     },
+    deviceItem: {
+      type: Object,
+      default: () => null,
+    },
   },
   setup(props, context) {
     const proxyGlobal: any = getCurrentInstance();
@@ -218,6 +224,7 @@ export default defineComponent({
       startLen: 0,
       formBtn: false,
       showLoading: false,
+      deviceItem: props.deviceItem,
       enterType: props.enterType, // 1:all 2:空调 3:灯
       setScreennWidth() {
         let addTimeEl: any = document.querySelector("#addTimeId");
@@ -734,40 +741,80 @@ export default defineComponent({
       myTimeArr: myTimeArr,
       isAir: false,
       isLight: false,
+      lightNum: 0,
+      airNum: 0,
       // 格式化设备
       formateEquipment() {
         proxyData.isLight = false;
         proxyData.isAir = false;
-        if (proxyData.enterType === 1) {
-          proxyData.nowData.equipmentList.map((item: any) => {
-            item.isCheck = true;
-          });
-        } else if (proxyData.enterType === 2) {
-          proxyData.nowData.equipmentList.map((item: any) => {
-            if (item.equipmentCategory !== "SELTLT") {
+        proxyData.lightNum = 0;
+        proxyData.airNum = 0;
+        if (
+          proxyData.nowData &&
+          proxyData.nowData.equipmentList &&
+          proxyData.nowData.equipmentList.length
+        ) {
+          if (proxyData.enterType === 1) {
+            proxyData.nowData.equipmentList.map((item: any) => {
               item.isCheck = true;
+            });
+          } else if (proxyData.enterType === 2) {
+            // 空调
+            if (proxyData.deviceItem && proxyData.deviceItem.id) {
+              proxyData.nowData.equipmentList.map((item: any) => {
+                if (
+                  item.equipmentCategory !== "SELTLT" &&
+                  proxyData.deviceItem.id == item.id
+                ) {
+                  item.isCheck = true;
+                } else {
+                  item.isCheck = false;
+                }
+              });
+            } else {
+              proxyData.nowData.equipmentList.map((item: any) => {
+                if (item.equipmentCategory !== "SELTLT") {
+                  item.isCheck = true;
+                } else {
+                  item.isCheck = false;
+                }
+              });
+            }
+          } else {
+            // 灯
+            if (proxyData.deviceItem && proxyData.deviceItem.id) {
+              proxyData.nowData.equipmentList.map((item: any) => {
+                if (
+                  item.equipmentCategory === "SELTLT" &&
+                  proxyData.deviceItem.id == item.id
+                ) {
+                  item.isCheck = true;
+                } else {
+                  item.isCheck = false;
+                }
+              });
             } else {
-              item.isCheck = false;
+              proxyData.nowData.equipmentList.map((item: any) => {
+                if (item.equipmentCategory === "SELTLT") {
+                  item.isCheck = true;
+                } else {
+                  item.isCheck = false;
+                }
+              });
             }
-          });
-        } else {
+          }
+          // 判断是否有空调和灯
           proxyData.nowData.equipmentList.map((item: any) => {
+            if (item.equipmentCategory == "SELTLT") {
+              proxyData.isLight = true;
+              proxyData.lightNum++;
+            }
             if (item.equipmentCategory !== "SELTLT") {
-              item.isCheck = false;
-            } else {
-              item.isCheck = true;
+              proxyData.isAir = true;
+              proxyData.airNum++;
             }
           });
         }
-        // 判断是否有空调和灯
-        proxyData.nowData.equipmentList.map((item: any) => {
-          if (item.equipmentCategory == "SELTLT") {
-            proxyData.isLight = true;
-          }
-          if (item.equipmentCategory !== "SELTLT") {
-            proxyData.isAir = true;
-          }
-        });
       },
       // 加班时间是否在所有的服务定制时间之前
       isCusTimeBefore(spaceCustomContentList: any, time: any) {
@@ -869,13 +916,13 @@ export default defineComponent({
           proxyData.dateArr.push({
             date: date,
             isActive: false,
-            equipmentList: data[i].equipmentList,
+            equipmentList: data[i].equipmentList || [],
             oldDate: data[i].date,
             objectId: data[i].objectId,
             cusStartTime: data[i].cusStartTime,
             customSceneList: customSceneList,
             cusEndTime: data[i].cusEndTime,
-            spaceCustomContentList: data[i].spaceCustomContentList,
+            spaceCustomContentList: data[i].spaceCustomContentList || [],
             day: getDate(new Date(date)),
             week: week,
             timerArr: timerArr,
@@ -1046,7 +1093,8 @@ export default defineComponent({
         console.log(item);
         let obj: any = {
           projectId: proxyData.projectId, //类型:String  必有字段  备注:项目id
-          sceneEquipList: item ? item.sceneEquipList : [],
+          sceneEquipList:
+            item && item.sceneEquipList ? item.sceneEquipList : [],
           objectId: proxyData.nowData.objectId, //类型:String  必有字段  备注:空间id
           sourceType: "sagacareAndtenantslink", //类型:String  必有字段  备注:sagacareAndtenantslink 来源
           startDate: proxyData.nowData.oldDate, //类型:String  必有字段  备注://开始日期
@@ -1227,14 +1275,16 @@ export default defineComponent({
           } else {
             formTimerArr.map((item: any) => {
               if (item.type == "1") {
-                item.sceneEquipList.map((scene: any) => {
-                  let obj: any = {
-                    projectId: scene.projectId, //类型:String  必有字段  备注:无
-                    objectId: scene.objectId, //类型:String  必有字段  备注:设备id
-                    type: scene.type,
-                  };
-                  sceneEquipList.push(obj);
-                });
+                if (item.sceneEquipList && item.sceneEquipList.length) {
+                  item.sceneEquipList.map((scene: any) => {
+                    let obj: any = {
+                      projectId: scene.projectId, //类型:String  必有字段  备注:无
+                      objectId: scene.objectId, //类型:String  必有字段  备注:设备id
+                      type: scene.type,
+                    };
+                    sceneEquipList.push(obj);
+                  });
+                }
               }
             });
           }
@@ -1304,13 +1354,14 @@ export default defineComponent({
             // debugger;
             if (type === 1) {
               // 添加
-              context.emit("closeWork");
-              // proxyGlobal.proxy.$loadinngEnd();
-              proxyData.showLoading = false;
             } else if (type === 2) {
               // 删除
               proxyData.isUpdate = true;
+              // context.emit("closeWork");
+              // proxyData.showLoading = false;
             }
+            context.emit("closeWork");
+            proxyData.showLoading = false;
             proxyData.formBtn = false;
           })
           .catch(() => {
@@ -1322,35 +1373,40 @@ export default defineComponent({
       isUpdate: false, // 删除更新弹窗数据
       triggerDelTime() {
         let formTimeArr: any = proxyData.formateDelTimer();
+        console.log("需要删除的数据---");
+        console.log(formTimeArr);
         if (formTimeArr && formTimeArr.length) {
           // console.log(formTimeArr);
           // alert("确定删除当前时间吗?");
+          // debugger;
           Dialog.confirm({
             title: "确认",
             message: "确定删除当前时间吗?",
           })
             .then(() => {
-              console.log("====");
-              console.log(formTimeArr);
               let sceneEquipList: any = [];
               formTimeArr.map((item: any) => {
                 if (item.type == "1") {
-                  item.sceneEquipList.map((scene: any) => {
-                    let obj: any = {
-                      projectId: scene.projectId, //类型:String  必有字段  备注:无
-                      objectId: scene.objectId, //类型:String  必有字段  备注:设备id
-                      type: scene.type,
-                    };
-                    sceneEquipList.push(obj);
-                  });
+                  if (item.sceneEquipList) {
+                    item.sceneEquipList.map((scene: any) => {
+                      let obj: any = {
+                        projectId: scene.projectId, //类型:String  必有字段  备注:无
+                        objectId: scene.objectId, //类型:String  必有字段  备注:设备id
+                        type: scene.type,
+                      };
+                      sceneEquipList.push(obj);
+                    });
+                  }
                 }
               });
               sceneEquipList = proxyData.removeDuplicateObj(sceneEquipList);
+
               formTimeArr.map((item: any) => {
                 if (item.type !== "1") {
                   item.sceneEquipList = sceneEquipList;
                 }
               });
+
               proxyData.saveBatchCustomScene(formTimeArr, 2);
             })
             .catch(() => {
@@ -1363,8 +1419,7 @@ export default defineComponent({
       proxyData.workkArr = newProps.workkArr;
       proxyData.projectId = newProps.projectId;
       proxyData.enterType = newProps.enterType;
-      console.log("newProps.enterType==", newProps.enterType);
-      console.log(newProps.enterType);
+      proxyData.deviceItem = newProps.deviceItem;
       if (proxyData.isUpdate) {
         proxyData.setWorkTimeList();
       }
@@ -1390,7 +1445,7 @@ export default defineComponent({
 }
 .work-space {
   width: 100%;
-  padding-left: 10px;
+  // padding-left: 10px;
   .space-title {
     padding-bottom: 10px;
     font-family: "Noto Sans SC";
@@ -1425,9 +1480,9 @@ export default defineComponent({
     padding-bottom: 5px;
 
     .date-item {
-      padding-top: 20px;
+      padding-top: 10px;
       width: 50px;
-      height: 74px;
+      height: 60px;
       box-sizing: border-box;
       border: 1px solid #eff0f1;
       border-radius: 16px;
@@ -1439,12 +1494,12 @@ export default defineComponent({
 
         &:nth-child(1) {
           font-family: "Noto Sans SC";
-          padding-bottom: 10px;
+          padding-bottom: 6px;
           font-style: normal;
           font-weight: 400;
-          font-size: 12px;
-          line-height: 12px;
-          transform: scale();
+          font-size: 14px;
+          line-height: 14px;
+          transform: scale(0.8);
           text-align: center;
           color: #8d9399;
         }
@@ -1453,8 +1508,8 @@ export default defineComponent({
           font-family: "Persagy";
           font-style: normal;
           font-weight: 700;
-          font-size: 14px;
-          line-height: 19px;
+          font-size: 16px;
+          // line-height: 19px;
           text-align: center;
           color: #000000;
         }
@@ -1469,8 +1524,7 @@ export default defineComponent({
 
   .sliders-list {
     position: relative;
-    // padding-top: 20px;
-    margin-top: 20px;
+    margin-top: 5px;
     height: 135px;
     white-space: nowrap;
     overflow-x: auto;
@@ -1577,7 +1631,8 @@ export default defineComponent({
   left: 50%;
   transform: translateX(-50%);
   display: flex;
-  padding-top: 10px;
+  justify-content: space-between;
+  // padding-top: 10px;
   text-align: center;
 
   .cancel-btn {
@@ -1614,7 +1669,7 @@ export default defineComponent({
 
 .work-device {
   // padding-top: 10px;
-  height: 27vh;
+  height: 36vh;
   overflow-y: auto;
   .device-tip {
     padding-top: 20px;
@@ -1648,7 +1703,8 @@ export default defineComponent({
     background: #f7f9fa;
     border-radius: 4px;
     margin-top: 10px;
-    line-height: 30px;
+    margin-bottom: 10px;
+    line-height: 20px;
     span {
       display: inline-block;
       font-family: "PingFang SC";
@@ -1667,7 +1723,7 @@ export default defineComponent({
   display: block;
   font-weight: 500;
   font-size: 14px;
-  line-height: 18px;
+  line-height: 14px;
   color: #000000;
   padding-top: 4px;
 }

+ 1 - 1
src/views/envmonitor/components/workOvertime/WorkConfig.vue

@@ -540,7 +540,7 @@ export default defineComponent({
 });
 </script>
 <style lang="scss" scoped>
-@import "~@/styles/comMedia.scss";
+// @import "~@/styles/comMedia.scss";
 .scene-config {
   display: flex;
   flex-wrap: wrap;

+ 1 - 0
src/views/envmonitor/components/workOvertime/index.vue

@@ -1044,6 +1044,7 @@ export default defineComponent({
             } else if (type === 2) {
               // 删除
               proxyData.isUpdate = true;
+              proxyData.showLoading = false;
               // proxyData.setWorkTimeList();
             }
             proxyData.formBtn = false;

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

@@ -242,6 +242,7 @@
       <manual-overtime
         v-if="isShowWork && controlMode === 1"
         :enterType="enterType"
+        :deviceItem="deviceItem"
         :spaceInfo="spaceInfo"
         @closeWork="closeWork"
         :projectId="projectId"
@@ -571,8 +572,10 @@ export default defineComponent({
     let nowWeek: any = getNowWeek();
     let padImgData: any = [];
     let controlMode: number = 0;
+    let deviceItem: any = null;
     const proxyData = reactive({
       enterType: 1,
+      deviceItem: deviceItem,
       parseImgUrl: parseImgUrl,
       fileUrl: proxyGlobal.proxy.$fileUrl,
       nowDate: nowDate,
@@ -830,9 +833,10 @@ export default defineComponent({
       /**
        * 加班
        */
-      triggerWork(type: any = 1) {
+      triggerWork(type: any = 1, deviceItem: any = null) {
         // console.log(type);
         proxyData.enterType = type;
+        proxyData.deviceItem = deviceItem || null;
         console.log("proxyData.enterType===");
         console.log(proxyData.enterType);
         proxyData.isShowWork = true;