mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-17 08:14:25 +08:00
code refactor
This commit is contained in:
@@ -103,10 +103,7 @@ import { ALL_CATEGORY_COLORS } from '@/consts/color.ts';
|
||||
import { TransactionCategory } from '@/models/transaction_category.ts';
|
||||
|
||||
import { generateRandomUUID } from '@/lib/misc.ts';
|
||||
import {
|
||||
setCategoryModelByAnotherCategory,
|
||||
allVisiblePrimaryTransactionCategoriesByType
|
||||
} from '@/lib/category.ts';
|
||||
import { allVisiblePrimaryTransactionCategoriesByType } from '@/lib/category.ts';
|
||||
|
||||
export default {
|
||||
props: [
|
||||
@@ -176,18 +173,18 @@ export default {
|
||||
self.submitting = false;
|
||||
|
||||
const newTransactionCategory = TransactionCategory.createNewCategory();
|
||||
setCategoryModelByAnotherCategory(self.category, newTransactionCategory);
|
||||
self.category.from(newTransactionCategory);
|
||||
|
||||
if (options.id) {
|
||||
if (options.currentCategory) {
|
||||
setCategoryModelByAnotherCategory(self.category, options.currentCategory);
|
||||
self.category.from(options.currentCategory);
|
||||
}
|
||||
|
||||
self.editCategoryId = options.id;
|
||||
self.transactionCategoriesStore.getCategory({
|
||||
categoryId: self.editCategoryId
|
||||
}).then(category => {
|
||||
setCategoryModelByAnotherCategory(self.category, category);
|
||||
self.category.from(category);
|
||||
self.loading = false;
|
||||
}).catch(error => {
|
||||
self.loading = false;
|
||||
|
||||
@@ -156,10 +156,7 @@ import { TransactionCategory } from '@/models/transaction_category.ts';
|
||||
|
||||
import { getNameByKeyValue } from '@/lib/common.ts';
|
||||
import { generateRandomUUID } from '@/lib/misc.ts';
|
||||
import {
|
||||
setCategoryModelByAnotherCategory,
|
||||
allVisiblePrimaryTransactionCategoriesByType
|
||||
} from '@/lib/category.ts';
|
||||
import { allVisiblePrimaryTransactionCategoriesByType } from '@/lib/category.ts';
|
||||
|
||||
export default {
|
||||
props: [
|
||||
@@ -238,7 +235,7 @@ export default {
|
||||
self.transactionCategoriesStore.getCategory({
|
||||
categoryId: self.editCategoryId
|
||||
}).then(category => {
|
||||
setCategoryModelByAnotherCategory(self.category, category);
|
||||
self.category.from(category);
|
||||
self.loading = false;
|
||||
}).catch(error => {
|
||||
if (error.processed) {
|
||||
|
||||
Reference in New Issue
Block a user