From 3c4d241b9ef0d14a0cea5cd69b7919dfba1d14c5 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 24 七月 2026 16:17:15 +0800
Subject: [PATCH] 银川 1.销售订单生产状态不匹配, 2.采购订单中没有退货状态字段,筛选项有退货状态 3.采购申请添加查看订单、查看审批功能 4.物料管理与mes产品管理的联动逻辑修改

---
 src/views/basicData/mdm/index.vue |   40 ++++++++++++++++++++++++++++++++++------
 1 files changed, 34 insertions(+), 6 deletions(-)

diff --git a/src/views/basicData/mdm/index.vue b/src/views/basicData/mdm/index.vue
index 7f87556..e59b39f 100644
--- a/src/views/basicData/mdm/index.vue
+++ b/src/views/basicData/mdm/index.vue
@@ -3,7 +3,7 @@
 import type { MdmItemApi } from '#/api/mdm/item';
 import type { MesMdItemTypeApi } from '#/api/mes/md/item/type';
 
-import { ref } from 'vue';
+import { computed, ref } from 'vue';
 
 import { confirm, Page, useVbenModal } from '#/packages/effects/common-ui/src';
 import { downloadFileFromBlobPart, isEmpty } from '#/packages/utils/src';
@@ -33,6 +33,34 @@
 
 // 鍒嗙被鍒楄〃缂撳瓨
 const categoryList = ref<MesMdItemTypeApi.ItemType[]>([]);
+
+const TAG_COLORS = [
+  'green',
+  'orange',
+  'blue',
+  'purple',
+  'cyan',
+  'magenta',
+  'geekblue',
+  'volcano',
+  'gold',
+  'lime',
+] as const;
+
+/** 鍒嗙被ID 鈫� 棰滆壊鏄犲皠锛堝熀浜庡垎绫诲湪鍒楄〃涓殑绱㈠紩寰幆鍒嗛厤锛� */
+const categoryColorMap = computed(() => {
+  const map = new Map<number, string>();
+  categoryList.value.forEach((item, index) => {
+    map.set(item.id!, TAG_COLORS[index % TAG_COLORS.length]!);
+  });
+  return map;
+});
+
+/** 鑾峰彇鍒嗙被Tag棰滆壊 */
+function getCategoryColor(categoryId?: number): string {
+  if (!categoryId) return '';
+  return categoryColorMap.value.get(categoryId) || '';
+}
 
 /** 鑾峰彇鍒嗙被鍚嶇О */
 function getCategoryName(categoryId?: number) {
@@ -196,17 +224,17 @@
         />
       </template>
       <template #categoryName="{ row }">
-        <Tag v-if="row.categoryId === 1" color="green">{{ getCategoryName(row.categoryId) }}</Tag>
-        <Tag v-else-if="row.categoryId === 2" color="orange">{{ getCategoryName(row.categoryId) }}</Tag>
-        <Tag v-else-if="row.categoryId === 3" color="blue">{{ getCategoryName(row.categoryId) }}</Tag>
-        <Tag v-else-if="row.categoryId === 4" color="purple">{{ getCategoryName(row.categoryId) }}</Tag>
-        <Tag v-else-if="row.categoryId === 5" color="cyan">{{ getCategoryName(row.categoryId) }}</Tag>
+        <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>
+      <template #syncedMes="{ row }">
+        <Tag v-if="row.syncedMes" color="success">宸插悓姝�</Tag>
+        <Tag v-else color="default">鏈悓姝�</Tag>
+      </template>
       <template #actions="{ row }">
         <TableAction
           :actions="[

--
Gitblit v1.9.3