From f10cf167372f2d8c4c0e14f42f361d7ab96d8347 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期五, 03 七月 2026 13:59:00 +0800
Subject: [PATCH] Merge branch 'dev_pro2.0' of http://114.132.189.42:9002/r/mom-pro2-before into dev_pro2.0

---
 src/views/mes/process-design/template/data.ts |  128 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 128 insertions(+), 0 deletions(-)

diff --git a/src/views/mes/process-design/template/data.ts b/src/views/mes/process-design/template/data.ts
new file mode 100644
index 0000000..0e2f655
--- /dev/null
+++ b/src/views/mes/process-design/template/data.ts
@@ -0,0 +1,128 @@
+import type { VbenFormSchema } from '#/adapter/form';
+import type { VxeTableGridOptions } from '#/adapter/vxe-table';
+import type { MesPdTemplateApi } from '#/api/mes/pro/processdesign/template';
+
+import { DICT_TYPE } from '../../../../packages/constants/src';
+import { getDictOptions } from '../../../../packages/effects/hooks/src';
+
+import { z } from '#/adapter/form';
+
+/** 琛ㄥ崟绫诲瀷 */
+export type FormType = 'create' | 'detail' | 'update';
+
+/** 鏂板/淇敼宸ヨ壓鍙傛暟妯℃澘鐨勮〃鍗� */
+export function useFormSchema(): VbenFormSchema[] {
+  return [
+    {
+      fieldName: 'id',
+      component: 'Input',
+      dependencies: {
+        triggerFields: [''],
+        show: () => false,
+      },
+    },
+    {
+      fieldName: 'name',
+      label: '妯℃澘鍚嶇О',
+      component: 'Input',
+      componentProps: {
+        maxLength: 100,
+        placeholder: '璇疯緭鍏ユā鏉垮悕绉�',
+      },
+      rules: z.string().min(1, '妯℃澘鍚嶇О涓嶈兘涓虹┖').max(100),
+    },
+    {
+      fieldName: 'type',
+      label: '妯℃澘绫诲瀷',
+      component: 'Select',
+      componentProps: {
+        allowClear: true,
+        options: getDictOptions(DICT_TYPE.MES_PD_TEMPLATE_TYPE, 'number'),
+        placeholder: '璇烽�夋嫨妯℃澘绫诲瀷',
+      },
+      rules: 'selectRequired',
+    },
+    {
+      fieldName: 'parameterIds',
+      label: '鍏宠仈鍙傛暟',
+      component: 'Input',
+      dependencies: {
+        triggerFields: [''],
+        show: () => false,
+      },
+    },
+    {
+      fieldName: 'remark',
+      label: '澶囨敞',
+      component: 'Textarea',
+      formItemClass: 'col-span-2',
+      componentProps: {
+        maxLength: 250,
+        placeholder: '璇疯緭鍏ュ娉�',
+        rows: 3,
+      },
+    },
+  ];
+}
+
+/** 鍒楄〃鐨勬悳绱㈣〃鍗� */
+export function useGridFormSchema(): VbenFormSchema[] {
+  return [
+    {
+      fieldName: 'name',
+      label: '妯℃澘鍚嶇О',
+      component: 'Input',
+      componentProps: {
+        allowClear: true,
+        placeholder: '璇疯緭鍏ユā鏉垮悕绉�',
+      },
+    },
+    {
+      fieldName: 'type',
+      label: '妯℃澘绫诲瀷',
+      component: 'Select',
+      componentProps: {
+        allowClear: true,
+        options: getDictOptions(DICT_TYPE.MES_PD_TEMPLATE_TYPE, 'number'),
+        placeholder: '璇烽�夋嫨妯℃澘绫诲瀷',
+      },
+    },
+  ];
+}
+
+/** 鍒楄〃鐨勫瓧娈� */
+export function useGridColumns(): VxeTableGridOptions<MesPdTemplateApi.Template>['columns'] {
+  return [
+    {
+      type: 'seq',
+      title: '搴忓彿',
+      width: 60,
+      align: 'center',
+    },
+    { field: 'name', title: '妯℃澘鍚嶇О', minWidth: 180 },
+    {
+      field: 'type',
+      title: '妯℃澘绫诲瀷',
+      width: 120,
+      cellRender: {
+        name: 'CellDict',
+        props: { type: DICT_TYPE.MES_PD_TEMPLATE_TYPE },
+      },
+    },
+    { field: 'createUser', title: '鍒涘缓浜�', width: 120 },
+    {
+      field: 'createTime',
+      title: '鍒涘缓鏃堕棿',
+      width: 180,
+      formatter: 'formatDateTime',
+    },
+    {
+      title: '鎿嶄綔',
+      width: 150,
+      fixed: 'right',
+      slots: {
+        default: 'actions',
+      },
+    },
+  ];
+}

--
Gitblit v1.9.3