From 339111ff4fe09368d5c1ff998d67575e53f912c1 Mon Sep 17 00:00:00 2001 From: zhaowei <zhaowei> Date: 星期二, 04 三月 2025 17:44:41 +0800 Subject: [PATCH] 1、车间看板页面调整鼠标悬浮框样式 2、车间看板页面增加定时任务定时刷新后台接口 --- src/views/mdc/base/modules/WorkshopSignage/WeekUtilizationRateTrend.vue | 543 ++---------------------------------------------------- 1 files changed, 22 insertions(+), 521 deletions(-) diff --git a/src/views/mdc/base/modules/WorkshopSignage/WeekUtilizationRateTrend.vue b/src/views/mdc/base/modules/WorkshopSignage/WeekUtilizationRateTrend.vue index 85dba23..8fd0d92 100644 --- a/src/views/mdc/base/modules/WorkshopSignage/WeekUtilizationRateTrend.vue +++ b/src/views/mdc/base/modules/WorkshopSignage/WeekUtilizationRateTrend.vue @@ -3,10 +3,15 @@ </template> <script> + import signageApi from '@/api/signage' + export default { name: 'WeekUtilizationRateTrend', components: {}, props: { + currentProductionId: { + type: String + }, toDecimal2NoZero: { type: Function } @@ -18,534 +23,31 @@ } }, mounted() { - this.getChartDataByApi() window.addEventListener('resize', this.handleWindowResize) + if (!this.currentProductionId) return + this.getChartDataByApi() }, beforeDestroy() { window.removeEventListener('resize', this.handleWindowResize) }, methods: { getChartDataByApi() { + const that = this this.chartContainer = this.$echarts.init(document.getElementById(this.chartContainerId)) - this.initChart() + signageApi.getWeekUtilizationRateApi(this.currentProductionId) + .then(res => { + if (!res.success) return + that.initChart(res.result) + }) }, - initChart() { - const data = [ - { - 'beltlineID': 'A_1', - 'beltlineName': '1-D鐗圭宸ヨ壓', - 'fullName': '1-D鐗圭宸ヨ壓鍗曞厓', - 'list': [ - { - 'code': '000000014831', - 'factoryID': 'A', - 'beltlineID': 'A_1', - 'beltlineName': '1-D鐗圭宸ヨ壓', - 'dayTime': '2023-09-28', - 'lineRate': 0.2456, - 'processingLong': 0.0000, - 'openingLong': 0.0000, - 'collectDate': '2023-10-05 00:25:01' - }, - { - 'code': '000000014820', - 'factoryID': 'A', - 'beltlineID': 'A_1', - 'beltlineName': '1-D鐗圭宸ヨ壓', - 'dayTime': '2023-09-29', - 'lineRate': 0.3452, - 'processingLong': 0.0000, - 'openingLong': 0.0000, - 'collectDate': '2023-10-05 00:25:01' - }, - { - 'code': '000000014809', - 'factoryID': 'A', - 'beltlineID': 'A_1', - 'beltlineName': '1-D鐗圭宸ヨ壓', - 'dayTime': '2023-09-30', - 'lineRate': 0.2453, - 'processingLong': 0.0000, - 'openingLong': 0.0000, - 'collectDate': '2023-10-05 00:25:01' - }, - { - 'code': '000000014798', - 'factoryID': 'A', - 'beltlineID': 'A_1', - 'beltlineName': '1-D鐗圭宸ヨ壓', - 'dayTime': '2023-10-01', - 'lineRate': 0.5623, - 'processingLong': 0.0000, - 'openingLong': 0.0000, - 'collectDate': '2023-10-05 00:25:01' - }, - { - 'code': '000000014787', - 'factoryID': 'A', - 'beltlineID': 'A_1', - 'beltlineName': '1-D鐗圭宸ヨ壓', - 'dayTime': '2023-10-02', - 'lineRate': 0.3254, - 'processingLong': 0.0000, - 'openingLong': 0.0000, - 'collectDate': '2023-10-05 00:25:01' - }, - { - 'code': '000000014776', - 'factoryID': 'A', - 'beltlineID': 'A_1', - 'beltlineName': '1-D鐗圭宸ヨ壓', - 'dayTime': '2023-10-03', - 'lineRate': 0.7456, - 'processingLong': 0.0000, - 'openingLong': 0.0000, - 'collectDate': '2023-10-05 00:25:01' - }, - { - 'code': '000000014765', - 'factoryID': 'A', - 'beltlineID': 'A_1', - 'beltlineName': '1-D鐗圭宸ヨ壓', - 'dayTime': '2023-10-04', - 'lineRate': 0.5389, - 'processingLong': 0.0000, - 'openingLong': 0.0000, - 'collectDate': '2023-10-05 00:25:00' - } - ] - }, - { - 'beltlineID': 'A_2', - 'beltlineName': '2-D鏁翠綋鏈哄專', - 'fullName': '2-D鏁翠綋鏈哄專鍗曞厓', - 'list': [ - { - 'code': '000000014833', - 'factoryID': 'A', - 'beltlineID': 'A_2', - 'beltlineName': '2-D鏁翠綋鏈哄專', - 'dayTime': '2023-09-28', - 'lineRate': 0.5234, - 'processingLong': 0.0000, - 'openingLong': 0.0000, - 'collectDate': '2023-10-05 00:25:01' - }, - { - 'code': '000000014822', - 'factoryID': 'A', - 'beltlineID': 'A_2', - 'beltlineName': '2-D鏁翠綋鏈哄專', - 'dayTime': '2023-09-29', - 'lineRate': 0.63465, - 'processingLong': 0.0000, - 'openingLong': 0.0000, - 'collectDate': '2023-10-05 00:25:01' - }, - { - 'code': '000000014811', - 'factoryID': 'A', - 'beltlineID': 'A_2', - 'beltlineName': '2-D鏁翠綋鏈哄專', - 'dayTime': '2023-09-30', - 'lineRate': 0.6747, - 'processingLong': 0.0000, - 'openingLong': 0.0000, - 'collectDate': '2023-10-05 00:25:01' - }, - { - 'code': '000000014800', - 'factoryID': 'A', - 'beltlineID': 'A_2', - 'beltlineName': '2-D鏁翠綋鏈哄專', - 'dayTime': '2023-10-01', - 'lineRate': 0.8675, - 'processingLong': 0.0000, - 'openingLong': 0.0000, - 'collectDate': '2023-10-05 00:25:01' - }, - { - 'code': '000000014789', - 'factoryID': 'A', - 'beltlineID': 'A_2', - 'beltlineName': '2-D鏁翠綋鏈哄專', - 'dayTime': '2023-10-02', - 'lineRate': 0.9774, - 'processingLong': 0.0000, - 'openingLong': 0.0000, - 'collectDate': '2023-10-05 00:25:01' - }, - { - 'code': '000000014778', - 'factoryID': 'A', - 'beltlineID': 'A_2', - 'beltlineName': '2-D鏁翠綋鏈哄專', - 'dayTime': '2023-10-03', - 'lineRate': 0.5637, - 'processingLong': 0.0000, - 'openingLong': 0.0000, - 'collectDate': '2023-10-05 00:25:01' - }, - { - 'code': '000000014767', - 'factoryID': 'A', - 'beltlineID': 'A_2', - 'beltlineName': '2-D鏁翠綋鏈哄專', - 'dayTime': '2023-10-04', - 'lineRate': 0.8565, - 'processingLong': 0.0000, - 'openingLong': 0.0000, - 'collectDate': '2023-10-05 00:25:01' - } - ] - }, - { - 'beltlineID': 'A_3', - 'beltlineName': '3-D鐕冪儳瀹ゆ満鍖�', - 'fullName': '3-D鐕冪儳瀹ゆ満鍖e崟鍏�', - 'list': [ - { - 'code': '000000014834', - 'factoryID': 'A', - 'beltlineID': 'A_3', - 'beltlineName': '3-D鐕冪儳瀹ゆ満鍖�', - 'dayTime': '2023-09-28', - 'lineRate': 0.6573, - 'processingLong': 0.0000, - 'openingLong': 0.0000, - 'collectDate': '2023-10-05 00:25:01' - }, - { - 'code': '000000014823', - 'factoryID': 'A', - 'beltlineID': 'A_3', - 'beltlineName': '3-D鐕冪儳瀹ゆ満鍖�', - 'dayTime': '2023-09-29', - 'lineRate': 0.7567, - 'processingLong': 0.0000, - 'openingLong': 0.0000, - 'collectDate': '2023-10-05 00:25:01' - }, - { - 'code': '000000014812', - 'factoryID': 'A', - 'beltlineID': 'A_3', - 'beltlineName': '3-D鐕冪儳瀹ゆ満鍖�', - 'dayTime': '2023-09-30', - 'lineRate': 0.8532, - 'processingLong': 0.0000, - 'openingLong': 0.0000, - 'collectDate': '2023-10-05 00:25:01' - }, - { - 'code': '000000014801', - 'factoryID': 'A', - 'beltlineID': 'A_3', - 'beltlineName': '3-D鐕冪儳瀹ゆ満鍖�', - 'dayTime': '2023-10-01', - 'lineRate': 0.4352, - 'processingLong': 0.0000, - 'openingLong': 0.0000, - 'collectDate': '2023-10-05 00:25:01' - }, - { - 'code': '000000014790', - 'factoryID': 'A', - 'beltlineID': 'A_3', - 'beltlineName': '3-D鐕冪儳瀹ゆ満鍖�', - 'dayTime': '2023-10-02', - 'lineRate': 0.3456, - 'processingLong': 0.0000, - 'openingLong': 0.0000, - 'collectDate': '2023-10-05 00:25:01' - }, - { - 'code': '000000014779', - 'factoryID': 'A', - 'beltlineID': 'A_3', - 'beltlineName': '3-D鐕冪儳瀹ゆ満鍖�', - 'dayTime': '2023-10-03', - 'lineRate': 0.1356, - 'processingLong': 0.0000, - 'openingLong': 0.0000, - 'collectDate': '2023-10-05 00:25:01' - }, - { - 'code': '000000014768', - 'factoryID': 'A', - 'beltlineID': 'A_3', - 'beltlineName': '3-D鐕冪儳瀹ゆ満鍖�', - 'dayTime': '2023-10-04', - 'lineRate': 0.5346, - 'processingLong': 0.0000, - 'openingLong': 0.0000, - 'collectDate': '2023-10-05 00:25:01' - } - ] - }, - { - 'beltlineID': 'A_4', - 'beltlineName': '4-D鐒婃帴鏈哄專宸ユ', - 'fullName': '4-D鐒婃帴鏈哄專宸ユ', - 'list': [ - { - 'code': '000000014835', - 'factoryID': 'A', - 'beltlineID': 'A_4', - 'beltlineName': '4-D鐒婃帴鏈哄專宸ユ', - 'dayTime': '2023-09-28', - 'lineRate': 0.1333, - 'processingLong': 11520.0000, - 'openingLong': 11520.0000, - 'collectDate': '2023-10-05 00:25:01' - }, - { - 'code': '000000014824', - 'factoryID': 'A', - 'beltlineID': 'A_4', - 'beltlineName': '4-D鐒婃帴鏈哄專宸ユ', - 'dayTime': '2023-09-29', - 'lineRate': 0.5234, - 'processingLong': 11520.0000, - 'openingLong': 11520.0000, - 'collectDate': '2023-10-05 00:25:01' - }, - { - 'code': '000000014813', - 'factoryID': 'A', - 'beltlineID': 'A_4', - 'beltlineName': '4-D鐒婃帴鏈哄專宸ユ', - 'dayTime': '2023-09-30', - 'lineRate': 0.5631, - 'processingLong': 11520.0000, - 'openingLong': 11520.0000, - 'collectDate': '2023-10-05 00:25:01' - }, - { - 'code': '000000014802', - 'factoryID': 'A', - 'beltlineID': 'A_4', - 'beltlineName': '4-D鐒婃帴鏈哄專宸ユ', - 'dayTime': '2023-10-01', - 'lineRate': 0.2345, - 'processingLong': 11520.0000, - 'openingLong': 11520.0000, - 'collectDate': '2023-10-05 00:25:01' - }, - { - 'code': '000000014791', - 'factoryID': 'A', - 'beltlineID': 'A_4', - 'beltlineName': '4-D鐒婃帴鏈哄專宸ユ', - 'dayTime': '2023-10-02', - 'lineRate': 0.1333, - 'processingLong': 11520.0000, - 'openingLong': 11520.0000, - 'collectDate': '2023-10-05 00:25:01' - }, - { - 'code': '000000014780', - 'factoryID': 'A', - 'beltlineID': 'A_4', - 'beltlineName': '4-D鐒婃帴鏈哄專宸ユ', - 'dayTime': '2023-10-03', - 'lineRate': 0.3215, - 'processingLong': 11520.0000, - 'openingLong': 11520.0000, - 'collectDate': '2023-10-05 00:25:01' - }, - { - 'code': '000000014769', - 'factoryID': 'A', - 'beltlineID': 'A_4', - 'beltlineName': '4-D鐒婃帴鏈哄專宸ユ', - 'dayTime': '2023-10-04', - 'lineRate': 0.4122, - 'processingLong': 11520.0000, - 'openingLong': 11520.0000, - 'collectDate': '2023-10-05 00:25:01' - } - ] - }, - { - 'beltlineID': 'A_5', - 'beltlineName': '5-D CRIC鍗曞厓', - 'fullName': '5-D CRIC鍗曞厓', - 'list': [ - { - 'code': '000000014836', - 'factoryID': 'A', - 'beltlineID': 'A_5', - 'beltlineName': '5-D CRIC鍗曞厓', - 'dayTime': '2023-09-28', - 'lineRate': 0.4234, - 'processingLong': 0.0000, - 'openingLong': 0.0000, - 'collectDate': '2023-10-05 00:25:01' - }, - { - 'code': '000000014825', - 'factoryID': 'A', - 'beltlineID': 'A_5', - 'beltlineName': '5-D CRIC鍗曞厓', - 'dayTime': '2023-09-29', - 'lineRate': 0.1213, - 'processingLong': 0.0000, - 'openingLong': 0.0000, - 'collectDate': '2023-10-05 00:25:01' - }, - { - 'code': '000000014814', - 'factoryID': 'A', - 'beltlineID': 'A_5', - 'beltlineName': '5-D CRIC鍗曞厓', - 'dayTime': '2023-09-30', - 'lineRate': 0.1245, - 'processingLong': 0.0000, - 'openingLong': 0.0000, - 'collectDate': '2023-10-05 00:25:01' - }, - { - 'code': '000000014803', - 'factoryID': 'A', - 'beltlineID': 'A_5', - 'beltlineName': '5-D CRIC鍗曞厓', - 'dayTime': '2023-10-01', - 'lineRate': 0.2467, - 'processingLong': 0.0000, - 'openingLong': 0.0000, - 'collectDate': '2023-10-05 00:25:01' - }, - { - 'code': '000000014792', - 'factoryID': 'A', - 'beltlineID': 'A_5', - 'beltlineName': '5-D CRIC鍗曞厓', - 'dayTime': '2023-10-02', - 'lineRate': 0.1579, - 'processingLong': 0.0000, - 'openingLong': 0.0000, - 'collectDate': '2023-10-05 00:25:01' - }, - { - 'code': '000000014781', - 'factoryID': 'A', - 'beltlineID': 'A_5', - 'beltlineName': '5-D CRIC鍗曞厓', - 'dayTime': '2023-10-03', - 'lineRate': 0.6757, - 'processingLong': 0.0000, - 'openingLong': 0.0000, - 'collectDate': '2023-10-05 00:25:01' - }, - { - 'code': '000000014770', - 'factoryID': 'A', - 'beltlineID': 'A_5', - 'beltlineName': '5-D CRIC鍗曞厓', - 'dayTime': '2023-10-04', - 'lineRate': 0.4563, - 'processingLong': 0.0000, - 'openingLong': 0.0000, - 'collectDate': '2023-10-05 00:25:01' - } - ] - }, - { - 'beltlineID': '鎬诲巶', - 'beltlineName': '鎬诲巶', - 'fullName': null, - 'list': [ - { - 'code': '000000014841', - 'factoryID': 'A', - 'beltlineID': '鎬诲巶', - 'beltlineName': '鎬诲巶', - 'dayTime': '2023-09-28', - 'lineRate': 0.0400, - 'processingLong': 3456.0000, - 'openingLong': 3456.0000, - 'collectDate': '2023-10-05 00:25:01' - }, - { - 'code': '000000014830', - 'factoryID': 'A', - 'beltlineID': '鎬诲巶', - 'beltlineName': '鎬诲巶', - 'dayTime': '2023-09-29', - 'lineRate': 0.0400, - 'processingLong': 3456.0000, - 'openingLong': 3456.0000, - 'collectDate': '2023-10-05 00:25:01' - }, - { - 'code': '000000014819', - 'factoryID': 'A', - 'beltlineID': '鎬诲巶', - 'beltlineName': '鎬诲巶', - 'dayTime': '2023-09-30', - 'lineRate': 0.0400, - 'processingLong': 3456.0000, - 'openingLong': 3456.0000, - 'collectDate': '2023-10-05 00:25:01' - }, - { - 'code': '000000014808', - 'factoryID': 'A', - 'beltlineID': '鎬诲巶', - 'beltlineName': '鎬诲巶', - 'dayTime': '2023-10-01', - 'lineRate': 0.0400, - 'processingLong': 3456.0000, - 'openingLong': 3456.0000, - 'collectDate': '2023-10-05 00:25:01' - }, - { - 'code': '000000014797', - 'factoryID': 'A', - 'beltlineID': '鎬诲巶', - 'beltlineName': '鎬诲巶', - 'dayTime': '2023-10-02', - 'lineRate': 0.0400, - 'processingLong': 3456.0000, - 'openingLong': 3456.0000, - 'collectDate': '2023-10-05 00:25:01' - }, - { - 'code': '000000014786', - 'factoryID': 'A', - 'beltlineID': '鎬诲巶', - 'beltlineName': '鎬诲巶', - 'dayTime': '2023-10-03', - 'lineRate': 0.0400, - 'processingLong': 3456.0000, - 'openingLong': 3456.0000, - 'collectDate': '2023-10-05 00:25:01' - }, - { - 'code': '000000014775', - 'factoryID': 'A', - 'beltlineID': '鎬诲巶', - 'beltlineName': '鎬诲巶', - 'dayTime': '2023-10-04', - 'lineRate': 0.0400, - 'processingLong': 3456.0000, - 'openingLong': 3456.0000, - 'collectDate': '2023-10-05 00:25:01' - } - ] - } - ] + initChart(dataObj) { const seriesArr = [] const xAxisData = [] const option = { color: ['#538dd6', '#ffff01', '#0bae8d', '#e26c0a', '#F6E1BE', '#7030a0', '#0ad0bb', '#FF9297', '#A40035'], tooltip: { trigger: 'axis', - textStyle: { - fontSize: '60%' - } }, legend: { //type:'scroll', @@ -616,18 +118,17 @@ }, series: [] } - data.forEach(item1 => { + dataObj.dataList.forEach(item1 => { const dataArr = [] - item1.list.forEach(item2 => { + item1.utilizationRateList.forEach(item2 => { dataArr.push({ - value: this.toDecimal2NoZero(item2.lineRate * 100), - hostType: (item2.dayTime == null ? '' : item2.dayTime) + value: item2.utilizationRate, + hostType: (item2.date ? item2.date : '') }) - xAxisData.push(item2.dayTime == null ? '' : item2.dayTime.slice(5)) }) - if (item1.beltlineName == '鎬诲巶') { + if (item1.productionName == '鎬诲巶') { seriesArr.push({ - name: item1.beltlineName, + name: item1.productionName, type: 'line', lineStyle: { width: 4, color: '#9cff45' }, itemStyle: { color: '#50ff45' }, @@ -636,7 +137,7 @@ }) } else { seriesArr.push({ - name: item1.fullName, + name: item1.productionName, type: 'line', lineStyle: { width: 2 }, symbol: 'circle', @@ -644,7 +145,7 @@ }) } }) - option.xAxis.data = Array.from(new Set(xAxisData)) + option.xAxis.data = dataObj.dateList option.series = seriesArr this.chartContainer.setOption(option, true) }, -- Gitblit v1.9.3