diff --git a/frontend/src/pages/Dashboard.tsx b/frontend/src/pages/Dashboard.tsx index 8a7bc86..3c99dc6 100644 --- a/frontend/src/pages/Dashboard.tsx +++ b/frontend/src/pages/Dashboard.tsx @@ -136,8 +136,8 @@ export default function Dashboard() { }) } - const riskTodos = data?.todos.filter((t) => t.type === 'CONTRACT' || t.type === 'TERMINATION' || t.type === 'ONBOARDING' || t.type === 'RETIREMENT') || [] - const taskTodos = data?.todos.filter((t) => t.type === 'MONTHLY' || t.type === 'SALARY') || [] + const riskTodos = data?.todos?.filter((t) => t.type === 'CONTRACT' || t.type === 'TERMINATION' || t.type === 'ONBOARDING' || t.type === 'RETIREMENT') || [] + const taskTodos = data?.todos?.filter((t) => t.type === 'MONTHLY' || t.type === 'SALARY') || [] const filteredTodos = activeTab === 'risk' ? riskTodos : taskTodos if (isLoading) { @@ -270,7 +270,7 @@ export default function Dashboard() { @@ -279,13 +279,13 @@ export default function Dashboard() {
- {complianceScore.overallScore} - {complianceScore.levelLabel} + {complianceScore?.overallScore ?? complianceScore?.totalScore ?? 0} + {complianceScore?.levelLabel ?? complianceScore?.summary ?? ''}
{/* 5 维度评分 */}
- {complianceScore.dimensions.map((dim: any) => ( + {complianceScore?.dimensions?.map((dim: any) => (
= 85 ? 'bg-safe' : dim.score >= 60 ? 'bg-warning' : 'bg-danger'}`} /> @@ -302,7 +302,7 @@ export default function Dashboard() { {/* AI 建议卡片流 */} - {complianceScore.suggestions.length > 0 && ( + {complianceScore?.suggestions && complianceScore.suggestions.length > 0 && (
@@ -547,8 +547,8 @@ export default function Dashboard() {
- {data.topRisks.filter(r => r.type === drillDownType).length > 0 ? ( - data.topRisks.filter(r => r.type === drillDownType).map((r) => ( + {(data.topRisks || []).filter(r => r.type === drillDownType).length > 0 ? ( + (data.topRisks || []).filter(r => r.type === drillDownType).map((r) => (