From 70b7935fc261cd5e8eaaf1cfbc8078b04db576d2 Mon Sep 17 00:00:00 2001
From: liu <2021943741@qq.com>
Date: 星期六, 07 十一月 2026 14:51:06 +0800
Subject: [PATCH] fix(mes): 自动回填销售订单生产信息

---
 src/views/mes/pro/route/data.ts |   33 +++++++++++++++++++++++++--------
 1 files changed, 25 insertions(+), 8 deletions(-)

diff --git a/src/views/mes/pro/route/data.ts b/src/views/mes/pro/route/data.ts
index 5fb905a..0444b0e 100644
--- a/src/views/mes/pro/route/data.ts
+++ b/src/views/mes/pro/route/data.ts
@@ -26,7 +26,7 @@
   MdProductBomSelect,
 } from '#/views/mes/md/item/components';
 
-import { RouteColorPicker } from './components';
+import { RouteColorPicker, RouteOutputAttribution } from './components';
 
 /** 琛ㄥ崟绫诲瀷 */
 export type FormType = 'create' | 'detail' | 'update';
@@ -183,7 +183,7 @@
 /** 宸ヨ壓璺嚎宸ュ簭鏄庣粏琛ㄥ崟 */
 export function useRouteProcessFormSchema(
   processOptions: Array<{ label: string; value: number }>,
-  productIds: number[] = [],
+  products: MesProRouteProductApi.RouteProduct[] = [],
 ): VbenFormSchema[] {
   return [
     {
@@ -220,13 +220,11 @@
       rules: 'selectRequired',
     },
     {
-      fieldName: 'outputItemIds',
+      fieldName: 'outputs',
       label: '鏈伐搴忎骇鍑�',
-      component: markRaw(MdItemSelect),
+      component: markRaw(RouteOutputAttribution),
       componentProps: {
-        multiple: true,
-        productIds,
-        placeholder: '鍙暀绌猴紱褰㈡垚鍗婃垚鍝佹椂閫夋嫨锛屾湯閬撳伐搴忛�夋嫨鍏ㄩ儴鎴愬搧',
+        products,
       },
       formItemClass: 'col-span-2',
     },
@@ -318,7 +316,25 @@
     { field: 'sort', title: '搴忓彿', width: 70, align: 'center', fixed: 'left' },
     { field: 'processCode', title: '宸ュ簭缂栫爜', width: 140, fixed: 'left' },
     { field: 'processName', title: '宸ュ簭鍚嶇О', width: 140, fixed: 'left' },
-    { field: 'outputItemNames', title: '鏈伐搴忎骇鍑�', minWidth: 190 },
+    {
+      field: 'outputItemNames',
+      title: '鏈伐搴忎骇鍑�',
+      minWidth: 240,
+      formatter: ({ cellValue, row }) => {
+        const outputs = row.outputs ?? [];
+        if (!outputs.length) {
+          return cellValue ?? '';
+        }
+        return outputs
+          .map((output) => {
+            const name = output.itemName ?? output.itemCode ?? output.itemId;
+            return output.productId == null
+              ? `${name}锛堥�氱敤锛塦
+              : `${name}锛�${output.productName ?? output.productId}锛塦;
+          })
+          .join('銆�');
+      },
+    },
     { field: 'nextProcessName', title: '涓嬩竴閬撳伐搴�', width: 140 },
     {
       field: 'linkType',
@@ -379,6 +395,7 @@
   return [
     { field: 'itemCode', title: '浜у嚭缂栫爜', width: 150 },
     { field: 'itemName', title: '浜у嚭鍚嶇О', width: 150 },
+    { field: 'templateReference', title: '妯℃澘寮曠敤', width: 100, slots: { default: 'templateReference' } },
     { field: 'specification', title: '瑙勬牸鍨嬪彿', width: 150 },
     { field: 'unitName', title: '鍗曚綅', width: 80 },
     { field: 'quantity', title: '鐢熶骇鏁伴噺', width: 100 },

--
Gitblit v1.9.3