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: '统计查询' }));