From 882eefb00eb081635111c3b4c36624073d1822b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E8=90=8C?= <525441437@qq.com> Date: Thu, 21 Dec 2023 11:36:14 +0800 Subject: [PATCH] 1 --- src/views/page/sensorSet-con.vue | 70 ++++++++++++++++++++++++-------- src/views/page/sensorSet.vue | 67 +++++++++++++++++++++++------- 2 files changed, 107 insertions(+), 30 deletions(-) diff --git a/src/views/page/sensorSet-con.vue b/src/views/page/sensorSet-con.vue index ef15a74..6b7cdea 100644 --- a/src/views/page/sensorSet-con.vue +++ b/src/views/page/sensorSet-con.vue @@ -72,13 +72,13 @@
标定低点AD值
标定低点数据
@@ -86,13 +86,13 @@
标定高点AD值
标定高点数据
@@ -127,6 +127,7 @@ export default { sel2: false, sel3: false, inputData: [], + inputDataNew:[], sensorType: '',//当前传感器类型 openList1: [],//当前有效的传感器 openList2: [],//当前有效的传感器 @@ -205,31 +206,57 @@ return num }; this.changeBtn(20904 + (this.active * 5), dataNum); }, + //根据类型反向计算赋值给inputData + getSaveCountData(){ + for (var i = 0; i < 48; i++) { + this.typeList.forEach((el, index) => { + if (el.value == this.inputData[20904 + (i * 5)]) { + if (el.countType == 0) { + this.inputData[20904 + (i * 5 + 2)]= this.inputDataNew[20904 + (i * 5 + 2)] + this.inputData[20904 + (i * 5 + 4)]=this.inputDataNew[20904 + (i * 5 + 4)] + } else if (el.countType == 1) { + this.inputData[20904 + (i * 5 + 2)] = this.sendCountType1(this.inputDataNew[20904 + (i * 5 + 2)]) + this.inputData[20904 + (i * 5 + 4)] = this.sendCountType1(this.inputDataNew[20904 + (i * 5 + 4)]) + } else if (el.countType == 2) { + this.inputData[20904 + (i * 5 + 2)] = this.sendCountType2(this.inputDataNew[20904 + (i * 5 + 2)]) + this.inputData[20904 + (i * 5 + 4)] = this.sendCountType2(this.inputDataNew[20904 + (i * 5 + 4)]) + } else if (el.countType == 3) { + this.inputData[20904 + (i * 5 + 2)] = this.sendCountType3(this.inputDataNew[20904 + (i * 5 + 2)]) + this.inputData[20904 + (i * 5 + 4)] = this.sendCountType3(this.inputDataNew[20904 + (i * 5 + 4)]) + } else if (el.countType == 4) { + this.inputData[20904 + (i * 5 + 2)] = this.sendCountType4(this.inputDataNew[20904 + (i * 5 + 2)]) + this.inputData[20904 + (i * 5 + 4)] = this.sendCountType4(this.inputDataNew[20904 + (i * 5 + 4)]) + } + + } + }) + } + }, //根据类型修改数据 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) { - + this.inputDataNew[20904 + (i * 5 + 2)] = this.inputData[20904 + (i * 5 + 2)] + this.inputDataNew[20904 + (i * 5 + 4)] = this.inputData[20904 + (i * 5 + 4)] } 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)]) + this.inputDataNew[20904 + (i * 5 + 2)] = this.countType1(this.inputData[20904 + (i * 5 + 2)]) + this.inputDataNew[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)]) + this.inputDataNew[20904 + (i * 5 + 2)] = this.countType2(this.inputData[20904 + (i * 5 + 2)]) + this.inputDataNew[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)]) + this.inputDataNew[20904 + (i * 5 + 2)] = this.countType3(this.inputData[20904 + (i * 5 + 2)]) + this.inputDataNew[20904 + (i * 5 + 4)] = this.countType3(this.inputData[20904 + (i * 5 + 4)]) } else if (el.countType == 4) { - this.inputData[20904 + (i * 5 + 2)] = this.countType4(this.inputData[20904 + (i * 5 + 2)]) - this.inputData[20904 + (i * 5 + 4)] = this.countType4(this.inputData[20904 + (i * 5 + 4)]) + this.inputDataNew[20904 + (i * 5 + 2)] = this.countType4(this.inputData[20904 + (i * 5 + 2)]) + this.inputDataNew[20904 + (i * 5 + 4)] = this.countType4(this.inputData[20904 + (i * 5 + 4)]) } } }) - } - + } }, getSensorType() { this.typeList.forEach((el, index) => { @@ -377,7 +404,8 @@ return num }; this.api.getReadControlSensorChannel(data).then((res) => { if (res.data.code == 200) { - this.inputData = res.data.data; + this.inputData = JSON.parse(JSON.stringify(res.data.data)); + this.inputDataNew = res.data.data; // this.getData272() this.getOpen() this.getSensorType() @@ -509,7 +537,17 @@ return num type: "success", }); store.nowInput='' + this.getSaveCountData() // this.dataInit(); + for (var i = 0; i < 48; i++) { + if((20904 + (i * 5))==data.regAddress){ + this.inputData[20904 + (i * 5)]=data.num + console.log( this.inputData[20904 + (i * 5)],20904 + (i * 5),777); + } + } + + + this.getCountData() } else { this.inputData[data.regAddress]=store.nowInput this.$message.error(res.data.msg); diff --git a/src/views/page/sensorSet.vue b/src/views/page/sensorSet.vue index 439c9de..8a740bb 100644 --- a/src/views/page/sensorSet.vue +++ b/src/views/page/sensorSet.vue @@ -54,13 +54,13 @@
标定低点AD值
-
标定低点数据
-
@@ -68,13 +68,13 @@
标定高点AD值
-
标定高点数据
-
@@ -99,6 +99,7 @@ export default { sel3: false, numberList: [273, 278, 283, 288, 293, 298], inputData: [], + inputDataNew:[], sensorType:'',//当前传感器类型 openList: [],//当前有效的传感器 typeList:this.$store.state.typeList @@ -174,6 +175,32 @@ return num }, }; this.changeBtn(this.numberList[this.active], dataNum); + }, + //根据类型反向计算赋值给inputData + getSaveCountData(){ + for (var i = 0; i < 48; i++) { + this.typeList.forEach((el, index) => { + if (el.value == this.inputData[this.numberList[i]]) { + if(el.countType==0){ + this.inputData[this.numberList[i] + 2]=this.inputDataNew[this.numberList[i] + 2] + this.inputData[this.numberList[i] + 4]=this.inputDataNew[this.numberList[i] + 4] + }else if(el.countType==1){ + this.inputData[this.numberList[i] + 2]=this.sendCountType1(this.inputDataNew[this.numberList[i] + 2]) + this.inputData[this.numberList[i] + 4]=this.sendCountType1(this.inputDataNew[this.numberList[i] + 4]) + }else if(el.countType==2){ + this.inputData[this.numberList[i] + 2]=this.sendCountType2(this.inputDataNew[this.numberList[i] + 2]) + this.inputData[this.numberList[i] + 4]=this.sendCountType2(this.inputDataNew[this.numberList[i] + 4]) + }else if(el.countType==3){ + this.inputData[this.numberList[i] + 2]=this.sendCountType3(this.inputDataNew[this.numberList[i] + 2]) + this.inputData[this.numberList[i] + 4]=this.sendCountType3(this.inputDataNew[this.numberList[i] + 4]) + }else if(el.countType==4){ + this.inputData[this.numberList[i] + 2]=this.sendCountType4(this.inputDataNew[this.numberList[i] + 2]) + this.inputData[this.numberList[i] + 4]=this.sendCountType4(this.inputDataNew[this.numberList[i] + 4]) + } + + } + }) + } }, //根据类型修改数据 getCountData(){ @@ -181,19 +208,20 @@ return num this.typeList.forEach((el, index) => { if (el.value == this.inputData[this.numberList[i]]) { if(el.countType==0){ - + this.inputDataNew[this.numberList[i] + 2]=this.inputData[this.numberList[i] + 2] + this.inputDataNew[this.numberList[i] + 4]=this.inputData[this.numberList[i] + 4] }else if(el.countType==1){ - this.inputData[this.numberList[i] + 2]=this.countType1(this.inputData[this.numberList[i] + 2]) - this.inputData[this.numberList[i] + 4]=this.countType1(this.inputData[this.numberList[i] + 4]) + this.inputDataNew[this.numberList[i] + 2]=this.countType1(this.inputData[this.numberList[i] + 2]) + this.inputDataNew[this.numberList[i] + 4]=this.countType1(this.inputData[this.numberList[i] + 4]) }else if(el.countType==2){ - this.inputData[this.numberList[i] + 2]=this.countType2(this.inputData[this.numberList[i] + 2]) - this.inputData[this.numberList[i] + 4]=this.countType2(this.inputData[this.numberList[i] + 4]) + this.inputDataNew[this.numberList[i] + 2]=this.countType2(this.inputData[this.numberList[i] + 2]) + this.inputDataNew[this.numberList[i] + 4]=this.countType2(this.inputData[this.numberList[i] + 4]) }else if(el.countType==3){ - this.inputData[this.numberList[i] + 2]=this.countType3(this.inputData[this.numberList[i] + 2]) - this.inputData[this.numberList[i] + 4]=this.countType3(this.inputData[this.numberList[i] + 4]) + this.inputDataNew[this.numberList[i] + 2]=this.countType3(this.inputData[this.numberList[i] + 2]) + this.inputDataNew[this.numberList[i] + 4]=this.countType3(this.inputData[this.numberList[i] + 4]) }else if(el.countType==4){ - this.inputData[this.numberList[i] + 2]=this.countType4(this.inputData[this.numberList[i] + 2]) - this.inputData[this.numberList[i] + 4]=this.countType4(this.inputData[this.numberList[i] + 4]) + this.inputDataNew[this.numberList[i] + 2]=this.countType4(this.inputData[this.numberList[i] + 2]) + this.inputDataNew[this.numberList[i] + 4]=this.countType4(this.inputData[this.numberList[i] + 4]) } } @@ -256,7 +284,8 @@ return num }; this.api.postReg(data).then((res) => { if (res.data.code == 200) { - this.inputData = res.data.data; + this.inputData = JSON.parse(JSON.stringify(res.data.data)); + this.inputDataNew = res.data.data; this.getData272() this.getSensorType() this.getCountData() @@ -387,7 +416,17 @@ getSendData(number){ type: "success", }); store.nowInput='' + this.getSaveCountData() // this.dataInit(); + for (var i = 0; i < 48; i++) { + if(this.numberList[i]==data.regAddress){ + this.inputData[this.numberList[i]]=data.num + + } + } + + + this.getCountData() } else { this.inputData[data.regAddress]=store.nowInput this.$message.error(res.data.msg);