From fb91d491ab78521e9902886cbe8e3dffc474bbf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E8=90=8C?= <525441437@qq.com> Date: Thu, 12 Oct 2023 15:26:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=20=E8=AE=BE=E5=AE=9A=E5=80=BC0-72=20=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E7=B1=BB=E4=BF=AE=E6=94=B9=E4=B8=8A=E4=BC=A0=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E6=94=B9=E4=B8=BA1s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/index.js | 2 +- src/views/page/sensorSet.vue | 29 +++++++++++++++++++++++++++-- src/views/page/status.vue | 7 ++++--- src/views/page/systemSet.vue | 4 ++-- src/views/page/upload.vue | 29 +++++++++++++++++++++++++++-- 5 files changed, 61 insertions(+), 10 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index 6ff7274..d0cfb26 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -6,7 +6,7 @@ Vue.use(Vuex) export default new Vuex.Store({ state: { lateSend: 100,//写入停止后 *100毫秒进行发送 例如10*100就是1000毫秒(1s) - lateSendBtn: 15,//写入停止后 *100毫秒进行发送 例如10*100就是1000毫秒(1s) + lateSendBtn: 10,//写入停止后 *100毫秒进行发送 例如10*100就是1000毫秒(1s) equipmentList: [],//当前账户施肥设备 equipmentIndex: 1,//当前在第几个设备 equipmentName: null,//当前设备 小设备的各个名字 diff --git a/src/views/page/sensorSet.vue b/src/views/page/sensorSet.vue index 9959aae..1256897 100644 --- a/src/views/page/sensorSet.vue +++ b/src/views/page/sensorSet.vue @@ -130,7 +130,7 @@ export default { value:command, }, }; - this.change(this.numberList[this.active], dataNum); + this.changeBtn(this.numberList[this.active], dataNum); }, getSensorType(){ this.typeList.forEach((el,index)=>{ @@ -163,7 +163,7 @@ export default { value: parseInt(listNew, 2), }, }; - this.change('272', dataNum); + this.changeBtn('272', dataNum); }, getData272() { var inputData = this.inputData @@ -213,6 +213,31 @@ selectValue(e) { 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) { var store = this.$store.state diff --git a/src/views/page/status.vue b/src/views/page/status.vue index 6b67b76..cc29b4e 100644 --- a/src/views/page/status.vue +++ b/src/views/page/status.vue @@ -288,6 +288,7 @@ export default { const that = this; if (localStorage.getItem('token')) { that.getEqbyid(); + this.getReg() setTimeout(() => { that.pageTimer && clearInterval(that.pageTimer) that.pageTimer = setInterval(() => { @@ -525,7 +526,7 @@ export default { var data = { "equipmentId": deviceDetail.deviceId, "pattern": 0,//需要根据文档填写 //6目标ph-数值 - "regNum": 71 + "regNum": 72 } var week = [ "星期日", @@ -542,7 +543,7 @@ export default { this.getData30() //数据30/进水出水泵 this.getData29()//数据29 启动方式/信号 - this.getReg() + this.getleft2List()//获取左下角数据 this.getrightList3()//获取又下角数据 this.getcenterBottom()//获取电磁阀 @@ -570,7 +571,7 @@ export default { return i; }, getReg() { - var deviceDetail = this.deviceDetail + var deviceDetail = store.equipmentList[store.equipmentIndex - 1] //获取传感器种类 var data1 = { equipmentId: deviceDetail.deviceId, diff --git a/src/views/page/systemSet.vue b/src/views/page/systemSet.vue index c85c966..ae2160e 100644 --- a/src/views/page/systemSet.vue +++ b/src/views/page/systemSet.vue @@ -90,8 +90,8 @@ export default { var store = this.$store.state var data = { equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId, - pattern: 55, //需要根据文档填写 //6目标ph-数值 - regNum: 17, + pattern: 0, //需要根据文档填写 //6目标ph-数值 + regNum: 72, }; this.api.postState(data).then((res) => { console.log(res, 11); diff --git a/src/views/page/upload.vue b/src/views/page/upload.vue index a7a184e..5268551 100644 --- a/src/views/page/upload.vue +++ b/src/views/page/upload.vue @@ -164,6 +164,31 @@ selectValue(e) { 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) { var store = this.$store.state @@ -220,7 +245,7 @@ selectValue(e) { value: parseInt(num, 2), }, }; - this.change('500', dataNum); + this.changeBtn('500', dataNum); }, selList2(index) { if (this.actList2.indexOf(index) == -1) { @@ -238,7 +263,7 @@ selectValue(e) { value: parseInt(num, 2), }, }; - this.change('501', dataNum); + this.changeBtn('501', dataNum); }, },