From 221bb1704bb74b38655c2cd2413242885b5cc614 Mon Sep 17 00:00:00 2001
From: zhuzhuanzhuan
Date: 星期日, 28 四月 2024 09:50:55 +0800
Subject: [PATCH] 1、调整路由模式为hash模式以试图解决项目上线后刷新页面后无法正常跳转页面而出现JSON页面问题 2、首页设备级看板点击报修按钮跳转至故障报修页面并根据设备编号筛选页面对应数据

---
 src/views/dashboard/EquipmentSignage.vue |  201 ++++++++++++++++++++++++++++++++++---------------
 1 files changed, 139 insertions(+), 62 deletions(-)

diff --git a/src/views/dashboard/EquipmentSignage.vue b/src/views/dashboard/EquipmentSignage.vue
index 9c24579..1917eca 100644
--- a/src/views/dashboard/EquipmentSignage.vue
+++ b/src/views/dashboard/EquipmentSignage.vue
@@ -38,40 +38,40 @@
             <dv-border-box-11 title="璁惧淇℃伅" class="info-container" style="flex:5;">
               <a-descriptions :column="3">
                 <a-descriptions-item label="缁熶竴缂栧彿">
-                  {{equipmentInfo.equipmentId}}
+                  {{equipmentInfo.num|equipmentInfoDisplay}}
                 </a-descriptions-item>
                 <a-descriptions-item label="ABC鏍囪瘑">
-                  {{equipmentInfo.ABCSymbol}}
+                  {{equipmentInfo.abc|equipmentInfoDisplay}}
                 </a-descriptions-item>
                 <a-descriptions-item label="璁惧鍚嶇О">
-                  {{equipmentInfo.equipmentName}}
+                  {{equipmentInfo.name|equipmentInfoDisplay}}
                 </a-descriptions-item>
                 <a-descriptions-item label="鍨嬪彿">
-                  {{equipmentInfo.equipmentType}}
+                  {{equipmentInfo.model|equipmentInfoDisplay}}
                 </a-descriptions-item>
                 <a-descriptions-item label="璁惧鍒嗙被">
-                  {{equipmentInfo.equipmentCategory}}
+                  {{equipmentInfo.equipmentCategoryName|equipmentInfoDisplay}}
                 </a-descriptions-item>
                 <a-descriptions-item label="宸ュ尯">
-                  {{equipmentInfo.workArea}}
+                  {{equipmentInfo.areaName|equipmentInfoDisplay}}
                 </a-descriptions-item>
                 <a-descriptions-item label="鎿嶄綔绯荤粺">
-                  {{equipmentInfo.driveType}}
+                  {{equipmentInfo.system|equipmentInfoDisplay}}
                 </a-descriptions-item>
                 <a-descriptions-item label="瑙勬牸">
-                  {{equipmentInfo.standard}}
+                  {{equipmentInfo.specification|equipmentInfoDisplay}}
                 </a-descriptions-item>
                 <a-descriptions-item label="缁存姢閮ㄩ棬">
-                  {{equipmentInfo.depart}}
+                  {{equipmentInfo.manageName|equipmentInfoDisplay}}
                 </a-descriptions-item>
                 <a-descriptions-item label="宸ユ">
-                  {{equipmentInfo.workshopSection}}
+                  {{equipmentInfo.workShopName|equipmentInfoDisplay}}
                 </a-descriptions-item>
                 <a-descriptions-item label="鎿嶄綔宸�">
-                  {{equipmentInfo.operator}}
+                  {{operationCertificateInfo.realname|equipmentInfoDisplay}}
                 </a-descriptions-item>
                 <a-descriptions-item label="璁惧鐘舵��">
-                  {{equipmentInfo.equipmentStatus}}
+                  {{equipmentInfo.equipmentStatus|equipmentInfoDisplay}}
                 </a-descriptions-item>
               </a-descriptions>
             </dv-border-box-11>
@@ -79,16 +79,16 @@
             <dv-border-box-11 title="鎿嶄綔璇佷俊鎭�" class="info-container" style="flex:2;">
               <a-descriptions :column="1">
                 <a-descriptions-item label="鎿嶄綔璇佺紪鍙�">
-                  {{equipmentInfo.equipmentId}}
+                  {{operationCertificateInfo.num|equipmentInfoDisplay}}
                 </a-descriptions-item>
                 <a-descriptions-item label="褰撳墠鍛ㄦ湡鍒嗘暟">
-                  {{equipmentInfo.ABCSymbol}}
+                  {{operationCertificateInfo.currentCycleScore|equipmentInfoDisplay}}
                 </a-descriptions-item>
                 <a-descriptions-item label="鍙戣瘉鏃ユ湡">
-                  {{equipmentInfo.equipmentName}}
+                  {{operationCertificateInfo.issueDate|equipmentInfoDisplay}}
                 </a-descriptions-item>
                 <a-descriptions-item label="鍛ㄦ湡鎴鏃ユ湡">
-                  {{equipmentInfo.equipmentType}}
+                  {{operationCertificateInfo.endTime|equipmentInfoDisplay}}
                 </a-descriptions-item>
               </a-descriptions>
             </dv-border-box-11>
@@ -96,29 +96,29 @@
             <dv-border-box-11 title="缁存姢淇℃伅" class="info-container" style="flex:2;">
               <a-descriptions :column="1">
                 <a-descriptions-item label="涓嬫涓変繚鏃ユ湡">
-                  {{equipmentInfo.equipmentId}}
+                  {{equipmentInfo.nextThirdMaintenanceTime|equipmentInfoDisplay}}
                 </a-descriptions-item>
                 <a-descriptions-item label="涓嬫浜屼繚鏃ユ湡">
-                  {{equipmentInfo.ABCSymbol}}
+                  {{equipmentInfo.nextSecondMaintenanceTime|equipmentInfoDisplay}}
                 </a-descriptions-item>
                 <a-descriptions-item label="鎶�鏈姸鎬�">
-                  {{equipmentInfo.equipmentName}}
+                  {{equipmentInfo.technology_status|equipmentInfoDisplay}}
                 </a-descriptions-item>
               </a-descriptions>
             </dv-border-box-11>
           </div>
 
           <!--鍔熻兘鎸夐挳鍖哄煙-->
-          <div style="display: flex;height: 30%;align-items: center;padding: 0 20px;color: #eee;">
+          <div style="display: flex;height: 30%;align-items: center;padding: 0 20px;color: #fff;">
             <div style="display: flex;justify-content:space-evenly;flex: 1">
               <div style="width: 45%;" class="info-card-container">
-                <div class="info-card-title">鏈湀鎶ヤ慨鏁伴噺</div>
-                <div class="info-card-value" style="color: #EAC910">20</div>
+                <div class="info-card-title">鏈湀鎶ヤ慨娆℃暟</div>
+                <div class="info-card-value" style="color: #EAC910">{{equipmentInfo.repairCount|equipmentInfoDisplay}}</div>
               </div>
 
               <div style="width: 45%;" class="info-card-container">
-                <div class="info-card-title">璁惧鐘舵�侊紙缁翠慨涓瓑锛�</div>
-                <div class="info-card-value">缁翠慨涓�</div>
+                <div class="info-card-title">璁惧鐘舵��</div>
+                <div class="info-card-value">{{equipmentInfo.equipmentStatus|equipmentInfoDisplay}}</div>
               </div>
             </div>
 
@@ -133,39 +133,37 @@
 
         <!--鍙充笅鍚勯」鏁版嵁鍥捐〃鍖哄煙-->
         <dv-border-box-12 style="height: 50%" class="right-bottom-row">
-          <div style="display: flex;justify-content:space-evenly;height: 100%">
+          <div style="display: flex;justify-content:space-evenly;height: 100%" v-show="isBelongToMdc">
             <div style="display: flex;flex-wrap: wrap;width: 30%;height: 100%">
               <div id="gauge_chart1" class="gauge-chart"></div>
               <div id="gauge_chart2" class="gauge-chart"></div>
               <div id="gauge_chart3" class="gauge-chart"></div>
               <div id="gauge_chart4" class="gauge-chart"></div>
             </div>
-            <div id="line_chart" style="width:40%;height: 100%;"></div>
-            <div style="width: 25%;height:100%;display: flex;align-items: center">
+            <div id="line_chart" :style="{width:lineChartWidth,height: '100%'}"></div>
+            <div v-show="isBelongToMdc&&isDisplayEquipmentDetails"
+                 style="width: 25%;height:100%;display: flex;align-items: center">
               <a-descriptions :column="2">
                 <a-descriptions-item label="杩愯妯″紡">
-                  {{equipmentInfo.equipmentId}}
+                  {{equipmentDetails.runModble|equipmentInfoDisplay}}
                 </a-descriptions-item>
                 <a-descriptions-item label="绋嬪簭鍙�">
-                  {{equipmentInfo.ABCSymbol}}
+                  {{equipmentDetails.sequencenumber|equipmentInfoDisplay}}
                 </a-descriptions-item>
                 <a-descriptions-item label="涓昏酱杞��">
-                  {{equipmentInfo.equipmentName}}
+                  {{equipmentDetails.spindlespeed|equipmentInfoDisplay}}
                 </a-descriptions-item>
                 <a-descriptions-item label="涓昏酱璐熻嵎">
-                  {{equipmentInfo.equipmentType}}
-                </a-descriptions-item>
-                <a-descriptions-item label="涓昏酱杞��">
-                  {{equipmentInfo.equipmentCategory}}
+                  {{equipmentDetails.spindleload|equipmentInfoDisplay}}
                 </a-descriptions-item>
                 <a-descriptions-item label="涓昏酱鍊嶇巼">
-                  {{equipmentInfo.workArea}}
+                  {{equipmentDetails.spindlebeilv|equipmentInfoDisplay}}
                 </a-descriptions-item>
                 <a-descriptions-item label="杩涚粰鍊嶇巼">
-                  {{equipmentInfo.driveType}}
+                  {{equipmentDetails.feedbeilv|equipmentInfoDisplay}}
                 </a-descriptions-item>
                 <a-descriptions-item label="鎶ヨ淇℃伅">
-                  {{equipmentInfo.standard}}
+                  {{equipmentDetails.alrmstate|equipmentInfoDisplay}}
                 </a-descriptions-item>
               </a-descriptions>
             </div>
@@ -199,20 +197,9 @@
       return {
         equipmentId: '',
         equipmentList: [],
-        equipmentInfo: {
-          equipmentId: '2511563154',
-          ABCSymbol: '3312321421',
-          equipmentName: '鏈烘涓績',
-          equipmentType: 'CV4160',
-          equipmentCategory: '杞ф満',
-          workArea: 'A鍒嗗尯',
-          driveType: 'JSOWJDF',
-          standard: '鏃�',
-          depart: '杞ф満涓績',
-          workshopSection: '407涓�宸ユ',
-          operator: 'admin',
-          equipmentStatus: 0
-        },
+        equipmentInfo: {},
+        operationCertificateInfo: {},
+        equipmentDetails: {},
         buttonList: [
           {
             label: '澶囦欢淇℃伅'
@@ -221,7 +208,8 @@
             label: '淇濆吇璁″垝'
           },
           {
-            label: '鎶ヤ慨'
+            label: '鎶ヤ慨',
+            pageName: 'eam-MalfunctionRepair'
           },
           {
             label: '璁惧鐝',
@@ -229,6 +217,7 @@
           }
         ],
         lineChart: '',
+        lineChartWidth: '40%',
         lineChartData: [],
         gaugeChart1: '',
         gaugeChart2: '',
@@ -240,7 +229,9 @@
           openRate: 0,
           overallEquipmentEfficiency: 0
         },
-        hideLoadingDelayTime: 500
+        hideLoadingDelayTime: 500,
+        isDisplayEquipmentDetails: false,
+        isBelongToMdc: true// 鏄惁鍦╩dc璁惧琛ㄤ腑
       }
     },
     created() {
@@ -248,12 +239,38 @@
     },
     mounted() {
       window.addEventListener('resize', this.handleWindowResize)
-      this.getEquipmentListByApi()
+      this.getOperationCertificateByApi()
+      // 鎿嶄綔宸ョ骇鐢ㄦ埛杩涘叆鏃惰皟鐢ㄦ帴鍙h幏鍙杕es璁惧鍒楄〃锛屽叾浣欐儏鍐佃幏鍙杕dc璁惧鍒楄〃
+      if (this.userType !== 1) this.getEquipmentListByApi()
+      else this.getAllAreaEquipmentListByApi()
     },
     beforeDestroy() {
       window.removeEventListener('resize', this.handleWindowResize)
     },
+    filters: {
+      equipmentInfoDisplay(value) {
+        return value ? value : '鏃�'
+      }
+    },
+    watch: {
+      isDisplayEquipmentDetails: {
+        handler(newVal) {
+          if (newVal) this.lineChartWidth = '40%'
+          else this.lineChartWidth = '65%'
+          this.$nextTick(() => {
+            this.lineChart.resize()
+          })
+        }
+      }
+    },
     methods: {
+      getOperationCertificateByApi() {
+        signageApi.getOperationCertificateApi()
+          .then(res => {
+            if (res.success && res.result.length > 0) this.operationCertificateInfo = res.result[0]
+          })
+      },
+
       getEquipmentListByApi() {
         // 棣栭〉涓�杩涘叆鍗宠澶囩骇鎴栧伐娈电骇鏃讹紝workshopSectionProductionCode涓虹┖锛岄粯璁ゆ煡璇㈢涓�涓溅闂翠腑绗竴涓伐娈典笅鐨勮澶囧垪琛�
         signageApi.getEquipmentListApi(this.workshopSectionProductionCode)
@@ -264,22 +281,75 @@
             }
           })
           .finally(() => {
-            // 姝ゅ涓轰繚璇乪quipmentId姝e父璧嬪�煎悗鍐嶈皟鐢ㄦ帴鍙h幏鍙栧浘琛ㄦ暟鎹紙寮傛锛�
+            // 姝ゅ涓轰繚璇乪quipmentId姝e父璧嬪�煎悗鍐嶈皟鐢ㄦ帴鍙h幏鍙栧浘琛ㄦ暟鎹互鍙婅澶囪缁嗕俊鎭紙寮傛锛�
             this.getChartDataByApi()
+            this.getEquipmentInfoByApi()
+            this.getEquipmentDetailsByApi()
           })
       },
 
+      getAllAreaEquipmentListByApi() {
+        signageApi.getAllAreaEquipmentListApi(this.workshopSectionProductionCode)
+          .then(res => {
+            if (res.success) {
+              this.equipmentList = res.result
+              this.equipmentList.forEach(item => {
+                item.equipmentId = item.num
+                item.equipmentModel = item.model
+              })
+              if (!this.productionCode && this.equipmentList.length > 0) this.equipmentId = this.equipmentList[0].equipmentId
+            }
+          })
+          .finally(() => {
+            // 姝ゅ涓轰繚璇乪quipmentId姝e父璧嬪�煎悗鍐嶈皟鐢ㄦ帴鍙h幏鍙栬澶囦俊鎭拰缁存姢淇℃伅锛堝紓姝ワ級
+            this.getEquipmentInfoByApi()
+          })
+      },
+
+      // 鑾峰彇鍙充笂瑙掕澶囦俊鎭拰缁存姢淇℃伅
+      getEquipmentInfoByApi() {
+        signageApi.getEquipmentInfoApi(this.equipmentId)
+          .then(res => {
+            if (res.success && res.result.length > 0) this.equipmentInfo = res.result[0]
+            else this.equipmentInfo = {}
+          })
+      },
+
+      /* 鑾峰彇鍙充笅瑙掕澶囪缁嗕俊鎭� */
+      getEquipmentDetailsByApi() {
+        signageApi.getEquipmentDetailsApi(this.equipmentId)
+          .then(res => {
+            if (res.success && res.result) {
+              this.equipmentDetails = res.result
+              this.isDisplayEquipmentDetails = true
+            }
+            else this.isDisplayEquipmentDetails = false
+          })
+      },
+
+      /* 鍙充笅瑙掑浘琛ㄦ暟鎹幏鍙栨眹鎬绘柟娉� */
       getChartDataByApi() {
         this.getGaugeChartDataByApi()
         this.getLineChartDataByApi()
       },
 
+      /* 鍗曞嚮璁惧鍒楄〃涓殑璁惧鏃惰Е鍙� */
       selectEquipment(record) {
+        // 閬垮厤鐐瑰嚮鐩稿悓璁惧閲嶅鍙戦�佽姹�
         if (record.equipmentId === this.equipmentId) return
         this.equipmentId = record.equipmentId
-        this.getChartDataByApi()
+
+        // 闈炴搷浣滃伐绾ф椂闇�瑕佷紶鍏ヨ澶囩紪鍙蜂互鏌ヨ鍥捐〃鍙婅澶囧悇椤逛俊鎭暟鎹紝鎿嶄綔宸ョ骇鏃跺彲灏嗚澶囧垪琛ㄨ淇℃伅鐩存帴璧嬪�煎睍绀�
+        if (this.userType !== 1) {
+          this.getChartDataByApi()
+          this.getEquipmentDetailsByApi()
+          this.getEquipmentInfoByApi()
+        } else {
+          this.equipmentInfo = record
+        }
       },
 
+      /* 鍗曞嚮鍙宠竟瀵艰埅鏍忓悗瑙﹀彂 */
       navigateToPage(record) {
         if (record.pageName) {
           this.$router.push({
@@ -322,8 +392,12 @@
 
         signageApi.getEquipmentLevelEfficiencyStatisticsApi(this.equipmentId)
           .then(res => {
-            if (res.success) this.gaugeChartData = res.result
-            this.drawGaugeChart()
+            if (res.success && res.result) {
+              this.gaugeChartData = res.result
+              this.isBelongToMdc = true
+              this.drawGaugeChart()
+            }
+            else this.isBelongToMdc = false
           })
       },
 
@@ -339,8 +413,12 @@
 
         signageApi.getEquipmentAnnualEfficiencyStatisticsApi(this.equipmentId)
           .then(res => {
-            if (res.success) this.lineChartData = res.result
-            this.drawLineChart()
+            if (res.success && res.result) {
+              this.lineChartData = res.result
+              this.isBelongToMdc = true
+              this.drawLineChart()
+            }
+            else this.isBelongToMdc = false
           })
       },
 
@@ -357,7 +435,6 @@
               fontSize: 18,
               fontWeight: 'normal',
               color: '#1AD8DE',
-              fontWeight: 'bold'
             }
           },
           tooltip: {
@@ -710,7 +787,7 @@
 
         .equipmentId-container {
           height: 100%;
-          color: #eee;
+          color: #fff;
           display: flex;
           justify-content: center;
           align-items: center;

--
Gitblit v1.9.3