Commit 9a364d64 by zhangzhen

设备控制优化

parent 8a669adc
......@@ -49,13 +49,14 @@
<view v-if="val.deviceList" class="flex-col device-list">
<view class="part" v-if="val.deviceList.door" >
<text class="text-title">门禁控制</text>
<view v-if="val.deviceList.door.status ==1" class="">
<text>电量:{{val.deviceList.door.voltage}}</text>
<view class="">
<text v-if="val.deviceList.door.status =='0'" class="text-green">离线</text>
<text v-else>电量:{{val.deviceList.door.voltage}}</text>
<button @tap="onDeviceRun(10,val.deviceList.door)" class="cu-btn bg-blue margin-left-sm">开启</button>
</view>
<view v-else-if="val.deviceList.door.status =='0'" class="">
<!-- <view v-else-if="val.deviceList.door.status =='0'" class="">
<text>离线</text>
</view>
</view> -->
</view>
<view class="part" v-if="val.deviceList.el">
<text class="text-title">取电开关</text>
......@@ -63,8 +64,8 @@
<text class="margin-right-sm" :class="val.deviceList.el.status==3?'text-red':'text-green'">{{deviceStatusEnum[val.deviceList.el.status]}}</text>
<button @tap="onDeviceRun(20,val.deviceList.el)" class="cu-btn margin-right-sm" :class="val.deviceList.el.status==2?'bg-blue':'bg-gray'">开启</button>
<button @tap="onDeviceRun(40,val.deviceList.el)" class="cu-btn" :class="val.deviceList.el.status==3?'bg-blue':'bg-gray'">关闭</button>
<button @tap="onDeviceRun(20,val.deviceList.el)" class="cu-btn margin-right-sm bg-blue">开启</button>
<button @tap="onDeviceRun(40,val.deviceList.el)" class="cu-btn bg-blue">关闭</button>
<!-- <switch data-type="door" :data-index="index" :data-k="k" :data-id="val.deviceList.el.roomId" @change="onSwitchDoor" :class="val.deviceList.el.status==3?'checked':''" :checked="val.deviceList.el.status==3?true:false" color="#e54d42"></switch> -->
</view>
</view>
......@@ -244,8 +245,8 @@ import moment from "@/common/moment";
// this.onDeviceRun(t,e.target.dataset.id)
// },
onDeviceRun(opType,device){
if(opType == 20 && device.status != 2) return;
if(opType == 40 && device.status != 3) return;
// if(opType == 20 && device.status != 2) return;
// if(opType == 40 && device.status != 3) return;
let that = this;
if(this.deviceTime){
uni.showToast({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment