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 @@
- +