feat(platform): add focus vehicle service card

This commit is contained in:
lingniu
2026-07-04 21:42:04 +08:00
parent 5d57efabea
commit f0f7bc546e
3 changed files with 179 additions and 3 deletions

View File

@@ -1015,6 +1015,11 @@ test('dashboard exposes end-to-end operations workflow entries', async () => {
test('dashboard surfaces highest priority quality issue with evidence shortcuts', 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')) {
@@ -1116,10 +1121,21 @@ test('dashboard surfaces highest priority quality issue with evidence shortcuts'
render(<App />);
expect(await screen.findByText('重点车辆服务')).toBeInTheDocument();
expect(screen.getByText('把协议来源作为证据把实时、轨迹、RAW、统计和告警集中到同一辆车处理。')).toBeInTheDocument();
expect(screen.getByText('实时证据')).toBeInTheDocument();
expect(screen.getAllByText('轨迹证据').length).toBeGreaterThanOrEqual(1);
expect(screen.getByText('告警证据')).toBeInTheDocument();
expect(screen.getByText('统计证据')).toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: '复制处置卡' }));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('【重点车辆服务处置卡】'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('车辆粤A告警1 / 13307795425'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('实时监控http://localhost:3000/#/realtime?keyword=%E7%B2%A4A%E5%91%8A%E8%AD%A61&protocol=JT808'));
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('RAW证据http://localhost:3000/#/history-query?keyword=%E7%B2%A4A%E5%91%8A%E8%AD%A61&protocol=JT808&tab=raw&includeFields=true'));
expect(await screen.findByText('最高优先级告警')).toBeInTheDocument();
expect(screen.getByText('粤A告警1 / 13307795425')).toBeInTheDocument();
expect(screen.getAllByText('粤A告警1 / 13307795425').length).toBeGreaterThanOrEqual(1);
expect(screen.getByText('VIN 缺失')).toBeInTheDocument();
expect(screen.getByText('JT808 数据缺少 VIN 映射')).toBeInTheDocument();
expect(screen.getAllByText('JT808 数据缺少 VIN 映射').length).toBeGreaterThanOrEqual(1);
fireEvent.click(screen.getByRole('button', { name: '首页告警轨迹证据' }));
@@ -2470,7 +2486,7 @@ test('shows row service status in dashboard vehicle previews', async () => {
expect(screen.getAllByText('1/2 来源在线').length).toBeGreaterThanOrEqual(1);
expect(screen.getByText('覆盖部分离线')).toBeInTheDocument();
expect(screen.getByText('VIN-REALTIME-OFFLINE')).toBeInTheDocument();
expect(screen.getByText('实时车辆离线')).toBeInTheDocument();
expect(screen.getAllByText('实时车辆离线').length).toBeGreaterThanOrEqual(1);
});
test('filters dashboard coverage from source consistency diagnosis', async () => {