fix the parent account not displayed in the account list in the transaction list page

This commit is contained in:
MaysWind
2025-02-19 23:04:27 +08:00
parent 7fca519fd9
commit a9eaf011cd
2 changed files with 25 additions and 1 deletions
+24
View File
@@ -50,6 +50,29 @@ export const useAccountsStore = defineStore('accounts', () => {
return Account.sortAccounts(allAccountsList, allAccountsMap.value);
});
const allMixedPlainAccounts = computed<Account[]>(() => {
const allAccountsList: Account[] = [];
for (let i = 0; i < allAccounts.value.length; i++) {
const account = allAccounts.value[i];
if (account.type === AccountType.SingleAccount.type) {
allAccountsList.push(account);
} else if (account.type === AccountType.MultiSubAccounts.type) {
allAccountsList.push(account);
if (account.subAccounts) {
for (let j = 0; j < account.subAccounts.length; j++) {
const subAccount = account.subAccounts[j];
allAccountsList.push(subAccount);
}
}
}
}
return Account.sortAccounts(allAccountsList, allAccountsMap.value);
});
const allVisiblePlainAccounts = computed<Account[]>(() => {
const allVisibleAccounts: Account[] = [];
@@ -982,6 +1005,7 @@ export const useAccountsStore = defineStore('accounts', () => {
accountListStateInvalid,
// computed states
allPlainAccounts,
allMixedPlainAccounts,
allVisiblePlainAccounts,
allAvailableAccountsCount,
allVisibleAccountsCount,
@@ -66,7 +66,7 @@ export function useTransactionListPageBase() {
const allDateRanges = computed<LocalizedDateRange[]>(() => getAllDateRanges(DateRangeScene.Normal, true, !!accountsStore.getAccountStatementDate(query.value.accountIds)));
const allAccounts = computed<Account[]>(() => accountsStore.allPlainAccounts);
const allAccounts = computed<Account[]>(() => accountsStore.allMixedPlainAccounts);
const allAccountsMap = computed<Record<string, Account>>(() => accountsStore.allAccountsMap);
const allAvailableAccountsCount = computed<number>(() => accountsStore.allAvailableAccountsCount);
const allPrimaryCategories = computed<Record<number, TransactionCategory[]>>(() => {