新问题修改 设定值0-72 按钮类修改上传时间改为1s

This commit is contained in:
孙萌 2023-10-12 15:26:42 +08:00
parent 44c073b3d2
commit fb91d491ab
5 changed files with 61 additions and 10 deletions

View File

@ -6,7 +6,7 @@ Vue.use(Vuex)
export default new Vuex.Store({ export default new Vuex.Store({
state: { state: {
lateSend: 100,//写入停止后 *100毫秒进行发送 例如10*100就是1000毫秒(1s) lateSend: 100,//写入停止后 *100毫秒进行发送 例如10*100就是1000毫秒(1s)
lateSendBtn: 15,//写入停止后 *100毫秒进行发送 例如10*100就是1000毫秒(1s) lateSendBtn: 10,//写入停止后 *100毫秒进行发送 例如10*100就是1000毫秒(1s)
equipmentList: [],//当前账户施肥设备 equipmentList: [],//当前账户施肥设备
equipmentIndex: 1,//当前在第几个设备 equipmentIndex: 1,//当前在第几个设备
equipmentName: null,//当前设备 小设备的各个名字 equipmentName: null,//当前设备 小设备的各个名字

View File

@ -130,7 +130,7 @@ export default {
value:command, value:command,
}, },
}; };
this.change(this.numberList[this.active], dataNum); this.changeBtn(this.numberList[this.active], dataNum);
}, },
getSensorType(){ getSensorType(){
this.typeList.forEach((el,index)=>{ this.typeList.forEach((el,index)=>{
@ -163,7 +163,7 @@ export default {
value: parseInt(listNew, 2), value: parseInt(listNew, 2),
}, },
}; };
this.change('272', dataNum); this.changeBtn('272', dataNum);
}, },
getData272() { getData272() {
var inputData = this.inputData var inputData = this.inputData
@ -213,6 +213,31 @@ selectValue(e) {
this.changeData(data); this.changeData(data);
} }
},
changeBtn(code,el){
var store=this.$store.state
var data = {
equipmentId: store.equipmentList[store.equipmentIndex-1].deviceId,
regAddress: code,
num: el.target.value,
};
this.delayTimerBtn(0, data);
},
//btn j*100
delayTimerBtn(i, data) {
const that = this;
//
let j = this.$store.state.lateSendBtn;
//
this.timer && clearInterval(this.timer);
this.timer = setInterval(() => {
++i;
if (i == j) {
that.changeData(data);
clearInterval(this.timer);
}
}, 100);
}, },
change(code, el) { change(code, el) {
var store = this.$store.state var store = this.$store.state

View File

@ -288,6 +288,7 @@ export default {
const that = this; const that = this;
if (localStorage.getItem('token')) { if (localStorage.getItem('token')) {
that.getEqbyid(); that.getEqbyid();
this.getReg()
setTimeout(() => { setTimeout(() => {
that.pageTimer && clearInterval(that.pageTimer) that.pageTimer && clearInterval(that.pageTimer)
that.pageTimer = setInterval(() => { that.pageTimer = setInterval(() => {
@ -525,7 +526,7 @@ export default {
var data = { var data = {
"equipmentId": deviceDetail.deviceId, "equipmentId": deviceDetail.deviceId,
"pattern": 0,// //6ph- "pattern": 0,// //6ph-
"regNum": 71 "regNum": 72
} }
var week = [ var week = [
"星期日", "星期日",
@ -542,7 +543,7 @@ export default {
this.getData30() //30/ this.getData30() //30/
this.getData29()//29 / this.getData29()//29 /
this.getReg()
this.getleft2List()// this.getleft2List()//
this.getrightList3()// this.getrightList3()//
this.getcenterBottom()// this.getcenterBottom()//
@ -570,7 +571,7 @@ export default {
return i; return i;
}, },
getReg() { getReg() {
var deviceDetail = this.deviceDetail var deviceDetail = store.equipmentList[store.equipmentIndex - 1]
// //
var data1 = { var data1 = {
equipmentId: deviceDetail.deviceId, equipmentId: deviceDetail.deviceId,

View File

@ -90,8 +90,8 @@ export default {
var store = this.$store.state var store = this.$store.state
var data = { var data = {
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId, equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
pattern: 55, // //6ph- pattern: 0, // //6ph-
regNum: 17, regNum: 72,
}; };
this.api.postState(data).then((res) => { this.api.postState(data).then((res) => {
console.log(res, 11); console.log(res, 11);

View File

@ -164,6 +164,31 @@ selectValue(e) {
this.changeData(data); this.changeData(data);
} }
},
changeBtn(code,el){
var store=this.$store.state
var data = {
equipmentId: store.equipmentList[store.equipmentIndex-1].deviceId,
regAddress: code,
num: el.target.value,
};
this.delayTimerBtn(0, data);
},
//btn j*100
delayTimerBtn(i, data) {
const that = this;
//
let j = this.$store.state.lateSendBtn;
//
this.timer && clearInterval(this.timer);
this.timer = setInterval(() => {
++i;
if (i == j) {
that.changeData(data);
clearInterval(this.timer);
}
}, 100);
}, },
change(code, el) { change(code, el) {
var store = this.$store.state var store = this.$store.state
@ -220,7 +245,7 @@ selectValue(e) {
value: parseInt(num, 2), value: parseInt(num, 2),
}, },
}; };
this.change('500', dataNum); this.changeBtn('500', dataNum);
}, },
selList2(index) { selList2(index) {
if (this.actList2.indexOf(index) == -1) { if (this.actList2.indexOf(index) == -1) {
@ -238,7 +263,7 @@ selectValue(e) {
value: parseInt(num, 2), value: parseInt(num, 2),
}, },
}; };
this.change('501', dataNum); this.changeBtn('501', dataNum);
}, },
}, },