Quellcode durchsuchen

4号板子UI调整

wzh vor 2 Jahren
Ursprung
Commit
1a759a3f0d
2 geänderte Dateien mit 352 neuen und 10 gelöschten Zeilen
  1. 27 0
      api/device/device.js
  2. 325 10
      pages/device/detail.vue

+ 27 - 0
api/device/device.js

@@ -193,3 +193,30 @@ export function getLatestFirmware(deviceId) {
         method: 'get'
     })
 }
+
+// 添加设备预约
+export function addDevicePlan(plan) {
+    return request({
+        url: '/iot/plan?minute='+plan.minute,
+        method: 'post',
+        data:plan
+    })
+}
+
+
+// 获取设备的预约信息
+export function getDevicePlan(deviceId) {
+    return request({
+        url: '/iot/plan/' + deviceId,
+        method: 'get'
+    })
+}
+
+
+// 删除设备预约
+export function delDevicePlan(deviceId) {
+    return request({
+        url: '/iot/plan/' + deviceId,
+        method: 'delete'
+    })
+}

+ 325 - 10
pages/device/detail.vue

@@ -58,8 +58,8 @@
 
       </view>
 
-      <view class="control_area" v-if="firstTab">
-        <view class="control">
+      <view class="control_area" v-if="firstTab" :style="boardStyle">
+        <view class="control" v-if="boardType ==3">
           <view class="control_item">
             <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
             <view class="control_item_detail">
@@ -124,7 +124,7 @@
             </view>
           </view>
 
-          <view class="control_item" v-if="boardType == 4">
+          <view class="control_item">
             <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,7 +137,135 @@
             </view>
           </view>
 
-          <view class="control_item" v-if="boardType == 5">
+
+
+        </view>
+        <view class="control" v-if="boardType ==4">
+          <view class="control_item" style="height: 370rpx" @click="modifyName">
+            <image :src="imgUrl+'/detail/bg_mid.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
+            <view style="text-align: center;position: absolute;height: 370rpx;line-height: 370rpx;right:0px;left:0px;font-size: 14px;">
+              {{deviceInfo.deviceName}}
+            </view>
+          </view>
+          <view style="display: inline-block;
+    width: 50%;position:relative;top:-38rpx">
+            <view class="control_item" v-if="wenhuoTimeDlgShow" 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_left" @click="subTemperatureTime(1)">-</view>
+                <view class="control_item_center">
+                  <view style="position: absolute;z-index: 999">
+                    <u-input  customStyle="width:150rpx;border:0px;z-index: 999" disabledColor="white"    v-model="temperatureTime"></u-input>
+                  </view>
+                </view>
+                <view class="control_item_center_unit" :style="unitFixedStyle">分钟</view>
+                <view class="control_item_right" style="left: 74%;" @click="addTemperatureTime(1)">+</view>
+              </view>
+              <view class="control_item_title">
+                时间设置
+              </view>
+            </view>
+
+            <view class="control_item" v-if="!wenhuoTimeDlgShow" 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_left" @click="subTemperatureTime(1)">-</view>
+                <view class="control_item_center">
+                  <view style="position: absolute">
+                    <u-input  customStyle="width:150rpx;border:0px;" disabledColor="white"  @change="propChange(1)"  @focus="propFocus(2)" @confirm="propBlur(2)" @blur="propBlur(2)"   v-model="leftJianyaoTime"></u-input>
+                  </view>
+                </view>
+                <view class="control_item_center_unit" :style="unitFixedStyle">分钟</view>
+                <view class="control_item_right" style="left: 74%;" @click="addTemperatureTime(1)">+</view>
+              </view>
+              <view class="control_item_title">
+                时间设置
+              </view>
+            </view>
+
+            <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">
+                  <u-input disabled customStyle="width:150rpx;border:0px;" disabledColor="white"  :value="currentTemperature"></u-input>
+                </view>
+                <view class="control_item_center_unit" :style="unitFixedStyle">℃</view>
+              </view>
+              <view class="control_item_title">
+                当前温度
+              </view>
+            </view>
+          </view>
+
+
+        </view>
+        <view class="control" v-if="boardType ==5">
+          <view class="control_item">
+            <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_left" @click="subTemperature(1)">-</view>
+              <view class="control_item_center">
+                <view style="position: absolute">
+                  <u-input  customStyle="width:150rpx;border:0px;" disabledColor="white" @change="propChange(1)"  @focus="propFocus(1)" @confirm="propBlur(1)" @blur="propBlur(1)" v-model="temperature"></u-input>
+                </view>
+              </view>
+              <view class="control_item_center_unit" :style="unitFixedStyle">℃</view>
+              <view class="control_item_right" @click="addTemperature(1)">+</view>
+            </view>
+            <view class="control_item_title">
+              设置温度
+            </view>
+          </view>
+
+          <view class="control_item" v-if="wenhuoTimeDlgShow">
+            <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_left" @click="subTemperatureTime(1)">-</view>
+              <view class="control_item_center">
+                <view style="position: absolute;z-index: 999">
+                  <u-input  customStyle="width:150rpx;border:0px;z-index: 999" disabledColor="white"    v-model="temperatureTime"></u-input>
+                </view>
+              </view>
+              <view class="control_item_center_unit" :style="unitFixedStyle">分钟</view>
+              <view class="control_item_right" style="left: 74%;" @click="addTemperatureTime(1)">+</view>
+            </view>
+            <view class="control_item_title">
+              时间设置
+            </view>
+          </view>
+
+          <view class="control_item" v-if="!wenhuoTimeDlgShow">
+            <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_left" @click="subTemperatureTime(1)">-</view>
+              <view class="control_item_center">
+                <view style="position: absolute">
+                  <u-input  customStyle="width:150rpx;border:0px;" disabledColor="white"  @change="propChange(1)"  @focus="propFocus(2)" @confirm="propBlur(2)" @blur="propBlur(2)"   v-model="leftJianyaoTime"></u-input>
+                </view>
+              </view>
+              <view class="control_item_center_unit" :style="unitFixedStyle">分钟</view>
+              <view class="control_item_right" style="left: 74%;" @click="addTemperatureTime(1)">+</view>
+            </view>
+            <view class="control_item_title">
+              时间设置
+            </view>
+          </view>
+
+          <view class="control_item">
+            <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">
+                <u-input disabled customStyle="width:150rpx;border:0px;" disabledColor="white"  :value="currentTemperature"></u-input>
+              </view>
+              <view class="control_item_center_unit" :style="unitFixedStyle">℃</view>
+            </view>
+            <view class="control_item_title">
+              当前温度
+            </view>
+          </view>
+
+
+          <view class="control_item">
             <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" >
@@ -148,18 +276,18 @@
     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: 180rpx" v-if="pressTurn == 1"  class="roate">
+              <view style="display: inline-block; position: absolute;top:30rpx;width: 43%;" v-if="pressTurn == 1"  class="roate">
                 <view style="width: 100%;height: 6px;background: white;border-radius: 10px;border:1px solid lightgray">
                   <view :style="lineProgreeStyle"></view>
                 </view>
 
               </view>
-              <view style="display: inline-block; position: absolute;top:30rpx;width: 180rpx" v-if="resetTurn == 1">
+              <view style="display: inline-block; position: absolute;top:30rpx;width: 43%;" v-if="resetTurn == 1">
                 <view style="width: 100%;height: 6px;background: white;border-radius: 10px;border:1px solid lightgray">
                   <view :style="lineProgreeStyle"></view>
                 </view>
               </view>
-              <view style="display: inline-block; position: absolute;top:30rpx;width: 180rpx" v-if="resetTurn == 0 && pressTurn == 0">
+              <view style="display: inline-block; position: absolute;top:30rpx;width: 43%;" v-if="resetTurn == 0 && pressTurn == 0">
                 <view style="width: 100%;height: 6px;background: white;border-radius: 10px;border:1px solid lightgray">
                   <view :style="lineProgreeStyle"></view>
                 </view>
@@ -180,7 +308,65 @@
 
 
         </view>
-        <view class="bottom">
+        <view class="bottom" v-if="boardType == 3">
+          <image :src="imgUrl+'/detail/bg_large.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
+          <view class="bottom_item" @click="decoctControlOnOffChange">
+            <image v-if="decoctControlOnOffStatus" :src="imgUrl+'/detail/open_on.png'" style="width: 32%;height:32%;"/>
+            <image v-if="!decoctControlOnOffStatus" :src="imgUrl+'/detail/open_off.png'" style="width: 32%;height:32%;"/>
+            <view :class="decoctControlOnOffStatus?'active_on':''">开关</view>
+          </view>
+          <view class="bottom_item" @click="decoctControlChange">
+            <image v-if="decoctControlStatus" :src="imgUrl+'/detail/jianing_on.png'" style="width: 32%;height:32%;"/>
+            <image v-if="!decoctControlStatus" :src="imgUrl+'/detail/jianing_off.png'" style="width: 32%;height:32%;"/>
+            <view :class="decoctControlStatus?'active_on':''">煎药</view>
+          </view>
+          <view class="bottom_item" @click="stopDecoctControlChange">
+            <image v-if="!decoctControlStatus" :src="imgUrl+'/detail/stop_on.png'" style="width: 32%;height:32%;"/>
+            <image v-if="decoctControlStatus" :src="imgUrl+'/detail/stop_off.png'" style="width: 32%;height:32%;"/>
+            <view :class="!decoctControlStatus?'active_on':''">停止</view>
+          </view>
+          <view class="bottom_item" @click="toPlan">
+            <image v-if="leftAppointmentTime>0" :src="imgUrl+'/detail/plan_on.png'" style="width: 32%;height:32%;"/>
+            <image v-else :src="imgUrl+'/detail/plan_off.png'" style="width: 32%;height:32%;"/>
+            <view :class="leftAppointmentTime>0?'active_on':''">预约</view>
+          </view>
+
+        </view>
+        <view class="bottom" v-if="boardType == 4" style="top:21vh">
+          <image :src="imgUrl+'/detail/bg_large.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
+          <view class="bottom_item" >
+            <view  style="display: inline;" v-if="!decoctControlOnOffStatus" @click="decoctControlOnOffChange">
+              <image :src="imgUrl+'/detail/jianing_off.png'" style="width: 32%;height:32%;"/>
+              <view>煎药</view>
+            </view>
+            <view  style="display: inline;"  v-else>
+              <image :src="imgUrl+'/detail/jianing_on.png'" style="width: 32%;height:32%;"/>
+              <view class="active_on">煎药</view>
+            </view>
+          </view>
+          <view class="bottom_item" >
+            <view style="display: inline;" v-if="decoctControlOnOffStatus" @click="decoctControlOnOffChange">
+              <image :src="imgUrl+'/detail/stop_off.png'" style="width: 32%;height:32%;"/>
+              <view>停止</view>
+            </view>
+            <view  style="display: inline;" v-else>
+              <image :src="imgUrl+'/detail/stop_on.png'" style="width: 32%;height:32%;"/>
+              <view class="active_on">停止</view>
+            </view>
+
+          </view>
+          <view class="bottom_item" @click="toDevicePlan">
+            <image v-if="devicePlanInfo!=null" :src="imgUrl+'/detail/plan_on.png'" style="width: 32%;height:32%;"/>
+            <image v-else :src="imgUrl+'/detail/plan_off.png'" style="width: 32%;height:32%;"/>
+            <view :class="devicePlanInfo!=null?'active_on':''">预约</view>
+          </view>
+          <view class="bottom_item" @click="skip(2)">
+            <image :src="imgUrl+'/detail/open_off.png'" style="width: 32%;height:32%;"/>
+            <view >客服</view>
+          </view>
+
+        </view>
+        <view class="bottom" v-if="boardType == 5">
           <image :src="imgUrl+'/detail/bg_large.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
           <view class="bottom_item" @click="decoctControlOnOffChange">
             <image v-if="decoctControlOnOffStatus" :src="imgUrl+'/detail/open_on.png'" style="width: 32%;height:32%;"/>
@@ -664,7 +850,49 @@
         </view>
       </view>
     </u-popup>
+    <u-popup :show="deviceYuyueIngPop" @close="closeDeviceYuyueIngPop" 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">
+              <u-input  customStyle="width:150rpx;border:0px;padding:0px" disabledColor="white"  :value="devicePlanInfo.minute"></u-input>
+            </view>
+            <view class="control_item_center_unit" :style="unitFixedStyle">分</view>
+          </view>
+          <view class="control_item_title">
+            剩余时间
+          </view>
+        </view>
+        <view>
+          <button style="background: white;" @click="cancelDevicePlan">取消</button>
+        </view>
+      </view>
+    </u-popup>
+    <u-popup :show="devicePlanPopDlg" @close="closeDevicePlanPop" 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_left" @click="subDevicePlanTime(1)" style="left: 18%;">-</view>
+            <view class="control_item_center">
+              <view style="position: absolute">
+                <u-input  customStyle="width:150rpx;border:0px;" disabledColor="white"   v-model="devicePlanTime"></u-input>
+              </view>
+            </view>
+            <view class="control_item_center_unit" :style="unitFixedStyle">分钟</view>
+            <view class="control_item_right" style="left: 80%;" @click="addDevicePlanTime(1)">+</view>
+          </view>
+          <view class="control_item_title">
+            预约时间
+          </view>
+        </view>
 
+        <view>
+          <button style="background: white;" @click="devicePlan">确认</button>
+        </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%">
@@ -694,7 +922,7 @@
 </template>
 
 <script>
-import { getDetail,getDeviceStatus,cacheJsonThingsModel,reportError ,getDeviceRunTime,getLatestFirmware,bingDeviceDept,editDeviceName} from '@/api/device/device.js'
+import { getDetail,getDeviceStatus,cacheJsonThingsModel,reportError ,getDeviceRunTime,getLatestFirmware,bingDeviceDept,editDeviceName,getDevicePlan,addDevicePlan,delDevicePlan} from '@/api/device/device.js'
 import config from '@/config'
 export default {
   data(){
@@ -817,7 +1045,7 @@ export default {
       baozhuangShuLIangSetting:false,
       tempFengkouWendu:0,
       tempFengBianWendu:0,
-      boardType:4,//板子类型
+      boardType:3,//板子类型
       lineTimer:null,
       validCurrent:0,//当前扭力
       turnCurrent:0,//堵转电流值
@@ -825,6 +1053,11 @@ export default {
       pressTurn:0,
       resetTurn:0,
       canGetPrsValue:false,//可以接收挤压的动画
+      devicePlanInfo:null,//设备后台预约任务
+      devicePlanPopDlg:false,
+      deviceYuyueIngPop:false,
+      devicePlanTime:10,
+      boardStyle:"",
     }
   },
   onLoad: function(opt) {
@@ -871,6 +1104,27 @@ export default {
     }
   },
   methods:{
+    closeDevicePlanPop(){
+      this.devicePlanPopDlg = false;
+    },
+    devicePlan(){
+      let self = this;
+      if(this.devicePlanTime>600){
+        this.$modal.showToast('预约时间最大为600分钟')
+        return;
+      }
+      if(this.devicePlanTime == 0){
+        this.$modal.showToast('预约时间不能为空')
+      }else{
+        let obj = {deviceNo:this.deviceInfo.serialNumber,minute:this.devicePlanTime};
+        addDevicePlan(obj).then(res=>{
+          self.getDevicePlanInfo();
+          self.$modal.showToast('预约成功')
+          self.devicePlanPopDlg = false;
+        });
+      }
+
+    },
     closeliuzhuanPop(){
       this.liuzhuanPopDlg = false;
     },
@@ -1488,6 +1742,49 @@ export default {
       }
 
     },
+
+    toDevicePlan(){
+      if(!this.jianyaoOpen()){
+        this.$modal.showToast('煎药机已经关机')
+        return;
+      }
+      let self = this;
+      getDevicePlan(this.deviceInfo.serialNumber).then(res=>{
+
+        if(res.data != null){
+          self.deviceYuyueIngPop = true;
+          self.devicePlanInfo = res.data;
+          let minute = self.devicePlanInfo.minute;
+          if(minute<0){
+            minute = 10;
+          }
+          self.devicePlanInfo.minute = minute;
+        }else{
+          self.devicePlanPopDlg = true;
+        }
+      });
+    },
+    cancelDevicePlan(){
+      delDevicePlan(this.devicePlanInfo.id).then(res=>{
+        this.$modal.showToast('取消成功')
+        this.deviceYuyueIngPop = false;
+        this.devicePlanInfo = null;
+      })
+    },
+    getDevicePlanInfo(){
+      let self = this;
+      self.devicePlanInfo = null;
+      getDevicePlan(this.deviceInfo.serialNumber).then(res=>{
+        if(res.data != null){
+          self.devicePlanInfo = res.data;
+          let minute = self.devicePlanInfo.minute;
+          if(minute<0){
+            minute = 10;
+          }
+          self.devicePlanInfo.minute = minute;
+        }
+      });
+    },
     calcuStep(){
       if(this.leftAppointmentTime>0){
         this.step = 0;
@@ -2179,6 +2476,13 @@ export default {
 
         let heng = false;
         self.productImage = self.imgUrl+'/detail/product.png'
+        if(self.deviceType == 13 || self.deviceType == 14){
+          self.boardType = 4;
+          self.getDevicePlanInfo();
+        }
+        if(self.deviceType == 14 ){
+          self.secondMachine = true;
+        }
         if(self.deviceType == 4 ||self.deviceType == 5 ){
           self.secondMachine = true;
         }
@@ -2205,6 +2509,17 @@ export default {
           }
         }
         self.fixImage(heng);
+
+        if(self.boardType = 4){
+          self.boardStyle  = ";top:15vh;";
+          self.modeList=[[
+            {id:1,text:"1"},
+            {id:2,text:"2"}
+          ]];
+        }
+
+
+
         self.$forceUpdate();
       });
     },