feat(platform): summarize vehicle action queue

This commit is contained in:
lingniu
2026-07-04 09:15:02 +08:00
parent c4ff0079cf
commit 5952bb1a6f
2 changed files with 91 additions and 1 deletions

View File

@@ -155,6 +155,27 @@ export function Vehicles({
}
return items;
}, [pagination.total, summary]);
const actionQueue = useMemo<Array<{ label: string; count: number; filters: Record<string, string>; color: 'orange' | 'red' }>>(() => {
const items: Array<{ label: string; count: number; filters: Record<string, string>; color: 'orange' | 'red' }> = [];
const unboundCount = summary?.unboundVehicles ?? 0;
if (unboundCount > 0) {
items.push({ label: '维护身份绑定', count: unboundCount, filters: { bindingStatus: 'unbound' }, color: 'orange' });
}
const noDataCount = summary?.noDataVehicles ?? 0;
if (noDataCount > 0) {
items.push({ label: '确认平台转发', count: noDataCount, filters: { serviceStatus: 'no_data' }, color: 'orange' });
}
for (const source of summary?.missingSources ?? []) {
if (source.count <= 0) continue;
items.push({
label: `补齐 ${source.protocol} 来源`,
count: source.count,
filters: { missingProtocol: source.protocol },
color: 'orange'
});
}
return items;
}, [summary]);
const filterSummary = [
filters.keyword ? `关键词:${filters.keyword}` : '',
filters.protocol ? `数据来源:${filters.protocol}` : '',
@@ -344,6 +365,17 @@ export function Vehicles({
))}
</div>
</Card>
{actionQueue.length > 0 ? (
<Card bordered title="处置队列" style={{ marginTop: 16 }}>
<Space wrap>
{actionQueue.map((item) => (
<Button key={`${item.label}-${item.count}`} size="small" theme="light" type={item.color === 'red' ? 'danger' : 'warning'} onClick={() => applyFilters({ ...filters, ...item.filters })}>
{item.label} {item.count.toLocaleString()}
</Button>
))}
</Space>
</Card>
) : null}
<Card bordered style={{ marginTop: 16 }}>
{rows.length === 0 && !loading ? (
<DataEmpty />