dzienniki

This commit is contained in:
2023-09-02 18:47:01 +02:00
parent 9d1dc4ffca
commit 1550849360
11 changed files with 163 additions and 167 deletions
+7 -5
View File
@@ -6,7 +6,7 @@
<JournalOptions
@on-search-confirm="fetchHistoryData"
@on-options-reset="resetOptions"
@on-refresh-data="fetchHistoryData"
@on-refresh-data="fetchHistoryData(true)"
:sorter-option-ids="['timestampFrom', 'duration']"
:data-status="dataStatus"
:current-options-active="currentOptionsActive"
@@ -186,10 +186,10 @@ export default defineComponent({
async addHistoryData() {
this.scrollDataLoaded = false;
const countFrom = this.historyList.length;
this.countFromIndex = this.historyList.length;
const responseData: DispatcherHistory[] = await (
await axios.get(`${DISPATCHERS_API_URL}?${this.currentQuery}&countFrom=${countFrom}`)
await axios.get(`${DISPATCHERS_API_URL}?${this.currentQuery}&countFrom=${this.countFromIndex}`)
).data;
if (!responseData) return;
@@ -203,7 +203,7 @@ export default defineComponent({
this.scrollDataLoaded = true;
},
async fetchHistoryData() {
async fetchHistoryData(reset = false) {
const queries: string[] = [];
const dispatcher = this.searchersValues['search-dispatcher'].trim();
@@ -217,7 +217,7 @@ export default defineComponent({
if (station) queries.push(`stationName=${station}`);
if (timestampFrom && timestampTo) queries.push(`timestampFrom=${timestampFrom}`, `timestampTo=${timestampTo}`);
// Z API: const SORT_TYPES = ['allStopsCount', 'endDate', 'beginDate', 'routeDistance'];
// API: const SORT_TYPES = ['allStopsCount', 'endDate', 'beginDate', 'routeDistance'];
if (this.sorterActive.id == 'timestampFrom') queries.push('sortBy=timestampFrom');
else if (this.sorterActive.id == 'duration') queries.push('sortBy=currentDuration');
else queries.push('sortBy=timestampFrom');
@@ -230,6 +230,8 @@ export default defineComponent({
this.currentQueryArray = queries;
try {
if (reset) this.dataStatus = DataStatus.Loading;
const responseData: DispatcherHistory[] = await (
await axios.get(`${DISPATCHERS_API_URL}?${this.currentQuery}`)
).data;