From b51265aacb3e3adc00be85c159cfee8027f7d40b Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期二, 21 七月 2026 11:04:42 +0800
Subject: [PATCH] 银川 1.销售订单页面、物料管理页面联调

---
 src/views/basicData/mdm/components/select-dialog.vue |   37 +++++++++++++++++++++++++++++++++++--
 1 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/src/views/basicData/mdm/components/select-dialog.vue b/src/views/basicData/mdm/components/select-dialog.vue
index 9c7a48a..f42875f 100644
--- a/src/views/basicData/mdm/components/select-dialog.vue
+++ b/src/views/basicData/mdm/components/select-dialog.vue
@@ -1,13 +1,15 @@
 <script lang="ts" setup>
 import type { VxeTableGridOptions } from '#/adapter/vxe-table';
 import type { MdmItemApi } from '#/api/mdm/item';
+import type { MesMdItemTypeApi } from '#/api/mes/md/item/type';
 
 import { nextTick, ref } from 'vue';
 
-import { message, Modal } from 'ant-design-vue';
+import { message, Modal, Tag } from 'ant-design-vue';
 
 import { useVbenVxeGrid } from '#/adapter/vxe-table';
 import { getItemPage } from '#/api/mdm/item';
+import { getItemTypeSimpleList } from '#/api/mes/md/item/type';
 
 import {
   useMdmItemSelectGridColumns,
@@ -24,6 +26,21 @@
 const multiple = ref(true); // 鏄惁澶氶��
 const selectedRows = ref<MdmItemApi.Item[]>([]); // 宸查�夌墿鏂欏垪琛�
 const preSelectedIds = ref<number[]>([]); // 棰勯�夌墿鏂欑紪鍙峰垪琛�
+const categoryList = ref<MesMdItemTypeApi.ItemType[]>([]); // 鍒嗙被鍒楄〃缂撳瓨
+
+const TAG_COLORS = ['green', 'orange', 'blue', 'purple', 'cyan', 'magenta', 'geekblue', 'volcano', 'gold', 'lime'] as const;
+
+function getCategoryName(categoryId?: number) {
+  if (!categoryId || !categoryList.value.length) return '';
+  const category = categoryList.value.find((item) => item.id === categoryId);
+  return category?.name || '';
+}
+
+function getCategoryColor(categoryId?: number): string {
+  if (!categoryId) return '';
+  const index = categoryList.value.findIndex((item) => item.id === categoryId);
+  return index >= 0 ? TAG_COLORS[index % TAG_COLORS.length]! : '';
+}
 
 /** 鑾峰彇褰撳墠琛ㄦ牸鏁版嵁 */
 function getTableRows() {
@@ -121,6 +138,13 @@
     proxyConfig: {
       ajax: {
         query: async ({ page }, formValues) => {
+          if (!categoryList.value.length) {
+            try {
+              categoryList.value = await getItemTypeSimpleList();
+            } catch {
+              categoryList.value = [];
+            }
+          }
           return await getItemPage({
             pageNo: page.currentPage,
             pageSize: page.pageSize,
@@ -204,6 +228,15 @@
     @ok="handleConfirm"
     @cancel="closeModal"
   >
-    <Grid table-title="鐗╂枡鍒楄〃" />
+    <Grid table-title="鐗╂枡鍒楄〃">
+      <template #categoryId="{ row }">
+        <Tag v-if="getCategoryColor(row.categoryId)" :color="getCategoryColor(row.categoryId)">{{ getCategoryName(row.categoryId) }}</Tag>
+        <span v-else>{{ getCategoryName(row.categoryId) || '-' }}</span>
+      </template>
+      <template #isBatchManaged="{ row }">
+        <Tag v-if="row.isBatchManaged" color="success">鏄�</Tag>
+        <Tag v-else>鍚�</Tag>
+      </template>
+    </Grid>
   </Modal>
 </template>

--
Gitblit v1.9.3