feat(platform): summarize vehicle source diagnosis

This commit is contained in:
lingniu
2026-07-04 07:47:57 +08:00
parent 36b75b4c0e
commit ec00dd0166
2 changed files with 14 additions and 0 deletions

View File

@@ -34,6 +34,18 @@ function sourceEvidenceText(row: VehicleCoverageRow) {
return `${row.onlineSourceCount}/${row.sourceCount} 来源在线`;
}
function sourceDiagnosisText(row: VehicleCoverageRow) {
const parts = [sourceEvidenceText(row)];
if ((row.missingProtocols ?? []).length > 0) {
parts.push(`${row.missingProtocols.join('、')}`);
} else if (row.sourceCount > 0) {
parts.push('来源完整');
} else {
parts.push('暂无来源');
}
return parts.join('');
}
function sourceConsistencyAction(row: VehicleCoverageRow, onFilter: (filters: Record<string, string>) => void) {
const consistency = row.sourceConsistency;
if (!consistency) {
@@ -180,6 +192,7 @@ export function Vehicles({
width: 140,
render: (_: unknown, row: VehicleCoverageRow) => sourceConsistencyAction(row, (nextFilters) => applyFilters({ ...filters, ...nextFilters }))
},
{ title: '诊断摘要', width: 240, render: (_: unknown, row: VehicleCoverageRow) => sourceDiagnosisText(row) },
{ title: '证据覆盖', width: 120, render: (_: unknown, row: VehicleCoverageRow) => sourceEvidenceText(row) },
{ title: '在线', width: 90, render: (_: unknown, row: VehicleCoverageRow) => <StatusTag status={row.online ? 'ok' : 'offline'} /> },
{ title: '最后在线', dataIndex: 'lastSeen', width: 170 },

View File

@@ -344,6 +344,7 @@ test('shows vehicle service result summary on vehicle list filters', async () =>
expect(screen.getByText('JT808 离线')).toBeInTheDocument();
expect(screen.getByText('YUTONG_MQTT 未接入')).toBeInTheDocument();
expect(screen.getByText('1/2 来源在线')).toBeInTheDocument();
expect(screen.getByText('1/2 来源在线,缺 YUTONG_MQTT')).toBeInTheDocument();
});
test('filters vehicle list from result summary actions', async () => {