pull/23/head
孙萌 2023-11-08 17:07:22 +08:00
parent af0a38da60
commit 53f0908869
1 changed files with 58 additions and 22 deletions

View File

@ -32,6 +32,10 @@ export default {
data() { data() {
return { return {
inputData: [], inputData: [],
nowSel: {
index: -1,
value: 0,
},
leftList: ['1#平均温度', leftList: ['1#平均温度',
'2#平均温度', '2#平均温度',
'1#平均湿度', '1#平均湿度',
@ -92,6 +96,8 @@ export default {
return [...arr].reverse() return [...arr].reverse()
}, },
changeType(index, index1) { changeType(index, index1) {
var store = this.$store.state
const that = this
if (this.rightList[index][index1] == '1') { if (this.rightList[index][index1] == '1') {
this.rightList[index][index1] = '0' this.rightList[index][index1] = '0'
} else { } else {
@ -104,7 +110,31 @@ export default {
value: parseInt(num, 2), value: parseInt(num, 2),
}, },
}; };
if (this.nowSel.index == -1) {
this.changeBtn('212' + this.checkTime(index), dataNum) this.changeBtn('212' + this.checkTime(index), dataNum)
this.nowSel.index = index
this.nowSel.value = parseInt(num, 2)
} else {
if (this.nowSel.index == index) {
this.changeBtn('212' + this.checkTime(index), dataNum)
this.nowSel.index = index
this.nowSel.value = parseInt(num, 2)
} else {
var code = '212' + this.checkTime(this.nowSel.index)
var data = {
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
regAddress: code,
num: this.nowSel.value,
};
this.nowSel.index = -1
this.nowSel.value = 0
that.changeData(data);
this.changeBtn('212' + this.checkTime(index), dataNum)
}
}
}, },
changeBtn(code, el) { changeBtn(code, el) {
var store = this.$store.state var store = this.$store.state
@ -164,10 +194,16 @@ export default {
type: "success", type: "success",
}); });
this.dataInit(); this.dataInit();
} else { } else {
this.$message.error("请求出错"); this.$message.error("请求出错");
} }
if (this.nowSel.index != -1) {
this.timer = null this.timer = null
this.nowSel.index = -1
this.nowSel.value = 0
}
}); });
}, },
}, },