From 27c8277d717b34b55f3ea967027b53b067f77df3 Mon Sep 17 00:00:00 2001
From: xiaoyi <908147524@qq.com>
Date: 星期四, 20 八月 2026 16:58:49 +0800
Subject: [PATCH] feat 功能变更
---
src/views/mes/qc/outsourcetest/data.ts | 263 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 263 insertions(+), 0 deletions(-)
diff --git a/src/views/mes/qc/outsourcetest/data.ts b/src/views/mes/qc/outsourcetest/data.ts
new file mode 100644
index 0000000..93e0f84
--- /dev/null
+++ b/src/views/mes/qc/outsourcetest/data.ts
@@ -0,0 +1,263 @@
+import type { VbenFormSchema } from '#/adapter/form';
+import type { VxeTableGridOptions } from '#/adapter/vxe-table';
+
+import { DICT_TYPE } from '@vben/constants';
+import { getDictOptions } from '@vben/hooks';
+
+import { getRangePickerDefaultProps } from '#/utils';
+
+/** 琛ㄥ崟绫诲瀷 */
+export type FormType = 'create' | 'detail' | 'edit';
+
+/** 鐘舵�佸父閲� */
+export const TEST_STATUS = {
+ DRAFT: 0,
+ SUBMITTED: 10,
+ FINISHED: 20,
+};
+
+/** 琛ㄥ崟鐨勯厤缃」 */
+export function useFormSchema(formType: FormType): VbenFormSchema[] {
+ const isReadonly = formType === 'detail';
+ return [
+ {
+ fieldName: 'id',
+ component: 'Input',
+ dependencies: {
+ triggerFields: [''],
+ show: () => false,
+ },
+ },
+ {
+ fieldName: 'code',
+ label: '鍗曟嵁缂栫爜',
+ component: 'Input',
+ componentProps: {
+ placeholder: '绯荤粺鑷姩鐢熸垚',
+ disabled: true,
+ },
+ },
+ {
+ fieldName: 'name',
+ label: '鍗曟嵁鍚嶇О',
+ component: 'Input',
+ componentProps: {
+ placeholder: '璇疯緭鍏ュ崟鎹悕绉�',
+ disabled: isReadonly,
+ },
+ rules: 'required',
+ },
+ {
+ fieldName: 'testType',
+ label: '妫�娴嬬被鍨�',
+ component: 'Select',
+ componentProps: {
+ options: getDictOptions(DICT_TYPE.MES_QC_OUTSOURCE_TEST_TYPE, 'number'),
+ placeholder: '璇烽�夋嫨妫�娴嬬被鍨�',
+ disabled: isReadonly,
+ },
+ rules: 'selectRequired',
+ },
+ {
+ fieldName: 'itemId',
+ label: '妫�娴嬪璞�',
+ component: 'Input',
+ componentProps: {
+ placeholder: '妫�娴嬪璞★紙鐗╂枡/璁惧锛�',
+ disabled: isReadonly,
+ },
+ },
+ {
+ fieldName: 'testOrg',
+ label: '妫�娴嬫満鏋�',
+ component: 'Input',
+ componentProps: {
+ placeholder: '璇疯緭鍏ユ娴嬫満鏋�',
+ disabled: isReadonly,
+ },
+ },
+ {
+ fieldName: 'testDate',
+ label: '妫�娴嬫棩鏈�',
+ component: 'DatePicker',
+ componentProps: {
+ placeholder: '閫夋嫨妫�娴嬫棩鏈�',
+ showTime: true,
+ format: 'YYYY-MM-DD HH:mm:ss',
+ valueFormat: 'YYYY-MM-DD HH:mm:ss',
+ disabled: isReadonly,
+ },
+ rules: 'required',
+ },
+ {
+ fieldName: 'result',
+ label: '妫�娴嬬粨鏋�',
+ component: 'Select',
+ componentProps: {
+ options: getDictOptions(DICT_TYPE.MES_QC_OUTSOURCE_TEST_RESULT, 'number'),
+ placeholder: '璇烽�夋嫨妫�娴嬬粨鏋�',
+ disabled: isReadonly,
+ },
+ },
+ {
+ fieldName: 'reportNo',
+ label: '鎶ュ憡缂栧彿',
+ component: 'Input',
+ componentProps: {
+ placeholder: '璇疯緭鍏ユ娴嬫姤鍛婄紪鍙�',
+ disabled: isReadonly,
+ },
+ },
+ {
+ fieldName: 'remark',
+ label: '澶囨敞',
+ component: 'Textarea',
+ componentProps: {
+ placeholder: '璇疯緭鍏ュ娉�',
+ autoSize: { minRows: 1, maxRows: 1 },
+ disabled: isReadonly,
+ },
+ formItemClass: 'col-span-2',
+ },
+ {
+ fieldName: 'blobIds',
+ label: '妫�娴嬫姤鍛�/璧勮川鏂囦欢',
+ component: 'FileUpload',
+ componentProps: {
+ valueKey: 'id',
+ maxNumber: 10,
+ multiple: true,
+ disabled: isReadonly,
+ },
+ formItemClass: 'col-span-3',
+ },
+ ];
+}
+
+/** 鍒楄〃鐨勬悳绱㈣〃鍗� */
+export function useGridFormSchema(): VbenFormSchema[] {
+ return [
+ {
+ fieldName: 'code',
+ label: '鍗曟嵁缂栫爜',
+ component: 'Input',
+ componentProps: {
+ placeholder: '璇疯緭鍏ュ崟鎹紪鐮�',
+ },
+ },
+ {
+ fieldName: 'name',
+ label: '鍗曟嵁鍚嶇О',
+ component: 'Input',
+ componentProps: {
+ placeholder: '璇疯緭鍏ュ崟鎹悕绉�',
+ },
+ },
+ {
+ fieldName: 'testType',
+ label: '妫�娴嬬被鍨�',
+ component: 'Select',
+ componentProps: {
+ allowClear: true,
+ options: getDictOptions(DICT_TYPE.MES_QC_OUTSOURCE_TEST_TYPE, 'number'),
+ placeholder: '璇烽�夋嫨妫�娴嬬被鍨�',
+ },
+ },
+ {
+ fieldName: 'result',
+ label: '妫�娴嬬粨鏋�',
+ component: 'Select',
+ componentProps: {
+ allowClear: true,
+ options: getDictOptions(DICT_TYPE.MES_QC_OUTSOURCE_TEST_RESULT, 'number'),
+ placeholder: '璇烽�夋嫨妫�娴嬬粨鏋�',
+ },
+ },
+ {
+ fieldName: 'status',
+ label: '鐘舵��',
+ component: 'Select',
+ componentProps: {
+ allowClear: true,
+ options: [
+ { label: '鑽夌', value: TEST_STATUS.DRAFT },
+ { label: '宸叉彁浜�', value: TEST_STATUS.SUBMITTED },
+ { label: '宸插畬鎴�', value: TEST_STATUS.FINISHED },
+ ],
+ placeholder: '璇烽�夋嫨鐘舵��',
+ },
+ },
+ {
+ fieldName: 'testDate',
+ label: '妫�娴嬫棩鏈�',
+ component: 'RangePicker',
+ componentProps: getRangePickerDefaultProps(),
+ },
+ ];
+}
+
+/** 鍒楄〃鐨勮〃鏍煎垪 */
+export function useGridColumns(): VxeTableGridOptions['columns'] {
+ return [
+ { type: 'checkbox', width: 50 },
+ { type: 'seq', title: '搴忓彿', width: 60 },
+ {
+ field: 'code',
+ title: '鍗曟嵁缂栫爜',
+ minWidth: 150,
+ slots: { default: 'code' },
+ },
+ {
+ field: 'name',
+ title: '鍗曟嵁鍚嶇О',
+ minWidth: 180,
+ },
+ {
+ field: 'testType',
+ title: '妫�娴嬬被鍨�',
+ width: 110,
+ cellRender: {
+ name: 'CellDict',
+ props: { type: DICT_TYPE.MES_QC_OUTSOURCE_TEST_TYPE },
+ },
+ },
+ {
+ field: 'itemName',
+ title: '妫�娴嬪璞�',
+ minWidth: 140,
+ },
+ {
+ field: 'testOrg',
+ title: '妫�娴嬫満鏋�',
+ minWidth: 160,
+ },
+ {
+ field: 'testDate',
+ title: '妫�娴嬫棩鏈�',
+ width: 170,
+ formatter: 'formatDateTime',
+ },
+ {
+ field: 'result',
+ title: '妫�娴嬬粨鏋�',
+ width: 100,
+ cellRender: {
+ name: 'CellDict',
+ props: { type: DICT_TYPE.MES_QC_OUTSOURCE_TEST_RESULT },
+ },
+ },
+ {
+ field: 'status',
+ title: '鐘舵��',
+ width: 100,
+ slots: { default: 'status' },
+ },
+ {
+ field: 'action',
+ title: '鎿嶄綔',
+ width: 260,
+ fixed: 'right',
+ slots: { default: 'actions' },
+ },
+ ];
+}
--
Gitblit v1.9.3