feat(platform): refine mileage customer workflow

This commit is contained in:
lingniu
2026-07-05 12:17:20 +08:00
parent 0e86d45288
commit a7e10f0983
2 changed files with 91 additions and 91 deletions

View File

@@ -2482,7 +2482,7 @@ test('shows and clears current vehicle service filters', async () => {
expect(await screen.findByText('当前车辆筛选')).toBeInTheDocument();
expect(screen.getByText('关键词粤A')).toBeInTheDocument();
expect(screen.getByText('证据来源JT808')).toBeInTheDocument();
expect(screen.getAllByText('数据通道JT808').length).toBeGreaterThan(0);
expect(screen.getByText('车辆覆盖:多源')).toBeInTheDocument();
expect(screen.getByText('缺失来源YUTONG_MQTT')).toBeInTheDocument();
expect(screen.getByText('服务状态:来源不完整')).toBeInTheDocument();
@@ -5437,7 +5437,7 @@ test('copies trajectory playback summary from history page', async () => {
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('【轨迹回放摘要】'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('车辆VIN-HISTORY-SUMMARY'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('证据来源JT808'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('数据通道JT808'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('查询范围2026-07-03 至 2026-07-04'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('轨迹点2有效定位2'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('区间里程22.6 km'));
@@ -5463,7 +5463,7 @@ test('copies trajectory playback summary from history page', async () => {
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('【轨迹运营影响】'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('车辆VIN-HISTORY-SUMMARY'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('证据来源JT808'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('数据通道JT808'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('业务状态:需要复核'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('轨迹范围:位置 2 / 有效定位 2 / 原始记录 1 / 字段明细 2'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('定位覆盖率100%'));
@@ -6376,7 +6376,7 @@ test('shows and clears current history filters while keeping vehicle scope', asy
expect(await screen.findByText('当前历史筛选')).toBeInTheDocument();
expect(screen.getByText('车辆VIN-HISTORY-001')).toBeInTheDocument();
expect(screen.getByText('证据来源JT808')).toBeInTheDocument();
expect(screen.getAllByText('数据通道JT808').length).toBeGreaterThan(0);
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);
@@ -7249,7 +7249,7 @@ test('shows vehicle and source scope on mileage hash', async () => {
render(<App />);
expect(await screen.findByText('当前车辆VIN-MILEAGE-001')).toBeInTheDocument();
expect(screen.getByText('当前来源GB32960')).toBeInTheDocument();
expect(screen.getAllByText('数据通道GB32960').length).toBeGreaterThan(0);
});
test('applies mileage date range from shareable hash to API requests', async () => {
@@ -7294,7 +7294,7 @@ test('applies mileage date range from shareable hash to API requests', async ()
expect(fetchMock).toHaveBeenCalledWith(expect.stringContaining('dateFrom=2026-07-01'), undefined);
expect(fetchMock).toHaveBeenCalledWith(expect.stringContaining('dateTo=2026-07-03'), undefined);
expect(screen.getByText('当前车辆VIN-MILEAGE-002')).toBeInTheDocument();
expect(screen.getByText('当前来源JT808')).toBeInTheDocument();
expect(screen.getAllByText('数据通道JT808').length).toBeGreaterThan(0);
});
test('shows and clears current mileage filters while keeping vehicle scope', async () => {
@@ -7335,7 +7335,7 @@ test('shows and clears current mileage filters while keeping vehicle scope', asy
expect(await screen.findByText('当前里程筛选')).toBeInTheDocument();
expect(screen.getByText('车辆VIN-MILEAGE-002')).toBeInTheDocument();
expect(screen.getByText('证据来源JT808')).toBeInTheDocument();
expect(screen.getAllByText('数据通道JT808').length).toBeGreaterThan(0);
expect(screen.getByText('开始日期2026-07-01')).toBeInTheDocument();
expect(screen.getByText('结束日期2026-07-03')).toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: '清空筛选' }));
@@ -7384,7 +7384,7 @@ test('updates mileage hash when mileage filters are submitted', async () => {
await screen.findByRole('heading', { name: '里程统计' });
fireEvent.change(screen.getByPlaceholderText('VIN / 车牌 / 手机号 / OEM'), { target: { value: '粤AG18312' } });
fireEvent.click(screen.getByText('全部来源'));
fireEvent.click(screen.getByText('全部数据通道'));
fireEvent.click(await screen.findByText('JT808'));
fireEvent.change(screen.getByPlaceholderText('2026-07-01'), { target: { value: '2026-07-01' } });
fireEvent.change(screen.getByPlaceholderText('2026-07-03'), { target: { value: '2026-07-03' } });
@@ -7454,7 +7454,7 @@ test('opens current vehicle service from mileage header with current source evid
render(<App />);
expect(await screen.findByText('当前来源GB32960')).toBeInTheDocument();
expect((await screen.findAllByText('数据通道GB32960')).length).toBeGreaterThan(0);
fireEvent.click(screen.getByRole('button', { name: '当前车辆服务' }));
await waitFor(() => {
@@ -7773,15 +7773,15 @@ test('shows mileage anomaly action guidance', async () => {
expect(screen.getByText('日里程异常,优先核对当天首末总里程、来源断链和补传数据。')).toBeInTheDocument();
fireEvent.click(screen.getAllByRole('button', { name: '复制证据' })[0]);
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('【里程异常证据包】'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('【里程异常复核包】'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('车辆粤A异常1 / VIN-MILEAGE-ANOMALY'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('证据来源GB32960'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('数据通道GB32960'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('统计日期2026-07-03'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('日里程:-3.2 km'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('异常等级warning'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('车辆服务http://localhost:3000/#/detail?keyword=VIN-MILEAGE-ANOMALY&protocol=GB32960'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('轨迹证据http://localhost:3000/#/history?keyword=VIN-MILEAGE-ANOMALY&protocol=GB32960&dateFrom=2026-07-03&dateTo=2026-07-04'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('原始记录http://localhost:3000/#/history-query?keyword=VIN-MILEAGE-ANOMALY&protocol=GB32960&tab=raw&dateFrom=2026-07-03&dateTo=2026-07-04&includeFields=true'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('历史明细http://localhost:3000/#/history-query?keyword=VIN-MILEAGE-ANOMALY&protocol=GB32960&tab=raw&dateFrom=2026-07-03&dateTo=2026-07-04&includeFields=true'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('统计查询http://localhost:3000/#/mileage?keyword=VIN-MILEAGE-ANOMALY&protocol=GB32960&dateFrom=2026-07-03&dateTo=2026-07-04'));
});
@@ -8001,28 +8001,28 @@ test('shows vehicle-first statistics domains for one vehicle service', async ()
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: '客户统计查询 明细导出 导出明细' })).toBeInTheDocument();
expect(await screen.findByText('车辆统计服务总览')).toBeInTheDocument();
expect(screen.getAllByText('里程统计').length).toBeGreaterThanOrEqual(1);
expect(screen.getByText('在线率与离线时长')).toBeInTheDocument();
expect(screen.getByText('数据完整性')).toBeInTheDocument();
expect(screen.getAllByText('来源一致性').length).toBeGreaterThanOrEqual(1);
expect(screen.getAllByText('通道一致性').length).toBeGreaterThanOrEqual(1);
expect(screen.getByText('三类数据源最终汇总为一个车辆服务统计视图')).toBeInTheDocument();
expect(screen.getByText('当前统计证据')).toBeInTheDocument();
expect(screen.getByText('3 车 / 2 来源 / 3 条明细')).toBeInTheDocument();
expect(screen.getByText('3 车 / 2 数据通道 / 3 条明细')).toBeInTheDocument();
expect(screen.getByText('客户里程决策台')).toBeInTheDocument();
expect(screen.getByText('先判断能不能交付,再进入轨迹、原始记录和导出复核')).toBeInTheDocument();
expect(screen.getByText('先判断能不能交付,再进入轨迹、历史明细和导出复核')).toBeInTheDocument();
expect(screen.getAllByRole('button', { name: '复制决策说明' }).length).toBeGreaterThanOrEqual(1);
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: '客户里程决策 异常复核 异常明细' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户里程决策 在线影响 在线态势' })).toBeInTheDocument();
expect(screen.getByText('客户里程复核交付包')).toBeInTheDocument();
expect(screen.getByText('面向客户交付里程时,先确认区间里程、闭合状态、异常记录和在线影响,再导出明细或进入轨迹与原始记录复核。')).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: '里程交付 在线影响 在线态势' })).toBeInTheDocument();
expect(screen.getByText('统计影响范围')).toBeInTheDocument();
expect(screen.getByRole('button', { name: '复制影响范围' })).toBeInTheDocument();
@@ -8033,11 +8033,11 @@ test('shows vehicle-first statistics domains for one vehicle service', async ()
expect(screen.getAllByText('发布判断').length).toBeGreaterThanOrEqual(1);
expect(screen.getByText('区间复核')).toBeInTheDocument();
expect(screen.getByText('异常处理')).toBeInTheDocument();
expect(screen.getAllByText('数据交付').length).toBeGreaterThanOrEqual(1);
expect(screen.getAllByText('明细导出').length).toBeGreaterThanOrEqual(1);
expect(screen.getByRole('button', { name: '里程服务任务 发布判断 BI口径' })).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.getByText('闭合影响')).toBeInTheDocument();
@@ -8057,13 +8057,13 @@ test('shows vehicle-first statistics domains for one vehicle service', async ()
fireEvent.click(screen.getByRole('button', { name: '复制影响范围' }));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('【统计影响范围】'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('车辆范围VIN-STATS-SERVICE'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('证据来源JT808'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('数据通道JT808'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('影响车辆3 辆'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('统计记录6 条'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('累计里程210 km'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('在线状态3 在线 / 1 离线 / 在线率 75%'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('发布判断:复核后发布'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('业务影响:当前统计范围需要先复核轨迹、原始记录和离线车辆影响'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('业务影响:当前统计范围需要先复核轨迹、历史明细和离线车辆影响'));
fireEvent.click(screen.getAllByRole('button', { name: '复制决策说明' })[0]);
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('【客户里程决策说明】'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('决策结论:复核后交付'));
@@ -8072,13 +8072,13 @@ test('shows vehicle-first statistics domains for one vehicle service', async ()
fireEvent.click(screen.getByRole('button', { name: '复制在线态势' }));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('【在线统计运营态势】'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('车辆范围VIN-STATS-SERVICE'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('证据来源JT808'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('数据通道JT808'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('在线概览3 在线 / 1 离线 / 在线率 75%'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('Redis 在线 Key92'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('当前页车辆2 / 当前筛选 2'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('最长离线粤A离线1 / 2 小时 / 2026-07-03 18:12:10'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('1. JT8082/3在线率 66.7%'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('2. 离线车辆优先打开车辆服务,核对实时、轨迹、原始记录和告警证据'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('2. 离线车辆优先打开车辆服务,核对实时、轨迹、历史明细和告警记录'));
fireEvent.click(screen.getByRole('button', { name: '里程交付 区间里程 复制交付' }));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('【客户里程复核交付包】'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('车辆范围VIN-STATS-SERVICE'));
@@ -8165,7 +8165,7 @@ test('copies mileage statistics summary for operations reporting', async () => {
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('【里程统计摘要】'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('车辆范围VIN-MILEAGE-COPY'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('证据来源JT808'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('数据通道JT808'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('日期范围2026-07-01 至 2026-07-03'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('累计里程140 km'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('当前页里程140 km'));
@@ -8181,8 +8181,8 @@ test('copies mileage statistics summary for operations reporting', async () => {
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('闭合状态:分页抽样'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('记录覆盖率50%'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('异常记录1'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('来源一致性:可做跨来源核对'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('发布风险:存在分页未全量、异常记录或闭合差值,需要先复核轨迹和原始记录'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('通道一致性:可做跨通道核对'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('发布风险:存在分页未全量、异常记录或闭合差值,需要先复核轨迹和历史明细'));
fireEvent.click(screen.getByRole('button', { name: '复制统计发布审计' }));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('【统计发布审计】'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('发布结论:复核后发布'));
@@ -8764,7 +8764,7 @@ test('opens current vehicle service from history header with current source evid
render(<App />);
expect(await screen.findByText('当前来源JT808')).toBeInTheDocument();
expect((await screen.findAllByText('数据通道JT808')).length).toBeGreaterThan(0);
fireEvent.click(screen.getByRole('button', { name: '当前车辆服务' }));
await waitFor(() => {
@@ -10319,7 +10319,7 @@ test('shows and clears current realtime service filters', async () => {
expect(await screen.findByText('当前实时筛选')).toBeInTheDocument();
expect(screen.getByText('关键词粤ART002')).toBeInTheDocument();
expect(screen.getByText('数据通道JT808')).toBeInTheDocument();
expect(screen.getAllByText('数据通道JT808').length).toBeGreaterThan(0);
expect(screen.getByText('在线:在线')).toBeInTheDocument();
expect(screen.getByText('服务状态:来源不完整')).toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: '清空筛选' }));