fix: 前端构建修复+后端静态托管+Docker部署
This commit is contained in:
@@ -36,12 +36,13 @@ export default function ProjectDetail() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!id) return;
|
if (!id) return;
|
||||||
|
const projectId = Number(id);
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
Promise.all([
|
Promise.all([
|
||||||
projectApi.get(id),
|
projectApi.get(projectId),
|
||||||
projectApi.stats(id),
|
projectApi.stats(projectId),
|
||||||
taskApi.list({ project_id: id }),
|
taskApi.list({ project_id: projectId }),
|
||||||
artifactApi.list({ project_id: id }),
|
artifactApi.list({ project_id: projectId }),
|
||||||
])
|
])
|
||||||
.then(([p, s, t, a]) => {
|
.then(([p, s, t, a]) => {
|
||||||
setProject(p);
|
setProject(p);
|
||||||
@@ -65,6 +66,15 @@ export default function ProjectDetail() {
|
|||||||
return <Empty description="项目不存在" />;
|
return <Empty description="项目不存在" />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const taskStatusDist = stats
|
||||||
|
? [
|
||||||
|
{ status: 'pending', count: stats.pending_tasks },
|
||||||
|
{ status: 'in_progress', count: stats.in_progress_tasks },
|
||||||
|
{ status: 'review', count: stats.review_tasks },
|
||||||
|
{ status: 'done', count: stats.done_tasks },
|
||||||
|
].filter((item) => item.count > 0)
|
||||||
|
: [];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div
|
<div
|
||||||
@@ -102,7 +112,9 @@ export default function ProjectDetail() {
|
|||||||
<ProjectStatusTag status={project.status} />
|
<ProjectStatusTag status={project.status} />
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
<Descriptions.Item label="预算">
|
<Descriptions.Item label="预算">
|
||||||
{project.budget != null ? `¥${project.budget.toFixed(2)}` : '-'}
|
{project.budget_limit_cents != null
|
||||||
|
? `¥${(project.budget_limit_cents / 100).toFixed(2)}`
|
||||||
|
: '-'}
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
<Descriptions.Item label="创建时间">
|
<Descriptions.Item label="创建时间">
|
||||||
{dayjs(project.created_at).format('YYYY-MM-DD HH:mm')}
|
{dayjs(project.created_at).format('YYYY-MM-DD HH:mm')}
|
||||||
@@ -133,15 +145,15 @@ export default function ProjectDetail() {
|
|||||||
<Col xs={12} md={6}>
|
<Col xs={12} md={6}>
|
||||||
<Statistic
|
<Statistic
|
||||||
title="已完成"
|
title="已完成"
|
||||||
value={stats.completed_tasks}
|
value={stats.done_tasks}
|
||||||
valueStyle={{ color: '#52c41a' }}
|
valueStyle={{ color: '#52c41a' }}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
<Col xs={12} md={6}>
|
<Col xs={12} md={6}>
|
||||||
<Card>
|
<Card>
|
||||||
<Statistic
|
<Statistic
|
||||||
title="活跃 AI 工作者"
|
title="待审核"
|
||||||
value={stats.active_workers}
|
value={stats.pending_reviews}
|
||||||
valueStyle={{ color: '#1677ff' }}
|
valueStyle={{ color: '#1677ff' }}
|
||||||
/>
|
/>
|
||||||
</Card>
|
</Card>
|
||||||
@@ -150,7 +162,7 @@ export default function ProjectDetail() {
|
|||||||
<Card>
|
<Card>
|
||||||
<Statistic
|
<Statistic
|
||||||
title="总花费"
|
title="总花费"
|
||||||
value={stats.total_cost}
|
value={stats.total_cost_cents / 100}
|
||||||
precision={2}
|
precision={2}
|
||||||
prefix="¥"
|
prefix="¥"
|
||||||
valueStyle={{ color: '#fa8c16' }}
|
valueStyle={{ color: '#fa8c16' }}
|
||||||
@@ -160,17 +172,14 @@ export default function ProjectDetail() {
|
|||||||
</Row>
|
</Row>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{stats && (
|
{stats && taskStatusDist.length > 0 && (
|
||||||
<Card title="任务状态分布" size="small" style={{ marginBottom: 16 }}>
|
<Card title="任务状态分布" size="small" style={{ marginBottom: 16 }}>
|
||||||
<Space wrap>
|
<Space wrap>
|
||||||
{Object.entries(stats.tasks_by_status || {}).map(([status, count]) => (
|
{taskStatusDist.map(({ status, count }) => (
|
||||||
<Tag key={status} style={{ padding: '4px 12px', fontSize: 14 }}>
|
<Tag key={status} style={{ padding: '4px 12px', fontSize: 14 }}>
|
||||||
<TaskStatusTag status={status as Task['status']} /> {count}
|
<TaskStatusTag status={status as Task['status']} /> {count}
|
||||||
</Tag>
|
</Tag>
|
||||||
))}
|
))}
|
||||||
{Object.keys(stats.tasks_by_status || {}).length === 0 && (
|
|
||||||
<Text type="secondary">暂无任务数据</Text>
|
|
||||||
)}
|
|
||||||
</Space>
|
</Space>
|
||||||
</Card>
|
</Card>
|
||||||
)}
|
)}
|
||||||
@@ -210,8 +219,8 @@ export default function ProjectDetail() {
|
|||||||
renderItem={(art) => (
|
renderItem={(art) => (
|
||||||
<List.Item key={art.id}>
|
<List.Item key={art.id}>
|
||||||
<List.Item.Meta
|
<List.Item.Meta
|
||||||
title={art.name}
|
title={art.title}
|
||||||
description={`${art.type} · ${dayjs(art.created_at).format('MM-DD HH:mm')}`}
|
description={`${art.artifact_type} · ${dayjs(art.created_at).format('MM-DD HH:mm')}`}
|
||||||
/>
|
/>
|
||||||
</List.Item>
|
</List.Item>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user