feat(platform): expose source slots in vehicle service
This commit is contained in:
@@ -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>
|
||||
)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user