mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 05:18:11 +00:00
chore(journal): added dispatcher filtering by duty id
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
export namespace Journal {
|
export namespace Journal {
|
||||||
export type DispatcherSearchKey =
|
export type DispatcherSearchKey =
|
||||||
|
| 'search-duty-id'
|
||||||
| 'search-dispatcher'
|
| 'search-dispatcher'
|
||||||
| 'search-station'
|
| 'search-station'
|
||||||
| 'search-date-from'
|
| 'search-date-from'
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
:to="
|
:to="
|
||||||
'trainNo' in entry.value
|
'trainNo' in entry.value
|
||||||
? `/journal/timetables?search-train=%23${entry.value.id}`
|
? `/journal/timetables?search-train=%23${entry.value.id}`
|
||||||
: `/journal/dispatchers?search-dispatcher=${entry.value.dispatcherName}`
|
: `/journal/dispatchers?search-duty-id=${entry.value.id}`
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<!-- Date -->
|
<!-- Date -->
|
||||||
@@ -209,7 +209,7 @@ function toggleFilter(filterType: JournalEntryType) {
|
|||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(3, 1fr);
|
grid-template-columns: repeat(3, 1fr);
|
||||||
gap: 1em;
|
gap: 1em;
|
||||||
padding: 0 1px;
|
padding: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu-btn {
|
.menu-btn {
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ import JournalStats from '../components/JournalView/JournalStats.vue';
|
|||||||
import { useApiStore } from '../store/apiStore';
|
import { useApiStore } from '../store/apiStore';
|
||||||
|
|
||||||
interface DispatchersQueryParams {
|
interface DispatchersQueryParams {
|
||||||
|
dutyId?: number;
|
||||||
dispatcherName?: string;
|
dispatcherName?: string;
|
||||||
stationName?: string;
|
stationName?: string;
|
||||||
stationHash?: string;
|
stationHash?: string;
|
||||||
@@ -114,12 +115,13 @@ export default defineComponent({
|
|||||||
const sorterActive: Journal.DispatcherSorter = reactive({ id: 'timestampFrom', dir: -1 });
|
const sorterActive: Journal.DispatcherSorter = reactive({ id: 'timestampFrom', dir: -1 });
|
||||||
const journalFilterActive = ref({});
|
const journalFilterActive = ref({});
|
||||||
|
|
||||||
const searchersValues = reactive({
|
const searchersValues = reactive<Record<Journal.DispatcherSearchKey, string>>({
|
||||||
|
'search-duty-id': '',
|
||||||
'search-dispatcher': '',
|
'search-dispatcher': '',
|
||||||
'search-station': '',
|
'search-station': '',
|
||||||
'search-date-from': '',
|
'search-date-from': '',
|
||||||
'search-date-to': ''
|
'search-date-to': ''
|
||||||
} as Journal.DispatcherSearchType);
|
});
|
||||||
|
|
||||||
provide('sorterActive', sorterActive);
|
provide('sorterActive', sorterActive);
|
||||||
provide('journalFilterActive', journalFilterActive);
|
provide('journalFilterActive', journalFilterActive);
|
||||||
@@ -171,6 +173,7 @@ export default defineComponent({
|
|||||||
handleRouteParams() {
|
handleRouteParams() {
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
query: {
|
query: {
|
||||||
|
'search-duty-id': this.searchersValues['search-duty-id'] || undefined,
|
||||||
'search-date-from': this.searchersValues['search-date-from'] || undefined,
|
'search-date-from': this.searchersValues['search-date-from'] || undefined,
|
||||||
'search-date-to': this.searchersValues['search-date-to'] || undefined,
|
'search-date-to': this.searchersValues['search-date-to'] || undefined,
|
||||||
'search-station': this.searchersValues['search-station'] || undefined,
|
'search-station': this.searchersValues['search-station'] || undefined,
|
||||||
@@ -194,7 +197,8 @@ export default defineComponent({
|
|||||||
this.setOptions(query as any);
|
this.setOptions(query as any);
|
||||||
},
|
},
|
||||||
|
|
||||||
setOptions(options: { [key: string]: string }) {
|
setOptions(options: Record<string, string>) {
|
||||||
|
this.searchersValues['search-duty-id'] = options['search-duty-id'] ?? '';
|
||||||
this.searchersValues['search-date-from'] = options['search-date-from'] ?? '';
|
this.searchersValues['search-date-from'] = options['search-date-from'] ?? '';
|
||||||
this.searchersValues['search-date-to'] = options['search-date-to'] ?? '';
|
this.searchersValues['search-date-to'] = options['search-date-to'] ?? '';
|
||||||
this.searchersValues['search-station'] = options['search-station'] ?? '';
|
this.searchersValues['search-station'] = options['search-station'] ?? '';
|
||||||
@@ -231,6 +235,7 @@ export default defineComponent({
|
|||||||
async fetchHistoryData() {
|
async fetchHistoryData() {
|
||||||
const queryParams: DispatchersQueryParams = {};
|
const queryParams: DispatchersQueryParams = {};
|
||||||
|
|
||||||
|
const dutyId = this.searchersValues['search-duty-id'].trim() || undefined;
|
||||||
const dispatcherName = this.searchersValues['search-dispatcher'].trim() || undefined;
|
const dispatcherName = this.searchersValues['search-dispatcher'].trim() || undefined;
|
||||||
const stationName = this.searchersValues['search-station'].trim() || undefined;
|
const stationName = this.searchersValues['search-station'].trim() || undefined;
|
||||||
const dateFromString = this.searchersValues['search-date-from'].trim() || undefined;
|
const dateFromString = this.searchersValues['search-date-from'].trim() || undefined;
|
||||||
@@ -251,6 +256,7 @@ export default defineComponent({
|
|||||||
dateToISO = dateTo.toISOString();
|
dateToISO = dateTo.toISOString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
queryParams['dutyId'] = Number(dutyId) || undefined;
|
||||||
queryParams['dispatcherName'] = dispatcherName;
|
queryParams['dispatcherName'] = dispatcherName;
|
||||||
|
|
||||||
queryParams['dateFrom'] = dateFromISO;
|
queryParams['dateFrom'] = dateFromISO;
|
||||||
|
|||||||
Reference in New Issue
Block a user