mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-14 15:07:33 +08:00
support sort account
This commit is contained in:
@@ -43,6 +43,24 @@ function getCategorizedAccounts(allAccounts) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
function getAccountByAccountId(categorizedAccounts, accountId) {
|
||||
for (let category in categorizedAccounts) {
|
||||
if (!Object.prototype.hasOwnProperty.call(categorizedAccounts, category)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const accountList = categorizedAccounts[category];
|
||||
|
||||
for (let i = 0; i < accountList.length; i++) {
|
||||
if (accountList[i].id === accountId) {
|
||||
return accountList[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
export default {
|
||||
isFunction,
|
||||
isObject,
|
||||
@@ -51,4 +69,5 @@ export default {
|
||||
isNumber,
|
||||
isBoolean,
|
||||
getCategorizedAccounts,
|
||||
getAccountByAccountId,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user