feat(platform): add live map dispatch desk

This commit is contained in:
lingniu
2026-07-05 16:53:21 +08:00
parent bc1fb71944
commit 4e829da048
4 changed files with 154 additions and 0 deletions

View File

@@ -1287,6 +1287,46 @@ export function Realtime({
onClick: exportRealtime
}
];
const realtimeMapDispatchItems = [
{
title: '查看在线车辆',
value: `${onlineCount.toLocaleString()} 在线`,
detail: `定位有效 ${locatedCount.toLocaleString()} 辆,先确认客户当前能看到哪些车。`,
action: '实时地图',
color: onlineCount > 0 ? 'green' as const : 'orange' as const,
disabled: false,
onClick: () => {
window.location.hash = buildAppHash({ page: 'map', protocol: filters.protocol, filters: { ...filters, online: 'online' } });
}
},
{
title: '复盘选中车辆',
value: selectedMapRow?.plate || selectedMapRow?.vin || '先选车',
detail: selectedMapRow ? `${vehicleServiceStatus(selectedMapRow).label}${dataFreshness(selectedMapRow).detail}` : '从地图或实时列表选择车辆后,回放轨迹和里程变化。',
action: '轨迹回放',
color: selectedMapRow ? vehicleServiceStatus(selectedMapRow).color : 'grey' as const,
disabled: !selectedMapRow || !canOpenVehicle(selectedMapRow.vin),
onClick: () => selectedMapRow && onOpenHistory?.(selectedMapRow.vin, selectedVehicleProtocol)
},
{
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: !onOpenQuality,
onClick: () => onOpenQuality?.({ serviceStatus: 'degraded', protocol: filters.protocol })
},
{
title: '导出当前态势',
value: `${rows.length.toLocaleString()} 辆当前页`,
detail: '导出在线、位置、速度、SOC、里程和数据通道证据用于客户交接。',
action: '导出CSV',
color: rows.length > 0 ? 'blue' as const : 'grey' as const,
disabled: rows.length === 0,
onClick: exportRealtime
}
];
const realtimeCustomerQuestions = [
{
question: '这辆车现在在哪里?',
@@ -1831,6 +1871,36 @@ export function Realtime({
</button>
))}
</div>
<div className="vp-realtime-map-dispatch">
<div className="vp-realtime-map-dispatch-copy">
<Space wrap>
<Tag color="blue"></Tag>
<Tag color={amapConfigured ? 'green' : 'orange'}>{amapConfigured ? '高德地图可用' : '坐标预览'}</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-realtime-map-dispatch-grid">
{realtimeMapDispatchItems.map((item) => (
<button
key={item.title}
type="button"
className="vp-realtime-map-dispatch-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-realtime-customer-steps">
{realtimeCustomerJourneyItems.map((item) => (
<button

View File

@@ -1822,6 +1822,79 @@ body {
line-height: 18px;
}
.vp-realtime-map-dispatch {
padding: 16px;
border-bottom: 1px solid var(--vp-border);
background: #f8fbff;
display: grid;
grid-template-columns: minmax(260px, 0.72fr) minmax(0, 1.28fr);
gap: 14px;
}
.vp-realtime-map-dispatch-copy {
padding: 14px;
border: 1px solid rgba(22, 100, 255, 0.18);
border-radius: var(--vp-radius);
background: #ffffff;
display: grid;
gap: 10px;
align-content: start;
}
.vp-realtime-map-dispatch-grid {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 10px;
}
.vp-realtime-map-dispatch-item {
min-height: 146px;
padding: 12px;
border: 1px solid var(--vp-border);
border-radius: var(--vp-radius);
background: #ffffff;
color: inherit;
text-align: left;
cursor: pointer;
font: inherit;
display: grid;
gap: 8px;
align-content: start;
}
.vp-realtime-map-dispatch-item:hover,
.vp-realtime-map-dispatch-item:focus-visible {
border-color: rgba(22, 100, 255, 0.42);
box-shadow: var(--vp-shadow-sm);
outline: none;
}
.vp-realtime-map-dispatch-item:disabled {
cursor: not-allowed;
opacity: 0.58;
}
.vp-realtime-map-dispatch-item strong {
color: var(--vp-text);
font-size: 16px;
line-height: 22px;
word-break: break-word;
}
.vp-realtime-map-dispatch-item span {
color: var(--vp-text-muted);
font-size: 12px;
line-height: 18px;
}
.vp-realtime-map-dispatch-item em {
color: var(--vp-primary);
font-size: 12px;
font-style: normal;
font-weight: 700;
line-height: 18px;
}
.vp-realtime-customer-steps {
padding: 16px;
display: grid;
@@ -7251,6 +7324,8 @@ button.vp-realtime-command-item:focus-visible {
.vp-realtime-question-board,
.vp-realtime-question-grid,
.vp-realtime-next-actions,
.vp-realtime-map-dispatch,
.vp-realtime-map-dispatch-grid,
.vp-realtime-customer-steps,
.vp-time-window-monitor .semi-card-body,
.vp-time-window-controls,

View File

@@ -9236,6 +9236,13 @@ test('frames realtime page as one vehicle service with source evidence', async (
expect(screen.getAllByText('高德地图待配置').length).toBeGreaterThan(0);
expect(screen.getByText('客户实时监控')).toBeInTheDocument();
expect(screen.getByText('从实时列表直接完成车辆监控闭环')).toBeInTheDocument();
expect(screen.getByText('实时地图调度台')).toBeInTheDocument();
expect(screen.getByText('像现代车队 Live Map 一样,把地图作为调度指挥台:先看在线位置,再处理轨迹、告警和导出。')).toBeInTheDocument();
expect(screen.getByText('协议来源只作为车辆位置可信度证据,客户主路径是找车、调度、复盘和通知。')).toBeInTheDocument();
expect(screen.getByRole('button', { name: '实时地图调度台 查看在线车辆 实时地图' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '实时地图调度台 复盘选中车辆 轨迹回放' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '实时地图调度台 处理异常车辆 告警事件' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '实时地图调度台 导出当前态势 导出CSV' })).toBeInTheDocument();
expect(screen.getByText('实时客户常问')).toBeInTheDocument();
expect(screen.getByText('把实时数据翻译成客户能直接理解的车辆状态')).toBeInTheDocument();
expect(screen.getByRole('button', { name: '实时客户常问 这辆车现在在哪里? 地图定位' })).toBeInTheDocument();