diff --git a/src/views/board/board1/index.vue b/src/views/board/board1/index.vue index 403c4d9..183d7d1 100644 --- a/src/views/board/board1/index.vue +++ b/src/views/board/board1/index.vue @@ -6,31 +6,30 @@
设备数量 - 16 + {{ deviceData.TOTALCOUNT }}
- 开机率 + 开机率 - 80 - % + {{ deviceData.runningRate }}
运行 - 11 + {{ deviceData.RUNNINGCOUNT }}
停机 - 02 + {{ deviceData.STOPPEDCOUNT }}
待机 - 01 + {{ deviceData.STANDBYCOUNT }}
@@ -42,7 +41,7 @@
未开机 - 01 + {{ deviceData.NOTSTARTEDCOUNT }}
@@ -85,6 +84,9 @@ import Chart from "@/components/board/Chart.vue"; import * as echarts from "echarts"; +import {getDeviceStatusStatistics} from "@/api/baseDeviceParamVal/val"; + +let timer = null const vw = (document.documentElement.clientWidth || document.body.clientWidth) / 100 export default { @@ -93,7 +95,9 @@ export default { }, name: "Liner", data() { - return {} + return { + deviceData: {} + } }, mounted() { this.$refs.chart1.setData({ @@ -230,8 +234,18 @@ export default { }, ], }) + this.getData() + timer = setInterval(() => { + this.getData() + }, 1000 * 5) + }, + methods: { + getData() { + getDeviceStatusStatistics().then(e => { + this.deviceData = e.data + }) + } }, - methods: {}, computed: { list() { return Array(222).fill(0).map(i => { @@ -242,6 +256,10 @@ export default { } }, beforeDestroy() { + if (timer) { + clearInterval(timer) + } + timer = null } }; diff --git a/src/views/board/board4/index.vue b/src/views/board/board4/index.vue index 85cda2a..6d3a7a1 100644 --- a/src/views/board/board4/index.vue +++ b/src/views/board/board4/index.vue @@ -444,6 +444,7 @@ import * as echarts from "echarts"; import {getSimulateData} from "@/api/board/getData"; import {updateCustomData} from "@/api/base/customData"; import {Message} from "element-ui"; +import {getDeviceStatusStatistics} from "@/api/baseDeviceParamVal/val"; const vw = (document.documentElement.clientWidth || document.body.clientWidth) / 100 export default { diff --git a/src/views/board/board5/index.vue b/src/views/board/board5/index.vue index faf5f70..e346896 100644 --- a/src/views/board/board5/index.vue +++ b/src/views/board/board5/index.vue @@ -250,6 +250,7 @@ import * as echarts from "echarts"; import {getSimulateData} from "@/api/board/getData"; import {updateCustomData} from "@/api/base/customData"; import {Message} from "element-ui"; +import {getDeviceStatusStatistics} from "@/api/baseDeviceParamVal/val"; const vw = (document.documentElement.clientWidth || document.body.clientWidth) / 100 export default {