Commit f5f49121 by 姜雷

添加设备告警中设备状态

parent bd56efbc
...@@ -134,6 +134,23 @@ Component({ ...@@ -134,6 +134,23 @@ Component({
console.log(err); console.log(err);
}); });
}, },
openEquipment(e) {
const { code, type } = e.currentTarget.dataset;
console.log(code);
deviceFetch({
url: `/device/${code}/${type}/enable`,
method: 'POST',
})
.then(res => {
wx.showToast({
title: res.msg || '操作成功',
});
this.refreshList();
})
.catch(err => {
console.log(err);
});
},
closeEquipment(e) { closeEquipment(e) {
const { code, type } = e.currentTarget.dataset; const { code, type } = e.currentTarget.dataset;
console.log(code); console.log(code);
......
...@@ -14,9 +14,12 @@ ...@@ -14,9 +14,12 @@
<view class="EquipmentWarning-listItem-title"> <view class="EquipmentWarning-listItem-title">
<view class="EquipmentWarning-listItem-titleCode">{{item.deviceCode}}</view> <view class="EquipmentWarning-listItem-titleCode">{{item.deviceCode}}</view>
<view class="EquipmentWarning-listItem-titleLocation">{{item.deviceLocation}}</view> <view class="EquipmentWarning-listItem-titleLocation">{{item.deviceLocation}}</view>
<view class="EquipmentWarning-listItem-titleState" data-code="{{item.deviceCode}}" data-type="{{item.deviceType}}" bind:tap="closeEquipment"> <view wx:if="{{item.status === 1}}" class="EquipmentWarning-listItem-titleState Close" data-code="{{item.deviceCode}}" data-type="{{item.deviceType}}" bind:tap="closeEquipment">
禁用 禁用
</view> </view>
<view wx:if="{{item.status === 0}}" class="EquipmentWarning-listItem-titleState Open" data-code="{{item.deviceCode}}" data-type="{{item.deviceType}}" bind:tap="openEquipment">
启用
</view>
</view> </view>
<view class="EquipmentWarning-listItem-info"> <view class="EquipmentWarning-listItem-info">
<view class="EquipmentWarning-listItem-infoErr">{{item.operationName}}</view> <view class="EquipmentWarning-listItem-infoErr">{{item.operationName}}</view>
......
...@@ -67,9 +67,15 @@ ...@@ -67,9 +67,15 @@
width: 80rpx; width: 80rpx;
height: 60rpx; height: 60rpx;
line-height: 60rpx; line-height: 60rpx;
margin-left: 120rpx;
}
.EquipmentWarning-listItem-titleState.Open {
background-color: #e6f9ec;
color: #6edb8f;
}
.EquipmentWarning-listItem-titleState.Close {
background-color: #ffe5e5; background-color: #ffe5e5;
color: #fe6868; color: #fe6868;
margin-left: 120rpx;
} }
.EquipmentWarning-listItem-info { .EquipmentWarning-listItem-info {
display: flex; display: flex;
......
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