clear displayed transactions when changing filter

This commit is contained in:
MaysWind
2023-08-12 00:28:32 +08:00
parent 2454e22ea2
commit 7c2831098c
2 changed files with 18 additions and 0 deletions
+5
View File
@@ -307,6 +307,11 @@ export const useTransactionsStore = defineStore('transactions', {
this.transactionsNextTimeId = 0;
this.transactionListStateInvalid = true;
},
clearTransactions() {
this.transactions = [];
this.transactionsNextTimeId = 0;
this.transactionListStateInvalid = true;
},
initTransactionListFilter(filter) {
if (filter && isNumber(filter.dateType)) {
this.transactionsFilter.dateType = filter.dateType;
@@ -740,7 +740,9 @@ export default {
minTime: recentDateRange.minTime
});
this.loading = true;
this.currentPageTransactions = [];
this.transactionsStore.clearTransactions();
this.$router.push(this.getFilterLinkUrl());
},
changeCustomDateFilter(minTime, maxTime) {
@@ -756,7 +758,9 @@ export default {
this.showCustomDateRangeDialog = false;
this.loading = true;
this.currentPageTransactions = [];
this.transactionsStore.clearTransactions();
this.$router.push(this.getFilterLinkUrl());
},
changeTypeFilter(type) {
@@ -775,6 +779,9 @@ export default {
categoryId: removeCategoryFilter ? '0' : undefined
});
this.loading = true;
this.currentPageTransactions = [];
this.transactionsStore.clearTransactions();
this.$router.push(this.getFilterLinkUrl());
},
changeCategoryFilter(categoryId) {
@@ -786,6 +793,9 @@ export default {
categoryId: categoryId
});
this.loading = true;
this.currentPageTransactions = [];
this.transactionsStore.clearTransactions();
this.$router.push(this.getFilterLinkUrl());
},
changeAccountFilter(accountId) {
@@ -797,6 +807,9 @@ export default {
accountId: accountId
});
this.loading = true;
this.currentPageTransactions = [];
this.transactionsStore.clearTransactions();
this.$router.push(this.getFilterLinkUrl());
},
changeKeywordFilter(keyword) {