diff --git a/core/core-frontend/src/utils/treeSortUtils.ts b/core/core-frontend/src/utils/treeSortUtils.ts index ec951e1880..5f72db52f3 100644 --- a/core/core-frontend/src/utils/treeSortUtils.ts +++ b/core/core-frontend/src/utils/treeSortUtils.ts @@ -3,13 +3,18 @@ import _ from 'lodash' export default function treeSort(tree: BusiTreeNode[], sortType: string) { const result = _.cloneDeep(tree) - sortPer(result, sortType) - _.forEach(result, node => { + sortCircle(result, sortType) + return result +} + +export function sortCircle(tree: BusiTreeNode[], sortType: string) { + sortPer(tree, sortType) + _.forEach(tree, node => { if (node.children && node.children.length > 0) { - sortPer(node.children, sortType) + sortCircle(node.children, sortType) } }) - return result + return tree } export const sortPer = (subTree: BusiTreeNode[], sortType: string) => {