From f43b1c1eabc95bcaa786fd9fae22edbc8ddd461b Mon Sep 17 00:00:00 2001 From: lb Date: Fri, 22 Sep 2023 10:29:28 +0800 Subject: [PATCH 1/2] =?UTF-8?q?update=20=E8=AE=BE=E5=A4=87=E5=8A=A0?= =?UTF-8?q?=E5=B7=A5=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 @@
- +
moment(val).format('yyyy-MM-DD HH:mm:ss'), + filter: (val) => + val != null ? moment(val).format('yyyy-MM-DD HH:mm:ss') : '-', }, { width: 90, diff --git a/src/views/quality/monitoring/qualityStatistics/index.vue b/src/views/quality/monitoring/qualityStatistics/index.vue index b5b7a100..2c3fa236 100644 --- a/src/views/quality/monitoring/qualityStatistics/index.vue +++ b/src/views/quality/monitoring/qualityStatistics/index.vue @@ -332,33 +332,51 @@ export default { }, mounted() { if (this.$route.params.startTime && this.$route.params.endTime) { - this.searchBarFormConfig[0].defaultSelect = [this.$route.params.startTime, this.$route.params.endTime] + this.searchBarFormConfig[0].defaultSelect = [ + this.$route.params.startTime, + this.$route.params.endTime, + ]; this.queryParams.param = {}; - this.$set(this.queryParams.param, 'startTime', this.$route.params.startTime); + this.$set( + this.queryParams.param, + 'startTime', + this.$route.params.startTime + ); this.$set(this.queryParams.param, 'endTime', this.$route.params.endTime); - } else { - this.searchBarFormConfig[0].defaultSelect = [] - } + } else { + this.searchBarFormConfig[0].defaultSelect = []; + } this.getList(); }, watch: { - $route: 'initData' - }, + $route: 'initData', + }, methods: { initData(to) { // console.log(to) - if (to.name === 'QualityStatistics') { - if (this.$route.params.startTime && this.$route.params.endTime) { - this.searchBarFormConfig[0].defaultSelect = [this.$route.params.startTime, this.$route.params.endTime] + if (to.name === 'QualityStatistics') { + if (this.$route.params.startTime && this.$route.params.endTime) { + this.searchBarFormConfig[0].defaultSelect = [ + this.$route.params.startTime, + this.$route.params.endTime, + ]; this.queryParams.param = {}; - this.$set(this.queryParams.param, 'startTime', this.$route.params.startTime); - this.$set(this.queryParams.param, 'endTime', this.$route.params.endTime); + this.$set( + this.queryParams.param, + 'startTime', + this.$route.params.startTime + ); + this.$set( + this.queryParams.param, + 'endTime', + this.$route.params.endTime + ); } else { - this.searchBarFormConfig[0].defaultSelect = [] + this.searchBarFormConfig[0].defaultSelect = []; } this.getList(); } - }, + }, getList() { this.getSummaryList(); this.getDetailedList(); @@ -367,20 +385,17 @@ export default { async getSummaryList() { const response = await this.$axios({ url: '/monitoring/statistical-data/getUpPart', - method: 'get', - params: this.queryParams.param + method: 'post', + data: this.queryParams.param ? { - param: { - // startTime: new Date(2022, 6, 1, 0, 0, 0).getTime(), // '2023-07-01 00:00:00', - // endTime: new Date(2023, 7, 10, 0, 0, 0).getTime(), // '2023-08-10 00:00:00', - startTime: this.queryParams.param.startTime, - endTime: this.queryParams.param.endTime, - }, + // startTime: new Date(2022, 6, 1, 0, 0, 0).getTime(), // '2023-07-01 00:00:00', + // endTime: new Date(2023, 7, 10, 0, 0, 0).getTime(), // '2023-08-10 00:00:00', + startTime: this.queryParams.param.startTime, + endTime: this.queryParams.param.endTime, } - : null, + : {}, }); this.summaryList = response.data; - console.log('summaryList', this.summaryList); }, /** 获取 检测内容和产线关联 列表 */ async getDetailedList() { @@ -388,22 +403,21 @@ export default { data: { data, otherList, otherMap, nameData }, } = await this.$axios({ url: '/monitoring/statistical-data/getDownPart', - params: this.queryParams.param + method: 'post', + data: this.queryParams.param ? { - param: { - // startTime: new Date(2023, 6, 1).getTime(), // '2023-07-01 00:00:00', - // endTime: new Date(2023, 7, 22).getTime(), // '2023-08-10 00:00:00', - startTime: this.queryParams.param.startTime, - endTime: this.queryParams.param.endTime, - }, + // startTime: new Date(2023, 6, 1).getTime(), // '2023-07-01 00:00:00', + // endTime: new Date(2023, 7, 22).getTime(), // '2023-08-10 00:00:00', + startTime: this.queryParams.param.startTime, + endTime: this.queryParams.param.endTime, } - : null, + : {}, }); // this.list = response.data; - console.log('data', data); - console.log('otherList', otherList); - console.log('otherMap', otherMap); - console.log('nameData', nameData); + // console.log('data', data); + // console.log('otherList', otherList); + // console.log('otherMap', otherMap); + // console.log('nameData', nameData); this.dynamicProps = this.filterNameData(nameData); this.list = this.filterData(data);