wx-program
parent
c1392d7077
commit
c388c4c824
|
@ -57,23 +57,9 @@ let api = {
|
|||
|
||||
readFs_byid:'/readFs/byid',//查看用户施肥机名称信息
|
||||
getFiState:"/getFI/getState",//智能灌溉控制器读取.
|
||||
irrigate1:"/readFi/irrigate1",//智能灌溉组
|
||||
irrigate2:"/readFi/irrigate2",//智能灌溉组
|
||||
irrigate3:"/readFi/irrigate3",//智能灌溉组
|
||||
irrigate4:"/readFi/irrigate4",//智能灌溉组
|
||||
irrigate5:"/readFi/irrigate5",//智能灌溉组
|
||||
irrigate6:"/readFi/irrigate6",//智能灌溉组
|
||||
irrigate7:"/readFi/irrigate7",//智能灌溉组
|
||||
irrigate8:"/readFi/irrigate8",//智能灌溉组
|
||||
irrigate9:"/readFi/irrigate9",//智能灌溉组
|
||||
irrigate10:"/readFi/irrigate10",//智能灌溉组
|
||||
irrigate11:"/readFi/irrigate11",//智能灌溉组
|
||||
irrigate12:"/readFi/irrigate12",//智能灌溉组
|
||||
irrigate13:"/readFi/irrigate13",//智能灌溉组
|
||||
irrigate14:"/readFi/irrigate14",//智能灌溉组
|
||||
irrigate15:"/readFi/irrigate15",//智能灌溉组
|
||||
irrigate16:"/readFi/irrigate16",//智能灌溉组
|
||||
getFi_rtdata:"/getFi/rtdata",//首页智能灌溉
|
||||
writeFi_write:"/writeFi/write",//智能灌溉组写入
|
||||
chart_fidata:'/chart/fidata',//智能灌溉的折线图
|
||||
getcontrol_geteqetdata:'/getcontrol/geteqetdata',//小程序气象站显示
|
||||
|
||||
getcontrol_rtDatastation:'/getcontrol/rtDatastation',//主页查看控制器气象站实时数据
|
||||
|
|
|
@ -371,9 +371,10 @@
|
|||
uni.stopPullDownRefresh();
|
||||
this.inputData = res.data;
|
||||
this.getData30() //数据30/进水出水泵
|
||||
this.getData29() //数据29 启动方式/信号
|
||||
|
||||
this.getDataInfo2()
|
||||
this.getcenterBottom() //获取电磁阀
|
||||
this.getData29() //数据29 启动方式/信号
|
||||
} else {
|
||||
that.$refs.uToast.show({
|
||||
title: res.msg,
|
||||
|
@ -547,8 +548,10 @@
|
|||
typeNumber = i
|
||||
}
|
||||
}
|
||||
|
||||
this.openType = this.getType29(typeNumber)
|
||||
this.dataInfo2_list[3].timer = this.getType29(typeNumber)
|
||||
console.log(typeNumber,111);
|
||||
this.dataInfo2_list[2].timer = this.getType29(typeNumber)
|
||||
var statusIndex = 8
|
||||
let list=[]
|
||||
for (var j = 0; j < statusIndex; j++) {
|
||||
|
@ -645,12 +648,15 @@
|
|||
});
|
||||
},
|
||||
getcenterBottom() {
|
||||
// 96个电磁阀
|
||||
this.centerBottom = []
|
||||
var inputData = this.inputData
|
||||
var list1 = this.padString(inputData['32'].toString(2), 16)
|
||||
var list2 = this.padString(inputData['33'].toString(2), 16)
|
||||
var list3 = this.padString(inputData['34'].toString(2), 16)
|
||||
var list4 = this.padString(inputData['35'].toString(2), 16)
|
||||
var list1 = this.padString(inputData['3016'].toString(2), 16)
|
||||
var list2 = this.padString(inputData['3017'].toString(2), 16)
|
||||
var list3 = this.padString(inputData['3018'].toString(2), 16)
|
||||
var list4 = this.padString(inputData['3019'].toString(2), 16)
|
||||
var list5 = this.padString(inputData['3020'].toString(2), 16)
|
||||
var list6 = this.padString(inputData['3021'].toString(2), 16)
|
||||
var number = 16
|
||||
for (var i = 0; i < number; i++) {
|
||||
if (Number(list1[list1.length - 1 - i])) {
|
||||
|
@ -672,6 +678,16 @@
|
|||
this.centerBottom.push(l + 48)
|
||||
}
|
||||
}
|
||||
for (var m = 0; m < number; m++) {
|
||||
if (Number(list5[list5.length - 1 - m])) {
|
||||
this.centerBottom.push(m + 64)
|
||||
}
|
||||
}
|
||||
for (var n = 0; n < number; n++) {
|
||||
if (Number(list6[list6.length - 1 - n])) {
|
||||
this.centerBottom.push(n + 80)
|
||||
}
|
||||
}
|
||||
},
|
||||
countData(data) {
|
||||
if (data) {
|
||||
|
|
|
@ -125,9 +125,10 @@
|
|||
}
|
||||
|
||||
this.titleName = this.getStatus(option.equipmentNumber, option.targetValue)
|
||||
this.getEchartsData()
|
||||
},
|
||||
mounted() {
|
||||
this.getEchartsData()
|
||||
|
||||
},
|
||||
methods: {
|
||||
getServerData() {
|
||||
|
@ -148,7 +149,60 @@
|
|||
|
||||
// 获取折线图数据
|
||||
getEchartsData() {
|
||||
if(this.flag != 1){
|
||||
if(this.flag == 1){
|
||||
|
||||
this.$http({
|
||||
url:this.api.equip_chartdata + '?equipmentId=' + this.equipmentId,
|
||||
method: 'POST'
|
||||
}).then(res=>{
|
||||
// console.log(res,'气象站折线图数据');
|
||||
res.data.forEach((i, index) => {
|
||||
this.categoriesList.push(i.time);
|
||||
this.valuePHList.push(i.value)
|
||||
})
|
||||
this.getServerData();
|
||||
|
||||
this.categoriesList = this.categoriesList.map(item => {
|
||||
return item.split(' ')[1]
|
||||
})
|
||||
for(let k=0;k<this.valuePHList.length;k++){
|
||||
// console.log(this.valuePHList[k]);
|
||||
this.valuePHList[k].forEach((item,index)=>{
|
||||
if(item.name == this.echartName){
|
||||
this.newValuePHList.push(item.value==undefined?'':item.value)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}else if(this.flag == 2){
|
||||
this.$http({
|
||||
url: this.api.chart_fidata+ '?equipmentId=' + this.equipmentId,
|
||||
method: 'POST'
|
||||
}).then(res => {
|
||||
// console.log(res, '获取折线图数据');
|
||||
res.data.forEach((i, index) => {
|
||||
this.categoriesList.push(i.time);
|
||||
this.valuePHList.push(i.value)
|
||||
})
|
||||
this.getServerData();
|
||||
|
||||
this.categoriesList = this.categoriesList.map(item => {
|
||||
return item.split(' ')[1]
|
||||
})
|
||||
// console.log(this.categoriesList,'this.categoriesList');
|
||||
// console.log(this.valuePHList,'this.valuePHList');
|
||||
for(let k=0;k<this.valuePHList.length;k++){
|
||||
// console.log(this.valuePHList[k]);
|
||||
this.valuePHList[k].forEach((item,index)=>{
|
||||
if(item.name == this.titleName + this.echartName){
|
||||
this.newValuePHList.push(item.value==undefined?'':item.value)
|
||||
}
|
||||
})
|
||||
}
|
||||
// console.log(this.newValuePHList, '121212212121211111111');
|
||||
})
|
||||
|
||||
}else{
|
||||
this.$http({
|
||||
url: (this.equipmentName == 1 ? this.api.chart_fsdata : this.api.getcontrol_fsdata) + '?equipmentId=' + this.equipmentId,
|
||||
method: 'POST'
|
||||
|
@ -175,30 +229,6 @@
|
|||
}
|
||||
// console.log(this.newValuePHList, '121212212121211111111');
|
||||
})
|
||||
}else{
|
||||
this.$http({
|
||||
url:this.api.equip_chartdata + '?equipmentId=' + this.equipmentId,
|
||||
method: 'POST'
|
||||
}).then(res=>{
|
||||
// console.log(res,'气象站折线图数据');
|
||||
res.data.forEach((i, index) => {
|
||||
this.categoriesList.push(i.time);
|
||||
this.valuePHList.push(i.value)
|
||||
})
|
||||
this.getServerData();
|
||||
|
||||
this.categoriesList = this.categoriesList.map(item => {
|
||||
return item.split(' ')[1]
|
||||
})
|
||||
for(let k=0;k<this.valuePHList.length;k++){
|
||||
// console.log(this.valuePHList[k]);
|
||||
this.valuePHList[k].forEach((item,index)=>{
|
||||
if(item.name == this.echartName){
|
||||
this.newValuePHList.push(item.value==undefined?'':item.value)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
|
|
|
@ -75,7 +75,31 @@
|
|||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<!-- 智能灌溉 -->
|
||||
<template v-for="item0 in equipmentName20List">
|
||||
<view class="waterAndFertilizerParams" :key="item0.id">
|
||||
<view class="nav">
|
||||
<image src="../../static/PH.png" mode=""></image>
|
||||
<text>{{item0.deviceTypeName}}</text>
|
||||
</view>
|
||||
<view class="detail">
|
||||
<view class="item" v-for="item,index in item0.equipmentName20ListChild" :key="index" @click="toTarget_water_fertilizer_PH(item.equipmentId,item.environmentData,item.environmentDataId,item.equipmentNumber,item.targetValue,getTypeList(item.formula),item.equipmentName,2)">
|
||||
<image :src="`../../static/icon_new/icon${ item.formula }.png`" mode=""></image>
|
||||
<view class="info">
|
||||
<view class="">
|
||||
{{ item.environmentDataId }}
|
||||
</view>
|
||||
<view class="" :style="item.equipmentStart == 0 ? 'color:red':''">{{ item.equipmentStart == 0 ? '故障' : ((item.formula == '12' ? getWindDirection(item.environmentData) : item.environmentData) + (item.formula == '12' ? '' : getTypeList(item.formula))) }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="line" v-if="item0.equipmentName20ListChild.length > 0"></view>
|
||||
<view class="updateTime">
|
||||
<span></span>
|
||||
<span>*更新数据时间 : {{ (updateTime20.filter(el=> el.equipmentId == item0.deviceId)).length > 0 ? (updateTime20.filter(el=> el.equipmentId == item0.deviceId))[0].updateTime : '暂无'}}</span>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<view class="waterAndFertilizerParams" v-for="(item1,index1) in waterAndFertilizerParamsList" :key="index1">
|
||||
<view class="nav">
|
||||
|
@ -402,7 +426,10 @@
|
|||
|
||||
equipmentName30List:[],
|
||||
equipmentName30ListChild:[],
|
||||
equipmentName20List:[],
|
||||
equipmentName20ListChild:[],
|
||||
updateTime30:[],
|
||||
updateTime20:[],
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
|
@ -489,15 +516,21 @@
|
|||
// console.log(res, '根据用户id查询对应的设备数据');
|
||||
if (res.code == 200) {
|
||||
this.equipmentName30List = [];
|
||||
this.equipmentName20List = [];
|
||||
res.data.forEach(el=>{
|
||||
if(el.equipmentName == 30){
|
||||
this.equipmentName30List.push(el)
|
||||
}
|
||||
if(el.equipmentName == 20){
|
||||
this.equipmentName20List.push(el)
|
||||
}
|
||||
})
|
||||
if(this.equipmentName30List.length != 0){
|
||||
this.getcontrol_rtDatastation1()
|
||||
}
|
||||
|
||||
if(this.equipmentName20List.length != 0){
|
||||
this.getFi_rtdata()
|
||||
}
|
||||
this.waterAndFertilizerParamsList = res.data.map((item, index) => {
|
||||
return {
|
||||
...item,
|
||||
|
@ -677,7 +710,32 @@
|
|||
getcontrol_rtDatastation(equipmentId){
|
||||
|
||||
},
|
||||
|
||||
// 获取deviceName为20的智能灌溉实时数据
|
||||
getFi_rtdata(){
|
||||
this.equipmentName20List = this.equipmentName20List.map((item,index)=>{
|
||||
return {
|
||||
...item,
|
||||
equipmentName20ListChild:[]
|
||||
}
|
||||
})
|
||||
|
||||
this.updateTime20 = []
|
||||
this.equipmentName20List.forEach(el=>{
|
||||
this.$http({
|
||||
url:this.api.getFi_rtdata + '?equipmentId=' + el.deviceId,
|
||||
method: 'GET'
|
||||
}).then(res=>{
|
||||
if(res.code == 200){
|
||||
el.equipmentName20ListChild = res.data;
|
||||
this.updateTime20.push(res.data[0])
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
console.log(this.equipmentName20List);
|
||||
|
||||
},
|
||||
// 获取deviceName为30的气象站实时数据
|
||||
getcontrol_rtDatastation1(){
|
||||
this.equipmentName30List = this.equipmentName30List.map((item,index)=>{
|
||||
|
|
Loading…
Reference in New Issue