feat(platform): add history replay customer navigation

This commit is contained in:
lingniu
2026-07-05 16:34:16 +08:00
parent 3d2d065246
commit 65ac26ef99
4 changed files with 153 additions and 2 deletions

View File

@@ -1346,6 +1346,44 @@ export function History({
}
loadRawFrames(nextFilters, 1, rawPagination.pageSize, tab === 'fields');
};
const customerReplayNavigation = [
{
title: '选车和时间',
value: currentVehicleKeyword || '待选择车辆',
detail: `${currentProtocol || '全部数据通道'} / ${filters.dateFrom || '-'}${filters.dateTo || '-'}`,
action: '调整筛选',
color: currentVehicleKeyword ? 'green' as const : 'orange' as const,
disabled: false,
onClick: () => document.querySelector<HTMLInputElement>('input[name="keyword"]')?.focus()
},
{
title: '回放路线',
value: validLocations.length > 0 ? `${validLocations.length.toLocaleString()}` : '待查询',
detail: '按时间顺序播放轨迹,核对路线、停留和断点。',
action: '播放轨迹',
color: validLocations.length > 0 ? 'green' as const : 'grey' as const,
disabled: validLocations.length === 0,
onClick: () => openQueryTab('location')
},
{
title: '核对里程',
value: formatNumber(mileageDelta, ' km'),
detail: '跳到同一车辆和时间窗的里程统计,检查区间差值。',
action: '统计查询',
color: isFiniteNumber(mileageDelta) ? 'green' as const : 'grey' as const,
disabled: !onOpenMileage || !currentVehicleKeyword,
onClick: () => onOpenMileage?.({ keyword: currentVehicleKeyword, protocol: currentProtocol, ...(filters.dateFrom ? { dateFrom: filters.dateFrom } : {}), ...(filters.dateTo ? { dateTo: filters.dateTo } : {}) })
},
{
title: '导出证据',
value: deliveryState,
detail: '复制客户交付包包含轨迹、位置、RAW、字段和统计链接。',
action: '复制交付',
color: deliveryStateColor,
disabled: false,
onClick: copyDeliveryPackage
}
];
return (
<div className="vp-page">
@@ -1528,6 +1566,38 @@ export function History({
</div>
</Card>
) : null}
<Card bordered title="客户复盘导航" style={{ marginTop: 16 }}>
<div className="vp-history-replay-nav">
<div className="vp-history-replay-nav-summary">
<Space wrap>
<Tag color="blue">Trips History</Tag>
<Tag color={trajectoryDecisionColor}>{trajectoryDecisionState}</Tag>
<Tag color={deliveryStateColor}>{deliveryState}</Tag>
</Space>
<Typography.Title heading={5} style={{ margin: 0 }}> Trips History 线</Typography.Title>
<Typography.Text type="secondary">
RAW 线
</Typography.Text>
</div>
<div className="vp-history-replay-nav-grid">
{customerReplayNavigation.map((item) => (
<button
key={item.title}
type="button"
className="vp-history-replay-nav-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>
</Card>
<Card bordered className="vp-trip-workbench" bodyStyle={{ padding: 0 }}>
<div className="vp-trip-workbench-map">
<div className="vp-trip-workbench-copy">

View File

@@ -5510,6 +5510,77 @@ button.vp-realtime-command-item:focus-visible {
font-weight: 700;
}
.vp-history-replay-nav {
display: grid;
grid-template-columns: minmax(300px, 0.7fr) minmax(0, 1.3fr);
gap: 14px;
}
.vp-history-replay-nav-summary {
min-height: 158px;
padding: 14px;
border: 1px solid rgba(22, 100, 255, 0.18);
border-radius: var(--vp-radius);
background: #f7faff;
display: grid;
gap: 10px;
align-content: start;
}
.vp-history-replay-nav-grid {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 12px;
}
.vp-history-replay-nav-item {
min-height: 158px;
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;
gap: 8px;
align-content: start;
}
.vp-history-replay-nav-item:hover,
.vp-history-replay-nav-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-history-replay-nav-item:disabled {
cursor: not-allowed;
opacity: 0.62;
}
.vp-history-replay-nav-item strong {
color: var(--vp-text);
font-size: 18px;
line-height: 24px;
font-weight: 700;
word-break: break-word;
}
.vp-history-replay-nav-item span {
color: var(--vp-text-muted);
font-size: 12px;
line-height: 18px;
}
.vp-history-replay-nav-item em {
color: var(--vp-primary);
font-size: 12px;
font-style: normal;
font-weight: 700;
}
.vp-history-query-workbench {
display: grid;
grid-template-columns: minmax(260px, 0.68fr) minmax(0, 1.32fr);
@@ -7121,6 +7192,8 @@ button.vp-realtime-command-item:focus-visible {
.vp-history-report-template-grid,
.vp-history-question-board,
.vp-history-question-grid,
.vp-history-replay-nav,
.vp-history-replay-nav-grid,
.vp-history-query-workbench,
.vp-history-query-grid,
.vp-history-package-board,

View File

@@ -5516,6 +5516,12 @@ test('copies trajectory playback summary from history page', async () => {
expect((await screen.findAllByText('VIN-HISTORY-SUMMARY')).length).toBeGreaterThan(0);
expect(screen.getByText('轨迹回放工作台')).toBeInTheDocument();
expect(screen.getByText('客户复盘导航')).toBeInTheDocument();
expect(screen.getByText('像 Trips History 一样,先锁定车辆和时间,再回放路线、核对里程、导出证据。')).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户复盘导航 选车和时间 调整筛选' })).toBeInTheDocument();
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: '轨迹回放指标 轨迹点 2' })).toBeInTheDocument();
@@ -7267,7 +7273,7 @@ test('exports current history location page as csv', async () => {
render(<App />);
expect(await screen.findByText('VIN-EXPORT-LOC')).toBeInTheDocument();
expect((await screen.findAllByText('VIN-EXPORT-LOC')).length).toBeGreaterThan(0);
fireEvent.click(screen.getByRole('button', { name: '导出位置当前页 CSV' }));
expect(createObjectURL).toHaveBeenCalled();
@@ -8570,7 +8576,7 @@ test('opens same-day mileage statistics from history location row', async () =>
render(<App />);
expect(await screen.findByText('VIN-HISTORY-MILEAGE')).toBeInTheDocument();
expect((await screen.findAllByText('VIN-HISTORY-MILEAGE')).length).toBeGreaterThan(0);
const locationRow = screen.getByRole('row', { name: /VIN-HISTORY-MILEAGE/ });
fireEvent.click(within(locationRow).getByRole('button', { name: '统计查询' }));

View File

@@ -16,6 +16,7 @@
- Geotab 关于远程车队管理的说明把数据流描述为:车辆采集位置和健康信息,经网络到云端,再在 Web/Mobile dashboard 展示实时报告和告警。这与本项目架构一致,但产品表达应从 dashboard 和 alerts 开始而不是从接入来源开始。参考https://www.geotab.com/blog/remote-fleet-management/
- Fleetio 的车辆资产和报表资料把 Vehicle List、Vehicle Details、Service History、Service Schedule 等作为车队管理的高频入口。这说明车辆中心不能只是数据覆盖表,还要提供最近车辆、待维护车辆、服务历史/报表导出的资产作业入口。参考https://www.fleetio.com/ 和 https://www.fleetio.com/blog/fleet-management-reports
- Azuga 的车队跟踪资料强调实时跟踪、车辆资产保护、维护告警和洞察报表。这对应本项目车辆中心的作业栏最近上报、待关注车辆、身份维护和报表导出。参考https://www.azuga.com/
- Verizon Connect 把 live map 与 historic replays 放在同一个 GPS tracking 叙事里Geotab Trips History 支持查看车辆实时位置和历史行程Samsara GPS tracking 也把 Trip history 作为分析车辆行程效率的核心入口。因此历史页要先呈现“车辆 + 时间窗 + 轨迹回放 + 证据导出”的客户复盘路径,而不是先暴露 RAW/字段表。参考https://www.verizonconnect.com/solutions/gps-fleet-tracking-software/、https://support.geotab.com/help/mygeotab/fleet-activity/trips/trips-history、https://www.samsara.com/products/telematics/gps-fleet-tracking
## 对标后的产品改造规则
@@ -23,6 +24,7 @@
- “32960 / 808 / MQTT”不作为主任务名称只在车辆档案、历史证据、运维质量中作为来源可信度出现。
- 自定义时间窗必须成为跨页面共享的查询意图:轨迹、里程、历史数据、告警复盘使用同一组参数。
- 车辆中心要像资产系统一样把车辆清单变成作业入口:最近上报、待关注、身份维护、报表导出,而不是只提供表格筛选。
- 轨迹/历史页要像 Trips History先锁定车辆和时间随后回放路线、核对里程、导出证据RAW 和字段裁剪只作为复盘依据。
- 内部可观测性继续保留,但默认折叠在运维/依据层,避免客户把系统理解为“协议接入平台”。
## 本项目采用的产品原则