feat(platform): add mileage BI publish package

This commit is contained in:
lingniu
2026-07-04 21:18:13 +08:00
parent 0fff9e3890
commit cd932dc097
3 changed files with 160 additions and 9 deletions

View File

@@ -7060,12 +7060,12 @@ test('shows mileage statistics workspace with trend source and definition', asyn
expect(screen.getByText('明细合计')).toBeInTheDocument();
expect(screen.getByText('闭合差值')).toBeInTheDocument();
expect(screen.getByText('记录覆盖率')).toBeInTheDocument();
expect(screen.getByText('闭合通过')).toBeInTheDocument();
expect(screen.getAllByText('闭合通过').length).toBeGreaterThanOrEqual(1);
expect(screen.getByText('当前筛选范围汇总总里程与明细合计一致,可作为统计证据。')).toBeInTheDocument();
expect(screen.getByRole('button', { name: '复制闭合摘要' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '闭合复核轨迹' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '闭合复核 RAW' })).toBeInTheDocument();
expect(screen.getByText('异常记录')).toBeInTheDocument();
expect(screen.getAllByText('异常记录').length).toBeGreaterThanOrEqual(1);
expect(screen.getAllByText('1').length).toBeGreaterThanOrEqual(1);
expect(screen.getByText('最大单日')).toBeInTheDocument();
expect(screen.getByText('60 km')).toBeInTheDocument();
@@ -7199,7 +7199,7 @@ 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.getByText('来源一致性')).toBeInTheDocument();
expect(screen.getAllByText('来源一致性').length).toBeGreaterThanOrEqual(1);
expect(screen.getByText('三类数据源最终汇总为一个车辆服务统计视图')).toBeInTheDocument();
expect(screen.getByText('当前统计证据')).toBeInTheDocument();
expect(screen.getByText('3 车 / 2 来源 / 3 条明细')).toBeInTheDocument();
@@ -7280,7 +7280,9 @@ test('copies mileage statistics summary for operations reporting', async () => {
render(<App />);
expect(await screen.findByText('区间趋势')).toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: '复制统计摘要' }));
expect(screen.getByText('BI发布口径')).toBeInTheDocument();
expect(screen.getByRole('button', { name: '复制BI发布口径' })).toBeInTheDocument();
fireEvent.click(screen.getAllByRole('button', { name: '复制统计摘要' })[0]);
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('【里程统计摘要】'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('车辆范围VIN-MILEAGE-COPY'));
@@ -7293,6 +7295,15 @@ test('copies mileage statistics summary for operations reporting', async () => {
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('统计口径:区间总值等于各日里程之和'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('统计查询http://localhost:3000/#/mileage?keyword=VIN-MILEAGE-COPY&protocol=JT808&dateFrom=2026-07-01&dateTo=2026-07-03'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('车辆服务http://localhost:3000/#/detail?keyword=VIN-MILEAGE-COPY&protocol=JT808'));
fireEvent.click(screen.getByRole('button', { name: '复制BI发布口径' }));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('【BI里程发布口径】'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('发布结论:需复核后发布'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('统计口径:日里程按首末总里程差值计算,区间总值等于每日里程之和'));
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('发布风险:存在分页未全量、异常记录或闭合差值,需要先复核轨迹和 RAW 证据'));
});
test('exports current mileage page as CSV', async () => {