From bbce6db600e6bb0cf2a3bb78bdf5ccff70b737a8 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期四, 23 七月 2026 13:05:10 +0800
Subject: [PATCH] feat(workorder): 添加工序投料BOM明细展开功能

---
 src/views/mes/pro/workorder/data.ts |  203 ++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 155 insertions(+), 48 deletions(-)

diff --git a/src/views/mes/pro/workorder/data.ts b/src/views/mes/pro/workorder/data.ts
index fc1bdfe..fcac639 100644
--- a/src/views/mes/pro/workorder/data.ts
+++ b/src/views/mes/pro/workorder/data.ts
@@ -1,8 +1,9 @@
-import type { VbenFormApi, VbenFormSchema } from '#/adapter/form';
+锘縤mport type { VbenFormApi, VbenFormSchema } from '#/adapter/form';
 import type { VxeTableGridOptions } from '#/adapter/vxe-table';
 import type { MesMdProductBomApi } from '#/api/mes/md/item/productBom';
 import type { MesProWorkOrderApi } from '#/api/mes/pro/workorder';
 import type { MesProWorkOrderBomApi } from '#/api/mes/pro/workorder/bom';
+import type { MesProWorkOrderProcessApi } from '#/api/mes/pro/workorder/process';
 
 import { h, markRaw } from 'vue';
 
@@ -11,14 +12,14 @@
   MesAutoCodeRuleCode,
   MesProWorkOrderSourceTypeEnum,
   MesProWorkOrderTypeEnum,
-} from '..\..\..\..\packages\constants\src';
-import { getDictOptions } from '..\..\..\..\packages\effects\hooks\src';
+} from '@vben/constants';
+import { getDictOptions } from '@vben/hooks';
 
 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,
@@ -58,7 +59,7 @@
     },
     {
       fieldName: 'status',
-      label: '宸ュ崟鐘舵��',
+      label: '璁㈠崟鐘舵��',
       component: 'Select',
       componentProps: {
         disabled: true,
@@ -71,11 +72,11 @@
     },
     {
       fieldName: 'code',
-      label: '宸ュ崟缂栫爜',
+      label: '璁㈠崟缂栫爜',
       component: 'Input',
       componentProps: {
         disabled: headerReadonly,
-        placeholder: '璇疯緭鍏ュ伐鍗曠紪鐮�',
+        placeholder: '璇疯緭鍏ヨ鍗曠紪鐮�',
       },
       rules: 'required',
       suffix:
@@ -98,17 +99,17 @@
     },
     {
       fieldName: 'name',
-      label: '宸ュ崟鍚嶇О',
+      label: '璁㈠崟鍚嶇О',
       component: 'Input',
       componentProps: {
         disabled: headerReadonly,
-        placeholder: '璇疯緭鍏ュ伐鍗曞悕绉�',
+        placeholder: '璇疯緭鍏ヨ鍗曞悕绉�',
       },
       rules: 'required',
     },
     {
       fieldName: 'orderSourceType',
-      label: '宸ュ崟鏉ユ簮',
+      label: '璁㈠崟鏉ユ簮',
       component: 'Select',
       componentProps: {
         disabled: headerReadonly,
@@ -116,8 +117,8 @@
           DICT_TYPE.MES_PRO_WORK_ORDER_SOURCE_TYPE,
           'number',
         ),
-        placeholder: '璇烽�夋嫨宸ュ崟鏉ユ簮',
-        // 宸ュ崟鏉ユ簮鍙樻洿锛氶潪瀹㈡埛璁㈠崟鏃舵竻绌烘潵婧愬崟鎹紪鍙峰拰瀹㈡埛
+        placeholder: '璇烽�夋嫨璁㈠崟鏉ユ簮',
+        // 璁㈠崟鏉ユ簮鍙樻洿锛氶潪瀹㈡埛璁㈠崟鏃舵竻绌烘潵婧愬崟鎹紪鍙峰拰瀹㈡埛
         onChange: async (value: number) => {
           if (value !== MesProWorkOrderSourceTypeEnum.ORDER) {
             await formApi?.setValues({
@@ -145,13 +146,13 @@
     },
     {
       fieldName: 'type',
-      label: '宸ュ崟绫诲瀷',
+      label: '璁㈠崟绫诲瀷',
       component: 'Select',
       componentProps: {
         disabled: headerReadonly,
         options: getDictOptions(DICT_TYPE.MES_PRO_WORK_ORDER_TYPE, 'number'),
-        placeholder: '璇烽�夋嫨宸ュ崟绫诲瀷',
-        // 宸ュ崟绫诲瀷鍙樻洿锛氶潪浠e伐/閲囪喘鏃舵竻绌轰緵搴斿晢
+        placeholder: '璇烽�夋嫨璁㈠崟绫诲瀷',
+        // 璁㈠崟绫诲瀷鍙樻洿锛氶潪浠e伐/閲囪喘鏃舵竻绌轰緵搴斿晢
         onChange: async (value: number) => {
           if (
             value !== MesProWorkOrderTypeEnum.OUTSOURCE &&
@@ -175,13 +176,13 @@
     },
     {
       fieldName: 'quantity',
-      label: '宸ュ崟鏁伴噺',
+      label: '璁㈠崟鏁伴噺',
       component: 'InputNumber',
       componentProps: {
         class: '!w-full',
         disabled: headerReadonly,
         min: 1,
-        placeholder: '璇疯緭鍏ュ伐鍗曟暟閲�',
+        placeholder: '璇疯緭鍏ヨ鍗曟暟閲�',
         precision: 2,
       },
       rules: 'required',
@@ -189,7 +190,7 @@
     {
       fieldName: 'clientId',
       label: '瀹㈡埛',
-      component: markRaw(MdClientSelect),
+      component: markRaw(CrmCustomerSelect),
       componentProps: {
         disabled: headerReadonly,
         placeholder: '璇烽�夋嫨瀹㈡埛',
@@ -256,20 +257,20 @@
   return [
     {
       fieldName: 'code',
-      label: '宸ュ崟缂栫爜',
+      label: '璁㈠崟缂栫爜',
       component: 'Input',
       componentProps: {
         allowClear: true,
-        placeholder: '璇疯緭鍏ュ伐鍗曠紪鐮�',
+        placeholder: '璇疯緭鍏ヨ鍗曠紪鐮�',
       },
     },
     {
       fieldName: 'name',
-      label: '宸ュ崟鍚嶇О',
+      label: '璁㈠崟鍚嶇О',
       component: 'Input',
       componentProps: {
         allowClear: true,
-        placeholder: '璇疯緭鍏ュ伐鍗曞悕绉�',
+        placeholder: '璇疯緭鍏ヨ鍗曞悕绉�',
       },
     },
     {
@@ -292,19 +293,19 @@
     {
       fieldName: 'clientId',
       label: '瀹㈡埛',
-      component: markRaw(MdClientSelect),
+      component: markRaw(CrmCustomerSelect),
       componentProps: {
         placeholder: '璇烽�夋嫨瀹㈡埛',
       },
     },
     {
       fieldName: 'type',
-      label: '宸ュ崟绫诲瀷',
+      label: '璁㈠崟绫诲瀷',
       component: 'Select',
       componentProps: {
         allowClear: true,
         options: getDictOptions(DICT_TYPE.MES_PRO_WORK_ORDER_TYPE, 'number'),
-        placeholder: '璇烽�夋嫨宸ュ崟绫诲瀷',
+        placeholder: '璇烽�夋嫨璁㈠崟绫诲瀷',
       },
     },
     {
@@ -324,7 +325,7 @@
   return [
     {
       field: 'code',
-      title: '宸ュ崟缂栫爜',
+      title: '璁㈠崟缂栫爜',
       fixed: 'left',
       width: 200,
       treeNode: true,
@@ -332,12 +333,12 @@
     },
     {
       field: 'name',
-      title: '宸ュ崟鍚嶇О',
+      title: '璁㈠崟鍚嶇О',
       minWidth: 150,
     },
     {
       field: 'type',
-      title: '宸ュ崟绫诲瀷',
+      title: '璁㈠崟绫诲瀷',
       width: 100,
       cellRender: {
         name: 'CellDict',
@@ -346,7 +347,7 @@
     },
     {
       field: 'orderSourceType',
-      title: '宸ュ崟鏉ユ簮',
+      title: '璁㈠崟鏉ユ簮',
       width: 100,
       cellRender: {
         name: 'CellDict',
@@ -380,7 +381,7 @@
     },
     {
       field: 'quantity',
-      title: '宸ュ崟鏁伴噺',
+      title: '璁㈠崟鏁伴噺',
       width: 100,
     },
     {
@@ -406,7 +407,7 @@
     },
     {
       field: 'status',
-      title: '宸ュ崟鐘舵��',
+      title: '璁㈠崟鐘舵��',
       width: 100,
       cellRender: {
         name: 'CellDict',
@@ -428,7 +429,7 @@
   ];
 }
 
-/** 宸ュ崟 BOM 瀛愯〃鐨勫瓧娈� */
+/** 璁㈠崟 BOM 瀛愯〃鐨勫瓧娈� */
 export function useBomGridColumns(
   editable: boolean,
   generatable: boolean,
@@ -486,7 +487,7 @@
   ];
 }
 
-/** 宸ュ崟 BOM 鏂板/淇敼鐨勮〃鍗� */
+/** 璁㈠崟 BOM 鏂板/淇敼鐨勮〃鍗� */
 export function useBomFormSchema(
   isCreate: boolean,
   productId?: number,
@@ -559,25 +560,25 @@
   ];
 }
 
-/** 宸ュ崟閫夋嫨寮圭獥鐨勬悳绱㈣〃鍗� */
+/** 璁㈠崟閫夋嫨寮圭獥鐨勬悳绱㈣〃鍗� */
 export function useWorkOrderSelectGridFormSchema(): VbenFormSchema[] {
   return [
     {
       fieldName: 'code',
-      label: '宸ュ崟缂栫爜',
+      label: '璁㈠崟缂栫爜',
       component: 'Input',
       componentProps: {
         allowClear: true,
-        placeholder: '璇疯緭鍏ュ伐鍗曠紪鐮�',
+        placeholder: '璇疯緭鍏ヨ鍗曠紪鐮�',
       },
     },
     {
       fieldName: 'name',
-      label: '宸ュ崟鍚嶇О',
+      label: '璁㈠崟鍚嶇О',
       component: 'Input',
       componentProps: {
         allowClear: true,
-        placeholder: '璇疯緭鍏ュ伐鍗曞悕绉�',
+        placeholder: '璇疯緭鍏ヨ鍗曞悕绉�',
       },
     },
     {
@@ -591,25 +592,25 @@
     {
       fieldName: 'clientId',
       label: '瀹㈡埛',
-      component: markRaw(MdClientSelect),
+      component: markRaw(CrmCustomerSelect),
       componentProps: {
         placeholder: '璇烽�夋嫨瀹㈡埛',
       },
     },
     {
       fieldName: 'status',
-      label: '宸ュ崟鐘舵��',
+      label: '璁㈠崟鐘舵��',
       component: 'Select',
       componentProps: {
         allowClear: true,
         options: getDictOptions(DICT_TYPE.MES_PRO_WORK_ORDER_STATUS, 'number'),
-        placeholder: '璇烽�夋嫨宸ュ崟鐘舵��',
+        placeholder: '璇烽�夋嫨璁㈠崟鐘舵��',
       },
     },
   ];
 }
 
-/** 宸ュ崟閫夋嫨寮圭獥鐨勫瓧娈� */
+/** 璁㈠崟閫夋嫨寮圭獥鐨勫瓧娈� */
 export function useWorkOrderSelectGridColumns(
   multiple = false,
 ): VxeTableGridOptions<MesProWorkOrderApi.WorkOrder>['columns'] {
@@ -620,17 +621,17 @@
     },
     {
       field: 'code',
-      title: '宸ュ崟缂栫爜',
+      title: '璁㈠崟缂栫爜',
       width: 180,
     },
     {
       field: 'name',
-      title: '宸ュ崟鍚嶇О',
+      title: '璁㈠崟鍚嶇О',
       minWidth: 180,
     },
     {
       field: 'orderSourceType',
-      title: '宸ュ崟鏉ユ簮',
+      title: '璁㈠崟鏉ユ簮',
       width: 100,
       cellRender: {
         name: 'CellDict',
@@ -664,7 +665,7 @@
     },
     {
       field: 'quantity',
-      title: '宸ュ崟鏁伴噺',
+      title: '璁㈠崟鏁伴噺',
       width: 100,
     },
     {
@@ -679,7 +680,7 @@
     },
     {
       field: 'status',
-      title: '宸ュ崟鐘舵��',
+      title: '璁㈠崟鐘舵��',
       width: 100,
       cellRender: {
         name: 'CellDict',
@@ -695,7 +696,7 @@
   ];
 }
 
-/** 宸ュ崟鐗╂枡闇�姹傚瓙琛ㄧ殑瀛楁锛堝彧璇伙級 */
+/** 璁㈠崟鐗╂枡闇�姹傚瓙琛ㄧ殑瀛楁锛堝彧璇伙級 */
 export function useItemGridColumns(): VxeTableGridOptions<MesProWorkOrderBomApi.WorkOrderBom>['columns'] {
   return [
     {
@@ -734,3 +735,109 @@
     },
   ];
 }
+
+/** 璁㈠崟宸ュ簭鍒楄〃鐨勫瓧娈� */
+export function useProcessGridColumns(
+  draggable = false,
+): VxeTableGridOptions<MesProWorkOrderProcessApi.WorkOrderProcess>['columns'] {
+  return [
+    ...(draggable
+      ? [
+          {
+            field: 'drag',
+            title: '',
+            width: 40,
+            fixed: 'left',
+            slots: { default: 'dragHandle' },
+          } as const,
+        ]
+      : []),
+    {
+      type: 'expand',
+      width: 50,
+    } as const,
+    {
+      field: 'sort',
+      title: '搴忓彿',
+      width: 80,
+    },
+    {
+      field: 'processCode',
+      title: '宸ュ簭缂栫爜',
+      width: 120,
+    },
+    {
+      field: 'processName',
+      title: '宸ュ簭鍚嶇О',
+      minWidth: 150,
+    },
+    {
+      field: 'nextProcessName',
+      title: '涓嬩竴閬撳伐搴�',
+      width: 120,
+    },
+    {
+      field: 'linkType',
+      title: '宸ュ簭鍏崇郴',
+      width: 100,
+      formatter: ({ cellValue }) => {
+        const map: Record<number, string> = {
+          0: '寮�濮�-寮�濮�',
+          1: '缁撴潫-缁撴潫',
+          2: '寮�濮�-缁撴潫',
+          3: '缁撴潫-寮�濮�',
+        };
+        return map[cellValue] ?? '-';
+      },
+    },
+    {
+      field: 'prepareTime',
+      title: '鍑嗗鏃堕棿(鍒�)',
+      width: 100,
+    },
+    {
+      field: 'waitTime',
+      title: '绛夊緟鏃堕棿(鍒�)',
+      width: 100,
+    },
+    {
+      field: 'keyFlag',
+      title: '鍏抽敭宸ュ簭',
+      width: 80,
+      slots: { default: 'keyFlag' },
+    },
+    {
+      field: 'checkFlag',
+      title: '璐ㄦ宸ュ簭',
+      width: 80,
+      slots: { default: 'checkFlag' },
+    },
+    {
+      field: 'backflushFlag',
+      title: '鍊掑啿',
+      width: 80,
+      slots: { default: 'backflushFlag' },
+    },
+    {
+      field: 'outputItemCode',
+      title: '浜у嚭鐗╂枡缂栫爜',
+      width: 120,
+    },
+    {
+      field: 'outputItemName',
+      title: '浜у嚭鐗╂枡鍚嶇О',
+      width: 120,
+    },
+    {
+      field: 'remark',
+      title: '澶囨敞',
+      minWidth: 120,
+    },
+    {
+      title: '鎿嶄綔',
+      width: 120,
+      fixed: 'right',
+      slots: { default: 'actions' },
+    },
+  ];
+}

--
Gitblit v1.9.3