diff --git a/src/views/page/PIDSet.vue b/src/views/page/PIDSet.vue index 60deac8..5105aaf 100644 --- a/src/views/page/PIDSet.vue +++ b/src/views/page/PIDSet.vue @@ -174,6 +174,9 @@ export default { regAddress: code, num: el.target.value, }; //避免开启多个计时器 + if (store.nowInput != el.target.value) { + this.changeData(data); + } // if(this.timer){ // this.timer && clearInterval(this.timer); // this.changeData(data); diff --git a/src/views/page/formula.vue b/src/views/page/formula.vue index 4a8358e..5f8d2e2 100644 --- a/src/views/page/formula.vue +++ b/src/views/page/formula.vue @@ -237,8 +237,34 @@ export default { value: parseInt(num, 2), }, }; - this.change(store.formulaNum[this.indexs - 1] + 3, dataNum); + this.changeBtn(store.formulaNum[this.indexs - 1] + 3, dataNum); }, + //修改数据的函数 + 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); + }, getSeldata3(num) { var number = this.padString(num.toString(2), 9) this.numlist = number.split('') @@ -378,19 +404,19 @@ export default { }, //限制 写入停止后j*100毫秒调取函数 delayTimer(i, data) { - // const that = this; - // //整体接口 - // let j = this.$store.state.lateSend; - // //避免开启多个计时器 - // this.timer && clearInterval(this.timer); + const that = this; + //整体接口 + let j = this.$store.state.lateSend; + //避免开启多个计时器 + this.timer && clearInterval(this.timer); - // this.timer = setInterval(() => { - // ++i; - // if (i == j) { - // that.changeData(data); - // clearInterval(this.timer); - // } - // }, 100); + this.timer = setInterval(() => { + ++i; + if (i == j) { + that.changeData(data); + clearInterval(this.timer); + } + }, 100); }, changeData(data) { var store = this.$store.state