feat(platform): customerize history export workflow
This commit is contained in:
@@ -199,11 +199,11 @@ const rawExportColumns: CsvColumn<RawFrameRow>[] = [
|
||||
{ title: '大小B', value: (row) => row.rawSizeBytes },
|
||||
{ title: '设备时间', value: (row) => row.deviceTime },
|
||||
{ title: '入库时间', value: (row) => row.serverTime },
|
||||
{ title: '解析字段', value: (row) => row.parsedFields ?? {} }
|
||||
{ title: '字段明细', value: (row) => row.parsedFields ?? {} }
|
||||
];
|
||||
|
||||
const rawFieldExportColumns: CsvColumn<RawFieldRow>[] = [
|
||||
{ title: 'RAW ID', value: (row) => row.rawId },
|
||||
{ title: '原始记录ID', value: (row) => row.rawId },
|
||||
{ title: 'VIN', value: (row) => row.vin },
|
||||
{ title: '车牌', value: (row) => row.plate },
|
||||
{ title: '数据来源', value: (row) => row.protocol },
|
||||
@@ -316,20 +316,20 @@ function historyEvidencePackageText({
|
||||
...(filters.dateTo?.trim() ? { dateTo: filters.dateTo.trim() } : {})
|
||||
};
|
||||
return [
|
||||
'【历史证据包】',
|
||||
'【数据复核包】',
|
||||
`车辆:${vehicle || '全部车辆'}`,
|
||||
`数据来源:${protocol || '全部来源'}`,
|
||||
`查询范围:${filters.dateFrom?.trim() || '-'} 至 ${filters.dateTo?.trim() || '-'}`,
|
||||
`位置记录:${locationCount.toLocaleString()},有效定位:${validPointCount.toLocaleString()}`,
|
||||
`RAW帧:${rawCount.toLocaleString()},解析字段:${fieldCount.toLocaleString()}`,
|
||||
`原始记录:${rawCount.toLocaleString()},字段明细:${fieldCount.toLocaleString()}`,
|
||||
`区间里程:${formatNumber(mileageDelta, ' km')},最高速度:${formatNumber(maxSpeed, ' km/h')}`,
|
||||
`起点:${firstLocation?.deviceTime || firstLocation?.serverTime || '-'}`,
|
||||
`终点:${lastLocation?.deviceTime || lastLocation?.serverTime || '-'}`,
|
||||
`异常:断点 ${anomalySummary.gapCount.toLocaleString()} / 里程回退 ${anomalySummary.mileageRollbackCount.toLocaleString()} / 超速 ${anomalySummary.overspeedCount.toLocaleString()}`,
|
||||
`轨迹回放:${appURL(buildAppHash({ page: 'history', keyword: vehicle, protocol, filters: evidenceFilters }))}`,
|
||||
`历史位置:${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: 'fields', includeFields: 'true', ...(filters.fields?.trim() ? { fields: filters.fields.trim() } : {}) } }))}`,
|
||||
`原始记录:${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: 'mileage', keyword: vehicle, protocol, filters: evidenceFilters }))}`,
|
||||
`车辆服务:${appURL(buildAppHash({ page: 'detail', keyword: vehicle, protocol }))}`
|
||||
].join('\n');
|
||||
@@ -379,14 +379,14 @@ function trajectoryReviewPackageText({
|
||||
...(filters.dateTo?.trim() ? { dateTo: filters.dateTo.trim() } : {})
|
||||
};
|
||||
const anomalyAction = anomalySummary.gapCount > 0 || anomalySummary.mileageRollbackCount > 0 || anomalySummary.overspeedCount > 0
|
||||
? '建议核对 RAW 帧、解析字段、当日里程统计,并确认平台是否存在断链或补发。'
|
||||
? '建议核对原始记录、字段明细、当日里程统计,并确认平台是否存在断链或补发。'
|
||||
: '当前页未发现明显断点、里程回退或速度异常,可作为轨迹证据使用。';
|
||||
return [
|
||||
'【轨迹复盘交接包】',
|
||||
`车辆:${vehicle || '全部车辆'}`,
|
||||
`数据来源:${protocol || '全部来源'}`,
|
||||
`查询范围:${filters.dateFrom?.trim() || '-'} 至 ${filters.dateTo?.trim() || '-'}`,
|
||||
`轨迹规模:位置 ${locationCount.toLocaleString()} / 有效定位 ${validPointCount.toLocaleString()} / RAW ${rawCount.toLocaleString()} / 解析字段 ${fieldCount.toLocaleString()}`,
|
||||
`轨迹规模:位置 ${locationCount.toLocaleString()} / 有效定位 ${validPointCount.toLocaleString()} / 原始记录 ${rawCount.toLocaleString()} / 字段明细 ${fieldCount.toLocaleString()}`,
|
||||
`轨迹质量:定位覆盖率 ${formatPercent(coverageRate)} / 回放跨度 ${formatDurationMinutes(playbackSpanMinutes)} / 采样间隔 ${formatDurationMinutes(playbackIntervalMinutes, '/点')}`,
|
||||
`里程速度:区间里程 ${formatNumber(mileageDelta, ' km')} / 最高速度 ${formatNumber(maxSpeed, ' km/h')}`,
|
||||
`起点:${firstLocation?.deviceTime || firstLocation?.serverTime || '-'}`,
|
||||
@@ -400,8 +400,8 @@ function trajectoryReviewPackageText({
|
||||
`下一步:${anomalyAction}`,
|
||||
`轨迹回放:${appURL(buildAppHash({ page: 'history', keyword: vehicle, protocol, filters: evidenceFilters }))}`,
|
||||
`历史位置:${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: 'fields', includeFields: 'true', ...(filters.fields?.trim() ? { fields: filters.fields.trim() } : {}) } }))}`,
|
||||
`原始记录:${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: 'mileage', keyword: vehicle, protocol, filters: evidenceFilters }))}`,
|
||||
`车辆服务:${appURL(buildAppHash({ page: 'detail', keyword: vehicle, protocol }))}`
|
||||
].join('\n');
|
||||
@@ -448,15 +448,15 @@ function trajectoryImpactPackageText({
|
||||
`数据来源:${protocol || '全部来源'}`,
|
||||
`查询范围:${filters.dateFrom?.trim() || '-'} 至 ${filters.dateTo?.trim() || '-'}`,
|
||||
`业务状态:${operationState}`,
|
||||
`轨迹范围:位置 ${locationCount.toLocaleString()} / 有效定位 ${validPointCount.toLocaleString()} / RAW ${rawCount.toLocaleString()} / 字段 ${fieldCount.toLocaleString()}`,
|
||||
`轨迹范围:位置 ${locationCount.toLocaleString()} / 有效定位 ${validPointCount.toLocaleString()} / 原始记录 ${rawCount.toLocaleString()} / 字段明细 ${fieldCount.toLocaleString()}`,
|
||||
`定位覆盖率:${formatPercent(coverageRate)}`,
|
||||
`回放跨度:${formatDurationMinutes(playbackSpanMinutes)},采样间隔:${formatDurationMinutes(playbackIntervalMinutes, '/点')}`,
|
||||
`里程速度:${formatNumber(mileageDelta, ' km')} / ${formatNumber(maxSpeed, ' km/h')}`,
|
||||
`异常影响:断点 ${anomalySummary.gapCount.toLocaleString()} / 里程回退 ${anomalySummary.mileageRollbackCount.toLocaleString()} / 超速 ${anomalySummary.overspeedCount.toLocaleString()}`,
|
||||
`地图能力:${amapConfigured ? '高德 JS API 已配置' : '高德 JS API 待配置'}`,
|
||||
`轨迹回放:${appURL(buildAppHash({ page: 'history', keyword: vehicle, protocol, filters: evidenceFilters }))}`,
|
||||
`历史查询:${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: 'location' } }))}`,
|
||||
`原始记录:${appURL(buildAppHash({ page: 'history-query', keyword: vehicle, protocol, filters: { ...evidenceFilters, tab: 'raw', includeFields: 'true' } }))}`,
|
||||
`车辆服务:${appURL(buildAppHash({ page: 'detail', keyword: vehicle, protocol }))}`
|
||||
].join('\n');
|
||||
}
|
||||
@@ -576,7 +576,7 @@ export function History({
|
||||
if ((forceIncludeFields || isIncludeFieldsEnabled(nextFilters.includeFields)) && shouldBlockRawFieldQuery(nextFilters)) {
|
||||
setRawFrames({ items: [], total: 0, limit: pageSize, offset: (page - 1) * pageSize });
|
||||
setRawPagination({ currentPage: page, pageSize });
|
||||
Toast.warning('RAW 解析字段查询需要车辆、时间范围或字段裁剪');
|
||||
Toast.warning('字段明细查询需要车辆、时间范围或字段裁剪');
|
||||
return;
|
||||
}
|
||||
setLoadingRaw(true);
|
||||
@@ -669,13 +669,13 @@ export function History({
|
||||
const hasTrajectoryAnomaly = trajectoryAnomalies.gapCount > 0 || trajectoryAnomalies.mileageRollbackCount > 0 || trajectoryAnomalies.overspeedCount > 0;
|
||||
const currentVehicleKeyword = filters.keyword?.trim() ?? '';
|
||||
const currentProtocol = filters.protocol?.trim() ?? '';
|
||||
const pageTitle = mode === 'query' ? '历史查询' : '轨迹回放';
|
||||
const pageTitle = mode === 'query' ? '数据导出' : '轨迹回放';
|
||||
const pageDescription = mode === 'query'
|
||||
? '按车辆查询历史位置、RAW 帧和扁平解析字段,支持分页、字段裁剪和证据导出'
|
||||
: '按车辆查询历史位置、轨迹回放和 RAW 帧证据,数据来源只作为过滤和诊断维度';
|
||||
? '按车辆、时间和数据通道导出位置记录、原始记录和字段明细,支持分页、字段裁剪和 CSV 导出'
|
||||
: '按车辆查询历史位置和轨迹回放,原始记录只作为复核证据,数据来源仅用于过滤';
|
||||
const scopeDescription = mode === 'query'
|
||||
? '历史位置、RAW 帧和解析字段按当前车辆与来源范围分页查询。'
|
||||
: '历史位置和 RAW 帧按当前车辆与来源范围查询。';
|
||||
? '位置记录、原始记录和字段明细按当前车辆与时间范围分页查询。'
|
||||
: '历史位置和原始记录按当前车辆与时间范围查询。';
|
||||
const amapConfigured = isAMapConfigured();
|
||||
const selectedFieldCount = splitFields(filters.fields).length;
|
||||
const playbackRows = validLocations.length > 0 ? validLocations : locationItems;
|
||||
@@ -697,7 +697,7 @@ export function History({
|
||||
currentProtocol ? `数据来源:${currentProtocol}` : '',
|
||||
filters.dateFrom?.trim() ? `开始时间:${filters.dateFrom.trim()}` : '',
|
||||
filters.dateTo?.trim() ? `结束时间:${filters.dateTo.trim()}` : '',
|
||||
isIncludeFieldsEnabled(filters.includeFields) ? '返回解析字段' : '',
|
||||
isIncludeFieldsEnabled(filters.includeFields) ? '返回字段明细' : '',
|
||||
selectedFieldCount > 0 ? `字段裁剪:${selectedFieldCount} 个` : ''
|
||||
].filter(Boolean);
|
||||
const clearRangeFilters = () => {
|
||||
@@ -713,19 +713,19 @@ export function History({
|
||||
};
|
||||
const exportRawFrames = () => {
|
||||
if (rawFrames.items.length === 0) {
|
||||
Toast.warning('当前没有可导出的 RAW 帧');
|
||||
Toast.warning('当前没有可导出的原始记录');
|
||||
return;
|
||||
}
|
||||
downloadCsv(exportFileName('raw-frames', filters), buildCsv(rawExportColumns, rawFrames.items));
|
||||
Toast.success(`已导出 ${rawFrames.items.length} 条 RAW 帧`);
|
||||
Toast.success(`已导出 ${rawFrames.items.length} 条原始记录`);
|
||||
};
|
||||
const exportRawFields = () => {
|
||||
if (rawFieldRows.length === 0) {
|
||||
Toast.warning('当前没有可导出的解析字段');
|
||||
Toast.warning('当前没有可导出的字段明细');
|
||||
return;
|
||||
}
|
||||
downloadCsv(exportFileName('raw-fields', filters), buildCsv(rawFieldExportColumns, rawFieldRows));
|
||||
Toast.success(`已导出 ${rawFieldRows.length} 条解析字段`);
|
||||
Toast.success(`已导出 ${rawFieldRows.length} 条字段明细`);
|
||||
};
|
||||
const copyTrajectorySummary = () => {
|
||||
copyText(
|
||||
@@ -755,7 +755,7 @@ export function History({
|
||||
lastLocation,
|
||||
anomalySummary: trajectoryAnomalies
|
||||
}),
|
||||
'历史证据包'
|
||||
'数据复核包'
|
||||
);
|
||||
};
|
||||
const copyTrajectoryReviewPackage = () => {
|
||||
@@ -911,7 +911,7 @@ export function History({
|
||||
description={pageDescription}
|
||||
actions={(
|
||||
<Space>
|
||||
<Button icon={<IconCopy />} onClick={copyHistoryEvidencePackage}>复制历史证据包</Button>
|
||||
<Button icon={<IconCopy />} onClick={copyHistoryEvidencePackage}>复制数据复核包</Button>
|
||||
<Button disabled={!currentVehicleKeyword} onClick={() => onOpenVehicle(currentVehicleKeyword, currentProtocol)}>
|
||||
当前车辆服务
|
||||
</Button>
|
||||
@@ -934,7 +934,7 @@ export function History({
|
||||
<Form.Input field="dateFrom" label="开始时间" placeholder="2026-07-03 00:00:00" style={{ width: 210 }} />
|
||||
<Form.Input field="dateTo" label="结束时间" placeholder="2026-07-03 23:59:59" style={{ width: 210 }} />
|
||||
<Form.Checkbox field="includeFields" noLabel>
|
||||
返回解析字段
|
||||
返回字段明细
|
||||
</Form.Checkbox>
|
||||
<Form.TextArea
|
||||
field="fields"
|
||||
@@ -970,7 +970,7 @@ export function History({
|
||||
</Space>
|
||||
<Typography.Text strong>{currentVehicleKeyword || '全部车辆'}</Typography.Text>
|
||||
<Typography.Text type="secondary">
|
||||
轨迹、历史查询、RAW 证据和里程复核按同一车辆范围联动,用于调度复盘、客户问询和断链定位。
|
||||
轨迹、数据导出、原始记录和里程复核按同一车辆范围联动,用于调度复盘、客户问询和断链定位。
|
||||
</Typography.Text>
|
||||
<Space wrap>
|
||||
<Button size="small" icon={<IconCopy />} onClick={copyTrajectoryImpactPackage}>复制轨迹影响</Button>
|
||||
@@ -999,9 +999,9 @@ export function History({
|
||||
color: hasTrajectoryAnomaly ? 'orange' as const : 'green' as const
|
||||
},
|
||||
{
|
||||
label: 'RAW证据',
|
||||
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
|
||||
},
|
||||
{
|
||||
@@ -1026,7 +1026,7 @@ export function History({
|
||||
<Space>
|
||||
<span>轨迹回放作业台</span>
|
||||
<Button size="small" theme="light" icon={<IconCopy />} onClick={copyTrajectorySummary}>复制轨迹摘要</Button>
|
||||
<Button size="small" theme="light" icon={<IconCopy />} onClick={copyHistoryEvidencePackage}>复制历史证据包</Button>
|
||||
<Button size="small" theme="light" icon={<IconCopy />} onClick={copyHistoryEvidencePackage}>复制数据复核包</Button>
|
||||
<Button size="small" theme="light" icon={<IconCopy />} onClick={copyTrajectoryReviewPackage}>复制轨迹复盘包</Button>
|
||||
<Button size="small" theme="light" disabled={validLocations.length === 0} onClick={openAmapTrajectory}>高德线路</Button>
|
||||
</Space>
|
||||
@@ -1209,9 +1209,9 @@ export function History({
|
||||
))}
|
||||
</div>
|
||||
<div className="vp-trajectory-anomaly-action">
|
||||
<Tag color={hasTrajectoryAnomaly ? 'orange' : 'green'}>{hasTrajectoryAnomaly ? '建议核对 RAW 帧和当日里程统计' : '轨迹质量可用'}</Tag>
|
||||
<Tag color={hasTrajectoryAnomaly ? 'orange' : 'green'}>{hasTrajectoryAnomaly ? '建议核对原始记录和当日里程统计' : '轨迹质量可用'}</Tag>
|
||||
<Typography.Text type="secondary">
|
||||
{hasTrajectoryAnomaly ? '异常点会影响轨迹回放、定位复盘和区间里程判断,请结合 RAW 解析字段与里程统计交叉确认。' : '当前页轨迹未发现明显断点、里程回退或速度异常。'}
|
||||
{hasTrajectoryAnomaly ? '异常点会影响轨迹回放、定位复盘和区间里程判断,请结合字段明细与里程统计交叉确认。' : '当前页轨迹未发现明显断点、里程回退或速度异常。'}
|
||||
</Typography.Text>
|
||||
</div>
|
||||
</Card>
|
||||
@@ -1258,21 +1258,21 @@ export function History({
|
||||
<Space wrap>
|
||||
<Button disabled={!canOpenVehicle(row.vin)} onClick={() => onOpenVehicle(row.vin, row.protocol)}>车辆服务</Button>
|
||||
<Button disabled={!canOpenVehicle(row.vin) || !onOpenMileage} onClick={() => openLocationMileage(row)}>核对里程</Button>
|
||||
<Button disabled={!canOpenVehicle(row.vin) || !onOpenRaw} onClick={() => openLocationRaw(row)}>核对 RAW</Button>
|
||||
<Button disabled={!canOpenVehicle(row.vin) || !onOpenRaw} onClick={() => openLocationRaw(row)}>核对原始记录</Button>
|
||||
</Space>
|
||||
)
|
||||
}
|
||||
]}
|
||||
/>
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane tab="RAW 帧" itemKey="raw">
|
||||
<Tabs.TabPane tab="原始记录" itemKey="raw">
|
||||
<div className="vp-table-toolbar">
|
||||
<Space wrap>
|
||||
<Tag color="blue">当前页 {rawFrames.items.length.toLocaleString()} 条</Tag>
|
||||
<Tag color={isIncludeFieldsEnabled(filters.includeFields) || splitFields(filters.fields).length > 0 ? 'green' : 'orange'}>
|
||||
{isIncludeFieldsEnabled(filters.includeFields) || splitFields(filters.fields).length > 0 ? '包含解析字段' : '未请求解析字段'}
|
||||
{isIncludeFieldsEnabled(filters.includeFields) || splitFields(filters.fields).length > 0 ? '包含字段明细' : '未请求字段明细'}
|
||||
</Tag>
|
||||
<Button size="small" onClick={exportRawFrames}>导出 RAW 当前页 CSV</Button>
|
||||
<Button size="small" onClick={exportRawFrames}>导出原始记录当前页 CSV</Button>
|
||||
</Space>
|
||||
</div>
|
||||
<Table
|
||||
@@ -1310,13 +1310,13 @@ export function History({
|
||||
]}
|
||||
/>
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane tab="解析字段" itemKey="fields">
|
||||
<Tabs.TabPane tab="字段明细" itemKey="fields">
|
||||
<div className="vp-table-toolbar">
|
||||
<Space wrap>
|
||||
<Tag color="green">当前页 {rawFieldRows.length.toLocaleString()} 个字段</Tag>
|
||||
<Tag color="blue">{rawFrames.items.length.toLocaleString()} 条 RAW 来源</Tag>
|
||||
{selectedFieldCount > 0 ? <Tag color="blue">字段裁剪 {selectedFieldCount.toLocaleString()} 个</Tag> : <Tag color="grey">全量解析字段</Tag>}
|
||||
<Button size="small" onClick={exportRawFields}>导出解析字段当前页 CSV</Button>
|
||||
<Tag color="blue">{rawFrames.items.length.toLocaleString()} 条原始记录</Tag>
|
||||
{selectedFieldCount > 0 ? <Tag color="blue">字段裁剪 {selectedFieldCount.toLocaleString()} 个</Tag> : <Tag color="grey">全量字段明细</Tag>}
|
||||
<Button size="small" onClick={exportRawFields}>导出字段明细当前页 CSV</Button>
|
||||
</Space>
|
||||
</div>
|
||||
<Table
|
||||
@@ -1338,7 +1338,7 @@ export function History({
|
||||
{ title: '数据来源', dataIndex: 'protocol', width: 120 },
|
||||
{ title: '帧类型', dataIndex: 'frameType', width: 190 },
|
||||
{ title: '设备时间', dataIndex: 'deviceTime', width: 190 },
|
||||
{ title: 'RAW ID', dataIndex: 'rawId', width: 260 },
|
||||
{ title: '原始记录ID', dataIndex: 'rawId', width: 260 },
|
||||
{
|
||||
title: '操作',
|
||||
width: 170,
|
||||
@@ -1351,19 +1351,19 @@ export function History({
|
||||
]}
|
||||
/>
|
||||
<Space wrap style={{ marginTop: 12 }}>
|
||||
<Tag color="grey">分页沿用 RAW 帧分页</Tag>
|
||||
<Tag color="grey">分页沿用原始记录分页</Tag>
|
||||
<Tag color="grey">字段来自 parsedFields,保留协议字段映射后的路径</Tag>
|
||||
</Space>
|
||||
</Tabs.TabPane>
|
||||
</Tabs>
|
||||
</Card>
|
||||
<SideSheet title="RAW 解析字段" visible={Boolean(selectedRaw)} onCancel={() => setSelectedRaw(null)} width={720}>
|
||||
<SideSheet title="原始记录字段明细" visible={Boolean(selectedRaw)} onCancel={() => setSelectedRaw(null)} width={720}>
|
||||
<Space vertical align="start" spacing={12} style={{ width: '100%' }}>
|
||||
<Typography.Text type="tertiary">
|
||||
{selectedRaw?.protocol ?? '-'} / {selectedRaw?.plate || selectedRaw?.vin || '-'} / {rawFieldCount} 个字段
|
||||
</Typography.Text>
|
||||
{rawFieldCount === 0 ? (
|
||||
<Typography.Text type="secondary">当前查询未返回解析字段,请勾选“返回解析字段”或配置字段裁剪后重新查询。</Typography.Text>
|
||||
<Typography.Text type="secondary">当前查询未返回字段明细,请勾选“返回字段明细”或配置字段裁剪后重新查询。</Typography.Text>
|
||||
) : null}
|
||||
</Space>
|
||||
<pre className="vp-json">{JSON.stringify(selectedRaw?.parsedFields ?? {}, null, 2)}</pre>
|
||||
|
||||
@@ -200,7 +200,7 @@ test('exposes AMap operations shortcuts when map key is configured', async () =>
|
||||
fireEvent.click(screen.getByRole('button', { name: '顶部数据导出' }));
|
||||
expect(window.location.hash.startsWith('#/history-query')).toBe(true);
|
||||
expect(new URLSearchParams(window.location.hash.split('?')[1] ?? '').get('tab')).toBe('raw');
|
||||
expect(await screen.findByRole('heading', { name: '历史查询' })).toBeInTheDocument();
|
||||
expect(await screen.findByRole('heading', { name: '数据导出' })).toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole('button', { name: '顶部里程统计' }));
|
||||
expect(window.location.hash.startsWith('#/mileage')).toBe(true);
|
||||
fireEvent.click(await screen.findByRole('button', { name: '顶部告警事件正常' }));
|
||||
@@ -4788,7 +4788,7 @@ test('opens same-day raw evidence from quality priority queue', async () => {
|
||||
expect(params.get('dateTo')).toBe('2026-07-04');
|
||||
expect(params.get('includeFields')).toBe('true');
|
||||
expect(params.get('tab')).toBe('raw');
|
||||
expect(await screen.findByRole('heading', { name: '历史查询' })).toBeInTheDocument();
|
||||
expect(await screen.findByRole('heading', { name: '数据导出' })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('opens vehicle service from quality issue with issue source evidence', async () => {
|
||||
@@ -5145,7 +5145,7 @@ test('opens same-day raw evidence from quality issue row', async () => {
|
||||
expect(params.get('dateTo')).toBe('2026-07-04');
|
||||
expect(params.get('includeFields')).toBe('true');
|
||||
expect(params.get('tab')).toBe('raw');
|
||||
expect(await screen.findByRole('heading', { name: '历史查询' })).toBeInTheDocument();
|
||||
expect(await screen.findByRole('heading', { name: '数据导出' })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('copies trajectory playback summary from history page', async () => {
|
||||
@@ -5258,17 +5258,17 @@ test('copies trajectory playback summary from history page', async () => {
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('起点:2026-07-03 10:00:00'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('终点:2026-07-03 11:00:00'));
|
||||
|
||||
fireEvent.click(screen.getAllByRole('button', { name: /复制历史证据包/ })[0]);
|
||||
fireEvent.click(screen.getAllByRole('button', { name: /复制数据复核包/ })[0]);
|
||||
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('【历史证据包】'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('【数据复核包】'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('车辆:VIN-HISTORY-SUMMARY'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('位置记录:2,有效定位:2'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('RAW帧:1,解析字段:2'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('原始记录:1,字段明细:2'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('异常:断点 1 / 里程回退 0 / 超速 0'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('轨迹回放:http://localhost:3000/#/history?keyword=VIN-HISTORY-SUMMARY&protocol=JT808&dateFrom=2026-07-03&dateTo=2026-07-04'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('历史位置:http://localhost:3000/#/history-query?keyword=VIN-HISTORY-SUMMARY&protocol=JT808&tab=location&dateFrom=2026-07-03&dateTo=2026-07-04'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('RAW证据:http://localhost:3000/#/history-query?keyword=VIN-HISTORY-SUMMARY&protocol=JT808&tab=raw&dateFrom=2026-07-03&dateTo=2026-07-04&includeFields=true'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('解析字段:http://localhost:3000/#/history-query?keyword=VIN-HISTORY-SUMMARY&protocol=JT808&tab=fields&dateFrom=2026-07-03&dateTo=2026-07-04&includeFields=true'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('原始记录:http://localhost:3000/#/history-query?keyword=VIN-HISTORY-SUMMARY&protocol=JT808&tab=raw&dateFrom=2026-07-03&dateTo=2026-07-04&includeFields=true'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('字段明细:http://localhost:3000/#/history-query?keyword=VIN-HISTORY-SUMMARY&protocol=JT808&tab=fields&dateFrom=2026-07-03&dateTo=2026-07-04&includeFields=true'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('里程复核:http://localhost:3000/#/mileage?keyword=VIN-HISTORY-SUMMARY&protocol=JT808&dateFrom=2026-07-03&dateTo=2026-07-04'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('车辆服务:http://localhost:3000/#/detail?keyword=VIN-HISTORY-SUMMARY&protocol=JT808'));
|
||||
|
||||
@@ -5278,25 +5278,25 @@ test('copies trajectory playback summary from history page', async () => {
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('车辆:VIN-HISTORY-SUMMARY'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('数据来源:JT808'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('业务状态:需要复核'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('轨迹范围:位置 2 / 有效定位 2 / RAW 1 / 字段 2'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('轨迹范围:位置 2 / 有效定位 2 / 原始记录 1 / 字段明细 2'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('定位覆盖率:100%'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('回放跨度:60 分钟,采样间隔:60 分钟/点'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('异常影响:断点 1 / 里程回退 0 / 超速 0'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('地图能力:高德 JS API 待配置'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('历史查询:http://localhost:3000/#/history-query?keyword=VIN-HISTORY-SUMMARY&protocol=JT808&tab=location&dateFrom=2026-07-03&dateTo=2026-07-04'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('RAW证据:http://localhost:3000/#/history-query?keyword=VIN-HISTORY-SUMMARY&protocol=JT808&tab=raw&dateFrom=2026-07-03&dateTo=2026-07-04&includeFields=true'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('数据导出:http://localhost:3000/#/history-query?keyword=VIN-HISTORY-SUMMARY&protocol=JT808&tab=location&dateFrom=2026-07-03&dateTo=2026-07-04'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('原始记录:http://localhost:3000/#/history-query?keyword=VIN-HISTORY-SUMMARY&protocol=JT808&tab=raw&dateFrom=2026-07-03&dateTo=2026-07-04&includeFields=true'));
|
||||
|
||||
fireEvent.click(screen.getByRole('button', { name: /复制轨迹复盘包/ }));
|
||||
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('【轨迹复盘交接包】'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('车辆:VIN-HISTORY-SUMMARY'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('轨迹规模:位置 2 / 有效定位 2 / RAW 1 / 解析字段 2'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('轨迹规模:位置 2 / 有效定位 2 / 原始记录 1 / 字段明细 2'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('轨迹质量:定位覆盖率 100% / 回放跨度 60 分钟 / 采样间隔 60 分钟/点'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('里程速度:区间里程 22.6 km / 最高速度 58.8 km/h'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('当前回放点:点 1/2,2026-07-03 10:00:00,12.5 km/h,1,000 km'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('异常判读:断点 1 / 里程回退 0 / 超速 0'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('下一步:建议核对 RAW 帧、解析字段、当日里程统计,并确认平台是否存在断链或补发。'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('RAW证据:http://localhost:3000/#/history-query?keyword=VIN-HISTORY-SUMMARY&protocol=JT808&tab=raw&dateFrom=2026-07-03&dateTo=2026-07-04&includeFields=true'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('下一步:建议核对原始记录、字段明细、当日里程统计,并确认平台是否存在断链或补发。'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('原始记录:http://localhost:3000/#/history-query?keyword=VIN-HISTORY-SUMMARY&protocol=JT808&tab=raw&dateFrom=2026-07-03&dateTo=2026-07-04&includeFields=true'));
|
||||
});
|
||||
|
||||
test('opens same-day mileage statistics from quality issue row', async () => {
|
||||
@@ -6185,7 +6185,7 @@ test('shows and clears current history filters while keeping vehicle scope', asy
|
||||
expect(screen.getByText('数据来源:JT808')).toBeInTheDocument();
|
||||
expect(screen.getByText('开始时间:2026-07-01 00:00:00')).toBeInTheDocument();
|
||||
expect(screen.getByText('结束时间:2026-07-01 23:59:59')).toBeInTheDocument();
|
||||
expect(screen.getAllByText('返回解析字段').length).toBeGreaterThanOrEqual(2);
|
||||
expect(screen.getAllByText('返回字段明细').length).toBeGreaterThanOrEqual(2);
|
||||
expect(screen.getByText('字段裁剪:2 个')).toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole('button', { name: '清空筛选' }));
|
||||
|
||||
@@ -6259,8 +6259,8 @@ test('shows parsed field history as a flattened evidence table', async () => {
|
||||
|
||||
render(<App />);
|
||||
|
||||
expect(await screen.findByRole('heading', { name: '历史查询' })).toBeInTheDocument();
|
||||
expect(await screen.findByRole('tab', { name: '解析字段' })).toHaveAttribute('aria-selected', 'true');
|
||||
expect(await screen.findByRole('heading', { name: '数据导出' })).toBeInTheDocument();
|
||||
expect(await screen.findByRole('tab', { name: '字段明细' })).toHaveAttribute('aria-selected', 'true');
|
||||
expect(fetchMock).toHaveBeenCalledWith('/api/history/raw-frames/query', expect.objectContaining({
|
||||
method: 'POST',
|
||||
body: expect.stringContaining('"includeFields":true')
|
||||
@@ -6357,10 +6357,10 @@ test('prevents unscoped raw parsed-field query from history form', async () => {
|
||||
await waitFor(() => {
|
||||
expect(keywordInput).toHaveValue('');
|
||||
});
|
||||
fireEvent.click(screen.getByRole('checkbox', { name: '返回解析字段' }));
|
||||
fireEvent.click(screen.getByRole('checkbox', { name: '返回字段明细' }));
|
||||
fireEvent.click(screen.getByRole('button', { name: 'search 查询' }));
|
||||
|
||||
expect((await screen.findAllByText('RAW 解析字段查询需要车辆、时间范围或字段裁剪')).length).toBeGreaterThanOrEqual(1);
|
||||
expect((await screen.findAllByText('字段明细查询需要车辆、时间范围或字段裁剪')).length).toBeGreaterThanOrEqual(1);
|
||||
expect(fetchMock).toHaveBeenCalledWith(expect.stringContaining('/api/history/locations?'), undefined);
|
||||
expect(fetchMock).not.toHaveBeenCalledWith('/api/history/raw-frames/query', expect.anything());
|
||||
});
|
||||
@@ -6417,7 +6417,7 @@ test('shows trajectory playback workspace from history locations', async () => {
|
||||
expect(screen.getByText('轨迹范围')).toBeInTheDocument();
|
||||
expect(screen.getByText('定位覆盖')).toBeInTheDocument();
|
||||
expect(screen.getByText('异常影响')).toBeInTheDocument();
|
||||
expect(screen.getByText('RAW证据')).toBeInTheDocument();
|
||||
expect(screen.getAllByText('原始记录').length).toBeGreaterThanOrEqual(1);
|
||||
expect(screen.getByText('地图能力')).toBeInTheDocument();
|
||||
expect(screen.getByText('轨迹回放作业台')).toBeInTheDocument();
|
||||
expect(screen.getByText('2 个有效轨迹点')).toBeInTheDocument();
|
||||
@@ -6520,7 +6520,7 @@ test('flags trajectory playback anomalies for gap mileage and speed review', asy
|
||||
expect(screen.getByText('2 km')).toBeInTheDocument();
|
||||
expect(screen.getByText('速度异常')).toBeInTheDocument();
|
||||
expect(screen.getAllByText('132 km/h').length).toBeGreaterThan(0);
|
||||
expect(screen.getByText('建议核对 RAW 帧和当日里程统计')).toBeInTheDocument();
|
||||
expect(screen.getByText('建议核对原始记录和当日里程统计')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('opens amap route from trajectory playback workspace', async () => {
|
||||
@@ -6975,7 +6975,7 @@ test('exports current raw frame page as csv with parsed fields', async () => {
|
||||
render(<App />);
|
||||
|
||||
expect((await screen.findAllByText('raw-export-001')).length).toBeGreaterThanOrEqual(1);
|
||||
fireEvent.click(screen.getByRole('button', { name: '导出 RAW 当前页 CSV' }));
|
||||
fireEvent.click(screen.getByRole('button', { name: '导出原始记录当前页 CSV' }));
|
||||
|
||||
expect(createObjectURL).toHaveBeenCalled();
|
||||
expect(revokeObjectURL).toHaveBeenCalledWith('blob:history-raw');
|
||||
@@ -7469,7 +7469,7 @@ test('opens same-day raw frame evidence from mileage row', async () => {
|
||||
expect(params.get('dateFrom')).toBe('2026-07-03');
|
||||
expect(params.get('dateTo')).toBe('2026-07-04');
|
||||
expect(params.get('tab')).toBe('raw');
|
||||
expect(await screen.findByRole('heading', { name: '历史查询' })).toBeInTheDocument();
|
||||
expect(await screen.findByRole('heading', { name: '数据导出' })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('shows mileage anomaly action guidance', async () => {
|
||||
@@ -8236,7 +8236,7 @@ test('opens same-day raw evidence from history location row', async () => {
|
||||
render(<App />);
|
||||
|
||||
expect((await screen.findAllByText('VIN-HISTORY-RAW')).length).toBeGreaterThan(0);
|
||||
fireEvent.click(screen.getByRole('button', { name: '核对 RAW' }));
|
||||
fireEvent.click(screen.getByRole('button', { name: '核对原始记录' }));
|
||||
|
||||
await waitFor(() => {
|
||||
expect(window.location.hash.startsWith('#/history-query?')).toBe(true);
|
||||
@@ -8248,7 +8248,7 @@ test('opens same-day raw evidence from history location row', async () => {
|
||||
expect(params.get('dateTo')).toBe('2026-07-04');
|
||||
expect(params.get('includeFields')).toBe('true');
|
||||
expect(params.get('tab')).toBe('raw');
|
||||
expect(await screen.findByRole('tab', { name: 'RAW 帧' })).toHaveAttribute('aria-selected', 'true');
|
||||
expect(await screen.findByRole('tab', { name: '原始记录' })).toHaveAttribute('aria-selected', 'true');
|
||||
expect((await screen.findAllByText('raw-from-location-001')).length).toBeGreaterThanOrEqual(1);
|
||||
});
|
||||
|
||||
@@ -8333,7 +8333,7 @@ test('opens vehicle service from raw history rows with row source evidence', asy
|
||||
|
||||
render(<App />);
|
||||
|
||||
fireEvent.click(await screen.findByRole('tab', { name: 'RAW 帧' }));
|
||||
fireEvent.click(await screen.findByRole('tab', { name: '原始记录' }));
|
||||
expect(await screen.findByText('raw-gb32960-001')).toBeInTheDocument();
|
||||
fireEvent.click(screen.getAllByRole('button', { name: '车辆服务' })[0]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user