From 46624ce480a3c14da21f39cc4ad5f7eecea2bb1e Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期四, 17 九月 2026 16:24:28 +0800
Subject: [PATCH] feat(mes): 优化生产批次和袋码管理功能

---
 src/views/basicData/mdm/index.vue |   72 +++++-------------------------------
 1 files changed, 10 insertions(+), 62 deletions(-)

diff --git a/src/views/basicData/mdm/index.vue b/src/views/basicData/mdm/index.vue
index 8995f78..3a02fe0 100644
--- a/src/views/basicData/mdm/index.vue
+++ b/src/views/basicData/mdm/index.vue
@@ -1,9 +1,8 @@
 <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 { computed, ref } from 'vue';
+import { ref } from 'vue';
 
 import { confirm, Page, useVbenModal } from '#/packages/effects/common-ui/src';
 import { downloadFileFromBlobPart, isEmpty } from '#/packages/utils/src';
@@ -19,7 +18,6 @@
   updateItemStatus,
   updateItemSync,
 } from '#/api/mdm/item';
-import { getItemTypeSimpleList } from '#/api/mes/md/item/type';
 import { $t } from '#/locales';
 
 import { useGridColumns, useGridFormSchema } from './data';
@@ -32,44 +30,6 @@
   destroyOnClose: true,
 });
 
-// 鍒嗙被鍒楄〃缂撳瓨
-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) {
-  if (!categoryId || !categoryList.value.length) return '';
-  const category = categoryList.value.find((item) => item.id === categoryId);
-  return category?.name || '';
-}
-
 /** 鍒锋柊琛ㄦ牸 */
 function handleRefresh() {
   gridApi.query();
@@ -78,20 +38,20 @@
 /** 瀵煎嚭琛ㄦ牸 */
 // async function handleExport() {
 //   const data = await exportItem(await gridApi.formApi.getValues());
-//   downloadFileFromBlobPart({ fileName: '鐗╂枡.xls', source: data });
+//   downloadFileFromBlobPart({ fileName: '鍝佺.xls', source: data });
 // }
 
-/** 鍒涘缓鐗╂枡 */
+/** 鍒涘缓鍝佺 */
 function handleCreate() {
   formModalApi.setData(null).open();
 }
 
-/** 缂栬緫鐗╂枡 */
+/** 缂栬緫鍝佺 */
 function handleEdit(row: MdmItemApi.Item) {
   formModalApi.setData(row).open();
 }
 
-/** 鍒犻櫎鐗╂枡 */
+/** 鍒犻櫎鍝佺 */
 async function handleDelete(row: MdmItemApi.Item) {
   const hideLoading = message.loading({
     content: $t('ui.actionMessage.deleting', [row.name]),
@@ -106,7 +66,7 @@
   }
 }
 
-/** 鎵归噺鍒犻櫎鐗╂枡 */
+/** 鎵归噺鍒犻櫎鍝佺 */
 async function handleDeleteBatch() {
   await confirm($t('ui.actionMessage.deleteBatchConfirm'));
   const hideLoading = message.loading({
@@ -141,10 +101,10 @@
 
 const syncingId = ref<number | null>(null);
 
-/** 鍒囨崲鍚屾鐘舵�侊細鍏抽棴寮�鍏充細浠� MES 鍒犻櫎鐗╂枡锛岄渶纭 */
+/** 鍒囨崲鍚屾鐘舵�侊細鍏抽棴寮�鍏充細浠� MES 鍒犻櫎鍝佺锛岄渶纭 */
 async function handleSyncChange(row: MdmItemApi.Item, checked: boolean) {
   if (!checked) {
-    await confirm('鍏抽棴鍚屾灏嗕粠 MES 鍒犻櫎璇ョ墿鏂欏強鍏宠仈閰嶇疆锛圔OM/SOP/SIP/鎵规閰嶇疆锛夛紝纭缁х画锛�');
+    await confirm('鍏抽棴鍚屾灏嗕粠 MES 鍒犻櫎璇ュ搧绉嶅強鍏宠仈閰嶇疆锛圔OM/SOP/SIP/鎵规閰嶇疆锛夛紝纭缁х画锛�');
   }
   syncingId.value = row.id!;
   try {
@@ -176,14 +136,6 @@
     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,
@@ -211,12 +163,12 @@
 <template>
   <Page auto-content-height>
     <FormModal @success="handleRefresh" />
-    <Grid table-title="鐗╂枡鍒楄〃">
+    <Grid table-title="鍝佺鍒楄〃">
       <template #toolbar-tools>
         <TableAction
           :actions="[
             {
-              label: $t('ui.actionTitle.create', ['鐗╂枡']),
+              label: $t('ui.actionTitle.create', ['鍝佺']),
               type: 'primary',
               icon: ACTION_ICON.ADD,
               auth: ['mdm:item:create'],
@@ -240,10 +192,6 @@
             },
           ]"
         />
-      </template>
-      <template #categoryName="{ 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>

--
Gitblit v1.9.3