diff --git a/vehicle-data-platform/apps/web/src/App.tsx b/vehicle-data-platform/apps/web/src/App.tsx index dc1270be..accdecb7 100644 --- a/vehicle-data-platform/apps/web/src/App.tsx +++ b/vehicle-data-platform/apps/web/src/App.tsx @@ -502,6 +502,47 @@ export default function App() { navigatePage(page); }; + const customerScopeURL = (page: PageKey, filters: Record = {}) => { + return `${window.location.origin}${window.location.pathname}${buildAppHash({ + page, + keyword: filters.keyword, + protocol: filters.protocol, + filters + })}`; + }; + + const copyCustomerScope = async () => { + const keyword = (activeVin || analysisVin).trim(); + if (!keyword) { + Toast.warning('请先查询一辆车'); + return; + } + const protocol = activeProtocol.trim(); + const timeWindow = currentCustomerTaskTimeWindow(); + const scopedFilters = { keyword, protocol, ...timeWindow }; + const rangeText = timeWindow.dateFrom || timeWindow.dateTo + ? `${timeWindow.dateFrom || '未指定'} 至 ${timeWindow.dateTo || '未指定'}` + : '实时范围'; + const lines = [ + '【客户车辆服务范围】', + `车辆:${currentVehicleLabel || keyword}`, + `协议:${protocol || '全部'}`, + `时间窗:${rangeText}`, + `实时地图:${customerScopeURL('map', { keyword, protocol })}`, + `实时监控:${customerScopeURL('realtime', { keyword, protocol })}`, + `轨迹回放:${customerScopeURL('history', scopedFilters)}`, + `统计查询:${customerScopeURL('mileage', scopedFilters)}`, + `数据导出:${customerScopeURL('history-query', { ...scopedFilters, tab: 'raw' })}`, + `告警通知:${customerScopeURL('alert-events', scopedFilters)}` + ]; + try { + await navigator.clipboard.writeText(lines.join('\n')); + Toast.success('已复制客户服务范围'); + } catch { + Toast.error('复制客户服务范围失败'); + } + }; + const updateVehicleDetailQuery = (keyword: string, protocol?: string) => { const nextKeyword = keyword.trim(); const nextProtocol = protocol?.trim() ?? ''; @@ -535,7 +576,7 @@ export default function App() { }; return ( - + {pages[activePage]} ); diff --git a/vehicle-data-platform/apps/web/src/layout/AppShell.tsx b/vehicle-data-platform/apps/web/src/layout/AppShell.tsx index 39c7ead0..ee0c21a4 100644 --- a/vehicle-data-platform/apps/web/src/layout/AppShell.tsx +++ b/vehicle-data-platform/apps/web/src/layout/AppShell.tsx @@ -142,6 +142,7 @@ export function AppShell({ currentVehicleConsistency, customerTimeWindow, onCustomerTimeWindowChange, + onCopyCustomerScope, onChange, onCustomerTask, onVehicleSearch, @@ -157,6 +158,7 @@ export function AppShell({ currentVehicleConsistency?: VehicleSourceConsistency; customerTimeWindow?: Record; onCustomerTimeWindowChange?: (filters: Record) => void; + onCopyCustomerScope?: () => void; onChange: (page: PageKey) => void; onCustomerTask?: (page: PageKey) => void; onVehicleSearch: (keyword: string) => void | Promise; @@ -326,6 +328,13 @@ export function AppShell({ ))} +