diff --git a/src/stores/transaction.js b/src/stores/transaction.js
index 987d5b38..67cf468b 100644
--- a/src/stores/transaction.js
+++ b/src/stores/transaction.js
@@ -489,37 +489,49 @@ export const useTransactionsStore = defineStore('transactions', {
}
},
updateTransactionListFilter(filter) {
- if (filter && isNumber(filter.dateType)) {
+ let changed = false;
+
+ if (filter && isNumber(filter.dateType) && this.transactionsFilter.dateType !== filter.dateType) {
this.transactionsFilter.dateType = filter.dateType;
+ changed = true;
}
- if (filter && isNumber(filter.maxTime)) {
+ if (filter && isNumber(filter.maxTime) && this.transactionsFilter.maxTime !== filter.maxTime) {
this.transactionsFilter.maxTime = filter.maxTime;
+ changed = true;
}
- if (filter && isNumber(filter.minTime)) {
+ if (filter && isNumber(filter.minTime) && this.transactionsFilter.minTime !== filter.minTime) {
this.transactionsFilter.minTime = filter.minTime;
+ changed = true;
}
- if (filter && isNumber(filter.type)) {
+ if (filter && isNumber(filter.type) && this.transactionsFilter.type !== filter.type) {
this.transactionsFilter.type = filter.type;
+ changed = true;
}
- if (filter && isString(filter.categoryIds)) {
+ if (filter && isString(filter.categoryIds) && this.transactionsFilter.categoryIds !== filter.categoryIds) {
this.transactionsFilter.categoryIds = filter.categoryIds;
+ changed = true;
}
- if (filter && isString(filter.accountIds)) {
+ if (filter && isString(filter.accountIds) && this.transactionsFilter.accountIds !== filter.accountIds) {
this.transactionsFilter.accountIds = filter.accountIds;
+ changed = true;
}
- if (filter && isString(filter.amountFilter)) {
+ if (filter && isString(filter.amountFilter) && this.transactionsFilter.amountFilter !== filter.amountFilter) {
this.transactionsFilter.amountFilter = filter.amountFilter;
+ changed = true;
}
- if (filter && isString(filter.keyword)) {
+ if (filter && isString(filter.keyword) && this.transactionsFilter.keyword !== filter.keyword) {
this.transactionsFilter.keyword = filter.keyword;
+ changed = true;
}
+
+ return changed;
},
getTransactionListPageParams() {
const querys = [];
diff --git a/src/views/desktop/common/cards/AccountFilterSettingsCard.vue b/src/views/desktop/common/cards/AccountFilterSettingsCard.vue
index 82455a85..6e76cc06 100644
--- a/src/views/desktop/common/cards/AccountFilterSettingsCard.vue
+++ b/src/views/desktop/common/cards/AccountFilterSettingsCard.vue
@@ -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);
diff --git a/src/views/desktop/common/cards/CategoryFilterSettingsCard.vue b/src/views/desktop/common/cards/CategoryFilterSettingsCard.vue
index 05d8aa21..e08f277a 100644
--- a/src/views/desktop/common/cards/CategoryFilterSettingsCard.vue
+++ b/src/views/desktop/common/cards/CategoryFilterSettingsCard.vue
@@ -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);
diff --git a/src/views/desktop/transactions/ListPage.vue b/src/views/desktop/transactions/ListPage.vue
index 6342db55..c86f378a 100644
--- a/src/views/desktop/transactions/ListPage.vue
+++ b/src/views/desktop/transactions/ListPage.vue
@@ -11,7 +11,7 @@
{ name: $t('Income'), value: 2 },
{ name: $t('Expense'), value: 3 },
{ name: $t('Transfer'), value: 4 }
- ]" v-model="query.type" @update:model-value="changeTypeFilter" />
+ ]" v-model="queryType" />
@@ -573,6 +573,14 @@ export default {
query() {
return this.transactionsStore.transactionsFilter;
},
+ queryType: {
+ get: function () {
+ return this.query.type;
+ },
+ set: function(value) {
+ this.changeTypeFilter(value);
+ }
+ },
queryMinTime() {
return this.$locale.formatUnixTimeToLongDateTime(this.userStore, this.query.minTime);
},
@@ -913,16 +921,18 @@ export default {
const newDateRange = getShiftedDateRangeAndDateType(startTime, endTime, scale, this.firstDayOfWeek, datetimeConstants.allDateRangeScenes.Normal);
- this.transactionsStore.updateTransactionListFilter({
+ const changed = this.transactionsStore.updateTransactionListFilter({
dateType: newDateRange.dateType,
maxTime: newDateRange.maxTime,
minTime: newDateRange.minTime
});
- this.loading = true;
- this.currentPageTransactions = [];
- this.transactionsStore.clearTransactions();
- this.$router.push(this.getFilterLinkUrl());
+ if (changed) {
+ this.loading = true;
+ this.currentPageTransactions = [];
+ this.transactionsStore.clearTransactions();
+ this.$router.push(this.getFilterLinkUrl());
+ }
},
changeDateFilter(recentDateRange) {
if (recentDateRange.dateType === datetimeConstants.allDateRanges.Custom.type &&
@@ -943,16 +953,18 @@ export default {
return;
}
- this.transactionsStore.updateTransactionListFilter({
+ const changed = this.transactionsStore.updateTransactionListFilter({
dateType: recentDateRange.dateType,
maxTime: recentDateRange.maxTime,
minTime: recentDateRange.minTime
});
- this.loading = true;
- this.currentPageTransactions = [];
- this.transactionsStore.clearTransactions();
- this.$router.push(this.getFilterLinkUrl());
+ if (changed) {
+ this.loading = true;
+ this.currentPageTransactions = [];
+ this.transactionsStore.clearTransactions();
+ this.$router.push(this.getFilterLinkUrl());
+ }
},
changeCustomDateFilter(minTime, maxTime) {
if (!minTime || !maxTime) {
@@ -966,7 +978,7 @@ export default {
return;
}
- this.transactionsStore.updateTransactionListFilter({
+ const changed = this.transactionsStore.updateTransactionListFilter({
dateType: dateType,
maxTime: maxTime,
minTime: minTime
@@ -974,10 +986,12 @@ export default {
this.showCustomDateRangeDialog = false;
- this.loading = true;
- this.currentPageTransactions = [];
- this.transactionsStore.clearTransactions();
- this.$router.push(this.getFilterLinkUrl());
+ if (changed) {
+ this.loading = true;
+ this.currentPageTransactions = [];
+ this.transactionsStore.clearTransactions();
+ this.$router.push(this.getFilterLinkUrl());
+ }
},
changeTypeFilter(type) {
let newCategoryFilter = undefined;
@@ -1002,15 +1016,17 @@ export default {
}
}
- this.transactionsStore.updateTransactionListFilter({
+ const changed = this.transactionsStore.updateTransactionListFilter({
type: type,
categoryIds: newCategoryFilter
});
- this.loading = true;
- this.currentPageTransactions = [];
- this.transactionsStore.clearTransactions();
- this.$router.push(this.getFilterLinkUrl());
+ if (changed) {
+ this.loading = true;
+ this.currentPageTransactions = [];
+ this.transactionsStore.clearTransactions();
+ this.$router.push(this.getFilterLinkUrl());
+ }
},
changeCategoryFilter(categoryIds) {
this.categoryMenuState = false;
@@ -1019,27 +1035,27 @@ export default {
return;
}
- this.transactionsStore.updateTransactionListFilter({
+ const changed = this.transactionsStore.updateTransactionListFilter({
categoryIds: categoryIds
});
- this.loading = true;
- this.currentPageTransactions = [];
- this.transactionsStore.clearTransactions();
- this.$router.push(this.getFilterLinkUrl());
+ if (changed) {
+ this.loading = true;
+ this.currentPageTransactions = [];
+ this.transactionsStore.clearTransactions();
+ this.$router.push(this.getFilterLinkUrl());
+ }
},
changeMultipleCategoriesFilter(changed) {
this.categoryMenuState = false;
this.showFilterCategoryDialog = false;
- if (!changed) {
- return;
+ if (changed) {
+ this.loading = true;
+ this.currentPageTransactions = [];
+ this.transactionsStore.clearTransactions();
+ this.$router.push(this.getFilterLinkUrl());
}
-
- this.loading = true;
- this.currentPageTransactions = [];
- this.transactionsStore.clearTransactions();
- this.$router.push(this.getFilterLinkUrl());
},
changeAmountFilter(filterType) {
this.currentAmountFilterType = '';
@@ -1076,54 +1092,59 @@ export default {
return;
}
- this.transactionsStore.updateTransactionListFilter({
+ const changed = this.transactionsStore.updateTransactionListFilter({
amountFilter: amountFilter
});
- this.loading = true;
- this.currentPageTransactions = [];
- this.transactionsStore.clearTransactions();
- this.$router.push(this.getFilterLinkUrl());
+ if (changed) {
+ this.loading = true;
+ this.currentPageTransactions = [];
+ this.transactionsStore.clearTransactions();
+ this.$router.push(this.getFilterLinkUrl());
+ }
},
changeAccountFilter(accountIds) {
if (this.query.accountIds === accountIds) {
return;
}
- this.transactionsStore.updateTransactionListFilter({
+ const changed = this.transactionsStore.updateTransactionListFilter({
accountIds: accountIds
});
- this.loading = true;
- this.currentPageTransactions = [];
- this.transactionsStore.clearTransactions();
- this.$router.push(this.getFilterLinkUrl());
+ if (changed) {
+ this.loading = true;
+ this.currentPageTransactions = [];
+ this.transactionsStore.clearTransactions();
+ this.$router.push(this.getFilterLinkUrl());
+ }
},
changeMultipleAccountsFilter(changed) {
this.showFilterAccountDialog = false;
- if (!changed) {
- return;
+ if (changed) {
+ this.loading = true;
+ this.currentPageTransactions = [];
+ this.transactionsStore.clearTransactions();
+ this.$router.push(this.getFilterLinkUrl());
}
-
- this.loading = true;
- this.currentPageTransactions = [];
- this.transactionsStore.clearTransactions();
- this.$router.push(this.getFilterLinkUrl());
},
changeKeywordFilter(keyword) {
if (this.query.keyword === keyword) {
return;
}
- this.transactionsStore.updateTransactionListFilter({
+ const changed = this.transactionsStore.updateTransactionListFilter({
keyword: keyword
});
- this.currentPage = 1;
- this.currentPageTransactions = [];
- this.transactionsStore.clearTransactions();
- this.$router.push(this.getFilterLinkUrl());
+ if (changed) {
+ this.loading = true;
+ this.currentPage = 1;
+ this.currentPageTransactions = [];
+ this.transactionsStore.clearTransactions();
+ this.$router.push(this.getFilterLinkUrl());
+ }
},
add() {
const self = this;
diff --git a/src/views/mobile/settings/AccountFilterSettingsPage.vue b/src/views/mobile/settings/AccountFilterSettingsPage.vue
index 9564f0b0..bf6af114 100644
--- a/src/views/mobile/settings/AccountFilterSettingsPage.vue
+++ b/src/views/mobile/settings/AccountFilterSettingsPage.vue
@@ -241,6 +241,7 @@ export default {
const router = self.f7router;
const filteredAccountIds = {};
+ let isAllSelected = true;
let finalAccountIds = '';
for (let accountId in self.filterAccountIds) {
@@ -252,6 +253,7 @@ export default {
if (!isAccountOrSubAccountsAllChecked(account, self.filterAccountIds)) {
filteredAccountIds[accountId] = true;
+ isAllSelected = false;
} else {
if (finalAccountIds.length > 0) {
finalAccountIds += ',';
@@ -268,10 +270,13 @@ export default {
filterAccountIds: filteredAccountIds
});
} else if (this.type === 'transactionListCurrent') {
- self.transactionsStore.updateTransactionListFilter({
- accountIds: finalAccountIds
+ const changed = self.transactionsStore.updateTransactionListFilter({
+ accountIds: isAllSelected ? '' : finalAccountIds
});
- self.transactionsStore.updateTransactionListInvalidState(true);
+
+ if (changed) {
+ self.transactionsStore.updateTransactionListInvalidState(true);
+ }
}
router.back();
diff --git a/src/views/mobile/settings/CategoryFilterSettingsPage.vue b/src/views/mobile/settings/CategoryFilterSettingsPage.vue
index f1030a45..dee19633 100644
--- a/src/views/mobile/settings/CategoryFilterSettingsPage.vue
+++ b/src/views/mobile/settings/CategoryFilterSettingsPage.vue
@@ -256,6 +256,7 @@ export default {
const router = self.f7router;
const filteredCategoryIds = {};
+ let isAllSelected = true;
let finalCategoryIds = '';
for (let categoryId in self.filterCategoryIds) {
@@ -267,6 +268,7 @@ export default {
if (!isCategoryOrSubCategoriesAllChecked(category, self.filterCategoryIds)) {
filteredCategoryIds[categoryId] = true;
+ isAllSelected = false;
} else {
if (finalCategoryIds.length > 0) {
finalCategoryIds += ',';
@@ -283,10 +285,13 @@ export default {
filterCategoryIds: filteredCategoryIds
});
} else if (this.type === 'transactionListCurrent') {
- self.transactionsStore.updateTransactionListFilter({
- categoryIds: finalCategoryIds
+ const changed = self.transactionsStore.updateTransactionListFilter({
+ categoryIds: isAllSelected ? '' : finalCategoryIds
});
- self.transactionsStore.updateTransactionListInvalidState(true);
+
+ if (changed) {
+ self.transactionsStore.updateTransactionListInvalidState(true);
+ }
}
router.back();
diff --git a/src/views/mobile/transactions/AmountFilterPage.vue b/src/views/mobile/transactions/AmountFilterPage.vue
index 7e7fea5e..4f9fee28 100644
--- a/src/views/mobile/transactions/AmountFilterPage.vue
+++ b/src/views/mobile/transactions/AmountFilterPage.vue
@@ -162,10 +162,14 @@ export default {
return;
}
- this.transactionsStore.updateTransactionListFilter({
+ const changed = this.transactionsStore.updateTransactionListFilter({
amountFilter: amountFilter
});
- this.transactionsStore.updateTransactionListInvalidState(true);
+
+ if (changed) {
+ this.transactionsStore.updateTransactionListInvalidState(true);
+ }
+
router.back();
},
getDisplayAmount(value) {
diff --git a/src/views/mobile/transactions/ListPage.vue b/src/views/mobile/transactions/ListPage.vue
index 16cd28d3..9a398d7e 100644
--- a/src/views/mobile/transactions/ListPage.vue
+++ b/src/views/mobile/transactions/ListPage.vue
@@ -772,14 +772,17 @@ export default {
return;
}
- this.transactionsStore.updateTransactionListFilter({
+ const changed = this.transactionsStore.updateTransactionListFilter({
dateType: dateRange.dateType,
maxTime: dateRange.maxTime,
minTime: dateRange.minTime
});
this.showDatePopover = false;
- this.reload(null);
+
+ if (changed) {
+ this.reload(null);
+ }
},
changeCustomDateFilter(minTime, maxTime) {
if (!minTime || !maxTime) {
@@ -788,7 +791,7 @@ export default {
const dateType = getDateTypeByDateRange(minTime, maxTime, this.firstDayOfWeek, datetimeConstants.allDateRangeScenes.Normal);
- this.transactionsStore.updateTransactionListFilter({
+ const changed = this.transactionsStore.updateTransactionListFilter({
dateType: dateType,
maxTime: maxTime,
minTime: minTime
@@ -796,7 +799,9 @@ export default {
this.showCustomDateRangeSheet = false;
- this.reload(null);
+ if (changed) {
+ this.reload(null);
+ }
},
changeTypeFilter(type) {
if (this.query.type === type) {
@@ -825,37 +830,46 @@ export default {
}
}
- this.transactionsStore.updateTransactionListFilter({
+ const changed = this.transactionsStore.updateTransactionListFilter({
type: type,
categoryIds: newCategoryFilter
});
this.showMorePopover = false;
- this.reload(null);
+
+ if (changed) {
+ this.reload(null);
+ }
},
changeCategoryFilter(categoryIds) {
if (this.query.categoryIds === categoryIds) {
return;
}
- this.transactionsStore.updateTransactionListFilter({
+ const changed = this.transactionsStore.updateTransactionListFilter({
categoryIds: categoryIds
});
this.showCategoryPopover = false;
- this.reload(null);
+
+ if (changed) {
+ this.reload(null);
+ }
},
changeAccountFilter(accountIds) {
if (this.query.accountIds === accountIds) {
return;
}
- this.transactionsStore.updateTransactionListFilter({
+ const changed = this.transactionsStore.updateTransactionListFilter({
accountIds: accountIds
});
this.showAccountPopover = false;
- this.reload(null);
+
+ if (changed) {
+ this.reload(null);
+ }
},
changeAmountFilter(filterType) {
if (this.query.amountFilter === filterType) {
@@ -868,23 +882,28 @@ export default {
return;
}
- this.transactionsStore.updateTransactionListFilter({
+ const changed = this.transactionsStore.updateTransactionListFilter({
amountFilter: filterType
});
this.showMorePopover = false;
- this.reload(null);
+
+ if (changed) {
+ this.reload(null);
+ }
},
changeKeywordFilter(keyword) {
if (this.query.keyword === keyword) {
return;
}
- this.transactionsStore.updateTransactionListFilter({
+ const changed = this.transactionsStore.updateTransactionListFilter({
keyword: keyword
});
- this.reload(null);
+ if (changed) {
+ this.reload(null);
+ }
},
filterMultipleCategories() {
this.f7router.navigate('/settings/filter/category?type=transactionListCurrent');
@@ -939,13 +958,15 @@ export default {
const newDateRange = getShiftedDateRangeAndDateType(minTime, maxTime, scale, this.firstDayOfWeek, datetimeConstants.allDateRangeScenes.Normal);
- this.transactionsStore.updateTransactionListFilter({
+ const changed = this.transactionsStore.updateTransactionListFilter({
dateType: newDateRange.dateType,
maxTime: newDateRange.maxTime,
minTime: newDateRange.minTime
});
- this.reload(null);
+ if (changed) {
+ this.reload(null);
+ }
},
scrollPopoverToSelectedItem(event) {
scrollToSelectedItem(event.$el, '.popover-inner', 'li.list-item-selected');