Browse Source

fix: 手动控制的设定温度展示的处理

chenzhen2 2 years ago
parent
commit
920877bb68
1 changed files with 30 additions and 12 deletions
  1. 30 12
      src/views/envmonitor/components/Air/manualIndex.vue

+ 30 - 12
src/views/envmonitor/components/Air/manualIndex.vue

@@ -13,8 +13,8 @@
           v-if="equipList && equipList.length > 1"
         >
           <van-icon :name="lightIcon" class="light-icon" />
-          <span v-if="!showChild">显示全部</span>
-          <span v-else>收全部</span>
+          <span v-if="!showChild">查看全部</span>
+          <span v-else>收全部</span>
         </div>
       </div>
       <div class="air-right">
@@ -387,15 +387,32 @@ export default defineComponent({
       },
       // 设置温度条的位置
       setBarNowPerstion() {
-        let left: any =
-          ((proxyData.airTemp - proxyData.airData.minTempSet) / 0.5) *
-          proxyData.part;
-        left = Math.floor(left);
-        proxyData.realTemp = proxyData.airTemp;
+        // proxyData.airTemp=14
         let barBox: any = document.querySelector("#barId");
-        if (barBox) {
-          barBox.style.left = left + "px";
+        let sliderBox: any = document.querySelector("#sliderId");
+        if (
+          proxyData.airTemp >= proxyData.airData.minTempSet &&
+          proxyData.airTemp <= proxyData.airData.maxTempSet
+        ) {
+          // 正常温度范围
+          let left: any =
+            ((proxyData.airTemp - proxyData.airData.minTempSet) / 0.5) *
+            proxyData.part;
+          left = Math.floor(left);
+
+          if (barBox) {
+            barBox.style.left = left + "px";
+          }
+        } else {
+          if (proxyData.airTemp < proxyData.airData.minTempSet) {
+            barBox.style.left = 0 + "px";
+          } else {
+            let sliderWidth: any = sliderBox.offsetWidth;
+            let barWidth: any = barBox.offsetWidth;
+            barBox.style.left = (sliderWidth-barWidth) + "px";
+          }
         }
+        proxyData.realTemp = proxyData.airTemp;
       },
       // 滑动
       endBoxSwiper() {
@@ -914,7 +931,7 @@ export default defineComponent({
   justify-content: space-between;
   .air-desc {
     position: relative;
-    flex: 1 157px;
+    // flex: 1 157px;
     padding-top: 10px;
     font-family: PingFang SC;
     font-size: 16px;
@@ -962,6 +979,7 @@ export default defineComponent({
     }
     .show-all {
       position: absolute;
+      width: 100px;
       bottom: -8px;
       font-family: PingFang SC;
       font-size: 14px;
@@ -1086,7 +1104,7 @@ export default defineComponent({
       font-size: 0;
       &:nth-child(1) {
         background: #5e8bcf;
-        border-radius: 5px 0 0 5px;
+        border-radius: 11px 0 0 11px;
       }
       &:nth-child(2) {
         background: #9fb7cd;
@@ -1099,7 +1117,7 @@ export default defineComponent({
       }
       &:nth-child(5) {
         background: #e5574f;
-        border-radius: 0 5px 5px 0;
+        border-radius: 0 11px 11px 0;
       }
     }
     .slider-bar {