mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-17 00:12:11 +08:00
only show categories with specified type in category filter dialog / page
This commit is contained in:
@@ -127,7 +127,7 @@ import { useTransactionsStore } from '@/stores/transaction.js';
|
||||
import { useStatisticsStore } from '@/stores/statistics.js';
|
||||
|
||||
import categoryConstants from '@/consts/category.js';
|
||||
import { copyObjectTo } from '@/lib/common.js';
|
||||
import { copyObjectTo, arrayItemToObjectField } from '@/lib/common.js';
|
||||
import {
|
||||
allVisibleTransactionCategories,
|
||||
hasAnyAvailableCategory,
|
||||
@@ -151,6 +151,7 @@ import {
|
||||
export default {
|
||||
props: [
|
||||
'dialogMode',
|
||||
'categoryTypes',
|
||||
'type',
|
||||
'autoSave'
|
||||
],
|
||||
@@ -190,8 +191,11 @@ export default {
|
||||
return 'Apply';
|
||||
}
|
||||
},
|
||||
allowCategoryTypes() {
|
||||
return this.categoryTypes ? arrayItemToObjectField(this.categoryTypes.split(','), true) : null;
|
||||
},
|
||||
allVisibleTransactionCategories() {
|
||||
return allVisibleTransactionCategories(this.transactionCategoriesStore.allTransactionCategories);
|
||||
return allVisibleTransactionCategories(this.transactionCategoriesStore.allTransactionCategories, this.allowCategoryTypes);
|
||||
},
|
||||
hasAnyAvailableCategory() {
|
||||
return hasAnyAvailableCategory(this.allVisibleTransactionCategories);
|
||||
@@ -217,6 +221,10 @@ export default {
|
||||
|
||||
const category = self.transactionCategoriesStore.allTransactionCategoriesMap[categoryId];
|
||||
|
||||
if (self.allowCategoryTypes && !self.allowCategoryTypes[category.type]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (this.type === 'transactionListCurrent' && self.transactionsStore.allFilterCategoryIdsCount > 0) {
|
||||
allCategoryIds[category.id] = true;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user