feat(platform): add vehicle service delivery package

This commit is contained in:
lingniu
2026-07-05 14:36:04 +08:00
parent ee257b4aa1
commit 96a419f5d4
3 changed files with 245 additions and 1 deletions

View File

@@ -1936,6 +1936,11 @@ test('opens vehicle list filtered by service summary KPI', async () => {
test('shows vehicle service result summary on vehicle list filters', async () => {
window.history.replaceState(null, '', '/#/vehicles?coverage=multi');
const writeText = vi.fn(() => Promise.resolve());
Object.defineProperty(navigator, 'clipboard', {
configurable: true,
value: { writeText }
});
vi.spyOn(globalThis, 'fetch').mockImplementation(async (input) => {
const path = String(input);
if (path.includes('/api/ops/health')) {
@@ -2050,12 +2055,21 @@ test('shows vehicle service result summary on vehicle list filters', async () =>
expect(screen.getByRole('button', { name: /复制客户查车路径/ })).toBeInTheDocument();
expect(screen.getByText('车辆服务决策板')).toBeInTheDocument();
expect(screen.getAllByText('异常车辆').length).toBeGreaterThan(0);
expect(screen.getByText('4 无来源')).toBeInTheDocument();
expect(screen.getAllByText('4 无来源').length).toBeGreaterThanOrEqual(1);
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.getByText('客户车辆服务交付包')).toBeInTheDocument();
expect(screen.getByText('客户交付')).toBeInTheDocument();
expect(screen.getByText('车辆池包')).toBeInTheDocument();
expect(screen.getByText('把车辆地图、实时监控、轨迹回放、里程统计、告警通知和历史导出放在同一份服务包里,客户不用理解 GB32960、808 或 MQTT 的差异。')).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.getAllByText('车辆地图').length).toBeGreaterThanOrEqual(1);
expect(screen.getAllByText('里程统计').length).toBeGreaterThanOrEqual(1);
expect(screen.getAllByText('数据导出').length).toBeGreaterThanOrEqual(1);
@@ -2098,6 +2112,15 @@ test('shows vehicle service result summary on vehicle list filters', async () =>
expect(screen.getByText('1/2 来源在线,缺 YUTONG_MQTT')).toBeInTheDocument();
expect(screen.getByText('建议动作')).toBeInTheDocument();
expect(screen.getByText('补齐 YUTONG_MQTT 来源')).toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: /复制交付包/ }));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('【客户车辆服务交付包】'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('服务范围:当前车辆池'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('车辆地图http://localhost:3000/#/map?'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('轨迹回放http://localhost:3000/#/history?tab=location'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('里程统计http://localhost:3000/#/mileage'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('告警通知http://localhost:3000/#/alert-events?coverage=multi'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('历史数据导出http://localhost:3000/#/history?tab=raw&includeFields=true'));
});
test('exports current vehicle coverage page as csv', async () => {