| | |
| | | style="height: 40vh; padding-top: 0.4em;" |
| | | :span="12" |
| | | ><largeAreaChart |
| | | :ref="'largeAreaChartRef' + k" |
| | | :key="new Date()" |
| | | ref="largeAreaChartRef" |
| | | :yAxisMonth="v.yAxisMonth" |
| | | :seriesData="v.listData" |
| | | :otherData="v" |
| | |
| | | obj.endTime = this.datePicker[1] |
| | | } |
| | | // 调用数据接口 |
| | | await mqttList(obj).then(async (res) => { |
| | | const data = res.data.data |
| | | await data.forEach((i, k) => { |
| | | i.listData = [] |
| | | i.yAxisMonth = [] |
| | | if (i.listMqttTableData.length > 0) { |
| | | i.deviceId = i.listMqttTableData[0].deviceId |
| | | } |
| | | i.listMqttTableData.forEach((j) => { |
| | | i.listData.push(j.value) |
| | | i.yAxisMonth.push(j.collectionTime) |
| | | }) |
| | | i.listMqttTableData = [] |
| | | }) |
| | | this.largeAreaChartList = data |
| | | }) |
| | | const res = await mqttList(obj) |
| | | const data = res.data.data |
| | | for (const i of data) { |
| | | i.listData = [] |
| | | i.yAxisMonth = [] |
| | | if (i.listMqttTableData.length > 0) { |
| | | i.deviceId = i.listMqttTableData[0].deviceId |
| | | } |
| | | for (const j of i.listMqttTableData) { |
| | | i.listData.push(j.value) |
| | | i.yAxisMonth.push(j.collectionTime) |
| | | } |
| | | i.listMqttTableData = [] |
| | | } |
| | | this.largeAreaChartList = data |
| | | // 处理数据,适配折线图格式 |
| | | await this.largeAreaChartList.forEach((i, k) => { |
| | | this.$refs['largeAreaChartRef' + k][0].refreshData( |
| | | i.listData, |
| | | i.yAxisMonth |
| | | ) |
| | | }) |
| | | for (const [k, i] of this.largeAreaChartList.entries()) { |
| | | this.$refs.largeAreaChartRef[k].refreshData(i.listData, i.yAxisMonth) |
| | | } |
| | | }, |
| | | // 开启定时器 |
| | | destroyTimerAgainStart() { |
| | | this.largeAreaChartList = [] |
| | | clearInterval(this.timer) |
| | | this.timer = setInterval(this.getMqttLists, 1000 * 30) |
| | | this.timer = setInterval(this.getMqttLists, 1000 * 3) |
| | | this.getMqttLists() |
| | | } |
| | | } |