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

View File

@@ -3632,6 +3632,81 @@ button.vp-realtime-command-item:focus-visible {
font-weight: 700;
}
.vp-map-dispatch-actions {
padding: 14px;
border: 1px solid rgba(255, 127, 0, 0.2);
border-radius: var(--vp-radius);
background: #fffaf3;
display: grid;
grid-template-columns: minmax(300px, 0.7fr) minmax(0, 1.3fr);
gap: 12px;
}
.vp-map-dispatch-actions-summary {
display: grid;
gap: 10px;
align-content: start;
}
.vp-map-dispatch-actions-summary .semi-typography {
font-size: 14px;
line-height: 22px;
}
.vp-map-dispatch-actions-grid {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 10px;
}
.vp-map-dispatch-action {
min-height: 142px;
padding: 12px;
border: 1px solid rgba(255, 127, 0, 0.22);
border-radius: var(--vp-radius);
background: #fff;
color: inherit;
text-align: left;
font: inherit;
cursor: pointer;
display: grid;
gap: 8px;
align-content: start;
}
.vp-map-dispatch-action:hover,
.vp-map-dispatch-action:focus-visible {
border-color: rgba(255, 127, 0, 0.48);
box-shadow: 0 10px 24px rgba(24, 39, 75, 0.08);
outline: none;
}
.vp-map-dispatch-action:disabled {
cursor: not-allowed;
opacity: 0.62;
}
.vp-map-dispatch-action strong {
color: var(--vp-text);
font-size: 18px;
line-height: 24px;
font-weight: 700;
word-break: break-word;
}
.vp-map-dispatch-action span {
color: var(--vp-text-muted);
font-size: 12px;
line-height: 18px;
}
.vp-map-dispatch-action em {
color: var(--vp-primary);
font-size: 12px;
font-style: normal;
font-weight: 700;
}
.vp-map-customer-package {
padding: 14px;
border: 1px solid rgba(0, 164, 184, 0.24);
@@ -8451,6 +8526,8 @@ button.vp-realtime-command-item:focus-visible {
.vp-map-service-rail-actions,
.vp-map-decision-board,
.vp-map-decision-grid,
.vp-map-dispatch-actions,
.vp-map-dispatch-actions-grid,
.vp-map-kpi-strip,
.vp-map-selected-service-strip,
.vp-map-selected-service-actions,

View File

@@ -9557,6 +9557,12 @@ test('shows realtime freshness status for recently updated and stale vehicles',
expect(screen.getByRole('button', { name: '地图现场指挥 关注车辆 定位关注车' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '地图现场指挥 轨迹复盘 打开轨迹' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '地图现场指挥 通知证据 告警事件' })).toBeInTheDocument();
expect(screen.getByText('地图调度处置栏')).toBeInTheDocument();
expect(screen.getByText('把地图上的车辆直接转成调度动作:先处理关注车辆,再复盘选中车辆,最后导出交接证据。')).toBeInTheDocument();
expect(screen.getByRole('button', { name: '地图调度处置栏 关注车辆 1 辆 告警事件' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '地图调度处置栏 复盘选中 粤A超时1 轨迹回放' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '地图调度处置栏 车辆档案 粤A超时1 车辆服务' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '地图调度处置栏 交接证据 2 辆 导出CSV' })).toBeInTheDocument();
expect(screen.getByText('实时盯车')).toBeInTheDocument();
expect(screen.getAllByText('异常优先').length).toBeGreaterThanOrEqual(1);
expect(screen.getAllByText('轨迹复盘').length).toBeGreaterThanOrEqual(1);