mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-15 15:37:33 +08:00
auto set transaction type in transaction adding page according to the category id
This commit is contained in:
@@ -458,6 +458,9 @@ export default {
|
||||
allCategories() {
|
||||
return this.$store.state.allTransactionCategories;
|
||||
},
|
||||
allCategoriesMap() {
|
||||
return this.$store.state.allTransactionCategoriesMap;
|
||||
},
|
||||
allTags() {
|
||||
return this.$store.state.allTransactionTags;
|
||||
},
|
||||
@@ -601,6 +604,15 @@ export default {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((!query.type || query.type === '0') && query.categoryId && query.categoryId !== '0' && self.allCategoriesMap[query.categoryId]) {
|
||||
const category = self.allCategoriesMap[query.categoryId];
|
||||
const type = self.$utilities.categroyTypeToTransactionType(category.type);
|
||||
|
||||
if (self.$utilities.isNumber(type)) {
|
||||
self.transaction.type = type;
|
||||
}
|
||||
}
|
||||
|
||||
if (self.allCategories[self.$constants.category.allCategoryTypes.Expense] &&
|
||||
self.allCategories[self.$constants.category.allCategoryTypes.Expense].length) {
|
||||
if (query.categoryId && query.categoryId !== '0' && self.isCategoryIdAvailable(self.allCategories[self.$constants.category.allCategoryTypes.Expense], query.categoryId)) {
|
||||
|
||||
Reference in New Issue
Block a user