mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-18 08:44:25 +08:00
code refactor
This commit is contained in:
@@ -146,8 +146,8 @@
|
||||
handle=".drag-handle"
|
||||
ghost-class="dragging-item"
|
||||
:disabled="activeAccountCategoryVisibleAccountCount <= 1"
|
||||
:list="categorizedAccounts[activeAccountCategory.id].accounts"
|
||||
v-if="categorizedAccounts[activeAccountCategory.id] && categorizedAccounts[activeAccountCategory.id].accounts && categorizedAccounts[activeAccountCategory.id].accounts.length"
|
||||
:list="allCategorizedAccountsMap[activeAccountCategory.id].accounts"
|
||||
v-if="allCategorizedAccountsMap[activeAccountCategory.id] && allCategorizedAccountsMap[activeAccountCategory.id].accounts && allCategorizedAccountsMap[activeAccountCategory.id].accounts.length"
|
||||
@change="onMove"
|
||||
>
|
||||
<template #item="{ element }">
|
||||
@@ -330,8 +330,8 @@ export default {
|
||||
allAccountCategories() {
|
||||
return accountConstants.allCategories;
|
||||
},
|
||||
categorizedAccounts() {
|
||||
return this.accountsStore.allCategorizedAccounts;
|
||||
allCategorizedAccountsMap() {
|
||||
return this.accountsStore.allCategorizedAccountsMap;
|
||||
},
|
||||
allAccountCount() {
|
||||
return this.accountsStore.allAvailableAccountsCount;
|
||||
@@ -355,11 +355,11 @@ export default {
|
||||
return this.accountCategoryTotalBalance(this.activeAccountCategory);
|
||||
},
|
||||
activeAccountCategoryVisibleAccountCount() {
|
||||
if (!this.categorizedAccounts[this.activeAccountCategory.id] || !this.categorizedAccounts[this.activeAccountCategory.id].accounts) {
|
||||
if (!this.allCategorizedAccountsMap[this.activeAccountCategory.id] || !this.allCategorizedAccountsMap[this.activeAccountCategory.id].accounts) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const accounts = this.categorizedAccounts[this.activeAccountCategory.id].accounts;
|
||||
const accounts = this.allCategorizedAccountsMap[this.activeAccountCategory.id].accounts;
|
||||
|
||||
if (this.showHidden) {
|
||||
return accounts.length;
|
||||
|
||||
@@ -216,7 +216,7 @@ export default {
|
||||
return accountConstants.allAccountTypes;
|
||||
},
|
||||
allCategorizedAccounts() {
|
||||
return getCategorizedAccountsWithVisibleCount(this.accountsStore.allCategorizedAccounts);
|
||||
return getCategorizedAccountsWithVisibleCount(this.accountsStore.allCategorizedAccountsMap);
|
||||
},
|
||||
hasAnyAvailableAccount() {
|
||||
return this.accountsStore.allAvailableAccountsCount > 0;
|
||||
|
||||
@@ -168,7 +168,7 @@
|
||||
:custom-selection-primary-text="sourceAccountName"
|
||||
:label="$t(sourceAccountTitle)"
|
||||
:placeholder="$t(sourceAccountTitle)"
|
||||
:items="categorizedAccounts"
|
||||
:items="allVisibleCategorizedAccounts"
|
||||
v-model="transaction.sourceAccountId">
|
||||
</two-column-select>
|
||||
</v-col>
|
||||
@@ -186,7 +186,7 @@
|
||||
:custom-selection-primary-text="destinationAccountName"
|
||||
:label="$t('Destination Account')"
|
||||
:placeholder="$t('Destination Account')"
|
||||
:items="categorizedAccounts"
|
||||
:items="allVisibleCategorizedAccounts"
|
||||
v-model="transaction.destinationAccountId">
|
||||
</two-column-select>
|
||||
</v-col>
|
||||
@@ -576,7 +576,7 @@ export default {
|
||||
allVisibleAccounts() {
|
||||
return this.accountsStore.allVisiblePlainAccounts;
|
||||
},
|
||||
categorizedAccounts() {
|
||||
allVisibleCategorizedAccounts() {
|
||||
return this.$locale.getCategorizedAccountsWithDisplayBalance(this.allVisibleAccounts, this.showAccountBalance, this.defaultCurrency, this.settingsStore, this.userStore, this.exchangeRatesStore);
|
||||
},
|
||||
allAccountsMap() {
|
||||
|
||||
@@ -224,7 +224,7 @@
|
||||
:disabled="loading || submitting || !allVisibleAccounts.length"
|
||||
:custom-selection-primary-text="getSourceAccountDisplayName(item)"
|
||||
:placeholder="getSourceAccountTitle(item)"
|
||||
:items="categorizedAccounts"
|
||||
:items="allVisibleCategorizedAccounts"
|
||||
v-model="item.sourceAccountId"
|
||||
@update:model-value="updateTransactionData(item)">
|
||||
</two-column-select>
|
||||
@@ -242,7 +242,7 @@
|
||||
:disabled="loading || submitting || !allVisibleAccounts.length"
|
||||
:custom-selection-primary-text="getDestinationAccountDisplayName(item)"
|
||||
:placeholder="$t('Destination Account')"
|
||||
:items="categorizedAccounts"
|
||||
:items="allVisibleCategorizedAccounts"
|
||||
v-model="item.destinationAccountId"
|
||||
@update:model-value="updateTransactionData(item)">
|
||||
</two-column-select>
|
||||
@@ -480,7 +480,7 @@ export default {
|
||||
allVisibleAccounts() {
|
||||
return this.accountsStore.allVisiblePlainAccounts;
|
||||
},
|
||||
categorizedAccounts() {
|
||||
allVisibleCategorizedAccounts() {
|
||||
return this.$locale.getCategorizedAccountsWithDisplayBalance(this.allVisibleAccounts, this.showAccountBalance, this.defaultCurrency, this.settingsStore, this.userStore, this.exchangeRatesStore);
|
||||
},
|
||||
allAccountsMap() {
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
:disabled="loading || saving || !allVisibleAccounts.length"
|
||||
:label="$t('Default Account')"
|
||||
:placeholder="$t('Default Account')"
|
||||
:items="allCategorizedAccounts"
|
||||
:items="allVisibleCategorizedAccounts"
|
||||
:no-item-text="$t('Unspecified')"
|
||||
v-model="newProfile.defaultAccountId">
|
||||
</two-column-select>
|
||||
@@ -420,7 +420,7 @@ export default {
|
||||
allVisibleAccounts() {
|
||||
return this.accountsStore.allVisiblePlainAccounts;
|
||||
},
|
||||
allCategorizedAccounts() {
|
||||
allVisibleCategorizedAccounts() {
|
||||
return getCategorizedAccounts(this.allVisibleAccounts);
|
||||
},
|
||||
allWeekDays() {
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
v-show="(showHidden && hasAccount(accountCategory, false)) || hasAccount(accountCategory, true)">
|
||||
<f7-list strong inset dividers sortable class="list-has-group-title account-list margin-vertical"
|
||||
:sortable-enabled="sortable"
|
||||
v-if="categorizedAccounts[accountCategory.id]"
|
||||
v-if="allCategorizedAccountsMap[accountCategory.id]"
|
||||
@sortable:sort="onSort">
|
||||
<f7-list-item group-title :sortable="false">
|
||||
<small>
|
||||
@@ -86,7 +86,7 @@
|
||||
:after="accountBalance(account)"
|
||||
:link="!sortable ? '/transaction/list?accountIds=' + account.id : null"
|
||||
:key="account.id"
|
||||
v-for="account in categorizedAccounts[accountCategory.id].accounts"
|
||||
v-for="account in allCategorizedAccountsMap[accountCategory.id].accounts"
|
||||
v-show="showHidden || !account.hidden"
|
||||
@taphold="setSortable()"
|
||||
>
|
||||
@@ -210,8 +210,8 @@ export default {
|
||||
allAccountCategories() {
|
||||
return accountConstants.allCategories;
|
||||
},
|
||||
categorizedAccounts() {
|
||||
return this.accountsStore.allCategorizedAccounts;
|
||||
allCategorizedAccountsMap() {
|
||||
return this.accountsStore.allCategorizedAccountsMap;
|
||||
},
|
||||
allAccountCount() {
|
||||
return this.accountsStore.allAvailableAccountsCount;
|
||||
|
||||
@@ -186,7 +186,7 @@ export default {
|
||||
return accountConstants.allAccountTypes;
|
||||
},
|
||||
allCategorizedAccounts() {
|
||||
return getCategorizedAccountsWithVisibleCount(this.accountsStore.allCategorizedAccounts);
|
||||
return getCategorizedAccountsWithVisibleCount(this.accountsStore.allCategorizedAccountsMap);
|
||||
},
|
||||
hasAnyAvailableAccount() {
|
||||
return this.accountsStore.allAvailableAccountsCount > 0;
|
||||
|
||||
@@ -200,7 +200,7 @@
|
||||
secondary-key-field="id" secondary-value-field="id"
|
||||
secondary-title-field="name" secondary-footer-field="displayBalance"
|
||||
secondary-icon-field="icon" secondary-icon-type="account" secondary-color-field="color"
|
||||
:items="categorizedAccounts"
|
||||
:items="allVisibleCategorizedAccounts"
|
||||
v-model:show="showSourceAccountSheet"
|
||||
v-model="transaction.sourceAccountId">
|
||||
</two-column-list-item-selection-sheet>
|
||||
@@ -223,7 +223,7 @@
|
||||
secondary-key-field="id" secondary-value-field="id"
|
||||
secondary-title-field="name" secondary-footer-field="displayBalance"
|
||||
secondary-icon-field="icon" secondary-icon-type="account" secondary-color-field="color"
|
||||
:items="categorizedAccounts"
|
||||
:items="allVisibleCategorizedAccounts"
|
||||
v-model:show="showDestinationAccountSheet"
|
||||
v-model="transaction.destinationAccountId">
|
||||
</two-column-list-item-selection-sheet>
|
||||
@@ -606,7 +606,7 @@ export default {
|
||||
allAccountsMap() {
|
||||
return this.accountsStore.allAccountsMap;
|
||||
},
|
||||
categorizedAccounts() {
|
||||
allVisibleCategorizedAccounts() {
|
||||
return this.$locale.getCategorizedAccountsWithDisplayBalance(this.allVisibleAccounts, this.showAccountBalance, this.defaultCurrency, this.settingsStore, this.userStore, this.exchangeRatesStore);
|
||||
},
|
||||
allCategories() {
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
secondary-key-field="id" secondary-value-field="id"
|
||||
secondary-title-field="name"
|
||||
secondary-icon-field="icon" secondary-icon-type="account" secondary-color-field="color"
|
||||
:items="allCategorizedAccounts"
|
||||
:items="allVisibleCategorizedAccounts"
|
||||
v-model:show="showAccountSheet"
|
||||
v-model="newProfile.defaultAccountId">
|
||||
</two-column-list-item-selection-sheet>
|
||||
@@ -415,7 +415,7 @@ export default {
|
||||
allVisibleAccounts() {
|
||||
return this.accountsStore.allVisiblePlainAccounts;
|
||||
},
|
||||
allCategorizedAccounts() {
|
||||
allVisibleCategorizedAccounts() {
|
||||
return getCategorizedAccounts(this.allVisibleAccounts);
|
||||
},
|
||||
allWeekDays() {
|
||||
|
||||
Reference in New Issue
Block a user