feat(platform): preserve vehicle context in topbar tasks
This commit is contained in:
@@ -272,7 +272,7 @@ export function AppShell({
|
||||
<Tag color={amapConfigured ? 'green' : 'orange'}>{amapConfigured ? '高德地图就绪' : '高德地图待配置'}</Tag>
|
||||
<div className="vp-topbar-quick-actions" aria-label="车辆服务快捷入口">
|
||||
{quickActions.map((item) => (
|
||||
<Button key={item.page} size="small" aria-label={item.ariaLabel} onClick={() => onChange(item.page)}>
|
||||
<Button key={item.page} size="small" aria-label={item.ariaLabel} onClick={() => (onCustomerTask ?? onChange)(item.page)}>
|
||||
{item.label}
|
||||
</Button>
|
||||
))}
|
||||
@@ -281,7 +281,7 @@ export function AppShell({
|
||||
size="small"
|
||||
aria-label={`顶部${alertLabel}`}
|
||||
className={alertClassName}
|
||||
onClick={() => onChange('alert-events')}
|
||||
onClick={() => (onCustomerTask ?? onChange)('alert-events')}
|
||||
>
|
||||
{alertLabel}
|
||||
</Button>
|
||||
|
||||
@@ -2946,6 +2946,15 @@ test('shows resolved vehicle service status after topbar search', async () => {
|
||||
expect(fetchMock).toHaveBeenCalledWith(expect.stringContaining('/api/vehicle-service/overview?keyword=%E7%B2%A4AG18312'), undefined);
|
||||
expect(fetchMock).not.toHaveBeenCalledWith(expect.stringContaining('/api/vehicles/resolve'), undefined);
|
||||
|
||||
fireEvent.click(screen.getByRole('button', { name: '顶部地图态势' }));
|
||||
expect(window.location.hash).toBe('#/map?keyword=LB9A32A24R0LS1426&protocol=JT808');
|
||||
fireEvent.click(screen.getByRole('button', { name: '顶部实时监控' }));
|
||||
expect(window.location.hash).toBe('#/realtime?keyword=LB9A32A24R0LS1426&protocol=JT808');
|
||||
fireEvent.click(screen.getByRole('button', { name: '顶部数据导出' }));
|
||||
expect(window.location.hash).toBe('#/history-query?keyword=LB9A32A24R0LS1426&protocol=JT808&tab=raw');
|
||||
fireEvent.click(await screen.findByRole('button', { name: '顶部告警事件正常' }));
|
||||
expect(window.location.hash).toBe('#/alert-events?keyword=LB9A32A24R0LS1426&protocol=JT808');
|
||||
|
||||
fireEvent.click(screen.getByRole('button', { name: '客户任务 轨迹回放 这段时间怎么跑' }));
|
||||
expect(window.location.hash).toBe('#/history?keyword=LB9A32A24R0LS1426&protocol=JT808');
|
||||
fireEvent.click(screen.getByRole('button', { name: '客户任务 统计查询 里程怎么算' }));
|
||||
|
||||
Reference in New Issue
Block a user