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
@@ -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>