feat(platform): separate history capability entry

This commit is contained in:
lingniu
2026-07-04 14:28:27 +08:00
parent c03e890096
commit f6710514e3
3 changed files with 11 additions and 3 deletions

View File

@@ -299,12 +299,18 @@ export default function App() {
const nextFilters = normalizeHistoryFilterValues(filters);
const nextVin = nextFilters.keyword?.trim() || analysisVin;
const nextProtocol = nextFilters.protocol?.trim() ?? activeProtocol;
const nextTab = nextFilters.tab === 'raw' ? 'raw' : 'location';
setAnalysisVin(nextVin);
setActiveProtocol(nextProtocol);
setHistoryTab('location');
setHistoryTab(nextTab);
setHistoryFilters({ ...nextFilters, keyword: nextVin, protocol: nextProtocol });
setActivePage('history');
const { keyword, protocol, ...restFilters } = nextFilters;
if (nextTab === 'raw') {
restFilters.tab = nextTab;
} else {
delete restFilters.tab;
}
replaceHash('history', keyword ?? nextVin, protocol ?? nextProtocol, restFilters);
};
@@ -466,7 +472,7 @@ function normalizeMileageFilterValues(filters: Record<string, unknown> = {}): Re
function normalizeHistoryFilterValues(filters: Record<string, unknown> = {}): Record<string, string> {
const normalized: Record<string, string> = {};
for (const key of ['keyword', 'protocol', 'dateFrom', 'dateTo', 'fields'] as const) {
for (const key of ['keyword', 'protocol', 'dateFrom', 'dateTo', 'fields', 'tab'] as const) {
const value = String(filters[key] ?? '').trim();
if (value) {
normalized[key] = value;