feat(platform): add live map decision strip

This commit is contained in:
lingniu
2026-07-06 03:19:40 +08:00
parent 89214a6b7f
commit 6a15503c7b
3 changed files with 244 additions and 0 deletions

View File

@@ -1650,6 +1650,73 @@ export function Realtime({
color: selectedMapRow ? vehicleServiceStatus(selectedMapRow).color : 'grey' as const
}
];
const liveMapDecisionItems = [
{
label: '在线覆盖',
value: `${onlineCount.toLocaleString()} / ${rows.length.toLocaleString()}`,
detail: `${(rows.length - onlineCount).toLocaleString()} 辆离线,在线率 ${formatPercent(onlineRate)}`,
color: onlineCount > 0 ? 'green' as const : 'orange' as const,
onClick: () => applyFilters({ ...filters, online: 'online' })
},
{
label: '定位覆盖',
value: `${locatedCount.toLocaleString()} / ${rows.length.toLocaleString()}`,
detail: `${missingCoordinateCount.toLocaleString()} 辆无坐标,定位率 ${formatPercent(locatedRate)}`,
color: locatedCount > 0 ? 'blue' as const : 'orange' as const,
onClick: () => load(filters, pagination.currentPage, pagination.pageSize)
},
{
label: '优先处理',
value: `${mapAttentionRows.length.toLocaleString()} 关注`,
detail: mapAttentionRows[0] ? `${mapAttentionRows[0].plate || mapAttentionRows[0].vin}${realtimeIssueLabels(mapAttentionRows[0]).join('')}` : '当前没有离线、超时或定位异常车辆。',
color: mapAttentionRows.length > 0 ? 'orange' as const : 'green' as const,
onClick: () => {
if (mapAttentionRows[0]) {
selectRealtimeRow(mapAttentionRows[0]);
return;
}
applyFilters({ ...filters, serviceStatus: 'degraded' });
}
},
{
label: '当前选车',
value: selectedVehicleLabel,
detail: selectedMapRow ? `${vehicleServiceStatus(selectedMapRow).label} / ${dataFreshness(selectedMapRow).detail}` : '从地图或车辆列表选择车辆。',
color: selectedMapRow ? vehicleServiceStatus(selectedMapRow).color : 'grey' as const,
disabled: !selectedMapRow || !canOpenVehicle(selectedMapRow.vin),
onClick: () => selectedMapRow && onOpenVehicle(selectedMapRow.vin, selectedVehicleProtocol)
}
];
const liveMapDecisionActions = [
{
label: '只看在线',
action: '在线',
color: 'green' as const,
disabled: false,
onClick: () => applyFilters({ ...filters, online: 'online' })
},
{
label: '定位关注',
action: '关注车',
color: mapAttentionRows.length > 0 ? 'orange' as const : 'green' as const,
disabled: mapAttentionRows.length === 0,
onClick: () => mapAttentionRows[0] && selectRealtimeRow(mapAttentionRows[0])
},
{
label: '轨迹复盘',
action: '轨迹',
color: selectedMapRow ? 'blue' as const : 'grey' as const,
disabled: !selectedMapRow || !canOpenVehicle(selectedMapRow.vin),
onClick: () => selectedMapRow && onOpenHistory?.(selectedMapRow.vin, selectedVehicleProtocol)
},
{
label: '导出地图',
action: 'CSV',
color: rows.length > 0 ? 'blue' as const : 'grey' as const,
disabled: rows.length === 0,
onClick: exportRealtime
}
];
const copyMapCustomerPackage = () => copyText(mapCustomerPackageText({
filters,
rows,
@@ -2196,6 +2263,55 @@ export function Realtime({
</aside>
</section>
<section className="vp-live-map-decision-strip" aria-label="Live Map 决策条">
<div className="vp-live-map-decision-copy">
<Space wrap>
<Tag color="blue">Live Map </Tag>
<Tag color={amapConfigured ? 'green' : 'orange'}>{amapConfigured ? '高德可用' : '坐标预览'}</Tag>
<Tag color={mapAttentionRows.length > 0 ? 'orange' : 'green'}>
{mapAttentionRows.length > 0 ? `${mapAttentionRows.length.toLocaleString()} 关注` : '态势稳定'}
</Tag>
</Space>
<Typography.Title heading={5} style={{ margin: 0 }}>
线
</Typography.Title>
<Typography.Text type="secondary">
线
</Typography.Text>
</div>
<div className="vp-live-map-decision-grid">
{liveMapDecisionItems.map((item) => (
<button
key={item.label}
type="button"
className="vp-live-map-decision-item"
disabled={item.disabled}
onClick={item.onClick}
aria-label={`Live Map 决策条 ${item.label} ${item.value}`}
>
<Tag color={item.color}>{item.label}</Tag>
<strong>{item.value}</strong>
<span>{item.detail}</span>
</button>
))}
</div>
<div className="vp-live-map-decision-actions">
{liveMapDecisionActions.map((item) => (
<button
key={item.label}
type="button"
className="vp-live-map-decision-action"
disabled={item.disabled}
onClick={item.onClick}
aria-label={`Live Map 决策动作 ${item.label} ${item.action}`}
>
<Tag color={item.color}>{item.label}</Tag>
<span>{item.action}</span>
</button>
))}
</div>
</section>
<section className="vp-map-status-filter-strip" aria-label="地图状态筛选条">
<div className="vp-map-status-filter-copy">
<Space wrap>