feat(platform): copy customer service scope
This commit is contained in:
@@ -502,6 +502,47 @@ export default function App() {
|
||||
navigatePage(page);
|
||||
};
|
||||
|
||||
const customerScopeURL = (page: PageKey, filters: Record<string, string> = {}) => {
|
||||
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 (
|
||||
<AppShell activePage={activePage} linkIssueCount={linkIssueCount} activeAlertRuleCount={activeAlertRuleCount} p0AlertRuleCount={p0AlertRuleCount} platformRelease={platformRelease} currentVehicleStatus={currentVehicleStatus} currentVehicleLabel={currentVehicleLabel} currentVehicleConsistency={currentVehicleConsistency} customerTimeWindow={customerTimeWindow} onCustomerTimeWindowChange={setCustomerTimeWindow} onChange={navigatePage} onCustomerTask={openCustomerTask} onVehicleSearch={openVehicle}>
|
||||
<AppShell activePage={activePage} linkIssueCount={linkIssueCount} activeAlertRuleCount={activeAlertRuleCount} p0AlertRuleCount={p0AlertRuleCount} platformRelease={platformRelease} currentVehicleStatus={currentVehicleStatus} currentVehicleLabel={currentVehicleLabel} currentVehicleConsistency={currentVehicleConsistency} customerTimeWindow={customerTimeWindow} onCustomerTimeWindowChange={setCustomerTimeWindow} onCopyCustomerScope={copyCustomerScope} onChange={navigatePage} onCustomerTask={openCustomerTask} onVehicleSearch={openVehicle}>
|
||||
{pages[activePage]}
|
||||
</AppShell>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user