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 && ( + + + + + 预览启动表单 + + )} + {/* 保存按钮(最右侧) */}