feat(platform): add map dispatch actions

This commit is contained in:
lingniu
2026-07-05 18:19:15 +08:00
parent 91b60ed63a
commit 24cabb2122
3 changed files with 151 additions and 0 deletions

View File

@@ -1164,6 +1164,46 @@ export function Realtime({
onClick: () => mapAttentionRows.length > 0 && onOpenQuality ? onOpenQuality({ serviceStatus: 'degraded' }) : copyMapCustomerPackage()
}
];
const mapDispatchActionItems = [
{
title: '关注车辆',
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,
action: '告警事件',
disabled: mapAttentionRows.length === 0 || !onOpenQuality,
onClick: () => onOpenQuality?.({ serviceStatus: 'degraded' })
},
{
title: '复盘选中',
value: selectedVehicleLabel,
detail: selectedMapRow ? `${dataFreshness(selectedMapRow).detail},回放轨迹和里程变化。` : '先从地图或列表选择车辆。',
color: selectedMapRow ? dataFreshness(selectedMapRow).color : 'grey' as const,
action: '轨迹回放',
disabled: !selectedMapRow || !canOpenVehicle(selectedMapRow.vin),
onClick: () => selectedMapRow && onOpenHistory?.(selectedMapRow.vin, selectedVehicleProtocol)
},
{
title: '车辆档案',
value: selectedVehicleLabel,
detail: selectedMapRow ? `${vehicleServiceStatus(selectedMapRow).label},查看车辆画像和来源证据。` : '选择车辆后进入单车服务。',
color: selectedMapRow ? vehicleServiceStatus(selectedMapRow).color : 'grey' as const,
action: '车辆服务',
disabled: !selectedMapRow || !canOpenVehicle(selectedMapRow.vin),
onClick: () => selectedMapRow && onOpenVehicle(selectedMapRow.vin, selectedVehicleProtocol)
},
{
title: '交接证据',
value: `${rows.length.toLocaleString()}`,
detail: '导出当前地图车辆清单,交接给客户或运营人员继续处理。',
color: rows.length > 0 ? 'blue' as const : 'grey' as const,
action: '导出CSV',
disabled: rows.length === 0,
onClick: exportRealtime
}
];
const mapCustomerDecisionItems = [
{
label: '先看在线',
@@ -1623,6 +1663,34 @@ export function Realtime({
</div>
</div>
<div className="vp-map-dispatch-actions">
<div className="vp-map-dispatch-actions-summary">
<Space wrap>
<Tag color="blue"></Tag>
<Tag color={mapAttentionRows.length > 0 ? 'orange' : 'green'}>{mapAttentionRows.length.toLocaleString()} </Tag>
<Tag color={selectedMapRow ? 'green' : 'grey'}>{selectedMapRow ? '已选车辆' : '待选车辆'}</Tag>
</Space>
<Typography.Text strong></Typography.Text>
</div>
<div className="vp-map-dispatch-actions-grid">
{mapDispatchActionItems.map((item) => (
<button
key={item.title}
type="button"
className="vp-map-dispatch-action"
disabled={item.disabled}
onClick={item.onClick}
aria-label={`地图调度处置栏 ${item.title} ${item.value} ${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-kpi-strip">
{mapFleetKpis.map((item) => (
<button