code refactor

This commit is contained in:
MaysWind
2023-08-13 20:01:44 +08:00
parent 141dc843f3
commit 41a8b8007a
4 changed files with 41 additions and 51 deletions
+11
View File
@@ -1,6 +1,17 @@
import categoryConstants from '@/consts/category.js';
import transactionConstants from '@/consts/transaction.js';
export function setCategoryModelByAnotherCategory(category, category2) {
category.id = category2.id;
category.type = category2.type;
category.parentId = category2.parentId;
category.name = category2.name;
category.icon = category2.icon;
category.color = category2.color;
category.comment = category2.comment;
category.visible = !category2.hidden;
}
export function transactionTypeToCategoryType(transactionType) {
if (transactionType === transactionConstants.allTransactionTypes.Income) {
return categoryConstants.allCategoryTypes.Income;