From a4025834e2304dc57f6e98d58feeb9416bd90609 Mon Sep 17 00:00:00 2001
From: xiaoyi <908147524@qq.com>
Date: 星期四, 20 八月 2026 14:10:49 +0800
Subject: [PATCH] feat 功能变更
---
src/views/mes/pro/workorder/data.ts | 200 ++++++++++++++-----------------------------------
1 files changed, 57 insertions(+), 143 deletions(-)
diff --git a/src/views/mes/pro/workorder/data.ts b/src/views/mes/pro/workorder/data.ts
index f277918..e046fdf 100644
--- a/src/views/mes/pro/workorder/data.ts
+++ b/src/views/mes/pro/workorder/data.ts
@@ -1,9 +1,9 @@
-锘縤mport type { VbenFormApi, VbenFormSchema } from '#/adapter/form';
+import 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 type { ErpSaleOrderApi } from '#/api/erp/sale/order';
import { h, markRaw } from 'vue';
@@ -22,9 +22,9 @@
import { getRangePickerDefaultProps } from '#/utils';
import {
MdItemSelect,
- MdProductBomSelect,
} from '#/views/mes/md/item/components';
import { MdVendorSelect } from '#/views/mes/md/vendor/components';
+import { ErpSaleOrderSelect } from '#/views/erp/sale/order/components';
/** 琛ㄥ崟绫诲瀷 */
export type FormType = 'confirm' | 'create' | 'detail' | 'finish' | 'update';
@@ -202,6 +202,30 @@
},
},
{
+ fieldName: 'saleOrderId',
+ label: '钀ラ攢璁㈠崟',
+ component: markRaw(ErpSaleOrderSelect),
+ componentProps: {
+ disabled: headerReadonly,
+ placeholder: '璇烽�夋嫨钀ラ攢璁㈠崟锛圗RP閿�鍞鍗曪級',
+ // 閫変腑钀ラ攢璁㈠崟鍚庤嚜鍔ㄥ甫鍏ュ鎴�
+ onChange: async (item?: ErpSaleOrderApi.SaleOrder) => {
+ if (!item) {
+ return;
+ }
+ const values = (await formApi?.getValues()) ?? {};
+ if (values.clientId == null && item.customerId) {
+ await formApi?.setFieldValue('clientId', item.customerId);
+ }
+ },
+ },
+ dependencies: {
+ triggerFields: ['orderSourceType'],
+ show: (values) =>
+ values.orderSourceType === MesProWorkOrderSourceTypeEnum.ORDER,
+ },
+ },
+ {
fieldName: 'vendorId',
label: '渚涘簲鍟�',
component: markRaw(MdVendorSelect),
@@ -234,7 +258,7 @@
disabled: headerReadonly,
format: 'YYYY-MM-DD',
placeholder: '璇烽�夋嫨闇�姹傛棩鏈�',
- valueFormat: 'x',
+ valueFormat: 'YYYY-MM-DD',
},
rules: 'required',
},
@@ -400,6 +424,11 @@
width: 120,
},
{
+ field: 'saleOrderNo',
+ title: '钀ラ攢璁㈠崟鍙�',
+ width: 140,
+ },
+ {
field: 'requestDate',
title: '闇�姹傛棩鏈�',
width: 180,
@@ -415,6 +444,27 @@
},
},
{
+ field: 'productionStatus',
+ title: '鐢熶骇鐘舵��',
+ width: 100,
+ cellRender: {
+ name: 'CellDict',
+ props: { type: DICT_TYPE.ORDER_PRODUCTION_STATUS },
+ },
+ },
+ {
+ field: 'processProgressList',
+ title: '宸ュ簭鐢熶骇杩涘害',
+ width: 350,
+ slots: { default: 'processProgressList' },
+ },
+ {
+ field: 'completionProgress',
+ title: '瀹屾垚杩涘害',
+ width: 200,
+ slots: { default: 'completionProgress' },
+ },
+ {
field: 'createTime',
title: '鍒涘缓鏃堕棿',
width: 180,
@@ -425,137 +475,6 @@
width: 240,
fixed: 'right',
slots: { default: 'actions' },
- },
- ];
-}
-
-/** 璁㈠崟 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,
- },
},
];
}
@@ -819,14 +738,9 @@
slots: { default: 'backflushFlag' },
},
{
- field: 'outputItemCode',
- title: '浜у嚭鐗╂枡缂栫爜',
- width: 120,
- },
- {
- field: 'outputItemName',
- title: '浜у嚭鐗╂枡鍚嶇О',
- width: 120,
+ field: 'outputItemNames',
+ title: '浜у嚭鐗╂枡',
+ width: 160,
},
{
field: 'remark',
--
Gitblit v1.9.3