feat(platform): show active realtime filters
This commit is contained in:
@@ -32,6 +32,18 @@ function sourceEvidenceText(row: VehicleRealtimeRow) {
|
||||
return `${row.onlineSourceCount}/${row.sourceCount} 来源在线`;
|
||||
}
|
||||
|
||||
const onlineLabel: Record<string, string> = {
|
||||
online: '在线',
|
||||
offline: '离线'
|
||||
};
|
||||
|
||||
const serviceStatusLabel: Record<string, string> = {
|
||||
healthy: '服务正常',
|
||||
degraded: '来源不完整',
|
||||
offline: '车辆离线',
|
||||
identity_required: '身份未绑定'
|
||||
};
|
||||
|
||||
export function Realtime({
|
||||
onOpenVehicle,
|
||||
onFiltersChange,
|
||||
@@ -72,6 +84,12 @@ export function Realtime({
|
||||
onFiltersChange?.(nextFilters);
|
||||
load(nextFilters, 1, pagination.pageSize);
|
||||
};
|
||||
const filterSummary = [
|
||||
filters.keyword ? `关键词:${filters.keyword}` : '',
|
||||
filters.protocol ? `数据来源:${filters.protocol}` : '',
|
||||
filters.online ? `在线:${onlineLabel[filters.online] ?? filters.online}` : '',
|
||||
filters.serviceStatus ? `服务状态:${serviceStatusLabel[filters.serviceStatus] ?? filters.serviceStatus}` : ''
|
||||
].filter(Boolean);
|
||||
|
||||
return (
|
||||
<div className="vp-page">
|
||||
@@ -104,6 +122,16 @@ export function Realtime({
|
||||
}}>重置</Button>
|
||||
</Space>
|
||||
</Form>
|
||||
{filterSummary.length > 0 ? (
|
||||
<Card bordered title="当前实时筛选" style={{ marginBottom: 12 }}>
|
||||
<Space wrap>
|
||||
{filterSummary.map((item) => (
|
||||
<Tag key={item} color="blue">{item}</Tag>
|
||||
))}
|
||||
<Button size="small" onClick={() => applyFilters({})}>清空筛选</Button>
|
||||
</Space>
|
||||
</Card>
|
||||
) : null}
|
||||
<Tabs type="line">
|
||||
<Tabs.TabPane tab="表格视图" itemKey="table">
|
||||
{rows.length === 0 && !loading ? (
|
||||
|
||||
Reference in New Issue
Block a user