Merge pull request 'pc-master' (#24) from pc-master into portal

Reviewed-on: #24
pull/34/head^2
xiaomeng 2023-11-09 06:49:11 +00:00
commit b352dc1bb0
4 changed files with 214 additions and 24 deletions

View File

@ -233,20 +233,22 @@ export default {
} }
}, },
toRouter1(item) { toRouter1(item) {
console.log(item, 11, this.routerNow);
if (item.router) { if (item.router) {
if (item.http) { if (item.http) {
window.location.href = item.http; window.location.href = item.http;
} else if (item.router == 'formula' && this.$route.query.index != item.index) { } else if (item.router == 'formula' && this.$route.query.index != item.index) {
if (this.routerNow == 'realTime') { if (this.routerNow == 'realTime') {
this.$store.state.equipmentIndex = item.index
this.$router.push({ path: `/realTime?index=${item.index ? item.index : 1}&name=${item.deviceName}` }) this.$router.push({ path: `/realTime?index=${item.index ? item.index : 1}&name=${item.deviceName}` })
} else if (this.routerNow == 'formula') { } else if (this.routerNow == 'formula') {
this.$store.state.equipmentIndex = item.index this.$store.state.equipmentIndex = item.index
this.$router.push({ path: `/formula?index=${item.index ? item.index : 1}` }) this.$router.push({ path: `/formula?index=${item.index ? item.index : 1}` })
} else if (this.routerNow == 'history') { } else if (this.routerNow == 'history') {
this.$store.state.equipmentIndex = item.index
this.$router.push({ path: `/history?index=${item.index ? item.index : 1}` }) this.$router.push({ path: `/history?index=${item.index ? item.index : 1}` })
} else if (this.routerNow == 'dataAnalysis') { } else if (this.routerNow == 'dataAnalysis') {
this.$store.state.equipmentIndex = item.index
this.$router.push({ path: `/dataAnalysis?index=${item.index ? item.index : 1}` }) this.$router.push({ path: `/dataAnalysis?index=${item.index ? item.index : 1}` })
} else if (item.router == 'formula') { } else if (item.router == 'formula') {
this.$store.state.equipmentIndex = item.index this.$store.state.equipmentIndex = item.index

View File

@ -58,9 +58,9 @@
</div> </div>
<div class="input-main"> <div class="input-main">
<div>标定低点数据</div> <div>标定低点数据</div>
<input @blur="blurChange(20904 + (active * 5 + 2), $event)" <input @blur="blurChange1(20904 + (active * 5 + 2), $event)"
v-model="inputData[20904 + (active * 5 + 2)]" v-model="inputData[20904 + (active * 5 + 2)]"
@input="change(20904 + (active * 5 + 2), $event)" type="number" placeholder="0.0"> @input="change1(20904 + (active * 5 + 2), $event)" type="number" placeholder="0.0">
</div> </div>
</div> </div>
<div> <div>
@ -72,9 +72,9 @@
</div> </div>
<div class="input-main"> <div class="input-main">
<div>标定高点数据</div> <div>标定高点数据</div>
<input @blur="blurChange(20904 + (active * 5 + 4), $event)" <input @blur="blurChange1(20904 + (active * 5 + 4), $event)"
v-model="inputData[20904 + (active * 5 + 4)]" v-model="inputData[20904 + (active * 5 + 4)]"
@input="change(20904 + (active * 5 + 4), $event)" type="number" placeholder="0.0"> @input="change1(20904 + (active * 5 + 4), $event)" type="number" placeholder="0.0">
</div> </div>
</div> </div>
</div> </div>
@ -119,6 +119,7 @@ export default {
watch: { watch: {
'active'(newVal, oldVal) { 'active'(newVal, oldVal) {
this.getSensorType() this.getSensorType()
this.getCountData()
}, },
}, },
mounted() { mounted() {
@ -130,6 +131,39 @@ export default {
} }
}, },
methods: { 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) { handleCommand(command) {
this.typeList.forEach((el, index) => { this.typeList.forEach((el, index) => {
@ -144,6 +178,26 @@ export default {
}; };
this.changeBtn(20904 + (this.active * 5), dataNum); 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() { getSensorType() {
this.typeList.forEach((el, index) => { this.typeList.forEach((el, index) => {
if (el.value == this.inputData[20904 + (this.active * 5)]) { if (el.value == this.inputData[20904 + (this.active * 5)]) {
@ -294,6 +348,7 @@ export default {
// this.getData272() // this.getData272()
this.getOpen() this.getOpen()
this.getSensorType() this.getSensorType()
this.getCountData()
} else { } else {
this.$message.error(res.data.msg); this.$message.error(res.data.msg);
} }
@ -303,6 +358,47 @@ export default {
selectValue(e) { selectValue(e) {
e.currentTarget.select(); 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) { blurChange(code, el) {
var store = this.$store.state var store = this.$store.state

View File

@ -60,8 +60,8 @@
</div> </div>
<div class="input-main"> <div class="input-main">
<div>标定低点数据</div> <div>标定低点数据</div>
<input @blur="blurChange(numberList[active] + 2, $event)" v-model="inputData[numberList[active] + 2]" <input @blur="blurChange1(numberList[active] + 2, $event)" v-model="inputData[numberList[active] + 2]"
@input="change(numberList[active] + 2, $event)" @input="change1(numberList[active] + 2, $event)"
type="number" placeholder="0.0"> type="number" placeholder="0.0">
</div> </div>
</div> </div>
@ -74,8 +74,8 @@
</div> </div>
<div class="input-main"> <div class="input-main">
<div>标定高点数据</div> <div>标定高点数据</div>
<input @blur="blurChange(numberList[active] + 4, $event)" v-model="inputData[numberList[active] + 4]" <input @blur="blurChange1(numberList[active] + 4, $event)" v-model="inputData[numberList[active] + 4]"
@input="change(numberList[active] + 4 , $event)" @input="change1(numberList[active] + 4 , $event)"
type="number" placeholder="0.0"> type="number" placeholder="0.0">
</div> </div>
</div> </div>
@ -107,6 +107,7 @@ export default {
watch:{ watch:{
'active'(newVal,oldVal){ 'active'(newVal,oldVal){
this.getSensorType() this.getSensorType()
this.getCountData()
}, },
}, },
mounted() { mounted() {
@ -118,6 +119,38 @@ export default {
} }
}, },
methods: { 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){ handleCommand(command){
this.typeList.forEach((el,index)=>{ this.typeList.forEach((el,index)=>{
@ -131,6 +164,26 @@ export default {
}, },
}; };
this.changeBtn(this.numberList[this.active], dataNum); 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(){ getSensorType(){
this.typeList.forEach((el,index)=>{ this.typeList.forEach((el,index)=>{
@ -191,6 +244,7 @@ export default {
this.inputData = res.data.data; this.inputData = res.data.data;
this.getData272() this.getData272()
this.getSensorType() this.getSensorType()
this.getCountData()
} else { } else {
this.$message.error(res.data.msg); this.$message.error(res.data.msg);
} }
@ -200,6 +254,47 @@ export default {
selectValue(e) { selectValue(e) {
e.currentTarget.select(); 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) { blurChange(code, el) {
var store=this.$store.state var store=this.$store.state

View File

@ -112,20 +112,17 @@ export default {
// //
actList2: [], actList2: [],
actList2New: [], actList2New: [],
list2: ['目标水肥PH数据', list2: ['1#平均温度传感器',
'目标水肥EC数据', '2#平均温度传感器',
'平均水肥PH数据', '1#平均湿度传感器',
'平均水肥EC数据', '2#平均湿度传感器',
'1#水肥PH数据', '1#平均光照传感器',
'1#水肥EC数据', '1#平均CO2传感器',
'2#水肥PH数据', '1#平均土温传感器',
'2#水肥EC数据', '1#平均土湿传感器',
'1#通道传感器数据', '1#平均PH传感器',
'2#通道传感器数据', '1#平均EC传感器',
'3#通道传感器数据', '1#水温传感器',],
'4#通道传感器数据',
'5#通道传感器数据',
'6#通道传感器数据'],
// //
actList3: [], actList3: [],
actList3New: [], actList3New: [],
@ -222,7 +219,7 @@ export default {
getAct2() { getAct2() {
this.actList2=[] this.actList2=[]
var num = this.inputData['21503'] var num = this.inputData['21503']
var num2 = this.padString(num.toString(2), 14) var num2 = this.padString(num.toString(2), 11)
this.actList2New=num2.split("") this.actList2New=num2.split("")
this.actList2New.forEach((el,index)=>{ this.actList2New.forEach((el,index)=>{
if(el=='1'){ if(el=='1'){