feat(platform): add realtime priority queue

This commit is contained in:
lingniu
2026-07-05 21:22:04 +08:00
parent 82faa046b7
commit 059e4586a7
3 changed files with 203 additions and 0 deletions

View File

@@ -990,6 +990,10 @@ export function Realtime({
{ label: '有效定位', value: locatedCount.toLocaleString(), color: locatedCount > 0 ? 'green' as const : 'orange' as const, helper: `定位率 ${formatPercent(locatedRate)}` },
{ label: '需关注', value: mapAttentionRows.length.toLocaleString(), color: mapAttentionRows.length > 0 ? 'orange' as const : 'green' as const, helper: `${staleCount.toLocaleString()} 辆更新超时` }
];
const realtimePriorityRows = mapAttentionRows.slice(0, 4);
const realtimePrioritySummary = realtimePriorityRows.length > 0
? `${realtimePriorityRows.length.toLocaleString()} 辆优先处置`
: '暂无阻断';
const missingCoordinateCount = Math.max(0, rows.length - locatedCount);
const selectedVehicleProtocol = selectedMapRow ? filters.protocol || selectedMapRow.primaryProtocol || '' : '';
const selectedVehicleLabel = selectedMapRow?.plate || selectedMapRow?.vin || '未选择车辆';
@@ -2210,6 +2214,54 @@ export function Realtime({
))}
</div>
</section>
<section className="vp-realtime-priority-board" aria-label="实时处置优先级">
<div className="vp-realtime-priority-summary">
<Space wrap>
<Tag color="blue"></Tag>
<Tag color={realtimePriorityRows.length > 0 ? 'orange' : 'green'}>{realtimePrioritySummary}</Tag>
<Tag color="grey"> {rows.length.toLocaleString()} </Tag>
</Space>
<Typography.Title heading={5} style={{ margin: 0 }}>
</Typography.Title>
<Typography.Text type="secondary">
</Typography.Text>
</div>
<div className="vp-realtime-priority-grid">
{realtimePriorityRows.length === 0 ? (
<div className="vp-realtime-priority-empty">
<Tag color="green"></Tag>
<strong></strong>
<span></span>
</div>
) : realtimePriorityRows.map((row, index) => {
const label = row.plate || row.vin || '未知车辆';
const protocol = filters.protocol || row.primaryProtocol || '';
const issueText = realtimeIssueLabels(row).join('');
return (
<article key={`${row.vin}-${row.primaryProtocol}-realtime-priority`} className="vp-realtime-priority-item">
<div className="vp-realtime-priority-rank">{index + 1}</div>
<div className="vp-realtime-priority-main">
<Space wrap>
<Tag color={vehicleServiceStatus(row).color}>{vehicleServiceStatus(row).label}</Tag>
<Tag color={dataFreshness(row).color}>{dataFreshness(row).label}</Tag>
<Tag color={isValidCoordinate(row) ? 'green' : 'orange'}>{isValidCoordinate(row) ? '有定位' : '无定位'}</Tag>
</Space>
<strong>{label}</strong>
<span>{issueText}</span>
<small>{row.vin} / {protocol || '全部数据通道'} / {row.lastSeen || '-'}</small>
</div>
<div className="vp-realtime-priority-actions">
<button type="button" onClick={() => onOpenQuality?.({ keyword: row.vin, protocol })} disabled={!onOpenQuality || !canOpenVehicle(row.vin)} aria-label={`实时处置优先级 ${index + 1} ${label} 查看告警`}></button>
<button type="button" onClick={() => onOpenHistory?.(row.vin, protocol)} disabled={!canOpenVehicle(row.vin)} aria-label={`实时处置优先级 ${index + 1} ${label} 轨迹回放`}></button>
<button type="button" onClick={() => onOpenVehicle(row.vin, protocol)} disabled={!canOpenVehicle(row.vin)} aria-label={`实时处置优先级 ${index + 1} ${label} 车辆档案`}></button>
</div>
</article>
);
})}
</div>
</section>
<Card bordered className="vp-realtime-customer-board" bodyStyle={{ padding: 0 }}>
<div className="vp-realtime-customer-summary">
<Space wrap>