do not reload transaction list when filter is not changed actually

This commit is contained in:
MaysWind
2024-07-07 11:07:26 +08:00
parent 9eddab3dd8
commit 297f8b9987
8 changed files with 175 additions and 95 deletions
@@ -252,7 +252,9 @@ export default {
const self = this;
const filteredAccountIds = {};
let isAllSelected = true;
let finalAccountIds = '';
let changed = true;
for (let accountId in self.filterAccountIds) {
if (!Object.prototype.hasOwnProperty.call(self.filterAccountIds, accountId)) {
@@ -263,6 +265,7 @@ export default {
if (!isAccountOrSubAccountsAllChecked(account, self.filterAccountIds)) {
filteredAccountIds[accountId] = true;
isAllSelected = false;
} else {
if (finalAccountIds.length > 0) {
finalAccountIds += ',';
@@ -279,13 +282,16 @@ export default {
filterAccountIds: filteredAccountIds
});
} else if (this.type === 'transactionListCurrent') {
self.transactionsStore.updateTransactionListFilter({
accountIds: finalAccountIds
changed = self.transactionsStore.updateTransactionListFilter({
accountIds: isAllSelected ? '' : finalAccountIds
});
self.transactionsStore.updateTransactionListInvalidState(true);
if (changed) {
self.transactionsStore.updateTransactionListInvalidState(true);
}
}
self.$emit('settings:change', true);
self.$emit('settings:change', changed);
},
cancel() {
this.$emit('settings:change', false);
@@ -260,7 +260,9 @@ export default {
const self = this;
const filteredCategoryIds = {};
let isAllSelected = true;
let finalCategoryIds = '';
let changed = true;
for (let categoryId in self.filterCategoryIds) {
if (!Object.prototype.hasOwnProperty.call(self.filterCategoryIds, categoryId)) {
@@ -271,6 +273,7 @@ export default {
if (!isCategoryOrSubCategoriesAllChecked(category, self.filterCategoryIds)) {
filteredCategoryIds[categoryId] = true;
isAllSelected = false;
} else {
if (finalCategoryIds.length > 0) {
finalCategoryIds += ',';
@@ -287,13 +290,16 @@ export default {
filterCategoryIds: filteredCategoryIds
});
} else if (this.type === 'transactionListCurrent') {
self.transactionsStore.updateTransactionListFilter({
categoryIds: finalCategoryIds
changed = self.transactionsStore.updateTransactionListFilter({
categoryIds: isAllSelected ? '' : finalCategoryIds
});
self.transactionsStore.updateTransactionListInvalidState(true);
if (changed) {
self.transactionsStore.updateTransactionListInvalidState(true);
}
}
self.$emit('settings:change', true);
self.$emit('settings:change', changed);
},
cancel() {
this.$emit('settings:change', false);