From a5a3f4b3a283d9d8e2b41b6291ed0fb11ad31c1c Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期三, 06 五月 2026 11:31:44 +0800
Subject: [PATCH] 生产订单模块做工序生产进度功能

---
 src/pages/productionManagement/productionOrder/index.vue |  144 ++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 138 insertions(+), 6 deletions(-)

diff --git a/src/pages/productionManagement/productionOrder/index.vue b/src/pages/productionManagement/productionOrder/index.vue
index 4894507..9cea91f 100644
--- a/src/pages/productionManagement/productionOrder/index.vue
+++ b/src/pages/productionManagement/productionOrder/index.vue
@@ -67,6 +67,31 @@
                 <text class="progress-text">{{ item.completeQuantity || 0 }} / {{ item.quantity || 0 }}</text>
               </view>
             </view>
+            <!-- 宸ュ簭鐢熶骇杩涘害灞曠ず -->
+            <view class="detail-row process-row">
+              <text class="detail-label">宸ュ簭杩涘害</text>
+              <scroll-view scroll-x
+                           class="process-scroll">
+                <view class="process-container">
+                  <view v-for="(process, pIdx) in item.processRouteStatus"
+                        :key="pIdx"
+                        class="process-item">
+                    <view class="process-node">
+                      <view class="node-circle"
+                            :class="{ 'is-complete': process.percentage >= 100 }">
+                        <text class="node-percentage"
+                              :style="{ color: process.percentage >= 100 ? '#52c41a' : (process.percentage >= 70 ? '#f56c6c' : '#3c9cff') }">{{ process.percentage }}%</text>
+                      </view>
+                      <text class="node-name">{{ process.name }}</text>
+                    </view>
+                    <view v-if="pIdx < item.processRouteStatus.length - 1"
+                          class="node-line"></view>
+                  </view>
+                  <view v-if="!item.processRouteStatus || !item.processRouteStatus.length"
+                        class="no-process">-</view>
+                </view>
+              </scroll-view>
+            </view>
             <view class="detail-row">
               <text class="detail-label">璁″垝瀹屾垚</text>
               <text class="detail-value">{{ formatDate(item.planCompleteTime) }}</text>
@@ -112,6 +137,7 @@
     productOrderListPage,
     getOrderProcessRouteMain,
   } from "@/api/productionManagement/productionOrder.js";
+  import { productWorkOrderPage } from "@/api/productionManagement/workOrder.js";
   import PageHeader from "@/components/PageHeader.vue";
 
   const { proxy } = getCurrentInstance();
@@ -166,7 +192,7 @@
       2: "warning",
       3: "success",
       4: "info",
-      5: "danger",
+      5: "error",
     };
     return typeMap[status] || "info";
   };
@@ -216,16 +242,44 @@
     };
 
     productOrderListPage(params)
-      .then(res => {
-        loading.value = false;
+      .then(async res => {
         const records = res.data.records || [];
+
+        // 涓烘瘡涓鍗曞苟琛屾煡璇㈠伐搴忚繘搴�
+        const processPromises = records.map(async item => {
+          if (item.npsNo) {
+            try {
+              const workOrderRes = await productWorkOrderPage({
+                npsNo: item.npsNo,
+                size: 100,
+              });
+              const workOrders = workOrderRes.data.records || [];
+              const processRouteStatus = workOrders.map(wo => ({
+                name: wo.operationName || "鏈煡宸ュ簭",
+                percentage:
+                  Number(wo.completionStatus) > 100
+                    ? 100
+                    : Number(wo.completionStatus || 0),
+              }));
+              return { ...item, processRouteStatus };
+            } catch (error) {
+              console.error(`鑾峰彇宸ュ崟 ${item.npsNo} 杩涘害澶辫触:`, error);
+              return { ...item, processRouteStatus: [] };
+            }
+          }
+          return { ...item, processRouteStatus: [] };
+        });
+
+        const updatedRecords = await Promise.all(processPromises);
+
+        loading.value = false;
         if (page.current === 1) {
-          tableData.value = records;
+          tableData.value = updatedRecords;
         } else {
-          tableData.value = [...tableData.value, ...records];
+          tableData.value = [...tableData.value, ...updatedRecords];
         }
 
-        if (records.length < page.size) {
+        if (updatedRecords.length < page.size) {
           loadStatus.value = "nomore";
         } else {
           loadStatus.value = "loadmore";
@@ -380,6 +434,84 @@
             text-align: right;
           }
         }
+
+        &.process-row {
+          flex-direction: column;
+          margin: 20rpx 0;
+
+          .process-scroll {
+            width: 100%;
+            margin-top: 16rpx;
+
+            .process-container {
+              display: flex;
+              align-items: flex-start;
+              padding: 10rpx 0;
+              min-height: 120rpx;
+
+              .process-item {
+                display: flex;
+                align-items: center;
+
+                .process-node {
+                  display: flex;
+                  flex-direction: column;
+                  align-items: center;
+                  width: 100rpx;
+
+                  .node-circle {
+                    width: 60rpx;
+                    height: 60rpx;
+                    border-radius: 50%;
+                    border: 2rpx solid #3c9cff;
+                    display: flex;
+                    align-items: center;
+                    justify-content: center;
+                    background: #fff;
+                    margin-bottom: 8rpx;
+
+                    .node-percentage {
+                      font-size: 18rpx;
+                      color: #3c9cff;
+                      font-weight: bold;
+                    }
+
+                    &.is-complete {
+                      border-color: #52c41a;
+                      background: #f6ffed;
+
+                      .node-percentage {
+                        color: #52c41a;
+                      }
+                    }
+                  }
+
+                  .node-name {
+                    font-size: 20rpx;
+                    color: #666;
+                    text-align: center;
+                    width: 120rpx;
+                    white-space: nowrap;
+                    overflow: hidden;
+                    text-overflow: ellipsis;
+                  }
+                }
+
+                .node-line {
+                  width: 40rpx;
+                  height: 2rpx;
+                  background: #e8e8e8;
+                  margin: -30rpx 0 0 0;
+                }
+              }
+
+              .no-process {
+                font-size: 24rpx;
+                color: #ccc;
+              }
+            }
+          }
+        }
       }
     }
 

--
Gitblit v1.9.3