Commit ff9c595b by 姜雷

Merge branch 'test'

parents 1acabf78 f7508ced
...@@ -166,38 +166,54 @@ Component({ ...@@ -166,38 +166,54 @@ Component({
if (!this.data.dataList[status].length) this.refreshList(); if (!this.data.dataList[status].length) this.refreshList();
}, },
openEquipment(e) { openEquipment(e) {
const { code, type } = e.currentTarget.dataset; wx.showModal({
console.log(code); title: '提示',
deviceFetch({ content: '是否启用设备',
url: `/device/${code}/${type}/enable`, success: res => {
method: 'POST', if (res.confirm) {
}) const { code, type } = e.currentTarget.dataset;
.then(res => { console.log(code);
wx.showToast({ deviceFetch({
title: res.msg || '操作成功', url: `/device/${code}/${type}/enable`,
}); method: 'POST',
this.refreshList(); })
}) .then(res => {
.catch(err => { wx.showToast({
console.log(err); title: res.msg || '操作成功',
}); });
this.refreshList();
})
.catch(err => {
console.log(err);
});
}
},
});
}, },
closeEquipment(e) { closeEquipment(e) {
const { code, type } = e.currentTarget.dataset; wx.showModal({
console.log(code); title: '提示',
deviceFetch({ content: '是否禁用设备',
url: `/device/${code}/${type}/forbidden`, success: res => {
method: 'POST', if (res.confirm) {
}) const { code, type } = e.currentTarget.dataset;
.then(res => { console.log(code);
wx.showToast({ deviceFetch({
title: res.msg || '操作成功', url: `/device/${code}/${type}/forbidden`,
}); method: 'POST',
this.refreshList(); })
}) .then(res => {
.catch(err => { wx.showToast({
console.log(err); title: res.msg || '操作成功',
}); });
this.refreshList();
})
.catch(err => {
console.log(err);
});
}
},
});
}, },
}, },
}); });
...@@ -53,7 +53,10 @@ ...@@ -53,7 +53,10 @@
} }
.EquipmentState-elist-ItemLocation { .EquipmentState-elist-ItemLocation {
margin-left: 20rpx; margin-left: 20rpx;
flex: 1; width: 340rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
} }
.EquipmentState-elist-ItemBtn { .EquipmentState-elist-ItemBtn {
width: 80rpx; width: 80rpx;
......
import { deviceFetch } from '../../../api/fetch'; import { deviceFetch } from '../../../api/fetch';
let warningLevelRangeOption = { key: null, value: '' };
// pages/components/EquipmentWarning/EquipmentWarning.js // pages/components/EquipmentWarning/EquipmentWarning.js
Component({ Component({
lifetimes: { lifetimes: {
...@@ -49,7 +50,7 @@ Component({ ...@@ -49,7 +50,7 @@ Component({
.then(res => { .then(res => {
console.log(res); console.log(res);
this.setData({ this.setData({
warningLevelRange: res.data, warningLevelRange: [warningLevelRangeOption, ...res.data],
}); });
}) })
.catch(err => { .catch(err => {
...@@ -61,10 +62,18 @@ Component({ ...@@ -61,10 +62,18 @@ Component({
if (index === this.data.warnLevelIndex) return; if (index === this.data.warnLevelIndex) return;
const item = this.data.warningLevelRange[index]; const item = this.data.warningLevelRange[index];
console.log(item); console.log(item);
this.setData({ if (item.key) {
warnLevelIndex: index, this.setData({
warnLevel: item.key, warnLevelIndex: index,
}); warnLevel: item.key,
});
} else {
this.setData({
warnLevelIndex: '',
warnLevel: 0,
});
}
this.refreshList(); this.refreshList();
}, },
changeLocation(e) { changeLocation(e) {
...@@ -147,38 +156,54 @@ Component({ ...@@ -147,38 +156,54 @@ Component({
}); });
}, },
openEquipment(e) { openEquipment(e) {
const { code, type } = e.currentTarget.dataset; wx.showModal({
console.log(code); title: '提示',
deviceFetch({ content: '是否启用设备',
url: `/device/${code}/${type}/enable`, success: res => {
method: 'POST', if (res.confirm) {
}) const { code, type } = e.currentTarget.dataset;
.then(res => { console.log(code);
wx.showToast({ deviceFetch({
title: res.msg || '操作成功', url: `/device/${code}/${type}/enable`,
}); method: 'POST',
this.refreshList(); })
}) .then(res => {
.catch(err => { wx.showToast({
console.log(err); title: res.msg || '操作成功',
}); });
this.refreshList();
})
.catch(err => {
console.log(err);
});
}
},
});
}, },
closeEquipment(e) { closeEquipment(e) {
const { code, type } = e.currentTarget.dataset; wx.showModal({
console.log(code); title: '提示',
deviceFetch({ content: '是否禁用设备',
url: `/device/${code}/${type}/forbidden`, success: res => {
method: 'POST', if (res.confirm) {
}) const { code, type } = e.currentTarget.dataset;
.then(res => { console.log(code);
wx.showToast({ deviceFetch({
title: res.msg || '操作成功', url: `/device/${code}/${type}/forbidden`,
}); method: 'POST',
this.refreshList(); })
}) .then(res => {
.catch(err => { wx.showToast({
console.log(err); title: res.msg || '操作成功',
}); });
this.refreshList();
})
.catch(err => {
console.log(err);
});
}
},
});
}, },
}, },
}); });
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