code refactor

This commit is contained in:
MaysWind
2021-05-04 22:50:06 +08:00
parent d2d2babf0b
commit ec19a18fc2
10 changed files with 91 additions and 143 deletions
+2 -16
View File
@@ -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 {