From f8bc8d5d87ab015272b64f9a1e997a4182203c44 Mon Sep 17 00:00:00 2001
From: xiaoyi <908147524@qq.com>
Date: 星期六, 07 十一月 2026 16:11:44 +0800
Subject: [PATCH] 完善物料颜色维护与选择

---
 src/views/basicData/mdm/components/data.ts    |   12 ++++++++++++
 src/views/basicData/mdm/components/select.vue |    5 ++++-
 src/views/basicData/mdm/data.ts               |   23 +++++++++++++++++++++++
 src/views/basicData/mdm/modules/form.vue      |    2 ++
 src/api/mdm/item/index.ts                     |    2 ++
 5 files changed, 43 insertions(+), 1 deletions(-)

diff --git a/src/api/mdm/item/index.ts b/src/api/mdm/item/index.ts
index 19d50a7..ebff2ea 100644
--- a/src/api/mdm/item/index.ts
+++ b/src/api/mdm/item/index.ts
@@ -10,6 +10,7 @@
     name: string;
     barCode?: string;
     specification?: string;
+    color?: string; // 棰滆壊
     categoryId?: number;
     categoryName?: string;
     unitMeasureId?: number;
@@ -56,6 +57,7 @@
   export interface PageParams extends PageParam {
     code?: string;
     name?: string;
+    color?: string; // 棰滆壊锛堟ā绯婂尮閰嶏級
     categoryId?: number;
     itemType?: number;
     status?: number;
diff --git a/src/views/basicData/mdm/components/data.ts b/src/views/basicData/mdm/components/data.ts
index 91c4743..f5ca42d 100644
--- a/src/views/basicData/mdm/components/data.ts
+++ b/src/views/basicData/mdm/components/data.ts
@@ -29,6 +29,12 @@
       },
     },
     {
+      fieldName: 'color',
+      label: '棰滆壊',
+      component: 'Input',
+      componentProps: { allowClear: true, placeholder: '璇疯緭鍏ラ鑹�' },
+    },
+    {
       fieldName: 'categoryId',
       label: '鐗╂枡鍒嗙被',
       component: 'ApiSelect',
@@ -80,6 +86,12 @@
       align: 'left',
     },
     {
+      field: 'color',
+      title: '棰滆壊',
+      minWidth: 100,
+      align: 'left',
+    },
+    {
       field: 'categoryId',
       title: '鐗╂枡鍒嗙被',
       minWidth: 120,
diff --git a/src/views/basicData/mdm/components/select.vue b/src/views/basicData/mdm/components/select.vue
index 6149196..77d6832 100644
--- a/src/views/basicData/mdm/components/select.vue
+++ b/src/views/basicData/mdm/components/select.vue
@@ -38,7 +38,9 @@
 const hovering = ref(false); // 鏄惁鎮仠
 const selectedItem = ref<MdmItemApi.Item>(); // 褰撳墠閫変腑鐗╂枡
 
-const displayLabel = computed(() => selectedItem.value?.name ?? props.label ?? ''); // 閫夋嫨鍣ㄥ睍绀哄悕绉�
+const displayLabel = computed(() => selectedItem.value
+  ? [selectedItem.value.name, selectedItem.value.specification, selectedItem.value.color].filter(Boolean).join(' ')
+  : props.label ?? '');
 const showClear = computed(
   () =>
     props.allowClear &&
@@ -118,6 +120,7 @@
           <div>缂栫爜锛歿{ selectedItem.code || '-' }}</div>
           <div>鍚嶇О锛歿{ selectedItem.name || '-' }}</div>
           <div>瑙勬牸锛歿{ selectedItem.specification || '-' }}</div>
+          <div>棰滆壊锛歿{ selectedItem.color || '-' }}</div>
           <div>鍗曚綅锛歿{ selectedItem.unitMeasureName || '-' }}</div>
         </div>
       </template>
diff --git a/src/views/basicData/mdm/data.ts b/src/views/basicData/mdm/data.ts
index b351a85..7c0bb74 100644
--- a/src/views/basicData/mdm/data.ts
+++ b/src/views/basicData/mdm/data.ts
@@ -147,6 +147,15 @@
       },
     },
     {
+      component: "Input",
+      fieldName: "color",
+      label: "棰滆壊",
+      componentProps: {
+        placeholder: "濡傦細绾㈣壊銆侀噾EF6F45",
+        allowClear: true,
+      },
+    },
+    {
       component: "ApiSelect",
       fieldName: "unitMeasureId",
       label: "璁¢噺鍗曚綅",
@@ -521,6 +530,15 @@
       },
     },
     {
+      fieldName: "color",
+      label: "棰滆壊",
+      component: "Input",
+      componentProps: {
+        placeholder: "璇疯緭鍏ラ鑹诧紙妯$硦鍖归厤锛�",
+        allowClear: true,
+      },
+    },
+    {
       fieldName: "status",
       label: "鐘舵��",
       component: "Select",
@@ -553,6 +571,11 @@
       minWidth: 150,
     },
     {
+      field: "color",
+      title: "棰滆壊",
+      width: 120,
+    },
+    {
       field: "categoryName",
       title: "鐗╂枡鍒嗙被",
       minWidth: 120,
diff --git a/src/views/basicData/mdm/modules/form.vue b/src/views/basicData/mdm/modules/form.vue
index 5d82e00..f6a331b 100644
--- a/src/views/basicData/mdm/modules/form.vue
+++ b/src/views/basicData/mdm/modules/form.vue
@@ -77,6 +77,8 @@
       // 鏂板妯″紡
       formData.value = undefined;
       await formApi.resetForm();
+      // 鍔ㄦ�佽缃� schema 鍚� resetForm 涓嶄細鑷姩甯﹀叆瀛楁榛樿鍊笺��
+      await formApi.setValues({ isBatchManaged: false, syncMes: true, status: 0 });
     }
   },
 });

--
Gitblit v1.9.3