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/pd/tech-confirm/data.ts | 260 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 260 insertions(+), 0 deletions(-)
diff --git a/src/views/mes/pd/tech-confirm/data.ts b/src/views/mes/pd/tech-confirm/data.ts
new file mode 100644
index 0000000..ea967b2
--- /dev/null
+++ b/src/views/mes/pd/tech-confirm/data.ts
@@ -0,0 +1,260 @@
+import type { VbenFormApi, VbenFormSchema } from '#/adapter/form';
+import type { VxeTableGridOptions } from '#/adapter/vxe-table';
+import type { CrmCustomerApi } from '#/api/crm/customer';
+import type { MesPdTechConfirmApi } from '#/api/mes/pd/tech-confirm';
+
+import { markRaw } from 'vue';
+
+import { DICT_TYPE } from '@vben/constants';
+import { getDictOptions } from '@vben/hooks';
+
+import CrmCustomerSelect from '#/components/crm-customer-select.vue';
+
+/** 琛ㄥ崟绫诲瀷 */
+export type FormType = 'create' | 'detail' | 'update';
+
+/** 鏂板/淇敼浜у搧鎶�鏈‘璁ゅ嚱 */
+export function useFormSchema(
+ formApi?: VbenFormApi,
+): VbenFormSchema[] {
+ return [
+ {
+ fieldName: 'id',
+ component: 'Input',
+ dependencies: {
+ triggerFields: [''],
+ show: () => false,
+ },
+ },
+ {
+ fieldName: 'confirmNo',
+ label: '纭鍑界紪鍙�',
+ component: 'Input',
+ componentProps: {
+ placeholder: '璇疯緭鍏ョ‘璁ゅ嚱缂栧彿',
+ },
+ rules: 'required',
+ },
+ {
+ fieldName: 'customerId',
+ label: '瀹㈡埛',
+ component: markRaw(CrmCustomerSelect),
+ componentProps: {
+ placeholder: '璇烽�夋嫨瀹㈡埛',
+ onChange: (item?: CrmCustomerApi.Customer) => {
+ formApi?.setFieldValue('customerName', item?.name);
+ },
+ },
+ },
+ {
+ fieldName: 'customerName',
+ label: '瀹㈡埛鍚嶇О',
+ component: 'Input',
+ componentProps: {
+ placeholder: '璇疯緭鍏ュ鎴峰悕绉�',
+ },
+ rules: 'required',
+ },
+ {
+ fieldName: 'productName',
+ label: '浜у搧鍚嶇О',
+ component: 'Input',
+ componentProps: {
+ placeholder: '璇疯緭鍏ヤ骇鍝佸悕绉�',
+ },
+ rules: 'required',
+ },
+ {
+ fieldName: 'specification',
+ label: '瑙勬牸鍨嬪彿',
+ component: 'Input',
+ componentProps: {
+ placeholder: '璇疯緭鍏ヨ鏍煎瀷鍙�',
+ },
+ },
+ {
+ fieldName: 'techParams',
+ label: '鎶�鏈弬鏁�(JSON)',
+ component: 'Textarea',
+ formItemClass: 'col-span-3',
+ componentProps: {
+ placeholder: '璇疯緭鍏ユ妧鏈弬鏁� JSON锛屽 {"thickness":"1.27","width":"5.7"}',
+ rows: 4,
+ },
+ },
+ {
+ fieldName: 'templateType',
+ label: '妯℃澘绫诲瀷',
+ component: 'Select',
+ componentProps: {
+ allowClear: true,
+ options: getDictOptions(DICT_TYPE.PRODUCT_TECH_CONFIRM_TEMPLATE, 'string'),
+ placeholder: '璇烽�夋嫨妯℃澘绫诲瀷',
+ },
+ },
+ {
+ fieldName: 'status',
+ label: '鐘舵��',
+ component: 'Select',
+ componentProps: {
+ allowClear: true,
+ options: getDictOptions(DICT_TYPE.PRODUCT_TECH_CONFIRM_STATUS, 'number'),
+ placeholder: '璇烽�夋嫨鐘舵��',
+ },
+ },
+ {
+ fieldName: 'drafterName',
+ label: '缂栧埗浜�',
+ component: 'Input',
+ componentProps: {
+ placeholder: '璇疯緭鍏ョ紪鍒朵汉濮撳悕',
+ },
+ },
+ {
+ fieldName: 'draftTime',
+ label: '缂栧埗鏃堕棿',
+ component: 'DatePicker',
+ componentProps: {
+ class: '!w-full',
+ format: 'YYYY-MM-DD HH:mm:ss',
+ showTime: true,
+ valueFormat: 'YYYY-MM-DD HH:mm:ss',
+ },
+ },
+ {
+ fieldName: 'reviewerName',
+ label: '瀹℃牳浜�',
+ component: 'Input',
+ componentProps: {
+ placeholder: '璇疯緭鍏ュ鏍镐汉濮撳悕',
+ },
+ },
+ {
+ fieldName: 'reviewTime',
+ label: '瀹℃牳鏃堕棿',
+ component: 'DatePicker',
+ componentProps: {
+ class: '!w-full',
+ format: 'YYYY-MM-DD HH:mm:ss',
+ showTime: true,
+ valueFormat: 'YYYY-MM-DD HH:mm:ss',
+ },
+ },
+ {
+ fieldName: 'customerConfirmUser',
+ label: '瀹㈡埛纭浜�',
+ component: 'Input',
+ componentProps: {
+ placeholder: '璇疯緭鍏ュ鎴风‘璁や汉',
+ },
+ },
+ {
+ fieldName: 'customerConfirmTime',
+ label: '瀹㈡埛纭鏃堕棿',
+ component: 'DatePicker',
+ componentProps: {
+ class: '!w-full',
+ format: 'YYYY-MM-DD HH:mm:ss',
+ showTime: true,
+ valueFormat: 'YYYY-MM-DD HH:mm:ss',
+ },
+ },
+ {
+ fieldName: 'remark',
+ label: '澶囨敞',
+ component: 'Textarea',
+ formItemClass: 'col-span-3',
+ componentProps: {
+ placeholder: '璇疯緭鍏ュ娉�',
+ rows: 2,
+ },
+ },
+ ];
+}
+
+/** 鍒楄〃鐨勬悳绱㈣〃鍗� */
+export function useGridFormSchema(): VbenFormSchema[] {
+ return [
+ {
+ fieldName: 'confirmNo',
+ label: '纭鍑界紪鍙�',
+ component: 'Input',
+ componentProps: {
+ allowClear: true,
+ placeholder: '璇疯緭鍏ョ‘璁ゅ嚱缂栧彿',
+ },
+ },
+ {
+ fieldName: 'productName',
+ label: '浜у搧鍚嶇О',
+ component: 'Input',
+ componentProps: {
+ allowClear: true,
+ placeholder: '璇疯緭鍏ヤ骇鍝佸悕绉�',
+ },
+ },
+ {
+ fieldName: 'templateType',
+ label: '妯℃澘绫诲瀷',
+ component: 'Select',
+ componentProps: {
+ allowClear: true,
+ options: getDictOptions(DICT_TYPE.PRODUCT_TECH_CONFIRM_TEMPLATE, 'string'),
+ placeholder: '璇烽�夋嫨妯℃澘绫诲瀷',
+ },
+ },
+ {
+ fieldName: 'status',
+ label: '鐘舵��',
+ component: 'Select',
+ componentProps: {
+ allowClear: true,
+ options: getDictOptions(DICT_TYPE.PRODUCT_TECH_CONFIRM_STATUS, 'number'),
+ placeholder: '璇烽�夋嫨鐘舵��',
+ },
+ },
+ ];
+}
+
+/** 鍒楄〃鐨勫瓧娈� */
+export function useGridColumns(): VxeTableGridOptions<MesPdTechConfirmApi.TechConfirm>['columns'] {
+ return [
+ { field: 'confirmNo', title: '纭鍑界紪鍙�', minWidth: 160 },
+ { field: 'customerName', title: '瀹㈡埛鍚嶇О', minWidth: 180 },
+ { field: 'productName', title: '浜у搧鍚嶇О', minWidth: 140 },
+ { field: 'specification', title: '瑙勬牸鍨嬪彿', minWidth: 140 },
+ {
+ field: 'templateType',
+ title: '妯℃澘绫诲瀷',
+ width: 110,
+ cellRender: {
+ name: 'CellDict',
+ props: { type: DICT_TYPE.PRODUCT_TECH_CONFIRM_TEMPLATE },
+ },
+ },
+ { field: 'drafterName', title: '缂栧埗浜�', width: 90 },
+ {
+ field: 'status',
+ title: '鐘舵��',
+ width: 110,
+ cellRender: {
+ name: 'CellDict',
+ props: { type: DICT_TYPE.PRODUCT_TECH_CONFIRM_STATUS },
+ },
+ },
+ {
+ field: 'createTime',
+ title: '鍒涘缓鏃堕棿',
+ width: 170,
+ formatter: 'formatDateTime',
+ },
+ {
+ title: '鎿嶄綔',
+ width: 260,
+ fixed: 'right',
+ slots: {
+ default: 'actions',
+ },
+ },
+ ];
+}
--
Gitblit v1.9.3