@@ -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);