diff --git a/src/components/JournalView/JournalDispatchersList.vue b/src/components/JournalView/JournalDispatchersList.vue index 26093a4..45708fa 100644 --- a/src/components/JournalView/JournalDispatchersList.vue +++ b/src/components/JournalView/JournalDispatchersList.vue @@ -33,7 +33,7 @@ {{ historyItem.stationName }} @@ -41,7 +41,7 @@ #{{ historyItem.stationHash }} { if (this.isAnotherDay(i - 1, i)) diff --git a/src/components/JournalView/JournalOptions.vue b/src/components/JournalView/JournalOptions.vue index 18242b8..0f9f289 100644 --- a/src/components/JournalView/JournalOptions.vue +++ b/src/components/JournalView/JournalOptions.vue @@ -41,7 +41,7 @@ { + const searchVal = this.searchersValues[k as Journal.TimetableSearchKey]; + + acc[k] = searchVal || undefined; + + return acc; + }, + {} as { [k: string]: string | undefined } + ), + ...this.filterList?.reduce( + (acc, f) => { + if (f.isActive) acc[f.filterSection] = f.default ? undefined : f.id; + return acc; + }, + {} as { [k: string]: string | undefined } + ) + } + }); + }, + refreshData() { this.$emit('onRefreshData'); }, @@ -233,7 +263,7 @@ export default defineComponent({ onSorterChange(item: { id: string | number; value: string }) { this.sorterActive.id = item.id; this.sorterActive.dir = -1; - this.$emit('onSearchConfirm'); + this.searchConfirm(); }, onFilterChange(filter: Journal.TimetableFilter) { @@ -243,25 +273,27 @@ export default defineComponent({ .forEach((f) => (f.isActive = false)); filter.isActive = true; - this.$emit('onSearchConfirm'); + this.searchConfirm(); }, onInputClear(id: any) { this.searchersValues[id] = ''; - this.$emit('onSearchConfirm'); + this.searchConfirm(); }, - onSearchConfirm() { + searchConfirm() { this.$emit('onSearchConfirm'); + this.handleRouteParams(); }, onSearchButtonConfirm() { this.showOptions = false; - this.$emit('onSearchConfirm'); + this.searchConfirm(); }, onResetButtonClick() { this.$emit('onOptionsReset'); + this.handleRouteParams(); } } }); diff --git a/src/components/SceneryView/SceneryDispatchersHistory.vue b/src/components/SceneryView/SceneryDispatchersHistory.vue index 87660cd..b99146c 100644 --- a/src/components/SceneryView/SceneryDispatchersHistory.vue +++ b/src/components/SceneryView/SceneryDispatchersHistory.vue @@ -19,7 +19,9 @@ #{{ historyItem.stationHash }} - + {{ historyItem.dispatcherName }} diff --git a/src/mixins/listObserverMixin.ts b/src/mixins/listObserverMixin.ts index 98ae7a8..cd1dd68 100644 --- a/src/mixins/listObserverMixin.ts +++ b/src/mixins/listObserverMixin.ts @@ -10,8 +10,6 @@ export default defineComponent({ mountObserver(actionFunction: () => void, target: Element) { this.observer = new IntersectionObserver( (entries) => { - console.log(entries); - if (entries[0].intersectionRatio > 0.5) actionFunction(); }, { threshold: 0.2 } diff --git a/src/views/JournalDispatchers.vue b/src/views/JournalDispatchers.vue index 9dab4d1..59f7d6b 100644 --- a/src/views/JournalDispatchers.vue +++ b/src/views/JournalDispatchers.vue @@ -140,8 +140,6 @@ export default defineComponent({ }, 'mainStore.dispatcherStatsData'(stats) { - console.log('dispatcher stats', stats); - this.statsButtons.find((sb) => sb.tab == Journal.StatsTab.DISPATCHER_STATS)!.disabled = stats === undefined; } @@ -175,6 +173,7 @@ export default defineComponent({ } }); }, + handleScroll(e: Event) { const listElement = e.target as HTMLElement; const scrollTop = listElement.scrollTop; @@ -187,19 +186,17 @@ export default defineComponent({ }, handleQueries(query: LocationQuery) { - // if (queryKeys.includes('sceneryName')) this.setSearchers('', `${query.sceneryName}`, ''); - // if (queryKeys.includes('dispatcherName')) - // this.setSearchers('', '', `${query.dispatcherName}`); + this.setOptions(query as any); }, - setSearchers(searchers: { [key: string]: string }) { + setOptions(searchers: { [key: string]: string }) { this.searchersValues['search-date'] = searchers['search-date'] ?? ''; this.searchersValues['search-station'] = searchers['search-station'] ?? ''; this.searchersValues['search-dispatcher'] = searchers['search-dispatcher'] ?? ''; }, resetOptions() { - this.setSearchers({}); + this.setOptions({}); this.sorterActive.id = 'timestampFrom'; this.fetchHistoryData(); diff --git a/src/views/JournalTimetables.vue b/src/views/JournalTimetables.vue index 56f31bf..ff0fcb9 100644 --- a/src/views/JournalTimetables.vue +++ b/src/views/JournalTimetables.vue @@ -250,37 +250,9 @@ export default defineComponent({ methods: { onSearchConfirm() { - this.handleRouteParams(); - this.fetchHistoryData(); }, - handleRouteParams() { - this.$router.push({ - query: { - ...this.$route.query, - 'sorter-active': this.sorterActive.id != 'timetableId' ? this.sorterActive.id : undefined, - ...Object.keys(this.searchersValues).reduce( - (acc, k) => { - const searchVal = this.searchersValues[k as Journal.TimetableSearchKey]; - - acc[k] = searchVal || undefined; - - return acc; - }, - {} as { [k: string]: string | undefined } - ), - ...this.filterList.reduce( - (acc, f) => { - if (f.isActive) acc[f.filterSection] = f.default ? undefined : f.id; - return acc; - }, - {} as { [k: string]: string | undefined } - ) - } - }); - }, - handleScroll(e: Event) { const listElement = e.target as HTMLElement; const scrollTop = listElement.scrollTop; @@ -316,15 +288,15 @@ export default defineComponent({ resetOptions() { this.setOptions({}); - this.sorterActive.id = 'timetableId'; + // this.sorterActive.id = 'timetableId'; - this.filterList.forEach( - (f) => - (f.isActive = - this.initFilters.find((initFilter) => initFilter.id == f.id)?.isActive || false) - ); + // this.filterList.forEach( + // (f) => + // (f.isActive = + // this.initFilters.find((initFilter) => initFilter.id == f.id)?.isActive || false) + // ); - this.handleRouteParams(); + // this.handleRouteParams(); this.fetchHistoryData(); },