feat(platform): refine vehicle detail operations view

This commit is contained in:
lingniu
2026-07-05 00:47:05 +08:00
parent 9a428198b4
commit 4acf86b073
2 changed files with 74 additions and 74 deletions

View File

@@ -9587,7 +9587,7 @@ test('opens amap coordinate and trajectory playback from realtime map service qu
'noopener,noreferrer'
);
fireEvent.click(screen.getByRole('button', { name: '轨迹回放' }));
fireEvent.click(screen.getAllByRole('button', { name: '轨迹回放' })[0]);
expect(window.location.hash).toBe('#/history?keyword=VIN-MAP-LINK&protocol=GB32960');
});
@@ -10738,11 +10738,11 @@ test('switches vehicle detail to a source from the source matrix', async () => {
expect(screen.getAllByText('定位证据').length).toBeGreaterThanOrEqual(1);
expect(screen.getAllByText('统计口径').length).toBeGreaterThanOrEqual(1);
expect(screen.getByText('无实时字段')).toBeInTheDocument();
expect(screen.getByText('无 RAW 证据')).toBeInTheDocument();
expect(screen.getByText('无原始记录')).toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: '复制归并矩阵' }));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('【单车多源归并矩阵】'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('1. GB32960 / 主来源'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('贡献:主实时来源、在线心跳、实时字段、定位证据、轨迹回放、RAW证据、统计口径'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('贡献:主实时来源、在线心跳、实时字段、定位证据、轨迹回放、原始记录、统计口径'));
expect(screen.getByText('车辆服务角色')).toBeInTheDocument();
expect(screen.getAllByText('主来源').length).toBeGreaterThanOrEqual(1);
expect(screen.getAllByText('在线证据').length).toBeGreaterThanOrEqual(1);
@@ -10828,22 +10828,22 @@ test('shows unified service overview on vehicle detail', async () => {
expect(await screen.findByText('车辆服务概览')).toBeInTheDocument();
expect(screen.getByText('车辆服务档案总览')).toBeInTheDocument();
expect(screen.getByRole('button', { name: /复制档案/ })).toBeInTheDocument();
expect(screen.getByText('单车服务作业台')).toBeInTheDocument();
expect(screen.getByText('单车服务闭环Runbook')).toBeInTheDocument();
expect(screen.getByText('单车运营工作台')).toBeInTheDocument();
expect(screen.getByText('单车服务处理清单')).toBeInTheDocument();
expect(screen.getAllByText('档案完整度').length).toBeGreaterThanOrEqual(1);
expect(screen.getByText('实时')).toBeInTheDocument();
expect(screen.getAllByText('轨迹').length).toBeGreaterThanOrEqual(1);
expect(screen.getAllByText('RAW').length).toBeGreaterThanOrEqual(1);
expect(screen.getAllByText('原始记录').length).toBeGreaterThanOrEqual(1);
expect(screen.getAllByText('里程').length).toBeGreaterThanOrEqual(1);
expect(screen.getAllByText('告警').length).toBeGreaterThanOrEqual(1);
expect(screen.getByText('实时定位')).toBeInTheDocument();
expect(screen.getAllByText('轨迹回放').length).toBeGreaterThanOrEqual(1);
expect(screen.getAllByText('RAW 证据').length).toBeGreaterThan(0);
expect(screen.getAllByText('原始记录').length).toBeGreaterThan(0);
expect(screen.getByText('告警处置')).toBeInTheDocument();
expect(screen.getByText('里程复核')).toBeInTheDocument();
expect(screen.getByText('确认实时状态')).toBeInTheDocument();
expect(screen.getByText('回放轨迹断点')).toBeInTheDocument();
expect(screen.getByText('核对 RAW 字段')).toBeInTheDocument();
expect(screen.getByText('核对原始记录')).toBeInTheDocument();
expect(screen.getByText('处理告警闭环')).toBeInTheDocument();
expect(screen.getByText('复核统计口径')).toBeInTheDocument();
expect(screen.getByText('车辆在线状态、最新时间、有效坐标均可解释。')).toBeInTheDocument();
@@ -10853,8 +10853,8 @@ test('shows unified service overview on vehicle detail', async () => {
expect(screen.getAllByText('1 项').length).toBeGreaterThan(0);
expect(screen.getByText('7 条统计')).toBeInTheDocument();
expect(screen.getByText('2/3')).toBeInTheDocument();
expect(screen.getByText('历史 12 / RAW 34 / 里程 7')).toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: '单车作业台 RAW 证据 查看 RAW' }));
expect(screen.getByText('轨迹 12 / 原始记录 34 / 里程 7')).toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: '单车运营工作台 原始记录 查看原始记录' }));
expect(window.location.hash).toBe('#/history-query?keyword=VIN001&tab=raw');
});
@@ -11338,7 +11338,7 @@ test('copies vehicle service diagnostic summary', async () => {
render(<App />);
expect(await screen.findByText('统一车辆服务视图')).toBeInTheDocument();
expect(await screen.findByText('车辆运营总览')).toBeInTheDocument();
expect(screen.getByRole('button', { name: /复制归一摘要/ })).toBeInTheDocument();
expect(screen.getByText('车辆身份')).toBeInTheDocument();
expect(screen.getByText('实时主来源')).toBeInTheDocument();
@@ -11358,7 +11358,7 @@ test('copies vehicle service diagnostic summary', async () => {
expect(unifiedCopied).toContain('实时主来源JT808');
expect(unifiedCopied).toContain('来源在线1/2');
expect(unifiedCopied).toContain('业务可用性:在线可用');
expect(unifiedCopied).toContain('数据资产:实时 2 / 轨迹 12 / RAW 34 / 里程 3 / 告警 1');
expect(unifiedCopied).toContain('服务数据:实时 2 / 轨迹 12 / 原始记录 34 / 里程 3 / 告警 1');
expect(unifiedCopied).toContain('车辆服务http://localhost:3000/#/detail?keyword=VIN-SUMMARY-001&protocol=JT808');
fireEvent.click(screen.getByRole('button', { name: /复制档案/ }));
await waitFor(() => {
@@ -11370,7 +11370,7 @@ test('copies vehicle service diagnostic summary', async () => {
expect(dossierCopied).toContain('当前范围单一来源JT808');
expect(dossierCopied).toContain('主来源JT808');
expect(dossierCopied).toContain('来源在线1/2');
expect(dossierCopied).toContain('资产概览:实时 2 / 轨迹 12 / RAW 34 / 里程 3 / 告警 1');
expect(dossierCopied).toContain('资产概览:实时 2 / 轨迹 12 / 原始记录 34 / 里程 3 / 告警 1');
expect(dossierCopied).toContain('车辆服务http://localhost:3000/#/detail?keyword=VIN-SUMMARY-001&protocol=JT808');
fireEvent.click(screen.getByRole('button', { name: /复制诊断摘要/ }));
@@ -11387,13 +11387,13 @@ test('copies vehicle service diagnostic summary', async () => {
expect(copied).toContain('定位证据2 个来源有位置');
expect(copied).toContain('里程差异12.6 km');
expect(copied).toContain('时间差异90 秒');
expect(copied).toContain('数据规模:实时 2 / 历史 12 / RAW 34 / 里程 3 / 质量 1');
expect(copied).toContain('服务数据:实时 2 / 轨迹 12 / 原始记录 34 / 里程 3 / 告警 1');
expect(copied).toContain('一致性:来源不完整');
expect(copied).toContain('下一步:');
expect(copied).toContain('车辆服务http://localhost:3000/#/detail?keyword=VIN-SUMMARY-001&protocol=JT808');
expect(copied).toContain('实时http://localhost:3000/#/realtime?keyword=VIN-SUMMARY-001&protocol=JT808');
expect(copied).toContain('轨迹http://localhost:3000/#/history?keyword=VIN-SUMMARY-001&protocol=JT808');
expect(copied).toContain('RAWhttp://localhost:3000/#/history-query?keyword=VIN-SUMMARY-001&protocol=JT808&tab=raw&includeFields=true');
expect(copied).toContain('原始记录http://localhost:3000/#/history-query?keyword=VIN-SUMMARY-001&protocol=JT808&tab=raw&includeFields=true');
expect(copied).toContain('里程http://localhost:3000/#/mileage?keyword=VIN-SUMMARY-001&protocol=JT808');
fireEvent.click(screen.getByRole('button', { name: /复制运营摘要/ }));
@@ -11415,25 +11415,25 @@ test('copies vehicle service diagnostic summary', async () => {
expect(operationsCopied).toContain('车辆服务http://localhost:3000/#/detail?keyword=VIN-SUMMARY-001&protocol=JT808');
expect(operationsCopied).toContain('实时监控http://localhost:3000/#/realtime?keyword=VIN-SUMMARY-001&protocol=JT808');
expect(operationsCopied).toContain('轨迹回放http://localhost:3000/#/history?keyword=VIN-SUMMARY-001&protocol=JT808');
expect(operationsCopied).toContain('RAW证据http://localhost:3000/#/history-query?keyword=VIN-SUMMARY-001&protocol=JT808&tab=raw&includeFields=true');
expect(operationsCopied).toContain('原始记录http://localhost:3000/#/history-query?keyword=VIN-SUMMARY-001&protocol=JT808&tab=raw&includeFields=true');
expect(operationsCopied).toContain('里程统计http://localhost:3000/#/mileage?keyword=VIN-SUMMARY-001&protocol=JT808');
fireEvent.click(screen.getByRole('button', { name: '复制Runbook' }));
fireEvent.click(screen.getByRole('button', { name: '复制处理清单' }));
await waitFor(() => {
expect(writeText.mock.calls.some((call) => String(call[0]).includes('【单车服务闭环Runbook】'))).toBe(true);
expect(writeText.mock.calls.some((call) => String(call[0]).includes('【单车服务处理清单】'))).toBe(true);
});
const runbookCopied = String(writeText.mock.lastCall?.[0] ?? '');
expect(runbookCopied).toContain('【单车服务闭环Runbook】');
expect(runbookCopied).toContain('【单车服务处理清单】');
expect(runbookCopied).toContain('车辆粤A诊断1 / VIN-SUMMARY-001');
expect(runbookCopied).toContain('当前范围单一来源JT808');
expect(runbookCopied).toContain('1. 确认实时状态');
expect(runbookCopied).toContain('2. 回放轨迹断点');
expect(runbookCopied).toContain('3. 核对 RAW 字段');
expect(runbookCopied).toContain('3. 核对原始记录');
expect(runbookCopied).toContain('4. 处理告警闭环');
expect(runbookCopied).toContain('5. 复核统计口径');
expect(runbookCopied).toContain('验收:车辆在线状态、最新时间、有效坐标均可解释。');
expect(runbookCopied).toContain('告警事件http://localhost:3000/#/alert-events?keyword=VIN-SUMMARY-001&protocol=JT808');
expect(runbookCopied).toContain('统计查询http://localhost:3000/#/mileage?keyword=VIN-SUMMARY-001&protocol=JT808');
expect(runbookCopied).toContain('里程统计http://localhost:3000/#/mileage?keyword=VIN-SUMMARY-001&protocol=JT808');
});
test('exports vehicle detail service dossier as csv', async () => {
@@ -11600,7 +11600,7 @@ test('opens history with the currently selected vehicle detail source', async ()
render(<App />);
fireEvent.click(await screen.findByRole('button', { name: '仅看 JT808' }));
fireEvent.click(screen.getByRole('button', { name: '查看历史' }));
fireEvent.click(screen.getAllByRole('button', { name: '轨迹回放' })[0]);
await waitFor(() => {
expect(window.location.hash).toBe('#/history?keyword=VIN001&protocol=JT808');
@@ -11676,7 +11676,7 @@ test('opens raw history with the currently selected vehicle detail source', asyn
render(<App />);
fireEvent.click(await screen.findByRole('button', { name: '仅看 JT808' }));
fireEvent.click(screen.getByRole('button', { name: '查看 RAW' }));
fireEvent.click(screen.getAllByRole('button', { name: '数据导出' })[0]);
await waitFor(() => {
expect(window.location.hash).toBe('#/history-query?keyword=VIN001&protocol=JT808&tab=raw');
@@ -11827,7 +11827,7 @@ test('opens source-specific history directly from vehicle detail source card', a
render(<App />);
fireEvent.click(await screen.findByRole('button', { name: '查看 JT808 历史' }));
fireEvent.click(await screen.findByRole('button', { name: '查看 JT808 轨迹' }));
await waitFor(() => {
expect(window.location.hash).toBe('#/history?keyword=VIN001&protocol=JT808');
@@ -11902,7 +11902,7 @@ test('opens source-specific raw history directly from vehicle detail source evid
render(<App />);
fireEvent.click(await screen.findByRole('button', { name: '查看 JT808 RAW' }));
fireEvent.click(await screen.findByRole('button', { name: '查看 JT808 原始记录' }));
await waitFor(() => {
expect(window.location.hash).toBe('#/history-query?keyword=VIN001&protocol=JT808&tab=raw');