From 346a988f537228ae44731cd31007f1412b482e83 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期一, 19 十月 2026 16:32:10 +0800
Subject: [PATCH] refactor(mdm): 移除物料主数据中废弃的字段配置

---
 src/views/mes/pro/batch/data.ts |   69 +++++++++++++++++++++++++++++++++-
 1 files changed, 66 insertions(+), 3 deletions(-)

diff --git a/src/views/mes/pro/batch/data.ts b/src/views/mes/pro/batch/data.ts
index 9e0803c..579f7ba 100644
--- a/src/views/mes/pro/batch/data.ts
+++ b/src/views/mes/pro/batch/data.ts
@@ -18,12 +18,21 @@
 export interface PalletOption {
   label: string;
   value: number;
+  itemId?: number;
+  itemName?: string;
+  itemCode?: string;
 }
+
+export type TonBagOption = PalletOption;
 
 /** 鏂板/淇敼鐨勮〃鍗� */
 export function useFormSchema(
   formType: FormType,
   palletOptions: PalletOption[] = [],
+  onPalletChange?: (ids: number[]) => void,
+  tonBagOptions: TonBagOption[] = [],
+  onTonBagChange?: (ids: number[]) => void,
+  existingBinding?: 'pallet' | 'tonBag',
 ): VbenFormSchema[] {
   const disabled = formType === 'detail';
   return [
@@ -132,6 +141,18 @@
       rules: 'selectRequired',
     },
     {
+      fieldName: 'itemId', component: 'Input',
+      dependencies: { triggerFields: [''], show: () => false },
+    },
+    {
+      fieldName: 'itemName', label: '鍝佺鍚嶇О', component: 'Input',
+      componentProps: { disabled: true, placeholder: '閫夋嫨鎵樼洏鎴栧惃琚嬪悗鑷姩甯﹀叆' },
+    },
+    {
+      fieldName: 'itemCode', label: '鍝佺缂栫爜', component: 'Input',
+      componentProps: { disabled: true, placeholder: '閫夋嫨鎵樼洏鎴栧惃琚嬪悗鑷姩甯﹀叆' },
+    },
+    {
       fieldName: 'palletIds',
       label: '缁戝畾鎵樼洏',
       component: 'Select',
@@ -139,17 +160,55 @@
         allowClear: true,
         disabled,
         maxTagCount: 3,
+        dropdownMatchSelectWidth: false,
+        dropdownStyle: { minWidth: '360px', maxWidth: 'calc(100vw - 32px)' },
         mode: 'multiple',
         optionFilterProp: 'label',
         options: palletOptions,
-        placeholder: '璇烽�夋嫨鎵樼洏锛堝彲涓嶉�夛級',
+        onChange: onPalletChange,
+        placeholder: '璇烽�夋嫨鐩稿悓鍝佺鐨勬墭鐩�',
         showSearch: true,
       },
       dependencies: {
-        triggerFields: [''],
+        triggerFields: ['itemId', 'tonBagIds'],
         show: () => formType !== 'detail',
+        componentProps: (values) => ({
+          options: palletOptions.map(option => ({ ...option,
+            disabled: existingBinding === 'tonBag' || !!values.tonBagIds?.length || !option.itemId || (!!values.itemId && option.itemId !== values.itemId),
+          })),
+          disabled: disabled || existingBinding === 'tonBag' || !!values.tonBagIds?.length,
+        }),
       },
-      help: '缁戝畾鍚庢壒娆$洿鎺ヨ繘鍏ョ敓浜т腑锛氭墭鐩樼敓鎴愭寮忔墭鐩樼爜锛屾墭鐩樹笅鏈綍鎵规鐨勮鐮佽嚜鍔ㄧ骇鑱斿綍鍏ユ湰鎵规锛堣鐮佸搧绉嶉』涓�鑷达級锛涚紪杈戞椂浠呴渶鍕鹃�夋柊澧炴墭鐩橈紝宸茬粦瀹氱殑涓嶅彲瑙g粦',
+      help: '鍙兘缁戝畾鐩稿悓鍝佺鐨勬墭鐩橈紝鍝佺淇℃伅鑷姩甯﹀叆锛涚己灏戝搧绉嶇殑鎵樼洏璇峰厛瑁呰銆傜粦瀹氬悗鎵规鐩存帴杩涘叆鐢熶骇涓細鎵樼洏鐢熸垚姝e紡鎵樼洏鐮侊紝鎵樼洏涓嬫湭褰曟壒娆$殑琚嬬爜鑷姩绾ц仈褰曞叆鏈壒娆★紙琚嬬爜鍝佺椤讳竴鑷达級锛涚紪杈戞椂浠呴渶鍕鹃�夋柊澧炴墭鐩橈紝宸茬粦瀹氱殑涓嶅彲瑙g粦',
+    },
+    {
+      fieldName: 'tonBagIds',
+      label: '缁戝畾鍚ㄨ',
+      component: 'Select',
+      componentProps: {
+        allowClear: true,
+        disabled,
+        maxTagCount: 3,
+        dropdownMatchSelectWidth: false,
+        dropdownStyle: { minWidth: '380px', maxWidth: 'calc(100vw - 32px)' },
+        mode: 'multiple',
+        optionFilterProp: 'label',
+        options: tonBagOptions,
+        onChange: onTonBagChange,
+        placeholder: '璇烽�夋嫨鐩稿悓鍝佺鐨勫惃琚�',
+        showSearch: true,
+      },
+      dependencies: {
+        triggerFields: ['itemId', 'palletIds'],
+        show: () => formType !== 'detail',
+        componentProps: (values) => ({
+          options: tonBagOptions.map(option => ({ ...option,
+            disabled: existingBinding === 'pallet' || !!values.palletIds?.length || (!!values.itemId && option.itemId !== values.itemId),
+          })),
+          disabled: disabled || existingBinding === 'pallet' || !!values.palletIds?.length,
+        }),
+      },
+      help: '浠呭彲缁戝畾璁¢噺鍗曚綅涓哄惃銆佹棤鎵樼洏涓旀湭褰曞叆鎵规鐨勮鐮侊紱涓庣粦瀹氭墭鐩樹簰鏂ャ�傜紪杈戞椂浠呴�夋嫨鏂板鍚ㄨ锛屽凡缁戝畾鐨勪笉鍙В缁�',
     },
     {
       fieldName: 'remark',
@@ -168,6 +227,7 @@
 /** 鍒楄〃鐨勬悳绱㈣〃鍗� */
 export function useGridFormSchema(): VbenFormSchema[] {
   return [
+    { fieldName: 'businessCode', label: '涓氬姟鐮�', component: 'Input', componentProps: { allowClear: true, placeholder: '璇疯緭鍏ヤ綔涓氭壂鐮佷笟鍔$爜' } },
     {
       fieldName: 'code',
       label: '鎵规鍙�',
@@ -237,6 +297,7 @@
 /** 鍒楄〃鐨勫瓧娈� */
 export function useGridColumns(): VxeTableGridOptions<MesProBatchApi.Batch>['columns'] {
   return [
+    { field: 'businessCode', title: '涓氬姟鐮侊紙浣滀笟鎵爜锛�', minWidth: 210 },
     {
       field: 'code',
       title: '鎵规鍙�',
@@ -244,6 +305,8 @@
       minWidth: 200,
       slots: { default: 'code' },
     },
+    { field: 'itemName', title: '鍝佺鍚嶇О', minWidth: 150 },
+    { field: 'itemCode', title: '鍝佺缂栫爜', minWidth: 150 },
     {
       field: 'lineName',
       title: '鍔犲伐鍗曚綅',

--
Gitblit v1.9.3