feat(platform): clarify customer history evidence copy

This commit is contained in:
lingniu
2026-07-05 05:20:13 +08:00
parent 488da08d39
commit 69496d6ca7
2 changed files with 25 additions and 25 deletions

View File

@@ -398,7 +398,7 @@ function deliveryPackageText({
return [
'【客户数据交付包】',
`交付状态:${deliveryState}`,
'交付物:位置历史 / 轨迹回放 / 里程复核 / RAW证据 / 字段明细 / 质量提示',
'交付物:位置历史 / 轨迹回放 / 里程复核 / 原始证据 / 字段明细 / 质量提示',
`车辆范围:${vehicle || '全部车辆'}`,
`证据来源:${protocol || '全部来源'}`,
`时间范围:${filters.dateFrom?.trim() || '-'}${filters.dateTo?.trim() || '-'}`,
@@ -408,7 +408,7 @@ function deliveryPackageText({
`区间里程:${formatNumber(mileageDelta, ' km')}`,
`质量提示:断点 ${anomalySummary.gapCount.toLocaleString()} / 里程回退 ${anomalySummary.mileageRollbackCount.toLocaleString()} / 超速 ${anomalySummary.overspeedCount.toLocaleString()}`,
`位置导出:${appURL(buildAppHash({ page: 'history-query', keyword: vehicle, protocol, filters: { ...evidenceFilters, tab: 'location' } }))}`,
`RAW导出:${appURL(buildAppHash({ page: 'history-query', keyword: vehicle, protocol, filters: { ...evidenceFilters, tab: 'raw', includeFields: 'true' } }))}`,
`原始导出:${appURL(buildAppHash({ page: 'history-query', keyword: vehicle, protocol, filters: { ...evidenceFilters, tab: 'raw', includeFields: 'true' } }))}`,
`字段导出:${appURL(buildAppHash({ page: 'history-query', keyword: vehicle, protocol, filters: { ...evidenceFilters, tab: 'fields', includeFields: 'true', ...(filters.fields?.trim() ? { fields: filters.fields.trim() } : {}) } }))}`,
`轨迹回放:${appURL(buildAppHash({ page: 'history', keyword: vehicle, protocol, filters: evidenceFilters }))}`,
`里程复核:${appURL(buildAppHash({ page: 'mileage', keyword: vehicle, protocol, filters: evidenceFilters }))}`,
@@ -605,7 +605,7 @@ function trajectoryCustomerDecisionText({
'1. 先看轨迹覆盖:确认是否有足够有效坐标。',
'2. 再看时间断点:断点会影响定位连续性和客户解释。',
'3. 再看里程速度:区间里程、速度和轨迹方向需要能互相解释。',
'4. 最后回到证据:异常点必须打开 RAW、字段明细和里程统计复核。',
'4. 最后回到证据:异常点必须打开原始记录、字段明细和里程统计复核。',
`轨迹回放:${appURL(buildAppHash({ page: 'history', keyword: vehicle, protocol, filters: evidenceFilters }))}`,
`数据导出:${appURL(buildAppHash({ page: 'history-query', keyword: vehicle, protocol, filters: { ...evidenceFilters, tab: 'location' } }))}`,
`原始记录:${appURL(buildAppHash({ page: 'history-query', keyword: vehicle, protocol, filters: { ...evidenceFilters, tab: 'raw', includeFields: 'true' } }))}`,
@@ -904,9 +904,9 @@ export function History({
{
label: '证据交付',
value: `${(rawFrames.total ?? 0).toLocaleString()}`,
detail: rawFieldRows.length > 0 ? `${rawFieldRows.length.toLocaleString()} 个字段明细可导出。` : '异常点需要回到 RAW 和字段明细。',
detail: rawFieldRows.length > 0 ? `${rawFieldRows.length.toLocaleString()} 个字段明细可导出。` : '异常点需要回到原始记录和字段明细。',
color: (rawFrames.total ?? 0) > 0 ? 'blue' as const : 'grey' as const,
action: 'RAW证据',
action: '原始证据',
disabled: false,
onClick: () => openQueryTab('raw')
}
@@ -940,11 +940,11 @@ export function History({
onClick: () => onOpenMileage?.({ keyword: currentVehicleKeyword, protocol: currentProtocol, ...(filters.dateFrom ? { dateFrom: filters.dateFrom } : {}), ...(filters.dateTo ? { dateTo: filters.dateTo } : {}) })
},
{
title: 'RAW证据',
title: '原始证据',
value: `${(rawFrames.total ?? 0).toLocaleString()}`,
detail: '保留接入证据,用于解释字段值来源。',
color: (rawFrames.total ?? 0) > 0 ? 'blue' as const : 'grey' as const,
action: '导出RAW',
action: '导出原始',
disabled: rawFrames.items.length === 0,
onClick: () => exportRawFrames()
},
@@ -1250,11 +1250,11 @@ export function History({
</Space>
<Typography.Title heading={5} style={{ margin: 0 }}></Typography.Title>
<Typography.Text type="secondary">
RAW证
</Typography.Text>
<Space wrap>
<Button size="small" theme="solid" type="primary" onClick={() => openQueryTab('location')}></Button>
<Button size="small" theme="light" type="primary" onClick={() => openQueryTab('raw')}>RAW</Button>
<Button size="small" theme="light" type="primary" onClick={() => openQueryTab('raw')}></Button>
<Button size="small" theme="light" type="primary" onClick={() => openQueryTab('fields')}></Button>
<Button size="small" theme="light" onClick={copyDeliveryPackage}></Button>
</Space>
@@ -1283,10 +1283,10 @@ export function History({
},
{
step: '03',
title: 'RAW证据',
title: '原始证据',
value: `${(rawFrames.total ?? 0).toLocaleString()}`,
detail: '保留原始接入记录,用于解释位置、里程和字段来源。',
action: '导出RAW',
action: '导出原始',
color: (rawFrames.total ?? 0) > 0 ? 'blue' as const : 'grey' as const,
disabled: rawFrames.items.length === 0,
onClick: exportRawFrames
@@ -1342,14 +1342,14 @@ export function History({
<Tag color={deliveryStateColor}>{deliveryState}</Tag>
<Tag color={amapConfigured ? 'green' : 'orange'}>{amapConfigured ? '高德地图可用' : '坐标预览'}</Tag>
</Space>
<Typography.Title heading={5} style={{ margin: 0 }}> RAW</Typography.Title>
<Typography.Title heading={5} style={{ margin: 0 }}></Typography.Title>
<Typography.Text type="secondary">
</Typography.Text>
<Space wrap>
<Button size="small" theme="solid" type="primary" icon={<IconCopy />} onClick={copyTrajectoryDecision}></Button>
<Button size="small" disabled={validLocations.length === 0} onClick={() => openQueryTab('location')}></Button>
<Button size="small" disabled={(rawFrames.total ?? 0) === 0} onClick={() => openQueryTab('raw')}>RAW证</Button>
<Button size="small" disabled={(rawFrames.total ?? 0) === 0} onClick={() => openQueryTab('raw')}></Button>
<Button size="small" disabled={!onOpenMileage} onClick={() => onOpenMileage?.({ keyword: currentVehicleKeyword, protocol: currentProtocol, ...(filters.dateFrom ? { dateFrom: filters.dateFrom } : {}), ...(filters.dateTo ? { dateTo: filters.dateTo } : {}) })}></Button>
</Space>
</div>
@@ -1451,7 +1451,7 @@ export function History({
</Space>
<Typography.Text strong>{deliveryScopeText}</Typography.Text>
<Typography.Text type="secondary">
RAW
</Typography.Text>
<Space wrap>
<Button size="small" theme="solid" type="primary" icon={<IconCopy />} onClick={copyDeliveryPackage}>
@@ -1481,7 +1481,7 @@ export function History({
value: `${(rawFrames.total ?? 0).toLocaleString()}`,
detail: '用于证明数据来自接入协议解析后的真实记录。',
color: (rawFrames.total ?? 0) > 0 ? 'blue' as const : 'grey' as const,
action: '导出RAW',
action: '导出原始',
disabled: rawFrames.items.length === 0,
onClick: exportRawFrames
},
@@ -1624,7 +1624,7 @@ export function History({
value: `${(rawFrames.total ?? 0).toLocaleString()}`,
detail: '保留接入侧原始记录,用于解释位置、里程和字段值的来源。',
primaryText: '看原始',
secondaryText: '导出RAW',
secondaryText: '导出原始',
disabled: false,
secondaryDisabled: rawFrames.items.length === 0,
onPrimary: () => openQueryTab('raw'),

View File

@@ -5418,17 +5418,17 @@ 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('先判断轨迹能否复盘,再进入 RAW、字段和里程证据')).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: '客户轨迹决策 里程速度 里程复核' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户轨迹决策 证据交付 RAW证据' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户轨迹决策 证据交付 原始证据' })).toBeInTheDocument();
fireEvent.click(screen.getAllByRole('button', { name: /复制决策说明/ })[0]);
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('【客户轨迹决策说明】'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('决策结论:可复盘,需附异常说明'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('客户复盘路径:'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('4. 最后回到证据:异常点必须打开 RAW、字段明细和里程统计复核。'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('4. 最后回到证据:异常点必须打开原始记录、字段明细和里程统计复核。'));
fireEvent.click(screen.getByRole('button', { name: /复制轨迹摘要/ }));
@@ -6456,27 +6456,27 @@ test('shows parsed field history as a flattened evidence table', async () => {
expect(screen.getByText('先锁定车辆和时间窗,再选择交付物并导出')).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户数据导出 选择范围 调整筛选' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户数据导出 位置历史 导出位置' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户数据导出 RAW证据 导出RAW' })).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.getAllByRole('button', { name: /复制决策说明/ }).length).toBeGreaterThanOrEqual(1);
expect(screen.getByRole('button', { name: '客户轨迹决策 证据交付 RAW证据' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户轨迹决策 证据交付 原始证据' })).toBeInTheDocument();
expect(screen.getByText('客户数据交付包')).toBeInTheDocument();
expect(screen.getByText('面向客户交付时,先确认车辆、时间、交付物和质量提示,再导出位置、RAW 或字段明细,避免把内部排查过程直接暴露给客户。')).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户数据交付 原始证据 导出RAW' })).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.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: '客户交付清单 RAW证据 导出RAW' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户交付清单 原始证据 导出原始' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户交付清单 字段明细 字段明细' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户交付清单 质量提示 复制清单' })).toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: /复制交付清单/ }));
await waitFor(() => {
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('交付物:位置历史 / 轨迹回放 / 里程复核 / RAW证据 / 字段明细 / 质量提示'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('交付物:位置历史 / 轨迹回放 / 里程复核 / 原始证据 / 字段明细 / 质量提示'));
});
expect(await screen.findByRole('tab', { name: '字段明细' })).toHaveAttribute('aria-selected', 'true');
expect(fetchMock).toHaveBeenCalledWith('/api/history/raw-frames/query', expect.objectContaining({