施工管理支持已完成项目+修复状态显示逻辑
This commit is contained in:
@@ -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' ? (
|
||||||
<div style={{ marginTop: 16 }}>
|
<>
|
||||||
<Button type="primary" onClick={() => navigate(`/projects/${id}`)}>返回项目详情</Button>
|
<CheckCircleOutlined style={{ fontSize: 48, color: '#52c41a', marginBottom: 16 }} />
|
||||||
</div>
|
<Title level={4} style={{ color: '#52c41a' }}>项目已完成</Title>
|
||||||
|
<Paragraph type="secondary">此项目已完工,无需施工阶段推进</Paragraph>
|
||||||
|
<div style={{ marginTop: 16 }}>
|
||||||
|
<Button onClick={() => navigate(`/projects/${id}`)}>查看项目详情</Button>
|
||||||
|
</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>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user