Pārlūkot izejas kodu

优化5好扳子

wzh 2 gadi atpakaļ
vecāks
revīzija
d531c6bb93
1 mainītis faili ar 263 papildinājumiem un 5 dzēšanām
  1. 263 5
      pages/device/detail.vue

+ 263 - 5
pages/device/detail.vue

@@ -124,7 +124,7 @@
             </view>
           </view>
 
-          <view class="control_item">
+          <view class="control_item" v-if="boardType == 4">
             <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
             <view class="control_item_detail">
               <view class="control_item_center">
@@ -137,6 +137,37 @@
             </view>
           </view>
 
+          <view class="control_item" v-if="boardType == 5">
+            <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
+            <view class="control_item_detail" style="">
+              <view style="width: 50px;height: 150rpx;display: inline-block" >
+                <image @click="setPressTurn" :src="imgUrl+'/detail/left_on.png'" v-if="pressTurn == 1" style="top:20rpx;
+    left: 40rpx;width: 20px;height:15px;position: absolute;"/>
+
+                <image @click="setPressTurn" :src="imgUrl+'/detail/left.png'" v-if="pressTurn == 0" style="top:20rpx;
+    left: 40rpx;width: 20px;height:15px;position: absolute;"/>
+                <view style="position: absolute;top:68rpx;left:40rpx;font-size: 12px;" :class="pressTurn == 1?'active_on':''">挤压</view>
+              </view>
+              <view style="display: inline-block; position: absolute;top:30rpx;width: 150rpx" v-if="pressTurn == 1"  class="roate">	<u-line-progress :percentage="turnPercent" activeColor="#50ACFF" height="6" :showText="false"></u-line-progress>
+              </view>
+              <view style="display: inline-block; position: absolute;top:30rpx;width: 150rpx" v-if="resetTurn == 1">	<u-line-progress :percentage="turnPercent" activeColor="#50ACFF" height="6" :showText="false"></u-line-progress>
+              </view>
+              <view style="display: inline-block; position: absolute;top:30rpx;width: 150rpx" v-if="resetTurn == 0 && pressTurn == 0">	<u-line-progress :percentage="turnPercent" activeColor="#50ACFF" height="6" :showText="false"></u-line-progress>
+              </view>
+              <view  style="width: 50px;height: 150rpx;display: inline-block">
+                <image @click="setResetTurn" :src="imgUrl+'/detail/right_on.png'" v-if="resetTurn == 1" style="top:20rpx;
+    right: 40rpx;width: 20px;height:15px;position: absolute;;display: inline-block;"/>
+
+                <image @click="setResetTurn" :src="imgUrl+'/detail/right.png'"  v-if="resetTurn == 0" style="top:20rpx;
+    right: 40rpx;width: 20px;height:15px;position: absolute;;display: inline-block;"/>
+                <view style="position: absolute;top:68rpx;right:40rpx;font-size: 12px;" :class="resetTurn == 1?'active_on':''">复位</view>
+              </view>
+            </view>
+            <view class="control_item_title">
+              电动挤压
+            </view>
+          </view>
+
 
         </view>
         <view class="bottom">
@@ -490,7 +521,24 @@
               {{jiaozhunTemp}}℃<uni-icons type="forward" size="16"></uni-icons>
             </view>
           </view>
-
+          <view class="prop-item" v-if="firstTab && boardType == 5">
+            <view class="prop-item-image">
+              <image :src="imgUrl+'/setting/current_icon6.png'" style="width: 100%;height:100%;"/>
+            </view>
+            <view class="prop-item-left">有效电流值</view>
+            <view class="prop-item-right" >
+              {{validCurrent}}MA
+            </view>
+          </view>
+          <view class="prop-item" v-if="firstTab && boardType == 5">
+            <view class="prop-item-image">
+              <image :src="imgUrl+'/setting/current_icon5.png'" style="width: 100%;height:100%;"/>
+            </view>
+            <view class="prop-item-left">扭转电流值</view>
+            <view class="prop-item-right" @click="showLiuProp">
+              {{turnCurrent}}MA<uni-icons type="forward" size="16"></uni-icons>
+            </view>
+          </view>
 
           <view class="prop-item"  v-if="firstTab">
             <view class="prop-item-image">
@@ -606,6 +654,29 @@
         </view>
       </view>
     </u-popup>
+
+    <u-popup :show="liuzhuanPopDlg" @close="closeliuzhuanPop" mode="center"  :closeable="true">
+      <view style="position: relative;width: 400rpx;background: none;padding:40rpx;">
+        <view class="control_item" style="width: 100%">
+          <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
+          <view class="control_item_detail">
+            <view class="control_item_center">
+              <view style="position: absolute">
+                <u-input  customStyle="width:150rpx;border:0px;" disabledColor="white"   v-model="setTurnCurrent"></u-input>
+
+              </view>
+            </view>
+            <view class="control_item_center_unit" :style="unitFixedStyle">MA</view>
+          </view>
+          <view class="control_item_title">
+            扭力
+          </view>
+        </view>
+        <view>
+          <button style="background: white;" @click="confirmLiuzhuannCurrent">确认</button>
+        </view>
+      </view>
+    </u-popup>
     <u-picker :show="showModelPicker" @cancel="closeModelPicker" @confirm="confirmMode" :columns="modeList" keyName="text"></u-picker>
 
   </view>
@@ -618,6 +689,8 @@ import config from '@/config'
 export default {
   data(){
     return {
+      liuzhuanPopDlg:false,
+      turnPercent:1,
       onlineStatus:false,
       modeList:[[
         {id:1,text:"1"},
@@ -733,6 +806,13 @@ export default {
       baozhuangShuLIangSetting:false,
       tempFengkouWendu:0,
       tempFengBianWendu:0,
+      boardType:4,//板子类型
+      lineTimer:null,
+      validCurrent:0,//有效电流值
+      turnCurrent:0,//堵转电流值
+      setTurnCurrent:0,
+      pressTurn:0,
+      resetTurn:0,
     }
   },
   onLoad: function(opt) {
@@ -750,7 +830,127 @@ export default {
     this.mqttUnSubscribe(this.deviceInfo);
     clearTimeout(this.checkTimer);
   },
+  watch: {
+    pressTurn(newVal,oldValue) {
+      if(newVal == 1){
+        this.startProgressTimer(1);
+      }else{
+        clearInterval(this.lineTimer)
+        this.turnPercent = 0;
+      }
+    },
+    resetTurn(newVal){
+      if(newVal == 1){
+        this.startProgressTimer(2);
+      }else{
+        clearInterval(this.lineTimer)
+        this.turnPercent = 0;
+      }
+    }
+  },
   methods:{
+    closeliuzhuanPop(){
+      this.liuzhuanPopDlg = false;
+    },
+    confirmLiuzhuannCurrent(){
+      if(this.setTurnCurrent<200 || this.setTurnCurrent>400){
+        this.notifyError("扭力范围为200-400")
+        return;
+      }
+      let arr = [];
+      let pressObj = {};
+      pressObj.id = "TurnCurrent";
+      pressObj.shadow = this.setTurnCurrent;
+      arr.push(pressObj);
+      this.mqttPublish(2,this.deviceInfo,arr)
+      this.closeliuzhuanPop();
+    },
+    setPressTurn(){
+      if(!this.decoctControlOnOffStatus){
+        this.notifyError("请先开机后再进行操作")
+        return;
+      }
+      let arr = [];
+      if(this.resetTurn == 1){
+        this.notifyError("请先关闭复位功能")
+        return;
+      }
+      let currentPresturn = this.pressTurn;
+      let pressObj = {};
+      if(currentPresturn == 1){//代表要关闭
+        pressObj.id = "PressTurn";
+        pressObj.shadow = 0;
+        arr.push(pressObj);
+        this.turnPercent = 0;
+        this.pressTurn = 0;
+      }else{//代表要开启
+        pressObj.id = "PressTurn";
+        pressObj.shadow = 1;
+        arr.push(pressObj);
+        this.pressTurn = 1;
+      }
+
+      this.mqttPublish(2,this.deviceInfo,arr)
+      this.$forceUpdate()
+    },
+    startProgressTimer(type){
+      let self = this;
+      if(self.lineTimer != null){
+        clearInterval(self.lineTimer)
+      }
+      if(type == 1){
+        self.lineTimer = setInterval(function(){
+          if(self.turnPercent >=100){
+            self.turnPercent = 1;
+            clearInterval(self.lineTimer);
+            setTimeout(function(){
+              self.startProgressTimer(1);
+            },500);
+          }
+          self.turnPercent +=5;
+        },200);
+      }else{
+        self.lineTimer = setInterval(function(){
+          if(self.turnPercent >=100){
+            self.turnPercent = 1;
+            clearInterval(self.lineTimer);
+            setTimeout(function(){
+              self.startProgressTimer(2);
+            },500);
+          }
+          self.turnPercent +=5;
+        },200);
+      }
+    },
+    setResetTurn(){
+      if(!this.decoctControlOnOffStatus){
+        this.notifyError("请先开机后再进行操作")
+        return;
+      }
+      if(this.pressTurn == 1){
+        this.notifyError("请先关闭挤压功能")
+        return;
+      }
+      let arr = [];
+      if(this.resetTurn == 1){
+        let pressObj = {};
+        pressObj.id = "PressTurn";
+        pressObj.shadow = 0;
+        this.resetTurn = 0;
+        this.turnPercent = 0;
+        arr.push(pressObj);
+      }else{
+        let pressObj = {};
+        pressObj.id = "PressTurn";
+        pressObj.shadow = 0;
+        this.resetTurn = 1;
+        arr.push(pressObj);
+      }
+
+
+      this.mqttPublish(2,this.deviceInfo,arr)
+      this.$forceUpdate()
+    },
     fixImage(heng){
       let self = this;
       wx.getSystemInfo({
@@ -1011,9 +1211,21 @@ export default {
     closejiaozhunPop(){
       this.jiaozhunPopDlg = false;
     },
+    showLiuProp(){
+      let self = this;
+      uni.showModal({
+        title: "提示",
+        content: "该功能请在专业人士指导下使用,是否继续",
+        confirmText:"是",
+        success: function (res) {
+          if(res.confirm){
+            self.liuzhuanPopDlg = true;
+          }
+        },
+      })
+    },
     showJiaozhunProp(){
       let self = this;
-
       uni.showModal({
         title: "提示",
         content: "该功能请在专业人士指导下使用,是否继续",
@@ -1897,10 +2109,13 @@ export default {
     getDetail(){
       let self = this;
       getDetail(this.id).then(res=>{
-
         self.deviceInfo = res.data;
         self.deviceType = res.data.type;
-        let online = self.deviceInfo == 3?true:false;
+        let productId = self.deviceInfo.productId;
+        if(productId === 57){
+          self.boardType = 5;
+        }
+        let online = self.deviceInfo.status == 3?true:false;
         if(!online){
           if(!self.onlineStatus){
             uni.showModal({
@@ -2036,6 +2251,30 @@ export default {
         this.formatValue(id,enumListElement,"CarrybagSwitch","qitingTurn")
         this.formatValue(id,enumListElement,"WashSwitch","qingxiTurn")
         this.formatValue(id,enumListElement,"PackageSwitch","baozhuangTurn");
+
+        //pressTurn resetTurn
+        if(id.indexOf("PressTurn") !=-1){
+          let shadow = enumListElement.shadow;
+          if(!shadow){
+            shadow = 0;
+          }
+          if(shadow == 1){
+            this.pressTurn = 1;
+          }
+
+
+        }
+
+        if(id.indexOf("ResetTurn") !=-1){
+          let shadow = enumListElement.shadow;
+          if(!shadow){
+            shadow = 0;
+          }
+          if(shadow == 1){
+            this.resetTurn = 1;
+          }
+        }
+
         if(id.indexOf("WorkMode") !=-1){
           let shadow = enumListElement.shadow;
           if(!shadow){
@@ -2137,6 +2376,11 @@ export default {
 
 
         this.setPropValue(id,"LeftAppointmentTime","leftAppointmentTime",value,0)
+
+
+        this.setPropValue(id,"ValidCurrent","validCurrent",value,0)
+        this.setPropValue(id,"TurnCurrent","turnCurrent",value,0)
+
         self.propMap[id] = prop;
 
       }
@@ -2420,6 +2664,17 @@ export default {
       if(msgId === "CalibrationTemp"){
         this.jiaozhunTemp = obj.value;
       }
+
+      if(msgId === "TurnCurrent"){
+        this.turnCurrent = obj.value;
+      }
+
+
+      if(msgId === "ValidCurrent"){
+        this.validCurrent = obj.value;
+      }
+
+
     },
     /** 发布物模型 类型(1=属性,2=功能) */
     publishThingsModel(device, model) {
@@ -3047,4 +3302,7 @@ font-size: 16px;
 .disabled_tab{
   opacity: 0.4;
 }
+.roate{
+  transform: rotate(180deg);
+}
 </style>