diff --git a/frontend/src/pages/Form/Data/Detail.tsx b/frontend/src/pages/Form/Data/Detail.tsx index 594bdd4b..4b89ad21 100644 --- a/frontend/src/pages/Form/Data/Detail.tsx +++ b/frontend/src/pages/Form/Data/Detail.tsx @@ -38,7 +38,7 @@ const FormDataDetail: React.FC = () => { // 返回列表 const handleBack = () => { - navigate('/form/data'); + navigate('/workflow/form/data'); }; // 状态徽章 diff --git a/frontend/src/pages/Form/Data/index.tsx b/frontend/src/pages/Form/Data/index.tsx index e4740b57..0b0e4491 100644 --- a/frontend/src/pages/Form/Data/index.tsx +++ b/frontend/src/pages/Form/Data/index.tsx @@ -97,7 +97,7 @@ const FormDataList: React.FC = () => { // 查看详情 const handleView = (record: FormDataResponse) => { - navigate(`/form/data/${record.id}`); + navigate(`/workflow/form/data/${record.id}`); }; // 删除 diff --git a/frontend/src/pages/Form/Definition/Designer.tsx b/frontend/src/pages/Form/Definition/Designer.tsx index bb8ac3d7..42c86883 100644 --- a/frontend/src/pages/Form/Definition/Designer.tsx +++ b/frontend/src/pages/Form/Definition/Designer.tsx @@ -76,7 +76,7 @@ const FormDesignerPage: React.FC = () => { // 返回列表 const handleBack = () => { - navigate('/form/definitions'); + navigate('/workflow/form'); }; return ( diff --git a/frontend/src/pages/Form/Definition/components/EditBasicInfoModal.tsx b/frontend/src/pages/Form/Definition/components/EditBasicInfoModal.tsx deleted file mode 100644 index 3dc2979f..00000000 --- a/frontend/src/pages/Form/Definition/components/EditBasicInfoModal.tsx +++ /dev/null @@ -1,248 +0,0 @@ -import React, { useState, useEffect } from 'react'; -import { - Dialog, - DialogContent, - DialogHeader, - DialogTitle, - DialogDescription, - DialogFooter, -} from '@/components/ui/dialog'; -import { Button } from '@/components/ui/button'; -import { Input } from '@/components/ui/input'; -import { Label } from '@/components/ui/label'; -import { Textarea } from '@/components/ui/textarea'; -import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'; -import { Switch } from '@/components/ui/switch'; -import { useToast } from '@/components/ui/use-toast'; -import { Loader2, FileText, Tag, Folder, AlignLeft, Copy } from 'lucide-react'; -import { getEnabledCategories } from '../../Category/service'; -import { updateDefinition } from '../service'; -import type { FormCategoryResponse } from '../../Category/types'; -import type { FormDefinitionRequest, FormDefinitionResponse } from '../types'; - -interface EditBasicInfoModalProps { - visible: boolean; - record: FormDefinitionResponse | null; - onClose: () => void; - onSuccess: () => void; -} - -const EditBasicInfoModal: React.FC = ({ visible, record, onClose, onSuccess }) => { - const { toast } = useToast(); - const [submitting, setSubmitting] = useState(false); - const [categories, setCategories] = useState([]); - const [formData, setFormData] = useState({ - name: '', - key: '', - categoryId: undefined as number | undefined, - description: '', - isTemplate: false, - }); - - useEffect(() => { - const loadCategories = async () => { - try { - const result = await getEnabledCategories(); - setCategories(result || []); - } catch (error) { - console.error('加载分类失败:', error); - } - }; - if (visible) { - loadCategories(); - if (record) { - setFormData({ - name: record.name, - key: record.key, - categoryId: record.categoryId, - description: record.description || '', - isTemplate: record.isTemplate || false, - }); - } - } - }, [visible, record]); - - const handleClose = () => { - if (!submitting) { - onClose(); - } - }; - - const handleSubmit = async () => { - if (!record) return; - - if (!formData.name.trim()) { - toast({ - variant: "destructive", - title: "验证失败", - description: "请输入表单名称", - }); - return; - } - if (!formData.key.trim()) { - toast({ - variant: "destructive", - title: "验证失败", - description: "请输入表单标识", - }); - return; - } - if (!/^[a-zA-Z0-9-]+$/.test(formData.key)) { - toast({ - variant: "destructive", - title: "验证失败", - description: "表单标识只能包含英文字母、数字和中划线", - }); - return; - } - - setSubmitting(true); - try { - const request: FormDefinitionRequest = { - name: formData.name, - key: formData.key, - categoryId: formData.categoryId, - description: formData.description, - schema: record.schema, - status: record.status, - isTemplate: formData.isTemplate, - version: record.version, // 乐观锁版本号 - }; - - await updateDefinition(record.id, request); - toast({ - title: "更新成功", - description: `表单 "${formData.name}" 的基本信息已更新`, - }); - onSuccess(); - onClose(); - } catch (error) { - console.error('更新表单失败:', error); - toast({ - variant: "destructive", - title: "更新失败", - description: error instanceof Error ? error.message : '未知错误,请稍后重试', - }); - } finally { - setSubmitting(false); - } - }; - - return ( - - - - 编辑基本信息 - - 修改表单的名称、标识、分类等基本信息 - - -
- {/* 第一行:表单名称 + 表单标识 */} -
-
- - setFormData(prev => ({ ...prev, name: e.target.value }))} - className="h-10" - /> -
- -
- - setFormData(prev => ({ ...prev, key: e.target.value }))} - className="h-10 font-mono" - /> -

- 英文字母、数字和中划线 -

-
-
- - {/* 第二行:分类 + 设为模板 */} -
-
- - -
- -
- -
-
- 启用模板功能 -
- setFormData(prev => ({ ...prev, isTemplate: checked }))} - /> -
-
-
- - {/* 第三行:描述 */} -
- -