pc-master #25
|
@ -84,7 +84,7 @@
|
||||||
<div class="sensor-type">
|
<div class="sensor-type">
|
||||||
<div class="sensor-title">通道输入信号类型</div>
|
<div class="sensor-title">通道输入信号类型</div>
|
||||||
<div class="sensor-type-div" v-for="item, index in openTypeList" :key="index">
|
<div class="sensor-type-div" v-for="item, index in openTypeList" :key="index">
|
||||||
<div class="name">第{{ index+1 }}通道</div>
|
<div class="name">第{{ index + 1 }}通道</div>
|
||||||
<div class="sensor-sel">
|
<div class="sensor-sel">
|
||||||
<div>
|
<div>
|
||||||
<div @click="changeTypeOpen(index, '0')" :class="item == '1' ? 'no-sel' : 'sel'"></div>
|
<div @click="changeTypeOpen(index, '0')" :class="item == '1' ? 'no-sel' : 'sel'"></div>
|
||||||
|
@ -119,7 +119,6 @@ export default {
|
||||||
watch: {
|
watch: {
|
||||||
'active'(newVal, oldVal) {
|
'active'(newVal, oldVal) {
|
||||||
this.getSensorType()
|
this.getSensorType()
|
||||||
this.getCountData()
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
@ -131,7 +130,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
//countType计算类型
|
//countType计算类型
|
||||||
//0是原数据
|
//0是原数据
|
||||||
//1是原数据-400
|
//1是原数据-400
|
||||||
//2是原数据/10
|
//2是原数据/10
|
||||||
|
@ -160,10 +159,10 @@ export default {
|
||||||
},
|
},
|
||||||
sendCountType3(data) {
|
sendCountType3(data) {
|
||||||
|
|
||||||
var num = (data* 10)+400
|
var num = (data * 10) + 400
|
||||||
return num
|
return num
|
||||||
},
|
},
|
||||||
|
|
||||||
//类型选择
|
//类型选择
|
||||||
handleCommand(command) {
|
handleCommand(command) {
|
||||||
this.typeList.forEach((el, index) => {
|
this.typeList.forEach((el, index) => {
|
||||||
|
@ -179,24 +178,27 @@ export default {
|
||||||
this.changeBtn(20904 + (this.active * 5), dataNum);
|
this.changeBtn(20904 + (this.active * 5), dataNum);
|
||||||
},
|
},
|
||||||
//根据类型修改数据
|
//根据类型修改数据
|
||||||
getCountData(){
|
getCountData() {
|
||||||
this.typeList.forEach((el, index) => {
|
for (var i = 0; i < 48; i++) {
|
||||||
if (el.value == this.inputData[20904 + (this.active * 5)]) {
|
this.typeList.forEach((el, index) => {
|
||||||
if(el.countType==0){
|
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() {
|
getSensorType() {
|
||||||
this.typeList.forEach((el, index) => {
|
this.typeList.forEach((el, index) => {
|
||||||
|
@ -358,19 +360,19 @@ export default {
|
||||||
selectValue(e) {
|
selectValue(e) {
|
||||||
e.currentTarget.select();
|
e.currentTarget.select();
|
||||||
},
|
},
|
||||||
getSendData(number){
|
getSendData(number) {
|
||||||
var number1=number
|
var number1 = number
|
||||||
this.typeList.some((el, index) => {
|
this.typeList.some((el, index) => {
|
||||||
if (el.value == this.inputData[20904 + (this.active * 5)]) {
|
if (el.value == this.inputData[20904 + (this.active * 5)]) {
|
||||||
if(el.countType==0){
|
if (el.countType == 0) {
|
||||||
number1=number
|
number1 = number
|
||||||
}else if(el.countType==1){
|
} else if (el.countType == 1) {
|
||||||
number1=this.sendCountType1(number)
|
number1 = this.sendCountType1(number)
|
||||||
}else if(el.countType==2){
|
} else if (el.countType == 2) {
|
||||||
number1=this.sendCountType2(number)
|
number1 = this.sendCountType2(number)
|
||||||
}else if(el.countType==3){
|
} else if (el.countType == 3) {
|
||||||
number1=this.sendCountType3(number)
|
number1 = this.sendCountType3(number)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return number1
|
return number1
|
||||||
|
@ -391,7 +393,7 @@ export default {
|
||||||
var data = {
|
var data = {
|
||||||
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
|
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
|
||||||
regAddress: code,
|
regAddress: code,
|
||||||
num:this.getSendData(el.target.value) ,
|
num: this.getSendData(el.target.value),
|
||||||
}; //避免开启多个计时器
|
}; //避免开启多个计时器
|
||||||
if (this.timer) {
|
if (this.timer) {
|
||||||
this.timer && clearInterval(this.timer);
|
this.timer && clearInterval(this.timer);
|
||||||
|
|
|
@ -400,7 +400,7 @@ selectValue(e) {
|
||||||
value: parseInt(num, 2),
|
value: parseInt(num, 2),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
this.changeBtn('500', dataNum);
|
this.changeBtn('21500', dataNum);
|
||||||
},
|
},
|
||||||
selList2(index) {
|
selList2(index) {
|
||||||
if (this.actList2.indexOf(index) == -1) {
|
if (this.actList2.indexOf(index) == -1) {
|
||||||
|
@ -408,7 +408,7 @@ selectValue(e) {
|
||||||
} else {
|
} else {
|
||||||
this.actList2.splice(this.actList2.indexOf(index), 1)
|
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.actList2.forEach((el, index) => {
|
||||||
this.actList2New[this.actList2New.length-el-1] = '1'
|
this.actList2New[this.actList2New.length-el-1] = '1'
|
||||||
})
|
})
|
||||||
|
@ -419,7 +419,7 @@ selectValue(e) {
|
||||||
value: parseInt(num, 2),
|
value: parseInt(num, 2),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
this.changeBtn('501', dataNum);
|
this.changeBtn('21501', dataNum);
|
||||||
},
|
},
|
||||||
selList3(index) {
|
selList3(index) {
|
||||||
if (this.actList3.indexOf(index) == -1) {
|
if (this.actList3.indexOf(index) == -1) {
|
||||||
|
@ -450,7 +450,6 @@ selectValue(e) {
|
||||||
this.actList4.forEach((el, index) => {
|
this.actList4.forEach((el, index) => {
|
||||||
this.actList4New[this.actList4New.length-el-1] = '1'
|
this.actList4New[this.actList4New.length-el-1] = '1'
|
||||||
})
|
})
|
||||||
|
|
||||||
var num = this.actList4New.join("");
|
var num = this.actList4New.join("");
|
||||||
var dataNum = {
|
var dataNum = {
|
||||||
target: {
|
target: {
|
||||||
|
|
Loading…
Reference in New Issue