feat(platform): link quality issues to vehicle lookup

This commit is contained in:
lingniu
2026-07-04 00:02:33 +08:00
parent a5ca34797d
commit bfdfb5761a
2 changed files with 29 additions and 5 deletions

View File

@@ -15,6 +15,14 @@ function formatLag(value?: number | null) {
return value == null ? '未接入' : value.toLocaleString();
}
function qualityVehicleLookupKey(row: QualityIssueRow) {
const vin = row.vin?.trim();
if (vin && vin !== 'unknown') {
return vin;
}
return row.plate?.trim() || row.phone?.trim() || '';
}
export function Dashboard({ onOpenVehicle, onOpenQuality }: { onOpenVehicle: (vin: string) => void; onOpenQuality: () => void }) {
const [summary, setSummary] = useState<DashboardSummary | null>(null);
const [coverage, setCoverage] = useState<VehicleCoverageRow[]>([]);
@@ -127,7 +135,14 @@ export function Dashboard({ onOpenVehicle, onOpenQuality }: { onOpenVehicle: (vi
{ title: '来源', dataIndex: 'protocol', width: 110 },
{ title: '问题', dataIndex: 'issueType', width: 140 },
{ title: '级别', width: 90, render: (_: unknown, row: QualityIssueRow) => <Tag color={row.severity === 'error' ? 'red' : 'orange'}>{row.severity}</Tag> },
{ title: '最后时间', dataIndex: 'lastSeen', width: 170 }
{ title: '最后时间', dataIndex: 'lastSeen', width: 170 },
{
title: '操作',
width: 110,
render: (_: unknown, row: QualityIssueRow) => (
<Button disabled={!qualityVehicleLookupKey(row)} onClick={() => onOpenVehicle(qualityVehicleLookupKey(row))}></Button>
)
}
]}
/>
</Card>