From 79314d765074927e218a060dc7ae4e3b6dd657ec Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期六, 18 七月 2026 15:54:07 +0800
Subject: [PATCH] 银川 1.销售订单页面展示字段修改 2.客户选择弹框复用调整 3.未使用菜单整理 4.发货通知、销售退货展示字段和操作权限判断修改 5.物料选择弹框展示字段修改

---
 src/views/basicData/mdm/components/data.ts           |   82 +++++++++++++--------------
 src/views/basicData/mdm/components/select-dialog.vue |   37 +++++++++++
 src/views/wls/transfer/data.ts                       |    2 
 src/views/erp/sale/order/modules/item-form.vue       |   29 +++------
 src/views/mes/pro/task/data.ts                       |    6 +-
 src/views/erp/sale/order/data.ts                     |    7 --
 src/views/mes/pro/workorder/data.ts                  |    8 +-
 7 files changed, 93 insertions(+), 78 deletions(-)

diff --git a/src/views/basicData/mdm/components/data.ts b/src/views/basicData/mdm/components/data.ts
index db1af68..91c4743 100644
--- a/src/views/basicData/mdm/components/data.ts
+++ b/src/views/basicData/mdm/components/data.ts
@@ -2,8 +2,10 @@
 import type { VxeTableGridOptions } from '#/adapter/vxe-table';
 import type { MdmItemApi } from '#/api/mdm/item';
 
-import { h } from 'vue';
-import { Tag } from 'ant-design-vue';
+import { DICT_TYPE } from '@vben/constants';
+import { getDictOptions } from '@vben/hooks';
+
+import { getItemTypeSimpleList } from '#/api/mes/md/item/type';
 
 /** 鐗╂枡閫夋嫨寮圭獥鎼滅储琛ㄥ崟 */
 export function useMdmItemSelectGridFormSchema(): VbenFormSchema[] {
@@ -27,30 +29,32 @@
       },
     },
     {
-      fieldName: 'itemType',
-      label: '鐗╂枡绫诲瀷',
+      fieldName: 'categoryId',
+      label: '鐗╂枡鍒嗙被',
+      component: 'ApiSelect',
+      componentProps: {
+        placeholder: '璇烽�夋嫨鐗╂枡鍒嗙被',
+        allowClear: true,
+        api: async () => {
+          const res = await getItemTypeSimpleList();
+          return res || [];
+        },
+        labelField: 'name',
+        valueField: 'id',
+      },
+    },
+    {
+      fieldName: 'status',
+      label: '鐘舵��',
       component: 'Select',
       componentProps: {
+        placeholder: '璇烽�夋嫨鐘舵��',
         allowClear: true,
-        placeholder: '璇烽�夋嫨鐗╂枡绫诲瀷',
-        options: [
-          { label: '鍘熸枡', value: 1 },
-          { label: '鍗婃垚鍝�', value: 2 },
-          { label: '鎴愬搧', value: 3 },
-          { label: '杈呮枡', value: 4 },
-        ],
+        options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
       },
     },
   ];
 }
-
-/** 鐗╂枡绫诲瀷棰滆壊鏄犲皠 */
-const itemTypeMap: Record<number, { label: string; color: string }> = {
-  1: { label: '鍘熸枡', color: 'green' },
-  2: { label: '鍗婃垚鍝�', color: 'orange' },
-  3: { label: '鎴愬搧', color: 'blue' },
-  4: { label: '杈呮枡', color: 'purple' },
-};
 
 /** 鐗╂枡閫夋嫨寮圭獥鍒楄〃瀛楁 */
 export function useMdmItemSelectGridColumns(
@@ -61,51 +65,45 @@
     {
       field: 'code',
       title: '鐗╂枡缂栫爜',
-      width: 180,
+      minWidth: 120,
     },
     {
       field: 'name',
       title: '鐗╂枡鍚嶇О',
-      minWidth: 160,
+      minWidth: 180,
       align: 'left',
     },
     {
       field: 'specification',
       title: '瑙勬牸鍨嬪彿',
-      minWidth: 140,
+      minWidth: 150,
       align: 'left',
+    },
+    {
+      field: 'categoryId',
+      title: '鐗╂枡鍒嗙被',
+      minWidth: 120,
+      align: 'center',
+      slots: { default: 'categoryId' },
     },
     {
       field: 'unitMeasureName',
       title: '鍗曚綅',
-      width: 90,
+      minWidth: 80,
       align: 'center',
-    },
-    {
-      field: 'itemType',
-      title: '鐗╂枡绫诲瀷',
-      width: 110,
-      align: 'center',
-      formatter: ({ cellValue }: { cellValue: number }) => {
-        const type = itemTypeMap[cellValue];
-        return type ? type.label : '-';
-      },
     },
     {
       field: 'isBatchManaged',
       title: '鎵规绠$悊',
-      width: 110,
+      minWidth: 80,
       align: 'center',
-      cellRender: {
-        name: 'CellDict',
-        props: { type: 'infra_boolean_string' },
-      },
+      slots: { default: 'isBatchManaged' },
     },
     {
-      field: 'createTime',
-      title: '鍒涘缓鏃堕棿',
-      width: 180,
-      formatter: 'formatDateTime',
+      field: 'warehouseName',
+      title: '榛樿浠撳簱',
+      minWidth: 100,
+      align: 'center',
     },
   ];
 }
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>
diff --git a/src/views/erp/sale/order/data.ts b/src/views/erp/sale/order/data.ts
index d43126c..eb76efe 100644
--- a/src/views/erp/sale/order/data.ts
+++ b/src/views/erp/sale/order/data.ts
@@ -199,11 +199,6 @@
       formatter: 'formatAmount3',
     },
     {
-      field: 'productBarCode',
-      title: '鏉$爜',
-      minWidth: 120,
-    },
-    {
       field: 'productUnitName',
       title: '鍗曚綅',
       minWidth: 80,
@@ -274,7 +269,7 @@
     },
     {
       title: '鎿嶄綔',
-      width: 320,
+      width: 80,
       fixed: 'right',
       slots: { default: 'actions' },
       visible: !disabled,
diff --git a/src/views/erp/sale/order/modules/item-form.vue b/src/views/erp/sale/order/modules/item-form.vue
index f877805..ffd3207 100644
--- a/src/views/erp/sale/order/modules/item-form.vue
+++ b/src/views/erp/sale/order/modules/item-form.vue
@@ -1,5 +1,4 @@
 <script lang="ts" setup>
-import type { MdmItemApi } from '#/api/mdm/item';
 import type { ErpSaleOrderApi } from '#/api/erp/sale/order';
 
 import { computed, nextTick, onMounted, ref, watch } from 'vue';
@@ -13,8 +12,7 @@
 import { Input, InputNumber, Select, Tag } from 'ant-design-vue';
 
 import { TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
-import { getItemPage } from '#/api/mdm/item';
-import { getStockCount } from '#/api/erp/stock/stock';
+import { MdmItemSelect } from '#/views/basicData/mdm/components';
 
 import { useFormItemColumns } from '../data';
 
@@ -36,8 +34,7 @@
   'update:totalPrice',
 ]);
 
-const tableData = ref<ErpSaleOrderApi.SaleOrderItem[]>([]); // 琛ㄦ牸鏁版嵁
-const productOptions = ref<MdmItemApi.Item[]>([]); // 鐗╂枡涓嬫媺閫夐」
+const tableData = ref<ErpSaleOrderApi.SaleOrderItem[]>([]);
 
 /** 鑾峰彇琛ㄦ牸鍚堣鏁版嵁 */
 const summaries = computed(() => {
@@ -124,8 +121,7 @@
   const newRow = {
     id: undefined,
     productId: undefined,
-    productUnitName: undefined, // 浜у搧鍗曚綅
-    productBarCode: undefined, // 浜у搧鏉$爜
+    productUnitName: undefined,
     productPrice: undefined,
     stockCount: undefined,
     count: 1,
@@ -134,7 +130,7 @@
     taxPrice: undefined,
     totalPrice: undefined,
     remark: undefined,
-    needProduction: 1, // 榛樿闇�瑕佺敓浜�
+    needProduction: 1,
   };
   tableData.value.push(newRow);
   // 閫氱煡鐖剁粍浠舵洿鏂�
@@ -153,12 +149,11 @@
 }
 
 /** 澶勭悊浜у搧鍙樻洿 */
-async function handleProductChange(productId: any, row: any) {
-  const product = productOptions.value.find((p) => p.id === productId);
+function handleProductChange(product: any, row: any) {
   if (!product) {
     return;
   }
-  row.productId = productId;
+  row.productId = product.id;
   row.productUnitId = product.unitMeasureId;
   row.productBarCode = product.barCode;
   row.productUnitName = product.unitMeasureName;
@@ -166,7 +161,6 @@
   row.productUnitName3 = product.unitMeasureName3;
   row.productSpecification = product.specification;
   row.productName = product.name;
-  row.stockCount = (await getStockCount(productId)) || 0;
   row.productPrice = product.salesPrice || 0;
   row.count = row.count || 1;
   handleRowChange(row);
@@ -221,8 +215,6 @@
 
 /** 鍒濆鍖� */
 onMounted(async () => {
-  const res = await getItemPage({ pageNo: 1, pageSize: 100, status: 0 });
-  productOptions.value = res.list || [];
   // 鐩殑锛氭柊澧炴椂锛岄粯璁ゆ坊鍔犱竴琛�
   if (tableData.value.length === 0) {
     handleAdd();
@@ -233,14 +225,11 @@
 <template>
   <Grid class="w-full">
     <template #productId="{ row }">
-      <Select
+      <MdmItemSelect
         v-if="!disabled"
-        v-model:value="row.productId"
-        :options="productOptions"
-        :field-names="{ label: 'name', value: 'id' }"
-        class="w-full"
+        :model-value="row.productId"
         placeholder="璇烽�夋嫨浜у搧"
-        show-search
+        @update:model-value="row.productId = $event"
         @change="handleProductChange($event, row)"
       />
       <span v-else>{{ row.productName || '-' }}</span>
diff --git a/src/views/mes/pro/task/data.ts b/src/views/mes/pro/task/data.ts
index 9fa3d36..a341512 100644
--- a/src/views/mes/pro/task/data.ts
+++ b/src/views/mes/pro/task/data.ts
@@ -8,8 +8,8 @@
 import { DICT_TYPE } from '@vben/constants';
 import { getDictOptions } from '@vben/hooks';
 
+import CrmCustomerSelect from '#/components/crm-customer-select.vue';
 import { getRangePickerDefaultProps } from '#/utils';
-import { MdClientSelect } from '#/views/mes/md/client/components';
 import { MdItemSelect } from '#/views/mes/md/item/components';
 import { MdWorkstationSelect } from '#/views/mes/md/workstation/components';
 import { ProProcessSelect } from '#/views/mes/process-design/process/components';
@@ -57,7 +57,7 @@
     {
       fieldName: 'clientId',
       label: '瀹㈡埛',
-      component: markRaw(MdClientSelect),
+      component: markRaw(CrmCustomerSelect),
       componentProps: {
         placeholder: '璇烽�夋嫨瀹㈡埛',
       },
@@ -258,7 +258,7 @@
     {
       fieldName: 'clientId',
       label: '瀹㈡埛',
-      component: markRaw(MdClientSelect),
+      component: markRaw(CrmCustomerSelect),
       componentProps: {
         disabled: true,
       },
diff --git a/src/views/mes/pro/workorder/data.ts b/src/views/mes/pro/workorder/data.ts
index 1caa0ff..265c93a 100644
--- a/src/views/mes/pro/workorder/data.ts
+++ b/src/views/mes/pro/workorder/data.ts
@@ -17,8 +17,8 @@
 import { Button } from 'ant-design-vue';
 
 import { generateAutoCode } from '#/api/mes/md/autocode/record';
+import CrmCustomerSelect from '#/components/crm-customer-select.vue';
 import { getRangePickerDefaultProps } from '#/utils';
-import { MdClientSelect } from '#/views/mes/md/client/components';
 import {
   MdItemSelect,
   MdProductBomSelect,
@@ -189,7 +189,7 @@
     {
       fieldName: 'clientId',
       label: '瀹㈡埛',
-      component: markRaw(MdClientSelect),
+      component: markRaw(CrmCustomerSelect),
       componentProps: {
         disabled: headerReadonly,
         placeholder: '璇烽�夋嫨瀹㈡埛',
@@ -292,7 +292,7 @@
     {
       fieldName: 'clientId',
       label: '瀹㈡埛',
-      component: markRaw(MdClientSelect),
+      component: markRaw(CrmCustomerSelect),
       componentProps: {
         placeholder: '璇烽�夋嫨瀹㈡埛',
       },
@@ -591,7 +591,7 @@
     {
       fieldName: 'clientId',
       label: '瀹㈡埛',
-      component: markRaw(MdClientSelect),
+      component: markRaw(CrmCustomerSelect),
       componentProps: {
         placeholder: '璇烽�夋嫨瀹㈡埛',
       },
diff --git a/src/views/wls/transfer/data.ts b/src/views/wls/transfer/data.ts
index 3c0edf3..864d701 100644
--- a/src/views/wls/transfer/data.ts
+++ b/src/views/wls/transfer/data.ts
@@ -394,7 +394,7 @@
       ? [
           {
             title: '鎿嶄綔',
-            width: 180,
+            width: 240,
             fixed: 'right',
             slots: { default: 'actions' },
           } as const,

--
Gitblit v1.9.3