From 0c85820e81bae62e8ff5f066803995dab1d3503f Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期二, 21 七月 2026 10:01:30 +0800
Subject: [PATCH] Merge branch 'dev_pro2.0' of http://114.132.189.42:9002/r/mom-pro2-before into dev_pro2.0

---
 src/views/erp/sale/order/index.vue                   |    2 
 src/views/basicData/mdm/data.ts                      |    5 ++
 src/views/mes/qc/defect/index.vue                    |   26 ++++++++++++
 src/views/basicData/mdm/modules/form.vue             |    4 +
 src/views/mes/qc/indicator/data.ts                   |   10 +----
 src/views/mes/qc/indicator/index.vue                 |   26 ++++++++++++
 src/views/mes/qc/defect/data.ts                      |    5 --
 src/views/mes/md/item/modules/product-media-list.vue |   26 +++++++++---
 8 files changed, 81 insertions(+), 23 deletions(-)

diff --git a/src/views/basicData/mdm/data.ts b/src/views/basicData/mdm/data.ts
index 088f514..c77d66f 100644
--- a/src/views/basicData/mdm/data.ts
+++ b/src/views/basicData/mdm/data.ts
@@ -53,6 +53,11 @@
   return unitListPromise;
 }
 
+/** 娓呴櫎鍗曚綅鍒楄〃缂撳瓨 */
+export function clearUnitListCache() {
+  unitListCache = null;
+}
+
 /** 鏂板/淇敼鐨勮〃鍗� */
 export function useFormSchema(formApi?: VbenFormApi): VbenFormSchema[] {
   return [
diff --git a/src/views/basicData/mdm/modules/form.vue b/src/views/basicData/mdm/modules/form.vue
index 73da21f..43e149b 100644
--- a/src/views/basicData/mdm/modules/form.vue
+++ b/src/views/basicData/mdm/modules/form.vue
@@ -11,7 +11,7 @@
 import { createItem, getItem, updateItem } from '#/api/mdm/item';
 import { $t } from '#/locales';
 
-import { useFormSchema } from '../data';
+import { useFormSchema, clearUnitListCache } from '../data';
 
 defineOptions({ name: "ItemForm" });
 
@@ -54,6 +54,8 @@
       return;
     }
     const data = modalApi.getData<MdmItemApi.Item>();
+    // 娓呴櫎鍗曚綅缂撳瓨锛岀‘淇濊幏鍙栨渶鏂版暟鎹�
+    clearUnitListCache();
     // 璁剧疆 schema锛坒ormApi 宸插垵濮嬪寲锛�
     formApi.setState({ schema: useFormSchema(formApi) });
     if (data?.id) {
diff --git a/src/views/erp/sale/order/index.vue b/src/views/erp/sale/order/index.vue
index 2df5b89..985ef0e 100644
--- a/src/views/erp/sale/order/index.vue
+++ b/src/views/erp/sale/order/index.vue
@@ -342,7 +342,7 @@
               type: 'link',
               icon: 'ant-design:file-protect-outlined',
               auth: ['mes:wm-sales-notice:create'],
-              ifShow: () => row.status === 20 && row.canCreateSalesNotice,
+              ifShow: () => row.status === 20 && (row.canCreateSalesNotice || row.productionStatus === 1),
               onClick: handleGenerateNotice.bind(null, row),
             },
             {
diff --git a/src/views/mes/md/item/modules/product-media-list.vue b/src/views/mes/md/item/modules/product-media-list.vue
index 1f58cda..e2b2adc 100644
--- a/src/views/mes/md/item/modules/product-media-list.vue
+++ b/src/views/mes/md/item/modules/product-media-list.vue
@@ -49,6 +49,17 @@
 
 const isReadOnly = computed(() => props.formType === 'detail'); // 鏄惁鍙
 const title = computed(() => props.kind); // 褰撳墠濯掍綋绫诲瀷鏍囬
+
+/** 灏嗗畬鏁� URL 杞负鐩稿璺緞锛岀‘淇濊蛋鍓嶇浠g悊 */
+function resolveImageUrl(url?: string): string {
+  if (!url) return '';
+  try {
+    const { pathname } = new URL(url, window.location.origin);
+    return pathname;
+  } catch {
+    return url;
+  }
+}
 const loading = ref(false); // SIP/SOP 鍒楄〃鍔犺浇涓�
 const formOpen = ref(false); // SIP/SOP 琛ㄥ崟鏄惁鎵撳紑
 const formLoading = ref(false); // SIP/SOP 琛ㄥ崟鎻愪氦涓�
@@ -219,27 +230,28 @@
       娣诲姞 {{ title }}
     </Button>
     <Spin :spinning="loading">
-      <div v-if="list.length > 0" class="grid grid-cols-4 gap-3">
+      <div v-if="list.length > 0" class="grid grid-cols-8 gap-1">
         <Card
           v-for="item in list"
           :key="item.id"
           hoverable
+          class="!w-[120px]"
           :body-style="{ padding: '0px' }"
         >
           <Image
             v-if="item.url"
-            :src="item.url"
-            class="block h-40 w-full object-cover"
-            :preview="{ src: item.url }"
+            :src="resolveImageUrl(item.url)"
+            class="block !h-[90px] !w-[120px] object-cover"
+            :preview="{ src: resolveImageUrl(item.url) }"
           />
           <div
             v-else
-            class="flex h-40 w-full items-center justify-center bg-gray-100 text-gray-400"
+            class="flex !h-[90px] !w-[120px] items-center justify-center bg-gray-100 text-gray-400"
           >
             鏆傛棤鍥剧墖
           </div>
-          <div class="p-3">
-            <div class="mb-1 truncate text-sm font-bold">{{ item.title }}</div>
+          <div class="p-2">
+            <div class="mb-1 truncate text-xs font-bold">{{ item.title }}</div>
             <div v-if="item.description" class="truncate text-xs text-gray-500">
               {{ item.description }}
             </div>
diff --git a/src/views/mes/qc/defect/data.ts b/src/views/mes/qc/defect/data.ts
index f9c678e..14e8457 100644
--- a/src/views/mes/qc/defect/data.ts
+++ b/src/views/mes/qc/defect/data.ts
@@ -150,10 +150,7 @@
       field: 'type',
       title: '妫�娴嬮」绫诲瀷',
       width: 120,
-      cellRender: {
-        name: 'CellDict',
-        props: { type: DICT_TYPE.MES_INDICATOR_TYPE },
-      },
+      slots: { default: 'type' },
     },
     {
       field: 'level',
diff --git a/src/views/mes/qc/defect/index.vue b/src/views/mes/qc/defect/index.vue
index 91cd617..0322a22 100644
--- a/src/views/mes/qc/defect/index.vue
+++ b/src/views/mes/qc/defect/index.vue
@@ -5,10 +5,12 @@
 import { Page, useVbenModal } from '@vben/common-ui';
 import { downloadFileFromBlobPart } from '@vben/utils';
 
-import { message } from 'ant-design-vue';
+import { message, Tag } from 'ant-design-vue';
 
 import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
 import { deleteDefect, exportDefect, getDefectPage } from '#/api/mes/qc/defect';
+import { DICT_TYPE } from '@vben/constants';
+import { getDictOptions } from '@vben/hooks';
 import { $t } from '#/locales';
 
 import { useGridColumns, useGridFormSchema } from './data';
@@ -18,6 +20,23 @@
   connectedComponent: Form,
   destroyOnClose: true,
 });
+
+const TAG_COLORS = ['blue', 'green', 'orange', 'purple', 'cyan', 'magenta', 'geekblue', 'volcano'] as const;
+
+const typeDictOptions = getDictOptions(DICT_TYPE.MES_INDICATOR_TYPE, 'number');
+const typeColorMap = new Map<number, string>();
+typeDictOptions.forEach((item, index) => {
+  typeColorMap.set(item.value as number, TAG_COLORS[index % TAG_COLORS.length]!);
+});
+
+function getTypeColor(type: number): string {
+  return typeColorMap.get(type) || 'default';
+}
+
+function getTypeLabel(type: number): string {
+  const item = typeDictOptions.find((d) => d.value === type);
+  return item?.label || String(type);
+}
 
 /** 鍒锋柊琛ㄦ牸 */
 function handleRefresh() {
@@ -110,6 +129,11 @@
           ]"
         />
       </template>
+      <template #type="{ row }">
+        <Tag v-if="row.type !== undefined && row.type !== null" :color="getTypeColor(row.type)">
+          {{ getTypeLabel(row.type) }}
+        </Tag>
+      </template>
       <template #actions="{ row }">
         <TableAction
           :actions="[
diff --git a/src/views/mes/qc/indicator/data.ts b/src/views/mes/qc/indicator/data.ts
index a34234a..a20cc84 100644
--- a/src/views/mes/qc/indicator/data.ts
+++ b/src/views/mes/qc/indicator/data.ts
@@ -186,10 +186,7 @@
       field: 'type',
       title: '妫�娴嬮」绫诲瀷',
       width: 120,
-      cellRender: {
-        name: 'CellDict',
-        props: { type: DICT_TYPE.MES_INDICATOR_TYPE },
-      },
+      slots: { default: 'type' },
     },
     {
       field: 'tool',
@@ -273,10 +270,7 @@
       field: 'type',
       title: '妫�娴嬮」绫诲瀷',
       width: 120,
-      cellRender: {
-        name: 'CellDict',
-        props: { type: DICT_TYPE.MES_INDICATOR_TYPE },
-      },
+      slots: { default: 'type' },
     },
     {
       field: 'tool',
diff --git a/src/views/mes/qc/indicator/index.vue b/src/views/mes/qc/indicator/index.vue
index f7afe01..ac34922 100644
--- a/src/views/mes/qc/indicator/index.vue
+++ b/src/views/mes/qc/indicator/index.vue
@@ -5,7 +5,7 @@
 import { Page, useVbenModal } from '@vben/common-ui';
 import { downloadFileFromBlobPart } from '@vben/utils';
 
-import { message } from 'ant-design-vue';
+import { message, Tag } from 'ant-design-vue';
 
 import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
 import {
@@ -13,6 +13,8 @@
   exportIndicator,
   getIndicatorPage,
 } from '#/api/mes/qc/indicator';
+import { DICT_TYPE } from '@vben/constants';
+import { getDictOptions } from '@vben/hooks';
 import { $t } from '#/locales';
 
 import { useGridColumns, useGridFormSchema } from './data';
@@ -22,6 +24,23 @@
   connectedComponent: Form,
   destroyOnClose: true,
 });
+
+const TAG_COLORS = ['blue', 'green', 'orange', 'purple', 'cyan', 'magenta', 'geekblue', 'volcano'] as const;
+
+const typeDictOptions = getDictOptions(DICT_TYPE.MES_INDICATOR_TYPE, 'number');
+const typeColorMap = new Map<number, string>();
+typeDictOptions.forEach((item, index) => {
+  typeColorMap.set(item.value as number, TAG_COLORS[index % TAG_COLORS.length]!);
+});
+
+function getTypeColor(type: number): string {
+  return typeColorMap.get(type) || 'default';
+}
+
+function getTypeLabel(type: number): string {
+  const item = typeDictOptions.find((d) => d.value === type);
+  return item?.label || String(type);
+}
 
 /** 鍒锋柊琛ㄦ牸 */
 function handleRefresh() {
@@ -114,6 +133,11 @@
           ]"
         />
       </template>
+      <template #type="{ row }">
+        <Tag v-if="row.type !== undefined && row.type !== null" :color="getTypeColor(row.type)">
+          {{ getTypeLabel(row.type) }}
+        </Tag>
+      </template>
       <template #actions="{ row }">
         <TableAction
           :actions="[

--
Gitblit v1.9.3