feat(platform): add map field command actions

This commit is contained in:
lingniu
2026-07-05 14:17:16 +08:00
parent 695cecc07b
commit e94ccc37d8
3 changed files with 154 additions and 2 deletions

View File

@@ -1070,6 +1070,46 @@ export function Realtime({
secondaryDisabled: !selectedMapRow || !canOpenVehicle(selectedMapRow.vin)
}
];
const mapFieldCommandItems = [
{
title: '全域定位',
value: `${locatedCount.toLocaleString()} 辆有坐标`,
detail: amapConfigured ? '用高德地图查看车辆分布、在线状态和最近上报位置。' : '高德不可用时先用坐标预览确认车辆分布。',
color: locatedCount > 0 ? 'blue' as const : 'orange' as const,
action: '刷新地图',
disabled: false,
onClick: () => load(filters, pagination.currentPage, pagination.pageSize)
},
{
title: '关注车辆',
value: mapAttentionRows.length > 0 ? `${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,
onClick: () => mapAttentionRows[0] && selectRealtimeRow(mapAttentionRows[0])
},
{
title: '轨迹复盘',
value: selectedVehicleLabel,
detail: selectedMapRow ? '打开选中车辆轨迹,核对路径、速度、里程和停留。' : '先选择车辆,再进入轨迹回放和时间窗复盘。',
color: selectedMapRow ? 'blue' as const : 'grey' as const,
action: '打开轨迹',
disabled: !selectedMapRow || !canOpenVehicle(selectedMapRow.vin),
onClick: () => selectedMapRow && onOpenHistory?.(selectedMapRow.vin, selectedVehicleProtocol)
},
{
title: '通知证据',
value: mapAttentionRows.length > 0 ? '需通知' : '可交付',
detail: mapAttentionRows.length > 0 ? '复制地图监控包后进入告警事件,形成通知和处置闭环。' : '地图态势稳定时,可直接复制地图监控包用于交接。',
color: mapAttentionRows.length > 0 ? 'orange' as const : 'green' as const,
action: mapAttentionRows.length > 0 ? '告警事件' : '复制监控包',
disabled: false,
onClick: () => mapAttentionRows.length > 0 && onOpenQuality ? onOpenQuality({ serviceStatus: 'degraded' }) : copyMapCustomerPackage()
}
];
const mapCustomerDecisionItems = [
{
label: '先看在线',
@@ -1346,7 +1386,7 @@ export function Realtime({
<Button size="small" theme="light" onClick={() => setAutoRefresh((value) => !value)}>{autoRefresh ? '暂停刷新' : '开启刷新'}</Button>
</Space>
</div>
<div className="vp-map-decision-board">
<div className="vp-map-decision-summary">
<Space wrap>
@@ -1381,7 +1421,40 @@ export function Realtime({
))}
</div>
</div>
<div className="vp-map-field-command">
<div className="vp-map-field-command-summary">
<Space wrap>
<Tag color="blue"></Tag>
<Tag color={amapConfigured ? 'green' : 'orange'}>{amapConfigured ? '地图可用' : '坐标预览'}</Tag>
<Tag color={mapAttentionRows.length > 0 ? 'orange' : 'green'}>
{mapAttentionRows.length > 0 ? '先处置关注车辆' : '态势稳定'}
</Tag>
</Space>
<Typography.Title heading={5} style={{ margin: 0 }}></Typography.Title>
<Typography.Text type="secondary">
</Typography.Text>
</div>
<div className="vp-map-field-command-grid">
{mapFieldCommandItems.map((item) => (
<button
key={item.title}
type="button"
className="vp-map-field-command-item"
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-kpi-strip">
{mapFleetKpis.map((item) => (
<button