From f43b1c1eabc95bcaa786fd9fae22edbc8ddd461b Mon Sep 17 00:00:00 2001 From: lb Date: Fri, 22 Sep 2023 10:29:28 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E8=AE=BE=E5=A4=87=E5=8A=A0=E5=B7=A5?= =?UTF-8?q?=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../equipmentProcessAmount/graph.vue | 23 +++++++++++-------- .../equipmentProcessAmount/index.vue | 20 ++++++++++------ 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/src/views/monitoring/equipmentProcessAmount/graph.vue b/src/views/monitoring/equipmentProcessAmount/graph.vue index 8bde181b..907313d2 100644 --- a/src/views/monitoring/equipmentProcessAmount/graph.vue +++ b/src/views/monitoring/equipmentProcessAmount/graph.vue @@ -17,11 +17,12 @@ import * as echarts from 'echarts'; export default { name: 'LineChartInEquipmentProcessAmount', components: {}, - props: ['equipmentList'], + props: ['equipmentList', 'render'], data() { return { chart: null, option: { + color: ['#288AFF'], grid: { top: 64, left: 56, @@ -89,16 +90,19 @@ export default { }, }; }, - mounted() { - // console.log('this.eq list', this.equipmentList); - if (!this.chart) this.chart = echarts.init(this.$refs.chart); - - this.$nextTick(() => { - this.chart.setOption(this.updateConfig(this.option)); - }); + watch: { + render: { + handler: function (newVal, oldVal) { + if (!this.chart) this.chart = echarts.init(this.$refs.chart); + this.$nextTick(() => { + if (this.chart) this.chart.setOption(this.updateConfig(this.option)); + }); + }, + deep: true, + }, }, beforeDestroy() { - this.chart.dispose(); + if (this.chart) this.chart.dispose(); }, methods: { updateConfig(config) { @@ -126,5 +130,6 @@ export default { .chart { height: 100%; width: 100%; + // background: lightcoral; } diff --git a/src/views/monitoring/equipmentProcessAmount/index.vue b/src/views/monitoring/equipmentProcessAmount/index.vue index d92d7b68..2acb6635 100644 --- a/src/views/monitoring/equipmentProcessAmount/index.vue +++ b/src/views/monitoring/equipmentProcessAmount/index.vue @@ -89,9 +89,12 @@
- +