feat(platform): expose source slots in vehicle service

This commit is contained in:
lingniu
2026-07-04 07:30:56 +08:00
parent 2cfb9e551f
commit c528376ef9
9 changed files with 67 additions and 3 deletions

View File

@@ -33,6 +33,16 @@ function sourceEvidenceText(row: VehicleCoverageRow) {
return `${row.onlineSourceCount}/${row.sourceCount} 来源在线`;
}
function sourceStatusLabel(source: { online: boolean; hasRealtime: boolean; lastSeen: string }) {
if (source.online) {
return { text: '在线', color: 'green' as const };
}
if (source.hasRealtime || source.lastSeen) {
return { text: '离线', color: 'orange' as const };
}
return { text: '未接入', color: 'grey' as const };
}
function sourceConsistencyAction(row: VehicleCoverageRow, onFilter: (filters: Record<string, string>) => void) {
const consistency = row.sourceConsistency;
if (!consistency) {
@@ -148,10 +158,13 @@ export function Vehicles({
},
{
title: '来源证据',
width: 240,
width: 300,
render: (_: unknown, row: VehicleCoverageRow) => (
<Space spacing={4} wrap>
{row.protocols.map((protocol) => <Tag key={protocol} color="blue">{protocol}</Tag>)}
{(row.sourceStatus?.length ? row.sourceStatus : row.protocols.map((protocol) => ({ protocol, online: false, hasRealtime: true, lastSeen: row.lastSeen }))).map((source) => {
const status = sourceStatusLabel(source);
return <Tag key={source.protocol} color={status.color}>{source.protocol} {status.text}</Tag>;
})}
</Space>
)
},