diff --git a/src/views/page/sensorSet-con.vue b/src/views/page/sensorSet-con.vue index a91c3ed..fd37518 100644 --- a/src/views/page/sensorSet-con.vue +++ b/src/views/page/sensorSet-con.vue @@ -58,9 +58,9 @@
标定低点数据
- + @input="change1(20904 + (active * 5 + 2), $event)" type="number" placeholder="0.0">
@@ -72,9 +72,9 @@
标定高点数据
- + @input="change1(20904 + (active * 5 + 4), $event)" type="number" placeholder="0.0">
@@ -119,6 +119,7 @@ export default { watch: { 'active'(newVal, oldVal) { this.getSensorType() + this.getCountData() }, }, mounted() { @@ -130,6 +131,39 @@ export default { } }, methods: { + //countType计算类型 + //0是原数据 + //1是原数据-400 + //2是原数据/10 + //3是(原数据-400) / 10 + countType1(data) { + var num = data - 400 + return num + }, + countType2(data) { + var num = data / 10 + return num + }, + countType3(data) { + + var num = (data - 400) / 10 + return num + }, + //反向计算提交 + sendCountType1(data) { + var num = data + 400 + return num + }, + sendCountType2(data) { + var num = data * 10 + return num + }, + sendCountType3(data) { + + var num = (data* 10)+400 + return num + }, + //类型选择 handleCommand(command) { this.typeList.forEach((el, index) => { @@ -144,6 +178,26 @@ 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){ + + }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) => { if (el.value == this.inputData[20904 + (this.active * 5)]) { @@ -294,6 +348,7 @@ export default { // this.getData272() this.getOpen() this.getSensorType() + this.getCountData() } else { this.$message.error(res.data.msg); } @@ -303,6 +358,47 @@ export default { selectValue(e) { e.currentTarget.select(); }, + 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) + } + } + }) + return number1 + }, + //需要反向计算提交 + change1(code, el) { + var store = this.$store.state + var data = { + equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId, + regAddress: code, + num: this.getSendData(el.target.value), + }; + this.delayTimer(0, data); + }, + //需要反向计算提交 + blurChange1(code, el) { + var store = this.$store.state + var data = { + equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId, + regAddress: code, + num:this.getSendData(el.target.value) , + }; //避免开启多个计时器 + if (this.timer) { + this.timer && clearInterval(this.timer); + this.changeData(data); + } + + }, //失去焦点 blurChange(code, el) { var store = this.$store.state diff --git a/src/views/page/sensorSet.vue b/src/views/page/sensorSet.vue index 1256897..15527f7 100644 --- a/src/views/page/sensorSet.vue +++ b/src/views/page/sensorSet.vue @@ -60,8 +60,8 @@
标定低点数据
-
@@ -74,8 +74,8 @@
标定高点数据
-
@@ -107,6 +107,7 @@ export default { watch:{ 'active'(newVal,oldVal){ this.getSensorType() + this.getCountData() }, }, mounted() { @@ -118,6 +119,38 @@ export default { } }, methods: { + //countType计算类型 + //0是原数据 + //1是原数据-400 + //2是原数据/10 + //3是(原数据-400) / 10 + countType1(data) { + var num = data - 400 + return num + }, + countType2(data) { + var num = data / 10 + return num + }, + countType3(data) { + + var num = (data - 400) / 10 + return num + }, + //反向计算提交 + sendCountType1(data) { + var num = data + 400 + return num + }, + sendCountType2(data) { + var num = data * 10 + return num + }, + sendCountType3(data) { + + var num = (data* 10)+400 + return num + }, //类型选择 handleCommand(command){ this.typeList.forEach((el,index)=>{ @@ -131,6 +164,26 @@ export default { }, }; this.changeBtn(this.numberList[this.active], dataNum); + }, + //根据类型修改数据 + getCountData(){ + this.typeList.forEach((el, index) => { + if (el.value == this.inputData[this.numberList[this.active]]) { + if(el.countType==0){ + + }else if(el.countType==1){ + this.inputData[this.numberList[this.active] + 2]=this.countType1(this.inputData[this.numberList[this.active] + 2]) + this.inputData[this.numberList[this.active] + 4]=this.countType1(this.inputData[this.numberList[this.active] + 4]) + }else if(el.countType==2){ + this.inputData[this.numberList[this.active] + 2]=this.countType2(this.inputData[this.numberList[this.active] + 2]) + this.inputData[this.numberList[this.active] + 4]=this.countType2(this.inputData[this.numberList[this.active] + 4]) + }else if(el.countType==3){ + this.inputData[this.numberList[this.active] + 2]=this.countType3(this.inputData[this.numberList[this.active] + 2]) + this.inputData[this.numberList[this.active] + 4]=this.countType3(this.inputData[this.numberList[this.active] + 4]) + } + + } + }) }, getSensorType(){ this.typeList.forEach((el,index)=>{ @@ -191,6 +244,7 @@ export default { this.inputData = res.data.data; this.getData272() this.getSensorType() + this.getCountData() } else { this.$message.error(res.data.msg); } @@ -200,6 +254,47 @@ export default { selectValue(e) { e.currentTarget.select(); }, +getSendData(number){ + var number1=number + this.typeList.some((el, index) => { + if (el.value == this.inputData[this.numberList[this.active]]) { + 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 + }, + //需要反向计算提交 + change1(code, el) { + var store = this.$store.state + var data = { + equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId, + regAddress: code, + num: this.getSendData(el.target.value), + }; + this.delayTimer(0, data); + }, + //需要反向计算提交 + blurChange1(code, el) { + var store = this.$store.state + var data = { + equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId, + regAddress: code, + num:this.getSendData(el.target.value) , + }; //避免开启多个计时器 + if (this.timer) { + this.timer && clearInterval(this.timer); + this.changeData(data); + } + + }, //失去焦点 blurChange(code, el) { var store=this.$store.state