feat(platform): preserve customer time window in tasks

This commit is contained in:
lingniu
2026-07-05 19:16:33 +08:00
parent 30c15ec8fd
commit 4085268971
3 changed files with 58 additions and 7 deletions

View File

@@ -445,13 +445,36 @@ export default function App() {
replaceHash('mileage', keyword ?? nextVin, protocol ?? nextProtocol, restFilters);
};
const currentCustomerTaskTimeWindow = () => {
const candidates = activePage === 'mileage'
? [mileageFilters, historyFilters, qualityFilters]
: activePage === 'history' || activePage === 'history-query'
? [historyFilters, mileageFilters, qualityFilters]
: activePage === 'alert-events' || activePage === 'quality'
? [qualityFilters, historyFilters, mileageFilters]
: [historyFilters, mileageFilters, qualityFilters];
for (const filters of candidates) {
const dateFrom = filters.dateFrom?.trim();
const dateTo = filters.dateTo?.trim();
if (dateFrom || dateTo) {
return {
...(dateFrom ? { dateFrom } : {}),
...(dateTo ? { dateTo } : {})
};
}
}
return {};
};
const openCustomerTask = (page: PageKey) => {
const keyword = (activeVin || analysisVin).trim();
const protocol = activeProtocol.trim();
const timeWindow = currentCustomerTaskTimeWindow();
if (!keyword) {
navigatePage(page);
return;
}
const scopedFilters = { keyword, protocol, ...timeWindow };
if (page === 'map') {
openMap({ keyword, protocol });
return;
@@ -461,19 +484,19 @@ export default function App() {
return;
}
if (page === 'history') {
openHistoryWithFilters({ keyword, protocol });
openHistoryWithFilters(scopedFilters);
return;
}
if (page === 'history-query') {
openRawWithFilters({ keyword, protocol, tab: 'raw' });
openRawWithFilters({ ...scopedFilters, tab: 'raw' });
return;
}
if (page === 'mileage') {
openMileageWithFilters({ keyword, protocol });
openMileageWithFilters(scopedFilters);
return;
}
if (page === 'alert-events' || page === 'quality') {
openQuality({ keyword, protocol });
openQuality(scopedFilters);
return;
}
navigatePage(page);
@@ -522,7 +545,9 @@ function qualityFiltersFromRoute(route: ReturnType<typeof parseAppHash>): Record
return {
...(route.keyword ? { keyword: route.keyword } : {}),
...(route.protocol ? { protocol: route.protocol } : {}),
...(route.filters?.issueType ? { issueType: route.filters.issueType } : {})
...(route.filters?.issueType ? { issueType: route.filters.issueType } : {}),
...(route.filters?.dateFrom ? { dateFrom: route.filters.dateFrom } : {}),
...(route.filters?.dateTo ? { dateTo: route.filters.dateTo } : {})
};
}