feat(platform): add live map service action rail

This commit is contained in:
lingniu
2026-07-05 17:29:29 +08:00
parent 2e20ec5c81
commit 2c6fca90d2
3 changed files with 171 additions and 1 deletions

View File

@@ -1070,6 +1070,60 @@ export function Realtime({
secondaryDisabled: !selectedMapRow || !canOpenVehicle(selectedMapRow.vin)
}
];
const mapServiceActionItems = [
{
title: '在线车辆',
value: `${onlineCount.toLocaleString()} 在线`,
detail: `在线率 ${formatPercent(onlineRate)},先确认客户当前能看到哪些车。`,
action: '只看在线',
color: onlineCount > 0 ? 'green' as const : 'orange' as const,
disabled: false,
onClick: () => applyFilters({ ...filters, online: 'online' })
},
{
title: '关注车辆',
value: `${mapAttentionRows.length.toLocaleString()} 关注`,
detail: mapAttentionRows[0] ? `${mapAttentionRows[0].plate || mapAttentionRows[0].vin}${realtimeIssueLabels(mapAttentionRows[0]).join('')}` : '当前没有明显离线、超时或坐标异常车辆。',
action: '异常优先',
color: mapAttentionRows.length > 0 ? 'orange' as const : 'green' as const,
disabled: false,
onClick: () => applyFilters({ ...filters, serviceStatus: 'degraded' })
},
{
title: '路线回放',
value: selectedMapRow?.plate || selectedMapRow?.vin || '先选车',
detail: selectedMapRow ? `${dataFreshness(selectedMapRow).detail},回放位置、速度和里程变化。` : '从地图或车辆列表选择一辆车后进入轨迹回放。',
action: '轨迹回放',
color: selectedMapRow ? 'blue' as const : 'grey' as const,
disabled: !selectedMapRow || !canOpenVehicle(selectedMapRow.vin),
onClick: () => selectedMapRow && onOpenHistory?.(selectedMapRow.vin, selectedVehicleProtocol)
},
{
title: '统计查询',
value: selectedMapRow?.totalMileageKm != null ? `${selectedMapRow.totalMileageKm} km` : '待选车',
detail: '按选中车辆进入统计查询,核对区间里程和日报闭合。',
action: '统计查询',
color: selectedMapRow?.totalMileageKm != null ? 'blue' as const : 'grey' as const,
disabled: !selectedMapRow || !canOpenVehicle(selectedMapRow.vin),
onClick: () => {
if (!selectedMapRow) return;
window.location.hash = buildAppHash({
page: 'mileage',
keyword: selectedMapRow.vin,
protocol: selectedVehicleProtocol
});
}
},
{
title: '证据导出',
value: `${rows.length.toLocaleString()} 当前页`,
detail: '导出当前地图车辆清单,作为客户问询和运营交接证据。',
action: '导出CSV',
color: rows.length > 0 ? 'blue' as const : 'grey' as const,
disabled: rows.length === 0,
onClick: exportRealtime
}
];
const mapFieldCommandItems = [
{
title: '全域定位',
@@ -1470,6 +1524,37 @@ export function Realtime({
</Space>
</div>
<div className="vp-map-service-rail">
<div className="vp-map-service-rail-summary">
<Space wrap>
<Tag color="blue"></Tag>
<Tag color={amapConfigured ? 'green' : 'orange'}>{amapConfigured ? 'Live Map 可用' : '坐标预览'}</Tag>
<Tag color={mapAttentionRows.length > 0 ? 'orange' : 'green'}>{mapAttentionRows.length.toLocaleString()} </Tag>
</Space>
<Typography.Title heading={5} style={{ margin: 0 }}> Live Map 线线</Typography.Title>
<Typography.Text type="secondary">
</Typography.Text>
</div>
<div className="vp-map-service-rail-actions">
{mapServiceActionItems.map((item) => (
<button
key={item.title}
type="button"
className="vp-map-service-rail-action"
disabled={item.disabled}
onClick={item.onClick}
aria-label={`地图服务行动条 ${item.title} ${item.action}`}
>
<Tag color={item.color}>{item.title}</Tag>
<strong>{item.value}</strong>
<span>{item.detail}</span>
<em>{item.action}</em>
</button>
))}
</div>
</div>
<div className="vp-map-decision-board">
<div className="vp-map-decision-summary">
<Space wrap>