From fb4db4ae9b6a7f113ba049f6789e6916c0dcc276 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期一, 12 十月 2026 09:15:08 +0800
Subject: [PATCH] feat(mes): 新增业务码支持并优化追溯查询功能
---
src/views/mes/pro/batch/data.ts | 154 ++++++++++++++++++++++++++++++++++-----------------
1 files changed, 103 insertions(+), 51 deletions(-)
diff --git a/src/views/mes/pro/batch/data.ts b/src/views/mes/pro/batch/data.ts
index f226782..408d018 100644
--- a/src/views/mes/pro/batch/data.ts
+++ b/src/views/mes/pro/batch/data.ts
@@ -7,16 +7,28 @@
import { DICT_TYPE } from '@vben/constants';
import { getDictOptions } from '@vben/hooks';
-import { MdItemSelect } from '#/views/mes/md/item/components';
import { ProLineSelect } from '#/views/mes/pro/line/components';
import { UserSelect } from '#/views/system/user/components';
import { getRangePickerDefaultProps } from '#/utils';
-/** 琛ㄥ崟绫诲瀷 */
-export type FormType = 'create' | 'detail' | 'update';
+/** 琛ㄥ崟绫诲瀷锛坒ill锛氫复鏃舵壒娆$爜琛ュ綍姝e紡淇℃伅锛� */
+export type FormType = 'create' | 'detail' | 'update' | 'fill';
+
+/** 鏈粦瀹氭墭鐩樹笅鎷夐�夐」 */
+export interface PalletOption {
+ label: string;
+ value: number;
+ itemId?: number;
+ itemName?: string;
+ itemCode?: string;
+}
/** 鏂板/淇敼鐨勮〃鍗� */
-export function useFormSchema(formType: FormType): VbenFormSchema[] {
+export function useFormSchema(
+ formType: FormType,
+ palletOptions: PalletOption[] = [],
+ onPalletChange?: (ids: number[]) => void,
+): VbenFormSchema[] {
const disabled = formType === 'detail';
return [
{
@@ -33,11 +45,24 @@
component: 'Input',
componentProps: {
disabled: true,
- placeholder: '淇濆瓨鍚庤嚜鍔ㄧ敓鎴�',
+ placeholder: '琛ュ綍鍚庤嚜鍔ㄧ敓鎴�',
},
dependencies: {
triggerFields: [''],
show: () => formType !== 'create',
+ },
+ },
+ {
+ fieldName: 'tempCode',
+ label: '涓存椂鎵规鐮�',
+ component: 'Input',
+ componentProps: {
+ disabled: true,
+ placeholder: '棰勭敓鎴愪簩缁寸爜闃舵浣跨敤鐨勪复鏃剁爜',
+ },
+ dependencies: {
+ triggerFields: [''],
+ show: () => formType === 'fill',
},
},
{
@@ -54,24 +79,25 @@
},
},
{
- fieldName: 'itemId',
- label: '鍝佺',
- component: markRaw(MdItemSelect),
+ fieldName: 'lineId',
+ label: '鍔犲伐鍗曚綅',
+ component: markRaw(ProLineSelect),
componentProps: {
disabled,
- placeholder: '璇烽�夋嫨鍝佺锛堜骇鍝佸搧绉嶏級',
+ placeholder: '璇烽�夋嫨鍔犲伐鍗曚綅',
},
rules: 'selectRequired',
},
{
- fieldName: 'lineId',
- label: '浜х嚎',
- component: markRaw(ProLineSelect),
+ fieldName: 'processingTeam',
+ label: '鍔犲伐鐝粍',
+ component: 'Input',
componentProps: {
+ allowClear: true,
disabled,
- placeholder: '璇烽�夋嫨浜х嚎',
+ maxlength: 64,
+ placeholder: '璇疯緭鍏ュ姞宸ョ彮缁�',
},
- rules: 'selectRequired',
},
{
fieldName: 'produceDate',
@@ -89,13 +115,13 @@
},
{
fieldName: 'planQuantity',
- label: '璁″垝鏁伴噺',
+ label: '鍔犲伐鏁伴噺',
component: 'InputNumber',
componentProps: {
class: '!w-full',
disabled,
min: 0,
- placeholder: '璇疯緭鍏ヨ鍒掓暟閲�',
+ placeholder: '璇疯緭鍏ュ姞宸ユ暟閲�',
precision: 2,
},
},
@@ -108,6 +134,46 @@
placeholder: '璇烽�夋嫨璐d换浜�',
},
rules: 'selectRequired',
+ },
+ {
+ fieldName: 'itemId', component: 'Input',
+ dependencies: { triggerFields: [''], show: () => false },
+ },
+ {
+ fieldName: 'itemName', label: '鍝佺鍚嶇О', component: 'Input',
+ componentProps: { disabled: true, placeholder: '閫夋嫨鎵樼洏鍚庤嚜鍔ㄥ甫鍏�' },
+ },
+ {
+ fieldName: 'itemCode', label: '鍝佺缂栫爜', component: 'Input',
+ componentProps: { disabled: true, placeholder: '閫夋嫨鎵樼洏鍚庤嚜鍔ㄥ甫鍏�' },
+ },
+ {
+ fieldName: 'palletIds',
+ label: '缁戝畾鎵樼洏',
+ component: 'Select',
+ componentProps: {
+ allowClear: true,
+ disabled,
+ maxTagCount: 3,
+ dropdownMatchSelectWidth: false,
+ dropdownStyle: { minWidth: '360px', maxWidth: 'calc(100vw - 32px)' },
+ mode: 'multiple',
+ optionFilterProp: 'label',
+ options: palletOptions,
+ onChange: onPalletChange,
+ placeholder: '璇烽�夋嫨鐩稿悓鍝佺鐨勬墭鐩�',
+ showSearch: true,
+ },
+ dependencies: {
+ triggerFields: ['itemId'],
+ show: () => formType !== 'detail',
+ componentProps: (values) => ({
+ options: palletOptions.map(option => ({ ...option,
+ disabled: !option.itemId || (!!values.itemId && option.itemId !== values.itemId),
+ })),
+ }),
+ },
+ help: '鍙兘缁戝畾鐩稿悓鍝佺鐨勬墭鐩橈紝鍝佺淇℃伅鑷姩甯﹀叆锛涚己灏戝搧绉嶇殑鎵樼洏璇峰厛瑁呰銆傜粦瀹氬悗鎵规鐩存帴杩涘叆鐢熶骇涓細鎵樼洏鐢熸垚姝e紡鎵樼洏鐮侊紝鎵樼洏涓嬫湭褰曟壒娆$殑琚嬬爜鑷姩绾ц仈褰曞叆鏈壒娆★紙琚嬬爜鍝佺椤讳竴鑷达級锛涚紪杈戞椂浠呴渶鍕鹃�夋柊澧炴墭鐩橈紝宸茬粦瀹氱殑涓嶅彲瑙g粦',
},
{
fieldName: 'remark',
@@ -126,6 +192,7 @@
/** 鍒楄〃鐨勬悳绱㈣〃鍗� */
export function useGridFormSchema(): VbenFormSchema[] {
return [
+ { fieldName: 'businessCode', label: '涓氬姟鐮�', component: 'Input', componentProps: { allowClear: true, placeholder: '璇疯緭鍏ヤ綔涓氭壂鐮佷笟鍔$爜' } },
{
fieldName: 'code',
label: '鎵规鍙�',
@@ -136,29 +203,21 @@
},
},
{
- fieldName: 'itemId',
- label: '鍝佺',
- component: markRaw(MdItemSelect),
- componentProps: {
- placeholder: '璇烽�夋嫨鍝佺',
- },
- },
- {
- fieldName: 'lineCode',
- label: '浜х嚎缂栫爜',
- component: 'Input',
- componentProps: {
- allowClear: true,
- placeholder: '璇疯緭鍏ヤ骇绾跨紪鐮�',
- },
- },
- {
fieldName: 'lineName',
- label: '浜х嚎鍚嶇О',
+ label: '鍔犲伐鍗曚綅',
component: 'Input',
componentProps: {
allowClear: true,
- placeholder: '璇疯緭鍏ヤ骇绾垮悕绉�',
+ placeholder: '璇疯緭鍏ュ姞宸ュ崟浣�',
+ },
+ },
+ {
+ fieldName: 'processingTeam',
+ label: '鍔犲伐鐝粍',
+ component: 'Input',
+ componentProps: {
+ allowClear: true,
+ placeholder: '璇疯緭鍏ュ姞宸ョ彮缁�',
},
},
{
@@ -203,6 +262,7 @@
/** 鍒楄〃鐨勫瓧娈� */
export function useGridColumns(): VxeTableGridOptions<MesProBatchApi.Batch>['columns'] {
return [
+ { field: 'businessCode', title: '涓氬姟鐮侊紙浣滀笟鎵爜锛�', minWidth: 210 },
{
field: 'code',
title: '鎵规鍙�',
@@ -210,24 +270,16 @@
minWidth: 200,
slots: { default: 'code' },
},
+ { field: 'itemName', title: '鍝佺鍚嶇О', minWidth: 150 },
+ { field: 'itemCode', title: '鍝佺缂栫爜', minWidth: 150 },
{
- field: 'itemCode',
- title: '鍝佺缂栫爜',
+ field: 'lineName',
+ title: '鍔犲伐鍗曚綅',
width: 120,
},
{
- field: 'itemName',
- title: '鍝佺鍚嶇О',
- width: 140,
- },
- {
- field: 'lineCode',
- title: '浜х嚎缂栫爜',
- width: 100,
- },
- {
- field: 'lineName',
- title: '浜х嚎鍚嶇О',
+ field: 'processingTeam',
+ title: '鍔犲伐鐝粍',
width: 120,
},
{
@@ -238,7 +290,7 @@
},
{
field: 'planQuantity',
- title: '璁″垝鏁伴噺',
+ title: '鍔犲伐鏁伴噺',
width: 100,
},
{
@@ -273,7 +325,7 @@
},
{
title: '鎿嶄綔',
- width: 200,
+ width: 350,
fixed: 'right',
slots: { default: 'actions' },
},
--
Gitblit v1.9.3