Merge pull request 'pc-master' (#24) from pc-master into portal
Reviewed-on: #24
This commit is contained in:
		
						commit
						b352dc1bb0
					
				| @ -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 | ||||||
|  | |||||||
| @ -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 | ||||||
|  | |||||||
| @ -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 | ||||||
|  | |||||||
| @ -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'){ | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user