From be590d48f66806716c990bdce18d0ed90bf18797 Mon Sep 17 00:00:00 2001
From: zhaowei <zhaowei>
Date: 星期二, 04 三月 2025 15:52:28 +0800
Subject: [PATCH] 420项目: 1、大屏车间管理页面新增及编辑时随意输入车间名称调整为选择已有车间 2、增加车间看板拖拽及缩放功能权限功能 3、实现车间看板设备状态数量及图表数据由后台驱动 4、车间看板页面月、周、日利用率图表数据由后台驱动 5、车间看板页面报警信息列表数据由后台驱动 6、车间看板页面调整右侧设备状态判定,同时加入异常状态展示(设备编号背景色变为红色)

---
 src/views/mdc/base/modules/WorkshopSignage/WeekUtilizationRateTrend.vue |  540 ++---------------------------------------------------------
 1 files changed, 22 insertions(+), 518 deletions(-)

diff --git a/src/views/mdc/base/modules/WorkshopSignage/WeekUtilizationRateTrend.vue b/src/views/mdc/base/modules/WorkshopSignage/WeekUtilizationRateTrend.vue
index 85dba23..4fbe249 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,525 +23,25 @@
       }
     },
     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 = {
@@ -616,18 +121,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 +140,7 @@
             })
           } else {
             seriesArr.push({
-              name: item1.fullName,
+              name: item1.productionName,
               type: 'line',
               lineStyle: { width: 2 },
               symbol: 'circle',
@@ -644,7 +148,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