mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-17 16:24:25 +08:00
code refactor
This commit is contained in:
@@ -154,7 +154,7 @@
|
||||
link="#"
|
||||
:class="{ 'disabled': !allVisibleAccounts.length }"
|
||||
:header="$t(sourceAccountName)"
|
||||
:title="transaction.sourceAccountId | accountName(allAccounts)"
|
||||
:title="transaction.sourceAccountId | optionName(allAccounts, 'id', 'name')"
|
||||
@click="showSourceAccountSheet = true"
|
||||
>
|
||||
<two-column-list-item-selection-sheet primary-key-field="id" primary-value-field="category"
|
||||
@@ -176,7 +176,7 @@
|
||||
link="#"
|
||||
:class="{ 'disabled': !allVisibleAccounts.length }"
|
||||
:header="$t('Destination Account')"
|
||||
:title="transaction.destinationAccountId | accountName(allAccounts)"
|
||||
:title="transaction.destinationAccountId | optionName(allAccounts, 'id', 'name')"
|
||||
v-if="transaction.type === $constants.transaction.allTransactionTypes.Transfer"
|
||||
@click="showDestinationAccountSheet = true"
|
||||
>
|
||||
@@ -225,7 +225,7 @@
|
||||
</select>
|
||||
<f7-block slot="title" class="list-item-custom-title no-padding">
|
||||
<span>{{ transaction.utcOffset | utcOffset }}</span>
|
||||
<span class="transaction-edit-timezone-name" v-if="transaction.timeZone || transaction.timeZone === ''">{{ transaction.timeZone | timeZoneName(allTimezones) }}</span>
|
||||
<span class="transaction-edit-timezone-name" v-if="transaction.timeZone || transaction.timeZone === ''">{{ transaction.timeZone | optionName(allTimezones, 'name', 'displayName') }}</span>
|
||||
</f7-block>
|
||||
</f7-list-item>
|
||||
|
||||
@@ -243,7 +243,7 @@
|
||||
<f7-chip class="transaction-edit-tag" media-bg-color="black"
|
||||
v-for="tagId in transaction.tagIds"
|
||||
:key="tagId"
|
||||
:text="tagId | tagName(allTags)">
|
||||
:text="tagId | optionName(allTags, 'id', 'name')">
|
||||
<f7-icon slot="media" f7="number"></f7-icon>
|
||||
</f7-chip>
|
||||
</f7-block>
|
||||
@@ -861,33 +861,6 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
},
|
||||
accountName(accountId, allAccounts) {
|
||||
for (let i = 0; i < allAccounts.length; i++) {
|
||||
if (allAccounts[i].id === accountId) {
|
||||
return allAccounts[i].name;
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
},
|
||||
timeZoneName(timeZoneName, allTimezones) {
|
||||
for (let i = 0; i < allTimezones.length; i++) {
|
||||
if (allTimezones[i].name === timeZoneName) {
|
||||
return allTimezones[i].displayName;
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
},
|
||||
tagName(tagId, allTags) {
|
||||
for (let i = 0; i < allTags.length; i++) {
|
||||
if (allTags[i].id === tagId) {
|
||||
return allTags[i].name;
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,10 +32,10 @@
|
||||
<span :class="{ 'tabbar-item-changed': query.type > 0 }">{{ query.type | typeName('Type') | localized }}</span>
|
||||
</f7-link>
|
||||
<f7-link class="tabbar-text-with-ellipsis" popover-open=".category-popover-menu" :class="{ 'disabled': query.type === 1 }">
|
||||
<span :class="{ 'tabbar-item-changed': query.categoryId > 0 }">{{ query.categoryId | categoryName(allCategories, $t('Category')) }}</span>
|
||||
<span :class="{ 'tabbar-item-changed': query.categoryId > 0 }">{{ query.categoryId | optionName(allCategories, null, 'name', $t('Category')) }}</span>
|
||||
</f7-link>
|
||||
<f7-link class="tabbar-text-with-ellipsis" popover-open=".account-popover-menu">
|
||||
<span :class="{ 'tabbar-item-changed': query.accountId > 0 }">{{ query.accountId | accountName(allAccounts, $t('Account')) }}</span>
|
||||
<span :class="{ 'tabbar-item-changed': query.accountId > 0 }">{{ query.accountId | optionName(allAccounts, null, 'name', $t('Account')) }}</span>
|
||||
</f7-link>
|
||||
</f7-toolbar>
|
||||
|
||||
@@ -903,20 +903,6 @@ export default {
|
||||
return defaultName;
|
||||
}
|
||||
},
|
||||
categoryName(categoryId, allCategories, defaultName) {
|
||||
if (allCategories[categoryId]) {
|
||||
return allCategories[categoryId].name;
|
||||
}
|
||||
|
||||
return defaultName;
|
||||
},
|
||||
accountName(accountId, allAccounts, defaultName) {
|
||||
if (allAccounts[accountId]) {
|
||||
return allAccounts[accountId].name;
|
||||
}
|
||||
|
||||
return defaultName;
|
||||
},
|
||||
categoryListItemCheckedClass(category, queryCategoryId) {
|
||||
if (category.id === queryCategoryId) {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user