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

diff --git a/src/views/mes/pro/emergencyplan/data.ts b/src/views/mes/pro/emergencyplan/data.ts
new file mode 100644
index 0000000..04e599c
--- /dev/null
+++ b/src/views/mes/pro/emergencyplan/data.ts
@@ -0,0 +1,187 @@
+import type { VbenFormSchema } from '#/adapter/form';
+import type { VxeTableGridOptions } from '#/adapter/vxe-table';
+
+import { DICT_TYPE } from '@vben/constants';
+import { getDictOptions } from '@vben/hooks';
+
+/** 琛ㄥ崟绫诲瀷 */
+export type FormType = 'create' | 'detail' | 'edit';
+
+/** 鐘舵�佸父閲� */
+export const PLAN_STATUS = {
+  DRAFT: 0,
+  PUBLISHED: 10,
+};
+
+/** 琛ㄥ崟鐨勯厤缃」 */
+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: 'planType',
+      label: '棰勬绫诲瀷',
+      component: 'Select',
+      componentProps: {
+        options: getDictOptions(DICT_TYPE.MES_PRO_EMERGENCY_PLAN_TYPE, 'number'),
+        placeholder: '璇烽�夋嫨棰勬绫诲瀷',
+        disabled: isReadonly,
+      },
+      rules: 'selectRequired',
+    },
+    {
+      fieldName: 'orgUnit',
+      label: '璐d换鍗曚綅',
+      component: 'Input',
+      componentProps: {
+        placeholder: '璇疯緭鍏ヨ矗浠诲崟浣�/閮ㄩ棬',
+        disabled: isReadonly,
+      },
+    },
+    {
+      fieldName: 'content',
+      label: '澶勭疆鍐呭',
+      component: 'Textarea',
+      componentProps: {
+        placeholder: '璇疯緭鍏ュ簲鎬ュ缃唴瀹�',
+        rows: 4,
+        disabled: isReadonly,
+      },
+      formItemClass: 'col-span-3',
+    },
+    {
+      fieldName: 'remark',
+      label: '澶囨敞',
+      component: 'Textarea',
+      componentProps: {
+        placeholder: '璇疯緭鍏ュ娉�',
+        autoSize: { minRows: 1, maxRows: 1 },
+        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: 'planType',
+      label: '棰勬绫诲瀷',
+      component: 'Select',
+      componentProps: {
+        allowClear: true,
+        options: getDictOptions(DICT_TYPE.MES_PRO_EMERGENCY_PLAN_TYPE, 'number'),
+        placeholder: '璇烽�夋嫨棰勬绫诲瀷',
+      },
+    },
+    {
+      fieldName: 'status',
+      label: '鐘舵��',
+      component: 'Select',
+      componentProps: {
+        allowClear: true,
+        options: [
+          { label: '鑽夌', value: PLAN_STATUS.DRAFT },
+          { label: '宸插彂甯�', value: PLAN_STATUS.PUBLISHED },
+        ],
+        placeholder: '璇烽�夋嫨鐘舵��',
+      },
+    },
+  ];
+}
+
+/** 鍒楄〃鐨勮〃鏍煎垪 */
+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: 200,
+    },
+    {
+      field: 'planType',
+      title: '棰勬绫诲瀷',
+      width: 110,
+      cellRender: {
+        name: 'CellDict',
+        props: { type: DICT_TYPE.MES_PRO_EMERGENCY_PLAN_TYPE },
+      },
+    },
+    {
+      field: 'orgUnit',
+      title: '璐d换鍗曚綅',
+      minWidth: 140,
+    },
+    {
+      field: 'status',
+      title: '鐘舵��',
+      width: 100,
+      slots: { default: 'status' },
+    },
+    {
+      field: 'createTime',
+      title: '鍒涘缓鏃堕棿',
+      width: 170,
+      formatter: 'formatDateTime',
+    },
+    {
+      field: 'action',
+      title: '鎿嶄綔',
+      width: 260,
+      fixed: 'right',
+      slots: { default: 'actions' },
+    },
+  ];
+}

--
Gitblit v1.9.3