code refactor

This commit is contained in:
MaysWind
2023-08-19 23:31:03 +08:00
parent b8bdb03fc0
commit b8acff3e7c
7 changed files with 100 additions and 49 deletions
@@ -124,8 +124,8 @@
/>
</v-col>
<v-col cols="12" md="12" v-if="account.type === allAccountTypes.SingleAccount || currentAccountIndex >= 0">
<amount-input persistent-placeholder
:disabled="loading || submitting || !!editAccountId"
<amount-input :disabled="loading || submitting || !!editAccountId"
:persistent-placeholder="true"
:currency="selectedAccount.currency"
:label="currentAccountIndex < 0 ? $t('Account Balance') : $t('Sub Account Balance')"
:placeholder="currentAccountIndex < 0 ? $t('Account Balance') : $t('Sub Account Balance')"
@@ -436,14 +436,12 @@ export default {
},
setAccount(account) {
setAccountModelByAnotherAccount(this.account, account);
this.account.balance = this.account.balance / 100;
this.subAccounts = [];
if (account.subAccounts && account.subAccounts.length > 0) {
for (let i = 0; i < account.subAccounts.length; i++) {
const subAccount = this.accountsStore.generateNewSubAccountModel(this.account);
setAccountModelByAnotherAccount(subAccount, account.subAccounts[i]);
subAccount.balance = subAccount.balance / 100;
this.subAccounts.push(subAccount);
}