From fa42bcb7396e06e335bbbff67f5898b98f8d9aa0 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期五, 24 七月 2026 17:09:28 +0800
Subject: [PATCH] refactor(mes): 移除工单模块中的BOM相关功能
---
src/views/mes/pro/workorder/data.ts | 240 ++++++++++++++++++++++++++---------------------------------
1 files changed, 107 insertions(+), 133 deletions(-)
diff --git a/src/views/mes/pro/workorder/data.ts b/src/views/mes/pro/workorder/data.ts
index 265c93a..add9af7 100644
--- a/src/views/mes/pro/workorder/data.ts
+++ b/src/views/mes/pro/workorder/data.ts
@@ -1,8 +1,8 @@
锘縤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';
@@ -21,7 +21,6 @@
import { getRangePickerDefaultProps } from '#/utils';
import {
MdItemSelect,
- MdProductBomSelect,
} from '#/views/mes/md/item/components';
import { MdVendorSelect } from '#/views/mes/md/vendor/components';
@@ -428,137 +427,6 @@
];
}
-/** 璁㈠崟 BOM 瀛愯〃鐨勫瓧娈� */
-export function useBomGridColumns(
- editable: boolean,
- generatable: boolean,
-): VxeTableGridOptions<MesProWorkOrderBomApi.WorkOrderBom>['columns'] {
- return [
- {
- field: 'itemCode',
- title: 'BOM 鐗╂枡缂栫爜',
- width: 120,
- },
- {
- field: 'itemName',
- title: 'BOM 鐗╂枡鍚嶇О',
- minWidth: 150,
- },
- {
- field: 'itemSpecification',
- title: '瑙勬牸鍨嬪彿',
- width: 120,
- },
- {
- field: 'unitMeasureName',
- title: '鍗曚綅',
- width: 80,
- },
- {
- field: 'itemOrProduct',
- title: '鐗╂枡/浜у搧',
- width: 100,
- cellRender: {
- name: 'CellDict',
- props: { type: DICT_TYPE.MES_MD_ITEM_OR_PRODUCT },
- },
- },
- {
- field: 'quantity',
- title: '棰勮浣跨敤閲�',
- width: 120,
- },
- {
- field: 'remark',
- title: '澶囨敞',
- minWidth: 120,
- },
- ...(editable || generatable
- ? [
- {
- title: '鎿嶄綔',
- width: 160,
- fixed: 'right',
- slots: { default: 'actions' },
- } as const,
- ]
- : []),
- ];
-}
-
-/** 璁㈠崟 BOM 鏂板/淇敼鐨勮〃鍗� */
-export function useBomFormSchema(
- isCreate: boolean,
- productId?: number,
- formApi?: VbenFormApi,
-): VbenFormSchema[] {
- return [
- {
- fieldName: 'itemId',
- label: '鐗╂枡',
- component: markRaw(MdProductBomSelect),
- componentProps: {
- itemId: productId,
- placeholder: '璇烽�夋嫨鐗╂枡',
- // BOM 鐗╂枡閫変腑鍚庤嚜鍔ㄥ洖濉璁′娇鐢ㄩ噺
- onChange: async (bom?: MesMdProductBomApi.ProductBom) => {
- await formApi?.setFieldValue('quantity', bom?.quantity ?? undefined);
- },
- },
- rules: 'selectRequired',
- dependencies: {
- triggerFields: [''],
- show: () => isCreate,
- },
- },
- {
- fieldName: 'itemName',
- label: '鐗╂枡',
- component: 'Input',
- componentProps: {
- disabled: true,
- },
- dependencies: {
- triggerFields: [''],
- show: () => !isCreate,
- },
- },
- {
- fieldName: 'unitMeasureName',
- label: '鍗曚綅',
- component: 'Input',
- componentProps: {
- disabled: true,
- },
- dependencies: {
- triggerFields: [''],
- show: () => !isCreate,
- },
- },
- {
- fieldName: 'quantity',
- label: '棰勮浣跨敤閲�',
- component: 'InputNumber',
- componentProps: {
- class: '!w-full',
- min: 0,
- placeholder: '璇疯緭鍏ラ璁′娇鐢ㄩ噺',
- precision: 2,
- },
- rules: 'required',
- },
- {
- fieldName: 'remark',
- label: '澶囨敞',
- component: 'Textarea',
- componentProps: {
- placeholder: '璇疯緭鍏ュ娉�',
- rows: 3,
- },
- },
- ];
-}
-
/** 璁㈠崟閫夋嫨寮圭獥鐨勬悳绱㈣〃鍗� */
export function useWorkOrderSelectGridFormSchema(): VbenFormSchema[] {
return [
@@ -734,3 +602,109 @@
},
];
}
+
+/** 璁㈠崟宸ュ簭鍒楄〃鐨勫瓧娈� */
+export function useProcessGridColumns(
+ draggable = false,
+): VxeTableGridOptions<MesProWorkOrderProcessApi.WorkOrderProcess>['columns'] {
+ return [
+ ...(draggable
+ ? [
+ {
+ field: 'drag',
+ title: '',
+ width: 40,
+ slots: { default: 'dragHandle' },
+ } as const,
+ ]
+ : []),
+ {
+ type: 'expand',
+ width: 50,
+ slots: { content: 'expand_content' },
+ } 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: 200,
+ fixed: 'right',
+ slots: { default: 'actions' },
+ },
+ ];
+}
--
Gitblit v1.9.3