diff --git a/api/driverapi.js b/api/driverapi.js index a6b20db..0f8706d 100644 --- a/api/driverapi.js +++ b/api/driverapi.js @@ -67,6 +67,7 @@ let api = { getcontrol_geteqetdata: '/getcontrol/geteqetdata', //小程序气象站显示 getcontrol_rtDatastation: '/getcontrol/rtDatastation', //主页查看控制器气象站实时数据 + getdata_rtdata: '/getdata/rtdata', //主页查看数据采集器实时数据 readControl_interiorthermalinsulation: '/readControl/interiorthermalinsulation', //读取(内保温)控制器 diff --git a/pages/timeEnvironment/timeEnvironment.vue b/pages/timeEnvironment/timeEnvironment.vue index e8f1ed4..f78f477 100644 --- a/pages/timeEnvironment/timeEnvironment.vue +++ b/pages/timeEnvironment/timeEnvironment.vue @@ -112,7 +112,7 @@ - + @@ -365,7 +365,36 @@  {{ (updateTime.filter(el=> el.equipmentId == item1.deviceId)).length > 0 ? (updateTime.filter(el=> el.equipmentId == item1.deviceId))[0].updateTime : '暂无'}} - + + + @@ -500,8 +529,11 @@ equipmentName30ListChild: [], equipmentName20List: [], equipmentName20ListChild: [], + equipmentName40List: [], + equipmentName40ListChild: [], updateTime30: [], updateTime20: [], + updateTime40: [], } }, onLoad() { @@ -590,15 +622,25 @@ 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 (el.equipmentName == 40) { + this.equipmentName40List.push(el) + } }) + // 数据采集器 + if (this.equipmentName40List.length != 0) { + this.getcontrol_rtDatastation40() + } + // 气象站 if (this.equipmentName30List.length != 0) { - this.getcontrol_rtDatastation1() + this.getcontrol_rtDatastation30() } if (this.equipmentName20List.length != 0) { this.getFi_rtdata() @@ -877,8 +919,37 @@ console.log(this.equipmentName20List); }, + // 获取deviceName为40的数据采集器实时数据 + getcontrol_rtDatastation40() { + this.equipmentName40List = this.equipmentName40List.map((item, index) => { + return { + ...item, + equipmentName40ListChild: [] + } + }) + + this.updateTime40 = [] + this.equipmentName40List.forEach(el => { + this.$http({ + url: this.api.getdata_rtdata + '?deviceId=' + el.deviceId, + method: 'GET' + }).then(res => { + if (res.code == 200) { + res.data.forEach((el1, index) => { + el.equipmentName40ListChild.push({ + ...el1, + environmentDataId: this.getStatusNew(el1), + }) + }) + this.updateTime40.push(res.data[0]) + } + + }) + }) + // console.log(this.equipmentName30List,'this.equipmentName30List'); + }, // 获取deviceName为30的气象站实时数据 - getcontrol_rtDatastation1() { + getcontrol_rtDatastation30() { this.equipmentName30List = this.equipmentName30List.map((item, index) => { return { ...item,