feat(platform): add map view modes
This commit is contained in:
@@ -1323,6 +1323,44 @@ export function Realtime({
|
||||
onClick: () => selectedMapRow && onOpenHistory?.(selectedMapRow.vin, selectedVehicleProtocol)
|
||||
}
|
||||
];
|
||||
const mapViewModeItems = [
|
||||
{
|
||||
label: '运营总览',
|
||||
value: `${rows.length.toLocaleString()} 辆`,
|
||||
detail: `在线 ${onlineCount.toLocaleString()},有效定位 ${locatedCount.toLocaleString()},先确认客户能看到的车辆范围。`,
|
||||
action: '当前页',
|
||||
color: 'blue' as const,
|
||||
disabled: false,
|
||||
onClick: () => load(filters, pagination.currentPage, pagination.pageSize)
|
||||
},
|
||||
{
|
||||
label: '异常优先',
|
||||
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' })
|
||||
},
|
||||
{
|
||||
label: '轨迹复盘',
|
||||
value: selectedVehicleLabel,
|
||||
detail: selectedMapRow ? '围绕选中车辆进入轨迹、统计和历史查询。' : '从地图或车辆列表选择一辆车后复盘。',
|
||||
action: '选中车辆',
|
||||
color: selectedMapRow ? 'blue' as const : 'grey' as const,
|
||||
disabled: !selectedMapRow || !canOpenVehicle(selectedMapRow.vin),
|
||||
onClick: () => selectedMapRow && onOpenHistory?.(selectedMapRow.vin, selectedVehicleProtocol)
|
||||
},
|
||||
{
|
||||
label: '交付导出',
|
||||
value: `${rows.length.toLocaleString()} 辆`,
|
||||
detail: '导出当前地图车辆清单、在线状态和客户交付证据。',
|
||||
action: '导出证据',
|
||||
color: rows.length > 0 ? 'blue' as const : 'grey' as const,
|
||||
disabled: rows.length === 0,
|
||||
onClick: exportRealtime
|
||||
}
|
||||
];
|
||||
const mapCustomerPackageItems = [
|
||||
{
|
||||
label: '车辆范围',
|
||||
@@ -1825,6 +1863,39 @@ export function Realtime({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="vp-map-view-mode">
|
||||
<div className="vp-map-view-mode-summary">
|
||||
<Space wrap>
|
||||
<Tag color="blue">地图视图模式</Tag>
|
||||
<Tag color={mapAttentionRows.length > 0 ? 'orange' : 'green'}>
|
||||
{mapAttentionRows.length > 0 ? '异常优先' : '运营稳定'}
|
||||
</Tag>
|
||||
<Tag color={selectedMapRow ? 'blue' : 'grey'}>{selectedVehicleLabel}</Tag>
|
||||
</Space>
|
||||
<Typography.Text strong>按客户现场使用场景切换地图重点:运营总览、异常优先、轨迹复盘或交付导出。</Typography.Text>
|
||||
<Typography.Text type="secondary">
|
||||
视图模式只改变工作重点,底层仍围绕同一批车辆、同一个时间上下文和同一套服务动作。
|
||||
</Typography.Text>
|
||||
</div>
|
||||
<div className="vp-map-view-mode-grid">
|
||||
{mapViewModeItems.map((item) => (
|
||||
<button
|
||||
key={item.label}
|
||||
type="button"
|
||||
className="vp-map-view-mode-item"
|
||||
disabled={item.disabled}
|
||||
onClick={item.onClick}
|
||||
aria-label={`地图视图模式 ${item.label} ${item.value} ${item.action}`}
|
||||
>
|
||||
<Tag color={item.color}>{item.label}</Tag>
|
||||
<strong>{item.value}</strong>
|
||||
<span>{item.detail}</span>
|
||||
<em>{item.action}</em>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="vp-map-field-command">
|
||||
<div className="vp-map-field-command-summary">
|
||||
<Space wrap>
|
||||
|
||||
@@ -5093,6 +5093,76 @@ button.vp-realtime-command-item:focus-visible {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.vp-map-view-mode {
|
||||
padding: 14px;
|
||||
border: 1px solid rgba(22, 100, 255, 0.2);
|
||||
border-radius: var(--vp-radius);
|
||||
background: #f7faff;
|
||||
display: grid;
|
||||
grid-template-columns: minmax(300px, 0.72fr) minmax(0, 1.28fr);
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.vp-map-view-mode-summary {
|
||||
display: grid;
|
||||
align-content: start;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.vp-map-view-mode-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.vp-map-view-mode-item {
|
||||
min-height: 150px;
|
||||
padding: 12px;
|
||||
border: 1px solid var(--vp-border);
|
||||
border-radius: var(--vp-radius);
|
||||
background: #fbfcff;
|
||||
color: inherit;
|
||||
text-align: left;
|
||||
font: inherit;
|
||||
cursor: pointer;
|
||||
display: grid;
|
||||
align-content: start;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.vp-map-view-mode-item:hover,
|
||||
.vp-map-view-mode-item:focus-visible {
|
||||
border-color: rgba(22, 100, 255, 0.42);
|
||||
box-shadow: 0 10px 24px rgba(24, 39, 75, 0.08);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.vp-map-view-mode-item:disabled {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.62;
|
||||
}
|
||||
|
||||
.vp-map-view-mode-item strong {
|
||||
color: var(--vp-text);
|
||||
font-size: 18px;
|
||||
line-height: 24px;
|
||||
font-weight: 700;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.vp-map-view-mode-item span {
|
||||
color: var(--vp-text-muted);
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
}
|
||||
|
||||
.vp-map-view-mode-item em {
|
||||
color: var(--vp-primary);
|
||||
font-size: 12px;
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.vp-map-kpi-strip {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
@@ -11099,6 +11169,8 @@ button.vp-realtime-command-item:focus-visible {
|
||||
.vp-map-service-rail-actions,
|
||||
.vp-map-decision-board,
|
||||
.vp-map-decision-grid,
|
||||
.vp-map-view-mode,
|
||||
.vp-map-view-mode-grid,
|
||||
.vp-map-dispatch-actions,
|
||||
.vp-map-dispatch-actions-grid,
|
||||
.vp-map-area-monitor,
|
||||
|
||||
@@ -10607,6 +10607,12 @@ test('shows realtime freshness status for recently updated and stale vehicles',
|
||||
expect(screen.getByText('地图客户决策')).toBeInTheDocument();
|
||||
expect(screen.getByText('先判断车辆是否在线、是否有位置、是否有异常,再进入单车轨迹和历史查询。')).toBeInTheDocument();
|
||||
expect(screen.getByText('地图页面向客户展示车辆服务状态,数据通道只作为定位、在线和异常追溯依据。')).toBeInTheDocument();
|
||||
expect(screen.getByText('地图视图模式')).toBeInTheDocument();
|
||||
expect(screen.getByText('按客户现场使用场景切换地图重点:运营总览、异常优先、轨迹复盘或交付导出。')).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: '地图视图模式 运营总览 2 辆 当前页' })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: '地图视图模式 异常优先 1 辆 关注车辆' })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: '地图视图模式 轨迹复盘 粤A超时1 选中车辆' })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: '地图视图模式 交付导出 2 辆 导出证据' })).toBeInTheDocument();
|
||||
expect(screen.getByText('先看在线')).toBeInTheDocument();
|
||||
expect(screen.getByText('再看定位')).toBeInTheDocument();
|
||||
expect(screen.getByText('优先异常')).toBeInTheDocument();
|
||||
|
||||
Reference in New Issue
Block a user