refactor(仪表板): 资源数排序规则支持缓存到本地

This commit is contained in:
wangjiahao 2024-03-29 11:23:37 +08:00
parent 48d76e68af
commit 7afd3ae2e5

View File

@ -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) => {