From 1524fa42ddf01fd72207a8a4b4667a48e4f233aa Mon Sep 17 00:00:00 2001
From: baoshiwei <baoshiwei@shlanbao.cn>
Date: 星期五, 11 七月 2025 13:39:02 +0800
Subject: [PATCH] refactor(eims): 重构预测性维护模块

---
 eims-ui/apps/web-antd/src/views/eims/predictive-maintenance/index.vue |  115 ++++++++++++++++++++++++++++-----------------------------
 1 files changed, 57 insertions(+), 58 deletions(-)

diff --git a/eims-ui/apps/web-antd/src/views/eims/predictive-maintenance/index.vue b/eims-ui/apps/web-antd/src/views/eims/predictive-maintenance/index.vue
index 4a04417..7b629cb 100644
--- a/eims-ui/apps/web-antd/src/views/eims/predictive-maintenance/index.vue
+++ b/eims-ui/apps/web-antd/src/views/eims/predictive-maintenance/index.vue
@@ -4,7 +4,7 @@
 
       <!-- 璁惧鍋ュ悍鐘舵�佸彲瑙嗗寲 -->
       <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6">
-        <Card title="璁惧鍋ュ悍搴﹀垎甯�" >
+        <Card title="璁惧鍋ュ悍搴﹁瘎鍒�" >
           <!-- 杩欓噷灏嗘斁缃仴搴峰害鍒嗗竷鍥捐〃 -->
           <div ref="chartRef" class="h-64 w-full"></div>
         </Card>
@@ -43,7 +43,7 @@
         <div class="grid grid-cols-1 gap-4">
 
             <!-- 杩欓噷灏嗘斁缃璀﹁〃鏍� -->
-            <a-table :columns="warningColumns" :data-source="warningData" :pagination="false" class="w-full">
+            <Table :columns="warningColumns" :data-source="warningData" :pagination="false" class="w-full">
               <template #bodyCell="{ column, record }">
                 <template v-if="column.key === 'status'">
                   <a-tag :color="getStatusColor(record.status)">
@@ -55,16 +55,16 @@
                   <a-button type="link" @click="generateWorkOrder(record)" :disabled="record.maintenanceSuggestion === '鏆傛棤寤鸿'">鐢熸垚宸ュ崟</a-button>
                 </template>
               </template>
-            </a-table>
+            </Table>
           </div>
 
       </Card>
 
       <!-- 澶囦欢淇℃伅 -->
       <div class="grid grid-cols-2 gap-4 mb-6">
-        <!-- 澶囦欢瀵垮懡棰勬祴 -->
-        <Card title="澶囦欢瀵垮懡棰勬祴">
-          <a-table :columns="lifePredictionColumns" :data-source="lifePredictionData" :pagination="false" class="w-full">
+        <!-- 璁惧閮ㄤ欢瀵垮懡棰勬祴 -->
+        <Card title="璁惧閮ㄤ欢瀵垮懡棰勬祴">
+          <Table :columns="lifePredictionColumns" :data-source="lifePredictionData" :pagination="false" class="w-full">
             <template #bodyCell="{ column, record }">
               <template v-if="column.key === 'lifeStatus'">
                 <a-tag :color="getLifeStatusColor(record.remainingDays)">
@@ -75,12 +75,12 @@
                 <a-button type="link" @click="showLifePredictionDetail(record)">璇︽儏</a-button>
               </template>
             </template>
-          </a-table>
+          </Table>
         </Card>
 
         <!-- 澶囦欢搴撳瓨涓庨璀� -->
         <Card title="澶囦欢搴撳瓨涓庨璀�">
-          <a-table :columns="sparePartColumns" :data-source="sparePartData" :pagination="false" class="w-full">
+          <Table :columns="sparePartColumns" :data-source="sparePartData" :pagination="false" class="w-full">
             <template #bodyCell="{ column, record }">
               <template v-if="column.key === 'stockStatus'">
                 <a-tag :color="getStockStatusColor(record.currentStock, record.safetyStock)">
@@ -91,7 +91,7 @@
                 <a-button type="link" @click="showSparePartDetail(record)">璇︽儏</a-button>
               </template>
             </template>
-          </a-table>
+          </Table>
         </Card>
       </div>
 
@@ -103,7 +103,7 @@
 <script setup lang="ts">
 import { onMounted, ref } from 'vue';
 import { Page } from '@vben/common-ui';
-import { Card, Table, Tag, Button, Form, Input, Textarea, Select, message } from 'ant-design-vue';
+import { Button, Card, Form, Input, message, Select, Table, Tag } from 'ant-design-vue';
 import * as echarts from 'echarts';
 
 const chartRef = ref<HTMLElement | null>(null);
@@ -136,12 +136,12 @@
     key: '1',
     name: 'SMT璐寸墖鏈�',
     type: 'SMT鏈哄櫒',
-    component: '浼犻�佸甫',
-    indicator: '鎸姩骞呭害',
-    value: 0.8,
-    threshold: 0.5,
-    status: '楂橀闄�',
-    maintenanceSuggestion: '寤鸿鏇存崲浼犻�佸甫杞存壙',
+    component: '宸�3-Head',
+    indicator: '鐪熺┖鍘嬪姏',
+    value: 32,
+    threshold: 35,
+    status: '涓闄�',
+    maintenanceSuggestion: '鐪熺┖鍘嬪姏鍊间綆浜庤瀹氬�硷紝寤鸿妫�鏌ユ垨鏇存崲鍚稿槾',
     maintenanceType: '棰勯槻鎬х淮鎶�',
   },
   {
@@ -153,7 +153,7 @@
     value: 85,
     threshold: 80,
     status: '涓闄�',
-    maintenanceSuggestion: '寤鸿瀵逛富杞磋繘琛屾鼎婊戜繚鍏�',
+    maintenanceSuggestion: '寤鸿瀵逛富杞磋繘琛屾鼎婊戜繚鍏诲苟妫�鏌ュ喎鍗寸郴缁�',
     maintenanceType: '娑︽粦缁存姢',
   },
   {
@@ -161,25 +161,25 @@
     name: '娉ㄥ鏈�',
     type: '娉ㄥ璁惧',
     component: '娑插帇绯荤粺',
-    indicator: '鍘嬪姏',
-    value: 120,
-    threshold: 150,
+    indicator: '灏勫嚭鍘嬪姏涓嶇ǔ瀹�',
+    value: 28,
+    threshold: 30,
     status: '浣庨闄�',
     maintenanceSuggestion: '寤鸿妫�鏌ユ恫鍘嬬郴缁熷瘑灏佷欢',
     maintenanceType: '妫�鏌ョ淮鎶�',
   },
-  {
-    key: '4',
-    name: '绌哄帇鏈�',
-    type: '绌烘皵鍘嬬缉鏈�',
-    component: '鐢垫満',
-    indicator: '鐢垫祦',
-    value: 49,
-    threshold: 50,
-    status: '浣庨闄�',
-    maintenanceSuggestion: '鏆傛棤寤鸿',
-    maintenanceType: '鏃�',
-  },
+  // {
+  //   key: '4',
+  //   name: '绌哄帇鏈�',
+  //   type: '绌烘皵鍘嬬缉鏈�',
+  //   component: '鐢垫満',
+  //   indicator: '鐢垫祦',
+  //   value: 49,
+  //   threshold: 50,
+  //   status: '浣庨闄�',
+  //   maintenanceSuggestion: '鏆傛棤寤鸿',
+  //   maintenanceType: '鏃�',
+  // },
 ]);
 
 // 澶囦欢搴撳瓨鏁版嵁
@@ -197,8 +197,8 @@
     key: '1',
     name: '浼犻�佸甫杞存壙',
     currentStock: 10,
-    safetyStock: 5,
-    predictedDemand: 3,
+    safetyStock: 15,
+    predictedDemand: 8,
   },
   {
     key: '2',
@@ -211,7 +211,7 @@
     key: '3',
     name: '娑插帇绯荤粺瀵嗗皝浠�',
     currentStock: 20,
-    safetyStock: 10,
+    safetyStock: 25,
     predictedDemand: 5,
   },
   {
@@ -245,8 +245,8 @@
 
 const lifePredictionColumns = [
   { title: '璁惧鍚嶇О', dataIndex: 'deviceName', key: 'deviceName' },
-  { title: '閮ㄤ欢鍚嶇О', dataIndex: 'componentName', key: 'componentName' },
-  { title: '澶囦欢鍚嶇О', dataIndex: 'name', key: 'name' },
+  { title: '閮ㄤ綅鍚嶇О', dataIndex: 'componentName', key: 'componentName' },
+  { title: '閮ㄤ欢鍚嶇О', dataIndex: 'name', key: 'name' },
   { title: '棰勬祴瀵垮懡 (澶�)', dataIndex: 'predictedLife', key: 'predictedLife' },
   { title: '鍓╀綑瀵垮懡 (澶�)', dataIndex: 'remainingDays', key: 'remainingDays' },
   { title: '鐘舵��', dataIndex: 'lifeStatus', key: 'lifeStatus' },
@@ -254,11 +254,13 @@
 ];
 
 const lifePredictionData = ref([
-  { key: '1', deviceName: 'SMT璐寸墖鏈�', componentName: '浼犻�佸甫', name: '杞存壙A', predictedLife: 365, remainingDays: 120 },
-  { key: '2', deviceName: 'CNC鍔犲伐涓績', componentName: '涓昏酱', name: '榻胯疆B', predictedLife: 730, remainingDays: 30 },
-  { key: '3', deviceName: '娉ㄥ鏈�', componentName: '娑插帇绯荤粺', name: '婊よ姱C', predictedLife: 180, remainingDays: 90 },
-  { key: '4', deviceName: '绌哄帇鏈�', componentName: '鐢垫満', name: '浼犳劅鍣―', predictedLife: 500, remainingDays: 10 },
-  { key: '5', deviceName: '鐒婃帴鏈哄櫒浜�', componentName: '鐒婃灙', name: '鐒婂槾E', predictedLife: 240, remainingDays: 60 }
+    { key: '4', deviceName: '绌哄帇鏈�', componentName: '鐢垫満', name: '浼犳劅鍣�', predictedLife: 500, remainingDays: 10 },
+      { key: '2', deviceName: 'CNC鍔犲伐涓績', componentName: '涓昏酱', name: '榻胯疆', predictedLife: 730, remainingDays: 30 },
+  { key: '1', deviceName: 'SMT璐寸墖鏈�', componentName: '浼犻�佸甫', name: '杞存壙', predictedLife: 365, remainingDays: 50 },
+
+  { key: '3', deviceName: '娉ㄥ鏈�', componentName: '娑插帇绯荤粺', name: '婊よ姱', predictedLife: 180, remainingDays: 90 },
+
+  { key: '5', deviceName: '鐒婃帴鏈哄櫒浜�', componentName: '鐒婃灙', name: '鐒婂槾', predictedLife: 240, remainingDays: 60 }
 ]);
 
 const getLifeStatus = (remainingDays) => {
@@ -340,7 +342,7 @@
     console.log('璁惧ID111:', record.name)
     router.push({ path: '/predictive/smt-detail', query: { deviceId: record.key } });
   } else if (record.name === 'CNC鍔犲伐涓績') {
-    router.push({ path: '/predictive/predictive-detail', query: { deviceId: record.key } });
+    router.push({ path: '/predictive/cnc-detail', query: { deviceId: record.key } });
   } else if (record.name === '娉ㄥ鏈�') {
     router.push({ path: '/predictive/injection-detail', query: { deviceId: record.key } });
   } else {
@@ -360,10 +362,8 @@
       },
       xAxis: {
         type: 'category',
-        data: ['90%-100%', '80%-90%', '70%-80%', '60%-70%', '50%-60%', '40%-50%', '30%-40%', '20%-30%', '10%-20%', '0%-10%'],
-        axisLabel: {
-          rotate: 45
-        }
+        data: ['10鍒�', '9鍒�', '8鍒�', '7鍒�', '6鍒�', '5鍒�', '4鍒�', '3鍒�', '2鍒�', '1鍒�'],
+        
       },
       yAxis: {
         type: 'value',
@@ -376,20 +376,19 @@
           type: 'bar',
           barWidth: '60%',
           data: [
-            { value: 15, itemStyle: { color: '#52c41a' } },
-            { value: 20, itemStyle: { color: '#52c41a' } },
-            { value: 25, itemStyle: { color: '#faad14' } },
-            { value: 15, itemStyle: { color: '#faad14' } },
-            { value: 10, itemStyle: { color: '#faad14' } },
-            { value: 5, itemStyle: { color: '#ff4d4f' } },
-            { value: 5, itemStyle: { color: '#ff4d4f' } },
-            { value: 3, itemStyle: { color: '#ff4d4f' } },
-            { value: 1, itemStyle: { color: '#ff4d4f' } },
-            { value: 1, itemStyle: { color: '#ff4d4f' } }
+            { value: 48, itemStyle: { color: '#52c41a' } },
+            { value: 53, itemStyle: { color: '#52c41a' } },
+            { value: 37, itemStyle: { color: '#52c41a' } },
+            { value: 29, itemStyle: { color: '#52c41a' } },
+            { value: 21, itemStyle: { color: '#52c41a' } },
+            { value: 8, itemStyle: { color: '#faad14' } },
+            { value: 5, itemStyle: { color: '#faad14' } },
+           
           ],
           label: {
             show: true,
-            position: 'top'
+            position: 'top',
+            formatter: '{c}鍙�'
           }
         }
       ]

--
Gitblit v1.9.3