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/parameter/data.ts |  197 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 197 insertions(+), 0 deletions(-)

diff --git a/src/views/mes/process-design/parameter/data.ts b/src/views/mes/process-design/parameter/data.ts
new file mode 100644
index 0000000..e90cfed
--- /dev/null
+++ b/src/views/mes/process-design/parameter/data.ts
@@ -0,0 +1,197 @@
+import type { VbenFormSchema } from '#/adapter/form';
+import type { VxeTableGridOptions } from '#/adapter/vxe-table';
+import type { MesPdParameterApi } from '#/api/mes/pro/processdesign/parameter';
+
+import { DICT_TYPE } from '../../../../packages/constants/src';
+import { getDictOptions } from '../../../../packages/effects/hooks/src';
+
+import { z } from '#/adapter/form';
+
+/** 鍙傛暟绫诲瀷 - 涓嬫媺閫夐」鐨勫�� */
+const PARAM_TYPE_SELECT = 3;
+
+/** 琛ㄥ崟绫诲瀷 */
+export type FormType = 'create' | 'detail' | 'update';
+
+/** 鏂板/淇敼宸ヨ壓鍙傛暟鐨勮〃鍗� */
+export function useFormSchema(): VbenFormSchema[] {
+  return [
+    {
+      fieldName: 'id',
+      component: 'Input',
+      dependencies: {
+        triggerFields: [''],
+        show: () => false,
+      },
+    },
+    {
+      fieldName: 'code',
+      label: '鍙傛暟缂栫爜',
+      component: 'Input',
+      componentProps: {
+        maxLength: 64,
+        placeholder: '璇疯緭鍏ュ弬鏁扮紪鐮�',
+      },
+      rules: z.string().min(1, '鍙傛暟缂栫爜涓嶈兘涓虹┖').max(64),
+    },
+    {
+      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_PARAM_TYPE, 'number'),
+        placeholder: '璇烽�夋嫨鍙傛暟绫诲瀷',
+      },
+      rules: 'selectRequired',
+    },
+    {
+      fieldName: 'unit',
+      label: '鍗曚綅',
+      component: 'Input',
+      componentProps: {
+        maxLength: 20,
+        placeholder: '璇疯緭鍏ュ崟浣�',
+      },
+    },
+    {
+      fieldName: 'requiredFlag',
+      label: '鏄惁蹇呭~',
+      component: 'Switch',
+      componentProps: {
+        checkedChildren: '鏄�',
+        unCheckedChildren: '鍚�',
+      },
+      rules: z.boolean().default(false),
+    },
+    {
+      fieldName: 'dictType',
+      label: '瀛楀吀绫诲瀷',
+      component: 'Input',
+      componentProps: {
+        maxLength: 64,
+        placeholder: '璇疯緭鍏ュ瓧鍏哥被鍨嬶紙涓嬫媺閫夐」鏃堕厤缃級',
+      },
+      dependencies: {
+        triggerFields: ['type'],
+        show: (values) => values?.type === PARAM_TYPE_SELECT,
+      },
+    },
+    {
+      fieldName: 'apiUrl',
+      label: '鎺ュ彛鍦板潃',
+      component: 'Input',
+      componentProps: {
+        maxLength: 250,
+        placeholder: '璇疯緭鍏ユ帴鍙e湴鍧�锛堜笅鎷夐�夐」鏃堕厤缃級',
+      },
+      dependencies: {
+        triggerFields: ['type'],
+        show: (values) => values?.type === PARAM_TYPE_SELECT,
+      },
+    },
+    {
+      fieldName: 'remark',
+      label: '澶囨敞',
+      component: 'Textarea',
+      formItemClass: 'col-span-2',
+      componentProps: {
+        maxLength: 250,
+        placeholder: '璇疯緭鍏ュ娉�',
+        rows: 3,
+      },
+    },
+  ];
+}
+
+/** 鍒楄〃鐨勬悳绱㈣〃鍗� */
+export function useGridFormSchema(): VbenFormSchema[] {
+  return [
+    {
+      fieldName: 'code',
+      label: '鍙傛暟缂栫爜',
+      component: 'Input',
+      componentProps: {
+        allowClear: true,
+        placeholder: '璇疯緭鍏ュ弬鏁扮紪鐮�',
+      },
+    },
+    {
+      fieldName: 'name',
+      label: '鍙傛暟鍚嶇О',
+      component: 'Input',
+      componentProps: {
+        allowClear: true,
+        placeholder: '璇疯緭鍏ュ弬鏁板悕绉�',
+      },
+    },
+    {
+      fieldName: 'type',
+      label: '鍙傛暟绫诲瀷',
+      component: 'Select',
+      componentProps: {
+        allowClear: true,
+        options: getDictOptions(DICT_TYPE.MES_PD_PARAM_TYPE, 'number'),
+        placeholder: '璇烽�夋嫨鍙傛暟绫诲瀷',
+      },
+    },
+  ];
+}
+
+/** 鍒楄〃鐨勫瓧娈� */
+export function useGridColumns(): VxeTableGridOptions<MesPdParameterApi.Parameter>['columns'] {
+  return [
+    {
+      type: 'seq',
+      title: '搴忓彿',
+      width: 60,
+      align: 'center',
+    },
+    { field: 'code', title: '鍙傛暟缂栫爜', minWidth: 150 },
+    { field: 'name', title: '鍙傛暟鍚嶇О', minWidth: 180 },
+    {
+      field: 'type',
+      title: '鍙傛暟绫诲瀷',
+      width: 120,
+      cellRender: {
+        name: 'CellDict',
+        props: { type: DICT_TYPE.MES_PD_PARAM_TYPE },
+      },
+    },
+    { field: 'unit', title: '鍗曚綅', width: 80 },
+    {
+      field: 'requiredFlag',
+      title: '鏄惁蹇呭~',
+      width: 90,
+      cellRender: {
+        name: 'CellDict',
+        props: { type: DICT_TYPE.INFRA_BOOLEAN_STRING },
+      },
+    },
+    { field: 'remark', title: '澶囨敞', minWidth: 180 },
+    {
+      field: 'createTime',
+      title: '鍒涘缓鏃堕棿',
+      width: 180,
+      formatter: 'formatDateTime',
+    },
+    {
+      title: '鎿嶄綔',
+      width: 150,
+      fixed: 'right',
+      slots: {
+        default: 'actions',
+      },
+    },
+  ];
+}

--
Gitblit v1.9.3