From a4ab7a6016081d5367806ae31b3bce1df2edfff0 Mon Sep 17 00:00:00 2001 From: dengqichen Date: Sat, 25 Oct 2025 12:20:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AE=A1=E6=89=B9=E7=BB=84?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/FormDesigner/Renderer.tsx | 1 - frontend/src/components/ui/toast.tsx | 2 +- frontend/src/pages/Form/Data/Detail.tsx | 93 +++++----- frontend/src/pages/Form/Data/index.tsx | 4 +- frontend/src/pages/Form/Definition/index.tsx | 50 +++--- frontend/src/pages/FormDesigner/index.tsx | 1 - .../components/StartWorkflowModal.tsx | 162 +++++++++--------- 7 files changed, 160 insertions(+), 153 deletions(-) diff --git a/frontend/src/components/FormDesigner/Renderer.tsx b/frontend/src/components/FormDesigner/Renderer.tsx index d54b8b36..bec2e38e 100644 --- a/frontend/src/components/FormDesigner/Renderer.tsx +++ b/frontend/src/components/FormDesigner/Renderer.tsx @@ -206,7 +206,6 @@ const FormRenderer = forwardRef((props, ref) const handleReset = () => { form.resetFields(); setFormData({}); - message.info('表单已重置'); }; // 监听表单值变化 diff --git a/frontend/src/components/ui/toast.tsx b/frontend/src/components/ui/toast.tsx index 4cba14ab..a2fb26db 100644 --- a/frontend/src/components/ui/toast.tsx +++ b/frontend/src/components/ui/toast.tsx @@ -14,7 +14,7 @@ const ToastViewport = React.forwardRef< { return (
- - -
+
+

表单数据详情

+ +
+ +
+ + 表单数据详情 - -
- - -
- - - - - - - - - -
-
- + + +
+ + + + + + + + + +
+
+ - - - 表单数据 - - - {/* 使用 FormRenderer 以只读模式展示数据 */} - - - + + + 表单数据 + + +
+ +
+
+
+
); }; diff --git a/frontend/src/pages/Form/Data/index.tsx b/frontend/src/pages/Form/Data/index.tsx index daff70ba..e4740b57 100644 --- a/frontend/src/pages/Form/Data/index.tsx +++ b/frontend/src/pages/Form/Data/index.tsx @@ -294,13 +294,13 @@ const FormDataList: React.FC = () => { - 表单标识 + 表单标识 分类 业务类型 业务标识 提交人 提交时间 - 状态 + 状态 操作 diff --git a/frontend/src/pages/Form/Definition/index.tsx b/frontend/src/pages/Form/Definition/index.tsx index 97dd3b2a..312348ba 100644 --- a/frontend/src/pages/Form/Definition/index.tsx +++ b/frontend/src/pages/Form/Definition/index.tsx @@ -1,5 +1,6 @@ -import React, { useState, useEffect, useMemo } from 'react'; +import React, { useState, useEffect, useMemo, useRef } from 'react'; import { useNavigate } from 'react-router-dom'; +import { Modal, Button as AntButton } from 'antd'; import { Card, CardHeader, CardTitle, CardContent, CardDescription } from '@/components/ui/card'; import { Table, TableHeader, TableBody, TableRow, TableHead, TableCell } from '@/components/ui/table'; import { Badge } from '@/components/ui/badge'; @@ -8,7 +9,7 @@ import { Input } from '@/components/ui/input'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'; import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter, DialogDescription } from '@/components/ui/dialog'; import { DataTablePagination } from '@/components/ui/pagination'; -import { FormRenderer } from '@/components/FormDesigner'; +import { FormRenderer, type FormRendererRef } from '@/components/FormDesigner'; import { Loader2, Plus, Search, Eye, Edit, FileText, Ban, Trash2, Database, MoreHorizontal, CheckCircle2, XCircle, Clock, AlertCircle, @@ -61,6 +62,7 @@ const FormDefinitionList: React.FC = () => { // 预览弹窗 const [previewVisible, setPreviewVisible] = useState(false); const [previewForm, setPreviewForm] = useState(null); + const previewFormRef = useRef(null); // 删除确认弹窗 const [deleteVisible, setDeleteVisible] = useState(false); @@ -522,26 +524,30 @@ const FormDefinitionList: React.FC = () => { {/* 预览弹窗 */} {previewForm && ( - - - - 预览表单 - - {previewForm.name} - {previewForm.key} (v{previewForm.formVersion}) - - - -
- setPreviewVisible(false)} - /> -
-
-
+ setPreviewVisible(false)} + width={800} + footer={[ + setPreviewVisible(false)} + > + 关闭 + , + ]} + > +
+ {previewForm.key} (v{previewForm.formVersion}) +
+ +
)} {/* 删除确认弹窗 */} diff --git a/frontend/src/pages/FormDesigner/index.tsx b/frontend/src/pages/FormDesigner/index.tsx index 857e67fa..06c9886d 100644 --- a/frontend/src/pages/FormDesigner/index.tsx +++ b/frontend/src/pages/FormDesigner/index.tsx @@ -859,7 +859,6 @@ const handleSubmit = async () => { 保存 , ]} - destroyOnClose > = ({ }) => { const formRef = useRef(null); const [loading, setLoading] = useState(false); - const [showCancelConfirm, setShowCancelConfirm] = useState(false); + const { toast } = useToast(); // 处理提交 const handleSubmit = async (formData: Record) => { @@ -69,16 +57,18 @@ const StartWorkflowModal: React.FC = ({ }; }; - // 处理取消 + // 处理取消 - 直接关闭弹窗 const handleCancel = () => { - setShowCancelConfirm(true); + onClose(); }; - // 确认取消 - const confirmCancel = () => { + // 处理重置 + const handleReset = () => { formRef.current?.reset(); - setShowCancelConfirm(false); - onClose(); + toast({ + title: "表单已重置", + description: "所有字段已恢复为初始状态", + }); }; // 处理表单提交触发 @@ -100,72 +90,74 @@ const StartWorkflowModal: React.FC = ({ const { schema } = formDefinition; return ( - <> - - - - + + {formDefinition.name || `启动工作流:${workflowDefinition.name}`} +
+ + 工作流 v{workflowDefinition.flowVersion} + + + 表单 v{formDefinition.formVersion} +
- } - destroyOnClose - > - - - {/* 表单元信息 */} -
-
工作流标识:{workflowDefinition.key}
-
工作流版本:v{workflowDefinition.flowVersion}
-
表单标识:{formDefinition.key}
-
表单版本:v{formDefinition.formVersion}
-
- - {/* 取消确认对话框 - 设置更高的 z-index 确保在 Modal 之上 */} - - - - - - 确认取消 - - 工作流将不会启动,确定要取消吗? - - - - setShowCancelConfirm(false)}>返回 - 确定取消 - - - - - + } + open={open} + onCancel={handleCancel} + width={schema.formConfig.formWidth || 600} + centered + footer={ +
+ + + +
+ } + > + +
); };