From 50c8b4240b8e4b8fefc5101649ded411a75b4228 Mon Sep 17 00:00:00 2001 From: dengqichen Date: Fri, 24 Oct 2025 23:17:07 +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 --- .../Design/components/FormPreviewModal.tsx | 75 +++++++++++++++++++ .../Design/components/WorkflowToolbar.tsx | 23 +++++- frontend/src/pages/Workflow/Design/index.tsx | 39 ++++++++++ 3 files changed, 136 insertions(+), 1 deletion(-) create mode 100644 frontend/src/pages/Workflow/Design/components/FormPreviewModal.tsx diff --git a/frontend/src/pages/Workflow/Design/components/FormPreviewModal.tsx b/frontend/src/pages/Workflow/Design/components/FormPreviewModal.tsx new file mode 100644 index 00000000..2b2b4173 --- /dev/null +++ b/frontend/src/pages/Workflow/Design/components/FormPreviewModal.tsx @@ -0,0 +1,75 @@ +/** + * 表单预览弹窗组件 + * 用于在工作流设计页面预览启动表单 + */ + +import React from 'react'; +import { + Dialog, + DialogContent, + DialogHeader, + DialogTitle, +} from '@/components/ui/dialog'; +import { FormRenderer } from '@/components/FormDesigner'; +import type { FormDefinitionResponse } from '@/pages/Form/Definition/types'; + +interface FormPreviewModalProps { + open: boolean; + onClose: () => void; + formDefinition: FormDefinitionResponse | null; +} + +const FormPreviewModal: React.FC = ({ + open, + onClose, + formDefinition +}) => { + if (!formDefinition) { + return null; + } + + return ( + + + + + 预览表单:{formDefinition.name} + {formDefinition.description && ( + + {formDefinition.description} + + )} + + + +
+ +
+ +
+
表单标识:{formDefinition.key}
+
表单版本:v{formDefinition.formVersion}
+
状态: + + {formDefinition.status === 'PUBLISHED' ? '已发布' : + formDefinition.status === 'DRAFT' ? '草稿' : + formDefinition.status} + +
+
+
+
+ ); +}; + +export default FormPreviewModal; + diff --git a/frontend/src/pages/Workflow/Design/components/WorkflowToolbar.tsx b/frontend/src/pages/Workflow/Design/components/WorkflowToolbar.tsx index 21642598..5ea989a2 100644 --- a/frontend/src/pages/Workflow/Design/components/WorkflowToolbar.tsx +++ b/frontend/src/pages/Workflow/Design/components/WorkflowToolbar.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { Save, Undo, Redo, ZoomIn, ZoomOut, Maximize2, ArrowLeft } from 'lucide-react'; +import { Save, Undo, Redo, ZoomIn, ZoomOut, Maximize2, ArrowLeft, Eye } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Separator } from '@/components/ui/separator'; import { @@ -12,6 +12,8 @@ import { interface WorkflowToolbarProps { title?: string; onSave?: () => void; + onPreviewForm?: () => void; + hasFormDefinition?: boolean; onUndo?: () => void; onRedo?: () => void; onZoomIn?: () => void; @@ -27,6 +29,8 @@ interface WorkflowToolbarProps { const WorkflowToolbar: React.FC = ({ title = '工作流设计器', onSave, + onPreviewForm, + hasFormDefinition = false, onUndo, onRedo, onZoomIn, @@ -146,6 +150,23 @@ const WorkflowToolbar: React.FC = ({ + {/* 预览表单按钮 */} + {hasFormDefinition && ( + + + + + 预览启动表单 + + )} + {/* 保存按钮(最右侧) */}