From 2fe330a44f9e8bdd8a1afd6124c57851f2a5b7ea Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 02 十一月 2026 11:07:01 +0800
Subject: [PATCH] 供应商档案:新增时状态默认「开启」
---
src/views/mes/pro/workorder/data.ts | 333 +++++++++++++++++++++++++++++-------------------------
1 files changed, 178 insertions(+), 155 deletions(-)
diff --git a/src/views/mes/pro/workorder/data.ts b/src/views/mes/pro/workorder/data.ts
index fcac639..8e4bf12 100644
--- a/src/views/mes/pro/workorder/data.ts
+++ b/src/views/mes/pro/workorder/data.ts
@@ -1,7 +1,7 @@
-锘縤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 MesProWorkOrderApi, getWorkOrderApproveProcessList } from '#/api/mes/pro/workorder';
+import { getSimpleRoleList } from '#/api/system/role';
import type { MesProWorkOrderBomApi } from '#/api/mes/pro/workorder/bom';
import type { MesProWorkOrderProcessApi } from '#/api/mes/pro/workorder/process';
@@ -18,13 +18,14 @@
import { Button } from 'ant-design-vue';
import { generateAutoCode } from '#/api/mes/md/autocode/record';
+import { getFactorySimpleList } from '#/api/mes/md/factory';
import CrmCustomerSelect from '#/components/crm-customer-select.vue';
import { getRangePickerDefaultProps } from '#/utils';
import {
MdItemSelect,
- MdProductBomSelect,
} from '#/views/mes/md/item/components';
import { MdVendorSelect } from '#/views/mes/md/vendor/components';
+import MdWorkshopSelect from '#/views/mes/md/workstation/components/workshop-select.vue';
/** 琛ㄥ崟绫诲瀷 */
export type FormType = 'confirm' | 'create' | 'detail' | 'finish' | 'update';
@@ -108,6 +109,37 @@
rules: 'required',
},
{
+ fieldName: 'factoryId',
+ label: '宸ュ巶',
+ component: 'ApiSelect',
+ componentProps: {
+ allowClear: true,
+ api: getFactorySimpleList,
+ disabled: headerReadonly,
+ labelField: 'name',
+ placeholder: '璇烽�夋嫨宸ュ巶',
+ valueField: 'id',
+ },
+ help: '閫夋嫨宸ュ崟鎵�灞炲伐鍘傦紙鐢熶骇涓讳綋锛夛紝鐢ㄤ簬鎸夊伐鍘傜瓫閫夊伐鍗曘�佸綊闆嗛鏂欙紱宸ュ巶鍙湪銆屽伐鍘傘�嶅熀纭�璧勬枡涓淮鎶ゃ��',
+ },
+ {
+ fieldName: 'workshopId',
+ label: '杞﹂棿',
+ component: markRaw(MdWorkshopSelect),
+ componentProps: {
+ disabled: headerReadonly,
+ placeholder: '璇烽�夋嫨杞﹂棿',
+ },
+ dependencies: {
+ triggerFields: ['factoryId'],
+ componentProps: (values: { factoryId?: number }) => ({
+ disabled: headerReadonly,
+ factoryId: values.factoryId,
+ }),
+ },
+ help: '閫夋嫨宸ュ巶鍚庯紝姝ゅ鍙樉绀鸿宸ュ巶涓嬬殑杞﹂棿锛涚敤浜庢淳宸ヤ笌宸ヤ綅褰掑睘銆�',
+ },
+ {
fieldName: 'orderSourceType',
label: '璁㈠崟鏉ユ簮',
component: 'Select',
@@ -128,6 +160,10 @@
}
},
},
+ help: (values: { orderSourceType?: number }) =>
+ values.orderSourceType === MesProWorkOrderSourceTypeEnum.ORDER
+ ? '宸查�夊鎴疯鍗曪細闇�琛ュ厖鏉ユ簮鍗曟嵁缂栧彿涓庡鎴凤紝渚夸簬杩芥函璁㈠崟鏉ユ簮銆�'
+ : '鐢ㄤ簬鍖哄垎璁㈠崟涓氬姟褰掑睘锛涢�夈�屽鎴疯鍗曘�嶆椂鎵嶉渶鍏宠仈鏉ユ簮鍗曟嵁涓庡鎴枫��',
rules: 'selectRequired',
},
{
@@ -143,6 +179,7 @@
show: (values) =>
values.orderSourceType === MesProWorkOrderSourceTypeEnum.ORDER,
},
+ help: '濉啓涓婃父鍗曟嵁锛堝閿�鍞鍗曪級鐨勭紪鍙凤紝鐢ㄤ簬杩芥函璇ヨ鍗曠殑鏉ユ簮銆�',
},
{
fieldName: 'type',
@@ -162,6 +199,11 @@
}
},
},
+ help: (values: { type?: number }) =>
+ values.type === MesProWorkOrderTypeEnum.OUTSOURCE ||
+ values.type === MesProWorkOrderTypeEnum.PURCHASE
+ ? '宸查�夊澶�/閲囪喘鐢熶骇锛氶渶鎸囧畾渚涘簲鍟嗭紝濮斿鎶ュ伐涓庡叆搴撳皢鎸夎渚涘簲鍟嗙粨绠椼��'
+ : '鑷惀鐢熶骇鎸夋湰鍗曞伐搴忔帓浜э紱閫夈�屽澶栧姞宸ャ�嶆垨銆岄噰璐敓浜с�嶆椂闇�棰濆鎸囧畾渚涘簲鍟嗐��',
rules: 'selectRequired',
},
{
@@ -172,6 +214,7 @@
disabled: headerReadonly,
placeholder: '璇烽�夋嫨浜у搧',
},
+ help: '閫夋嫨浜у搧鍚庯紝宸ュ簭灏嗚嚜鍔ㄤ粠鍏跺伐鑹鸿矾绾垮甫鍑哄苟鎸夐渶璋冩暣锛涗骇鍝侀渶鍏堝湪銆屽伐鑹烘祦绋嬨�嶄腑閰嶇疆璺嚎涓庢姇鏂� BOM銆�',
rules: 'selectRequired',
},
{
@@ -200,6 +243,7 @@
show: (values) =>
values.orderSourceType === MesProWorkOrderSourceTypeEnum.ORDER,
},
+ help: '鍏宠仈瀹㈡埛鍚庯紝璁㈠崟鍙湪瀹㈡埛缁村害杩芥函骞跺鎺ュ悗缁粨绠椼��',
},
{
fieldName: 'vendorId',
@@ -215,6 +259,7 @@
values.type === MesProWorkOrderTypeEnum.OUTSOURCE ||
values.type === MesProWorkOrderTypeEnum.PURCHASE,
},
+ help: '濮斿/閲囪喘璁㈠崟闇�鎸囧畾渚涘簲鍟嗭紝濮斿鎶ュ伐涓庡叆搴撳潎浠ヨ渚涘簲鍟嗕负鍑嗐��',
},
{
fieldName: 'batchCode',
@@ -234,10 +279,63 @@
disabled: headerReadonly,
format: 'YYYY-MM-DD',
placeholder: '璇烽�夋嫨闇�姹傛棩鏈�',
- valueFormat: 'x',
+ valueFormat: 'YYYY-MM-DD',
},
+ help: '棰勮浜や粯/瀹屾垚鏃ユ湡锛岀敤浜庢帓浜с�佽繘搴﹁窡韪笌浜ゆ湡棰勮銆�',
rules: 'required',
},
+ // {
+ // fieldName: 'feedbackRole',
+ // label: '鎶ュ伐瑙掕壊',
+ // component: 'ApiSelect',
+ // componentProps: {
+ // api: getSimpleRoleList,
+ // disabled: headerReadonly,
+ // labelField: 'name',
+ // valueField: 'code',
+ // mode: 'multiple',
+ // placeholder: '璇烽�夋嫨鎶ュ伐瑙掕壊',
+ // },
+ // rules: 'selectRequired',
+ // },
+ {
+ fieldName: 'feedbackApprove',
+ label: '鏄惁鎶ュ伐瀹℃壒',
+ component: 'Switch',
+ componentProps: {
+ class: '!w-auto',
+ checkedChildren: '鏄�',
+ unCheckedChildren: '鍚�',
+ disabled: headerReadonly,
+ },
+ defaultValue: false,
+ help: '寮�鍚悗锛岀敓浜ф姤宸ユ彁浜ら渶缁忓鎵归�氳繃鎵嶈鍏ヤ骇閲忥紱鍏抽棴鍒欐姤宸ョ洿鎺ョ敓鏁堛��',
+ rules: 'required',
+ },
+ {
+ fieldName: 'processDefinitionKey',
+ label: '瀹℃壒娴佺▼',
+ component: 'ApiSelect',
+ componentProps: {
+ api: getWorkOrderApproveProcessList,
+ disabled: headerReadonly,
+ labelField: 'name',
+ valueField: 'key',
+ placeholder: '璇烽�夋嫨瀹℃壒娴佺▼',
+ },
+ dependencies: {
+ triggerFields: ['feedbackApprove'],
+ show: (values) => !!values.feedbackApprove,
+ rules(values) {
+ if (values.feedbackApprove) {
+ return 'selectRequired';
+ }
+ return undefined;
+ },
+ },
+ help: '閫夋嫨鎶ュ伐鎻愪氦鍚庤蛋鐨勫鎵规祦绋嬶紱娴佺▼闇�鍏堝湪绯荤粺銆屾祦绋嬬鐞嗐�嶄腑閮ㄧ讲锛屼粎銆屾姤宸ュ鎵广�嶇被娴佺▼鍙�夈��',
+ },
+
{
fieldName: 'remark',
label: '澶囨敞',
@@ -271,6 +369,32 @@
componentProps: {
allowClear: true,
placeholder: '璇疯緭鍏ヨ鍗曞悕绉�',
+ },
+ },
+ {
+ fieldName: 'factoryId',
+ label: '宸ュ巶',
+ component: 'ApiSelect',
+ componentProps: {
+ allowClear: true,
+ api: getFactorySimpleList,
+ labelField: 'name',
+ placeholder: '璇烽�夋嫨宸ュ巶',
+ valueField: 'id',
+ },
+ },
+ {
+ fieldName: 'workshopId',
+ label: '杞﹂棿',
+ component: markRaw(MdWorkshopSelect),
+ componentProps: {
+ placeholder: '璇烽�夋嫨杞﹂棿',
+ },
+ dependencies: {
+ triggerFields: ['factoryId'],
+ componentProps: (values: { factoryId?: number }) => ({
+ factoryId: values.factoryId,
+ }),
},
},
{
@@ -337,6 +461,16 @@
minWidth: 150,
},
{
+ field: 'factoryName',
+ title: '宸ュ巶',
+ width: 120,
+ },
+ {
+ field: 'workshopName',
+ title: '杞﹂棿',
+ width: 120,
+ },
+ {
field: 'type',
title: '璁㈠崟绫诲瀷',
width: 100,
@@ -390,11 +524,6 @@
width: 100,
},
{
- field: 'clientCode',
- title: '瀹㈡埛缂栫爜',
- width: 120,
- },
- {
field: 'clientName',
title: '瀹㈡埛鍚嶇О',
width: 120,
@@ -402,6 +531,12 @@
{
field: 'requestDate',
title: '闇�姹傛棩鏈�',
+ width: 180,
+ formatter: 'formatDate',
+ },
+ {
+ field: 'actualStartTime',
+ title: '瀹為檯寮�宸ユ椂闂�',
width: 180,
formatter: 'formatDate',
},
@@ -415,147 +550,34 @@
},
},
{
+ field: 'started',
+ title: '寮�宸ョ姸鎬�',
+ width: 100,
+ slots: { default: 'started' },
+ },
+ {
+ field: 'processProgressList',
+ title: '宸ュ簭鐢熶骇杩涘害',
+ width: 350,
+ slots: { default: 'processProgressList' },
+ },
+ {
+ field: 'completionProgress',
+ title: '瀹屾垚杩涘害',
+ width: 200,
+ slots: { default: 'completionProgress' },
+ },
+ {
field: 'createTime',
title: '鍒涘缓鏃堕棿',
width: 180,
- formatter: 'formatDateTime',
+ formatter: 'formatDate',
},
{
title: '鎿嶄綔',
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,
- },
},
];
}
@@ -669,11 +691,6 @@
width: 100,
},
{
- field: 'clientCode',
- title: '瀹㈡埛缂栫爜',
- width: 120,
- },
- {
field: 'clientName',
title: '瀹㈡埛鍚嶇О',
minWidth: 120,
@@ -747,7 +764,6 @@
field: 'drag',
title: '',
width: 40,
- fixed: 'left',
slots: { default: 'dragHandle' },
} as const,
]
@@ -755,6 +771,7 @@
{
type: 'expand',
width: 50,
+ slots: { content: 'expand_content' },
} as const,
{
field: 'sort',
@@ -819,14 +836,20 @@
slots: { default: 'backflushFlag' },
},
{
- field: 'outputItemCode',
- title: '浜у嚭鐗╂枡缂栫爜',
- width: 120,
+ field: 'outputItemNames',
+ title: '浜у嚭鐗╂枡',
+ width: 160,
},
{
- field: 'outputItemName',
- title: '浜у嚭鐗╂枡鍚嶇О',
- width: 120,
+ field: 'warehouseName',
+ title: '鎶ュ伐浠撳簱',
+ width: 130,
+ formatter: ({ cellValue, row }) => {
+ if (!cellValue) return '-';
+ return row.areaName
+ ? `${cellValue}/${row.locationName ?? ''}/${row.areaName}`
+ : cellValue;
+ },
},
{
field: 'remark',
@@ -835,7 +858,7 @@
},
{
title: '鎿嶄綔',
- width: 120,
+ width: 200,
fixed: 'right',
slots: { default: 'actions' },
},
--
Gitblit v1.9.3