feat(platform): add customer daily operations home

This commit is contained in:
lingniu
2026-07-06 05:52:22 +08:00
parent ebaf67a134
commit 8b7614d2d6
3 changed files with 200 additions and 0 deletions

View File

@@ -1120,6 +1120,11 @@ test('dashboard presents one vehicle service operating posture', async () => {
test('dashboard prioritizes customer vehicle service command over data sources', async () => {
window.history.replaceState(null, '', '/#/dashboard');
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')) {
@@ -1206,6 +1211,23 @@ test('dashboard prioritizes customer vehicle service command over data sources',
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.getByText('今天先看在线和地图,再处理告警、复盘轨迹、核对里程,最后把证据导出给客户。')).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户今日运营台 车辆在线 208 在线 打开地图' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户今日运营台 地图可见 0 有坐标 实时地图' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户今日运营台 轨迹复盘 4 活跃 回放轨迹' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户今日运营台 里程报表 1 天窗口 核对里程' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户今日运营台 告警通知 7 告警 闭环处理' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: /复制今日服务简报/ })).toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: /复制今日服务简报/ }));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('【客户今日车辆服务简报】'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('在线车辆208 / 1,033'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('地图可见0 辆有坐标'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('今日活跃4'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('告警车辆7'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('车辆地图http://localhost:3000/#/map?online=online'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('里程报表http://localhost:3000/#/mileage'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('历史导出http://localhost:3000/#/history-query?tab=raw&includeFields=true'));
expect(screen.getByRole('button', { name: '车辆服务指挥台优先队列 告警待处理 7 辆 告警事件' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '车辆服务指挥台优先队列 无有效定位 208 辆 打开地图' })).toBeInTheDocument();
expect(screen.getAllByText('车辆服务指挥台')[0].compareDocumentPosition(screen.getByText('车辆地图态势')) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();