mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-15 15:37:33 +08:00
code refactor
This commit is contained in:
@@ -7,7 +7,6 @@ import { useStatisticsStore } from '@/stores/statistics.ts';
|
||||
|
||||
import type { Account, AccountCategoriesWithVisibleCount } from '@/models/account.ts';
|
||||
|
||||
import { copyObjectTo } from '@/lib/common.ts';
|
||||
import {
|
||||
getCategorizedAccountsWithVisibleCount,
|
||||
selectAccountOrSubAccounts,
|
||||
@@ -73,10 +72,10 @@ export function useAccountFilterSettingPageBase(type?: string) {
|
||||
}
|
||||
|
||||
if (type === 'statisticsDefault') {
|
||||
filterAccountIds.value = copyObjectTo(settingsStore.appSettings.statistics.defaultAccountFilter, allAccountIds) as Record<string, boolean>;
|
||||
filterAccountIds.value = Object.assign(allAccountIds, settingsStore.appSettings.statistics.defaultAccountFilter);
|
||||
return true;
|
||||
} else if (type === 'statisticsCurrent') {
|
||||
filterAccountIds.value = copyObjectTo(statisticsStore.transactionStatisticsFilter.filterAccountIds, allAccountIds) as Record<string, boolean>;
|
||||
filterAccountIds.value = Object.assign(allAccountIds, statisticsStore.transactionStatisticsFilter.filterAccountIds);
|
||||
return true;
|
||||
} else if (type === 'transactionListCurrent') {
|
||||
for (const accountId in transactionsStore.allFilterAccountIds) {
|
||||
|
||||
@@ -11,7 +11,6 @@ import { CategoryType } from '@/core/category.ts';
|
||||
import type { TransactionCategory, TransactionCategoriesWithVisibleCount } from '@/models/transaction_category.ts';
|
||||
|
||||
import {
|
||||
copyObjectTo,
|
||||
arrayItemToObjectField
|
||||
} from '@/lib/common.ts';
|
||||
import {
|
||||
@@ -96,10 +95,10 @@ export function useCategoryFilterSettingPageBase(type?: string, allowCategoryTyp
|
||||
}
|
||||
|
||||
if (type === 'statisticsDefault') {
|
||||
filterCategoryIds.value = copyObjectTo(settingsStore.appSettings.statistics.defaultTransactionCategoryFilter, allCategoryIds) as Record<string, boolean>;
|
||||
filterCategoryIds.value = Object.assign(allCategoryIds, settingsStore.appSettings.statistics.defaultTransactionCategoryFilter);
|
||||
return true;
|
||||
} else if (type === 'statisticsCurrent') {
|
||||
filterCategoryIds.value = copyObjectTo(statisticsStore.transactionStatisticsFilter.filterCategoryIds, allCategoryIds) as Record<string, boolean>;
|
||||
filterCategoryIds.value = Object.assign(allCategoryIds, statisticsStore.transactionStatisticsFilter.filterCategoryIds);
|
||||
return true;
|
||||
} else if (type === 'transactionListCurrent') {
|
||||
for (const categoryId in transactionsStore.allFilterCategoryIds) {
|
||||
|
||||
Reference in New Issue
Block a user