From 4f9ab9db75d56f1ebe4c8bd22f12f21088e00491 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 21 Jul 2024 22:28:42 +0800 Subject: [PATCH] code refactor --- .../desktop/common/cards/AccountFilterSettingsCard.vue | 8 ++++---- .../desktop/common/cards/CategoryFilterSettingsCard.vue | 8 ++++---- src/views/mobile/settings/AccountFilterSettingsPage.vue | 8 ++++---- src/views/mobile/settings/CategoryFilterSettingsPage.vue | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/views/desktop/common/cards/AccountFilterSettingsCard.vue b/src/views/desktop/common/cards/AccountFilterSettingsCard.vue index 4db83e5f..64d2566c 100644 --- a/src/views/desktop/common/cards/AccountFilterSettingsCard.vue +++ b/src/views/desktop/common/cards/AccountFilterSettingsCard.vue @@ -212,18 +212,18 @@ export default { const account = self.accountsStore.allAccountsMap[accountId]; - if (this.type === 'transactionListCurrent' && self.transactionsStore.allFilterAccountIdsCount > 0) { + if (self.type === 'transactionListCurrent' && self.transactionsStore.allFilterAccountIdsCount > 0) { allAccountIds[account.id] = true; } else { allAccountIds[account.id] = false; } } - if (this.type === 'statisticsDefault') { + if (self.type === 'statisticsDefault') { self.filterAccountIds = copyObjectTo(self.settingsStore.appSettings.statistics.defaultAccountFilter, allAccountIds); - } else if (this.type === 'statisticsCurrent') { + } else if (self.type === 'statisticsCurrent') { self.filterAccountIds = copyObjectTo(self.statisticsStore.transactionStatisticsFilter.filterAccountIds, allAccountIds); - } else if (this.type === 'transactionListCurrent') { + } else if (self.type === 'transactionListCurrent') { for (let accountId in self.transactionsStore.allFilterAccountIds) { if (!Object.prototype.hasOwnProperty.call(self.transactionsStore.allFilterAccountIds, accountId)) { continue; diff --git a/src/views/desktop/common/cards/CategoryFilterSettingsCard.vue b/src/views/desktop/common/cards/CategoryFilterSettingsCard.vue index 9eb879bb..7a1f53eb 100644 --- a/src/views/desktop/common/cards/CategoryFilterSettingsCard.vue +++ b/src/views/desktop/common/cards/CategoryFilterSettingsCard.vue @@ -225,18 +225,18 @@ export default { continue; } - if (this.type === 'transactionListCurrent' && self.transactionsStore.allFilterCategoryIdsCount > 0) { + if (self.type === 'transactionListCurrent' && self.transactionsStore.allFilterCategoryIdsCount > 0) { allCategoryIds[category.id] = true; } else { allCategoryIds[category.id] = false; } } - if (this.type === 'statisticsDefault') { + if (self.type === 'statisticsDefault') { self.filterCategoryIds = copyObjectTo(self.settingsStore.appSettings.statistics.defaultTransactionCategoryFilter, allCategoryIds); - } else if (this.type === 'statisticsCurrent') { + } else if (self.type === 'statisticsCurrent') { self.filterCategoryIds = copyObjectTo(self.statisticsStore.transactionStatisticsFilter.filterCategoryIds, allCategoryIds); - } else if (this.type === 'transactionListCurrent') { + } else if (self.type === 'transactionListCurrent') { for (let categoryId in self.transactionsStore.allFilterCategoryIds) { if (!Object.prototype.hasOwnProperty.call(self.transactionsStore.allFilterCategoryIds, categoryId)) { continue; diff --git a/src/views/mobile/settings/AccountFilterSettingsPage.vue b/src/views/mobile/settings/AccountFilterSettingsPage.vue index bf6af114..53cd7bf4 100644 --- a/src/views/mobile/settings/AccountFilterSettingsPage.vue +++ b/src/views/mobile/settings/AccountFilterSettingsPage.vue @@ -195,18 +195,18 @@ export default { const account = self.accountsStore.allAccountsMap[accountId]; - if (this.type === 'transactionListCurrent' && self.transactionsStore.allFilterAccountIdsCount > 0) { + if (self.type === 'transactionListCurrent' && self.transactionsStore.allFilterAccountIdsCount > 0) { allAccountIds[account.id] = true; } else { allAccountIds[account.id] = false; } } - if (this.type === 'statisticsDefault') { + if (self.type === 'statisticsDefault') { self.filterAccountIds = copyObjectTo(self.settingsStore.appSettings.statistics.defaultAccountFilter, allAccountIds); - } else if (this.type === 'statisticsCurrent') { + } else if (self.type === 'statisticsCurrent') { self.filterAccountIds = copyObjectTo(self.statisticsStore.transactionStatisticsFilter.filterAccountIds, allAccountIds); - } else if (this.type === 'transactionListCurrent') { + } else if (self.type === 'transactionListCurrent') { for (let accountId in self.transactionsStore.allFilterAccountIds) { if (!Object.prototype.hasOwnProperty.call(self.transactionsStore.allFilterAccountIds, accountId)) { continue; diff --git a/src/views/mobile/settings/CategoryFilterSettingsPage.vue b/src/views/mobile/settings/CategoryFilterSettingsPage.vue index a7a5a8f2..1362aa61 100644 --- a/src/views/mobile/settings/CategoryFilterSettingsPage.vue +++ b/src/views/mobile/settings/CategoryFilterSettingsPage.vue @@ -213,18 +213,18 @@ export default { continue; } - if (this.type === 'transactionListCurrent' && self.transactionsStore.allFilterCategoryIdsCount > 0) { + if (self.type === 'transactionListCurrent' && self.transactionsStore.allFilterCategoryIdsCount > 0) { allCategoryIds[category.id] = true; } else { allCategoryIds[category.id] = false; } } - if (this.type === 'statisticsDefault') { + if (self.type === 'statisticsDefault') { self.filterCategoryIds = copyObjectTo(self.settingsStore.appSettings.statistics.defaultTransactionCategoryFilter, allCategoryIds); - } else if (this.type === 'statisticsCurrent') { + } else if (self.type === 'statisticsCurrent') { self.filterCategoryIds = copyObjectTo(self.statisticsStore.transactionStatisticsFilter.filterCategoryIds, allCategoryIds); - } else if (this.type === 'transactionListCurrent') { + } else if (self.type === 'transactionListCurrent') { for (let categoryId in self.transactionsStore.allFilterCategoryIds) { if (!Object.prototype.hasOwnProperty.call(self.transactionsStore.allFilterCategoryIds, categoryId)) { continue;