add category api

This commit is contained in:
MaysWind
2020-11-27 00:40:43 +08:00
parent 5e03d5aaec
commit 5a211c4666
9 changed files with 719 additions and 1 deletions
+42
View File
@@ -212,6 +212,48 @@ export default {
id
});
},
getAllTransactionCategories: ({ type, parentId }) => {
return axios.get('v1/transaction/categories/list.json?type=' + (type || '0') + '&parent_id=' + (parentId || parentId === 0 ? parentId : '-1'));
},
getTransactionCategory: ({ id }) => {
return axios.get('v1/transaction/categories/get.json?id=' + id);
},
addTransactionCategory: ({ name, type, parentId, icon, color, comment }) => {
return axios.post('v1/transaction/categories/add.json', {
name,
type,
parentId,
icon,
color,
comment
});
},
modifyTransactionCategory: ({ id, name, icon, color, comment, hidden }) => {
return axios.post('v1/transaction/categories/modify.json', {
id,
name,
icon,
color,
comment,
hidden
});
},
hideTransactionCategory: ({ id, hidden }) => {
return axios.post('v1/transaction/categories/hide.json', {
id,
hidden
});
},
moveTransactionCategory: ({ newDisplayOrders }) => {
return axios.post('v1/transaction/categories/move.json', {
newDisplayOrders,
});
},
deleteTransactionCategory: ({ id }) => {
return axios.post('v1/transaction/categories/delete.json', {
id
});
},
getLatestExchangeRates: () => {
return axios.get('v1/exchange_rates/latest.json');
},
+4
View File
@@ -221,6 +221,9 @@ export default {
'sub account category not equals to parent': 'Sub account category does not equal to parent',
'sub account type invalid': 'Sub account type is invalid',
'cannot add or delete sub accounts when modify account': 'You cannot add or delete sub accounts when modify account',
'transaction category id is invalid': 'Transaction category ID is invalid',
'transaction category not found': 'Transaction category is not found',
'transaction category type is invalid': 'Transaction category type is invalid',
},
'parameter': {
'id': 'ID',
@@ -236,6 +239,7 @@ export default {
'type': 'Type',
'color': 'Color',
'currency': 'Currency',
'parentId': 'Parent Node ID',
'comment': 'Comment',
},
'parameterizedError': {
+4
View File
@@ -221,6 +221,9 @@ export default {
'sub account category not equals to parent': '子账户类别与父账户不同',
'sub account type invalid': '子账户类型无效',
'cannot add or delete sub accounts when modify account': '您不能在修改账户时添加或删除子账户',
'transaction category id is invalid': '交易分类ID无效',
'transaction category not found': '交易分类不存在',
'transaction category type is invalid': '交易分类类型无效',
},
'parameter': {
'id': 'ID',
@@ -236,6 +239,7 @@ export default {
'type': '类型',
'color': '颜色',
'currency': '货币',
'parentId': '父节点ID',
'comment': '备注',
},
'parameterizedError': {