| | |
| | | </template> |
| | | |
| | | <script> |
| | | import signageApi from '@/api/signage' |
| | | |
| | | export default { |
| | | name: 'WeekUtilizationRateTrend', |
| | | components: {}, |
| | | props: { |
| | | currentProductionId: { |
| | | type: String |
| | | }, |
| | | toDecimal2NoZero: { |
| | | type: Function |
| | | } |
| | |
| | | } |
| | | }, |
| | | 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燃烧室机匣单元', |
| | | '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', |
| | |
| | | }, |
| | | 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' }, |
| | |
| | | }) |
| | | } else { |
| | | seriesArr.push({ |
| | | name: item1.fullName, |
| | | name: item1.productionName, |
| | | type: 'line', |
| | | lineStyle: { width: 2 }, |
| | | symbol: 'circle', |
| | |
| | | }) |
| | | } |
| | | }) |
| | | option.xAxis.data = Array.from(new Set(xAxisData)) |
| | | option.xAxis.data = dataObj.dateList |
| | | option.series = seriesArr |
| | | this.chartContainer.setOption(option, true) |
| | | }, |