施工管理支持已完成项目+修复状态显示逻辑

This commit is contained in:
a273825743
2026-05-17 01:24:37 +08:00
parent 86a4cc65ee
commit 9d8f741771
4 changed files with 22 additions and 8 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ router.get('/my-projects', async (req, res) => {
FROM projects p FROM projects p
LEFT JOIN customers c ON p.customer_id = c.id LEFT JOIN customers c ON p.customer_id = c.id
LEFT JOIN users u ON p.project_manager_id = u.id LEFT JOIN users u ON p.project_manager_id = u.id
WHERE p.status IN ('active', 'in_progress', 'planning', 'pending') WHERE p.status IN ('active', 'in_progress', 'planning', 'pending', 'completed')
ORDER BY p.created_at DESC ORDER BY p.created_at DESC
`); `);
@@ -50,12 +50,12 @@ const ConstructionOverview: React.FC = () => {
}; };
const getStatusColor = (status: string) => { const getStatusColor = (status: string) => {
const map: Record<string, string> = { active: 'green', planning: 'blue', completed: 'default', suspended: 'orange' }; const map: Record<string, string> = { active: 'green', in_progress: 'processing', planning: 'blue', completed: 'default', suspended: 'orange' };
return map[status] || 'default'; return map[status] || 'default';
}; };
const getStatusText = (status: string) => { const getStatusText = (status: string) => {
const map: Record<string, string> = { active: '施工中', planning: '待开工', completed: '已完工', suspended: '暂停' }; const map: Record<string, string> = { active: '施工中', in_progress: '施工中', planning: '待开工', completed: '已完工', suspended: '暂停' };
return map[status] || status; return map[status] || status;
}; };
@@ -221,10 +221,24 @@ const ConstructionProgress: React.FC = () => {
{!currentPhase && pendingPhases.length === 0 && completedPhases.length === 0 && ( {!currentPhase && pendingPhases.length === 0 && completedPhases.length === 0 && (
<Card> <Card>
<div style={{ textAlign: 'center', padding: 24 }}> <div style={{ textAlign: 'center', padding: 24 }}>
<Text type="secondary"></Text> {project?.status === 'completed' ? (
<>
<CheckCircleOutlined style={{ fontSize: 48, color: '#52c41a', marginBottom: 16 }} />
<Title level={4} style={{ color: '#52c41a' }}></Title>
<Paragraph type="secondary"></Paragraph>
<div style={{ marginTop: 16 }}> <div style={{ marginTop: 16 }}>
<Button type="primary" onClick={() => navigate(`/projects/${id}`)}></Button> <Button onClick={() => navigate(`/projects/${id}`)}></Button>
</div> </div>
</>
) : (
<>
<Text type="secondary"></Text>
<Paragraph type="secondary" style={{ marginTop: 8 }}></Paragraph>
<div style={{ marginTop: 16 }}>
<Button type="primary" onClick={() => navigate(`/projects/${id}`)}></Button>
</div>
</>
)}
</div> </div>
</Card> </Card>
)} )}
+1 -1
View File
@@ -310,7 +310,7 @@ const ProjectsPage: React.FC = () => {
<Select options={[ <Select options={[
{ value: 'planning', label: '规划中' }, { value: 'planning', label: '规划中' },
{ value: 'in_progress', label: '进行中' }, { value: 'in_progress', label: '进行中' },
{ value: 'completed', label: '已完成' }, { value: 'completed', label: '已完成(补录历史项目)' },
]} /> ]} />
</Form.Item> </Form.Item>
</Col> </Col>