From 331eae59829e32bd573bcaa8021cd644f448313f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E8=90=8C?= <525441437@qq.com> Date: Thu, 9 Nov 2023 16:05:04 +0800 Subject: [PATCH 1/2] 1 --- src/views/page/sensorSet-con.vue | 72 ++++++++++++++++---------------- src/views/page/upload-con.vue | 9 ++-- 2 files changed, 42 insertions(+), 39 deletions(-) diff --git a/src/views/page/sensorSet-con.vue b/src/views/page/sensorSet-con.vue index fd37518..93a5327 100644 --- a/src/views/page/sensorSet-con.vue +++ b/src/views/page/sensorSet-con.vue @@ -84,7 +84,7 @@
通道输入信号类型
-
第{{ index+1 }}通道
+
第{{ index + 1 }}通道
@@ -119,7 +119,6 @@ export default { watch: { 'active'(newVal, oldVal) { this.getSensorType() - this.getCountData() }, }, mounted() { @@ -131,7 +130,7 @@ export default { } }, methods: { - //countType计算类型 + //countType计算类型 //0是原数据 //1是原数据-400 //2是原数据/10 @@ -160,10 +159,10 @@ export default { }, sendCountType3(data) { - var num = (data* 10)+400 + var num = (data * 10) + 400 return num }, - + //类型选择 handleCommand(command) { this.typeList.forEach((el, index) => { @@ -179,24 +178,27 @@ export default { this.changeBtn(20904 + (this.active * 5), dataNum); }, //根据类型修改数据 - getCountData(){ - this.typeList.forEach((el, index) => { - if (el.value == this.inputData[20904 + (this.active * 5)]) { - if(el.countType==0){ + getCountData() { + for (var i = 0; i < 48; i++) { + this.typeList.forEach((el, index) => { + if (el.value == this.inputData[20904 + (i * 5)]) { + if (el.countType == 0) { + + } else if (el.countType == 1) { + this.inputData[20904 + (i * 5 + 2)] = this.countType1(this.inputData[20904 + (i * 5 + 2)]) + this.inputData[20904 + (i * 5 + 4)] = this.countType1(this.inputData[20904 + (i * 5 + 4)]) + } else if (el.countType == 2) { + this.inputData[20904 + (i * 5 + 2)] = this.countType2(this.inputData[20904 + (i * 5 + 2)]) + this.inputData[20904 + (i * 5 + 4)] = this.countType2(this.inputData[20904 + (i * 5 + 4)]) + } else if (el.countType == 3) { + this.inputData[20904 + (i * 5 + 2)] = this.countType3(this.inputData[20904 + (i * 5 + 2)]) + this.inputData[20904 + (i * 5 + 4)] = this.countType3(this.inputData[20904 + (i * 5 + 4)]) + } + + } + }) + } - }else if(el.countType==1){ - this.inputData[20904 + (this.active * 5 + 2)]=this.countType1(this.inputData[20904 + (this.active * 5 + 2)]) - this.inputData[20904 + (this.active * 5 + 4)]=this.countType1(this.inputData[20904 + (this.active * 5 + 4)]) - }else if(el.countType==2){ - this.inputData[20904 + (this.active * 5 + 2)]=this.countType2(this.inputData[20904 + (this.active * 5 + 2)]) - this.inputData[20904 + (this.active * 5 + 4)]=this.countType2(this.inputData[20904 + (this.active * 5 + 4)]) - }else if(el.countType==3){ - this.inputData[20904 + (this.active * 5 + 2)]=this.countType3(this.inputData[20904 + (this.active * 5 + 2)]) - this.inputData[20904 + (this.active * 5 + 4)]=this.countType3(this.inputData[20904 + (this.active * 5 + 4)]) - } - - } - }) }, getSensorType() { this.typeList.forEach((el, index) => { @@ -358,19 +360,19 @@ export default { selectValue(e) { e.currentTarget.select(); }, - getSendData(number){ - var number1=number - this.typeList.some((el, index) => { + getSendData(number) { + var number1 = number + this.typeList.some((el, index) => { if (el.value == this.inputData[20904 + (this.active * 5)]) { - if(el.countType==0){ - number1=number - }else if(el.countType==1){ - number1=this.sendCountType1(number) - }else if(el.countType==2){ - number1=this.sendCountType2(number) - }else if(el.countType==3){ - number1=this.sendCountType3(number) - } + if (el.countType == 0) { + number1 = number + } else if (el.countType == 1) { + number1 = this.sendCountType1(number) + } else if (el.countType == 2) { + number1 = this.sendCountType2(number) + } else if (el.countType == 3) { + number1 = this.sendCountType3(number) + } } }) return number1 @@ -391,7 +393,7 @@ export default { var data = { equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId, regAddress: code, - num:this.getSendData(el.target.value) , + num: this.getSendData(el.target.value), }; //避免开启多个计时器 if (this.timer) { this.timer && clearInterval(this.timer); diff --git a/src/views/page/upload-con.vue b/src/views/page/upload-con.vue index c018a53..566bcd5 100644 --- a/src/views/page/upload-con.vue +++ b/src/views/page/upload-con.vue @@ -400,7 +400,7 @@ selectValue(e) { value: parseInt(num, 2), }, }; - this.changeBtn('500', dataNum); + this.changeBtn('21500', dataNum); }, selList2(index) { if (this.actList2.indexOf(index) == -1) { @@ -408,7 +408,7 @@ selectValue(e) { } else { this.actList2.splice(this.actList2.indexOf(index), 1) } - this.actList2New=['0','0','0','0','0','0','0','0','0','0','0','0','0','0',] + this.actList2New=['0','0','0','0','0','0','0','0','0','0','0'] this.actList2.forEach((el, index) => { this.actList2New[this.actList2New.length-el-1] = '1' }) @@ -419,7 +419,7 @@ selectValue(e) { value: parseInt(num, 2), }, }; - this.changeBtn('501', dataNum); + this.changeBtn('21501', dataNum); }, selList3(index) { if (this.actList3.indexOf(index) == -1) { @@ -450,13 +450,14 @@ selectValue(e) { this.actList4.forEach((el, index) => { this.actList4New[this.actList4New.length-el-1] = '1' }) - + console.log(this.actList4New,11); var num = this.actList4New.join(""); var dataNum = { target: { value: parseInt(num, 2), }, }; + console.log(num,parseInt(num, 2),22); this.changeBtn('21504', dataNum); }, selList5(index) { From 95b35bcdf71be9acf93ed2fbbdbefc68fd34ec19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E8=90=8C?= <525441437@qq.com> Date: Thu, 9 Nov 2023 16:06:57 +0800 Subject: [PATCH 2/2] 1 --- src/views/page/upload-con.vue | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/views/page/upload-con.vue b/src/views/page/upload-con.vue index 566bcd5..7bbc012 100644 --- a/src/views/page/upload-con.vue +++ b/src/views/page/upload-con.vue @@ -450,14 +450,12 @@ selectValue(e) { this.actList4.forEach((el, index) => { this.actList4New[this.actList4New.length-el-1] = '1' }) - console.log(this.actList4New,11); var num = this.actList4New.join(""); var dataNum = { target: { value: parseInt(num, 2), }, }; - console.log(num,parseInt(num, 2),22); this.changeBtn('21504', dataNum); }, selList5(index) {