diff --git a/frontend/src/pages/Projects.tsx b/frontend/src/pages/Projects.tsx index 41fe256..258809a 100644 --- a/frontend/src/pages/Projects.tsx +++ b/frontend/src/pages/Projects.tsx @@ -23,7 +23,7 @@ import { } from '@ant-design/icons'; import { useNavigate } from 'react-router-dom'; import { projectApi } from '@/api'; -import type { Project, ProjectCreate, ProjectStatus } from '@/types'; +import type { Project, ProjectCreate } from '@/types'; import { ProjectStatusTag } from '@/components/constants'; import dayjs from 'dayjs'; @@ -31,12 +31,13 @@ const { Title } = Typography; const { TextArea } = Input; const { RangePicker } = DatePicker; -const projectStatuses: { value: ProjectStatus; label: string }[] = [ +const projectStatuses: { value: string; label: string }[] = [ + { value: 'draft', label: '草稿' }, { value: 'planning', label: '规划中' }, - { value: 'active', label: '进行中' }, - { value: 'paused', label: '已暂停' }, - { value: 'completed', label: '已完成' }, - { value: 'cancelled', label: '已取消' }, + { value: 'in_progress', label: '执行中' }, + { value: 'review', label: '审核中' }, + { value: 'accepted', label: '已验收' }, + { value: 'archived', label: '已归档' }, ]; export default function Projects() { @@ -64,7 +65,6 @@ export default function Projects() { const openCreate = () => { setEditing(null); form.resetFields(); - form.setFieldsValue({ status: 'planning' }); setModalOpen(true); }; @@ -74,7 +74,7 @@ export default function Projects() { name: record.name, description: record.description, status: record.status, - budget: record.budget, + budget: record.budget_limit_cents ? record.budget_limit_cents / 100 : undefined, }); setModalOpen(true); }; @@ -87,10 +87,12 @@ export default function Projects() { const payload: ProjectCreate = { name: values.name, description: values.description, - status: values.status, - budget: values.budget, }; + if (values.budget != null) { + payload.budget_limit_cents = Math.round(values.budget * 100); + } + if (values.date_range) { payload.start_date = values.date_range[0].toISOString(); payload.end_date = values.date_range[1].toISOString(); @@ -112,7 +114,7 @@ export default function Projects() { } }; - const handleDelete = async (id: string) => { + const handleDelete = async (id: number) => { try { await projectApi.delete(id); message.success('删除成功'); @@ -135,13 +137,13 @@ export default function Projects() { title: '状态', dataIndex: 'status', key: 'status', - render: (status: ProjectStatus) => , + render: (status: string) => , }, { title: '预算', - dataIndex: 'budget', - key: 'budget', - render: (v: number) => (v != null ? `¥${v.toFixed(2)}` : '-'), + dataIndex: 'budget_limit_cents', + key: 'budget_limit_cents', + render: (v?: number) => (v != null ? `¥${(v / 100).toFixed(2)}` : '-'), }, { title: '创建时间',