wujingjing
2024-11-14 ce1658eb1c17ba7e8fe3f0a21771b4af5ccee8cd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
 
export const enum CustomLayout {
    /** @description 紧凑树布局 n <= 30*/
    NormalTree,
    /** @description 垂直紧凑树,根节点在中间 30 < n <= 50*/
    Vertical,
    /** @description 辐射紧凑树,> 50 */
    Radial,
}
 
export const customLayoutMap ={
    [CustomLayout.NormalTree]:'紧凑树布局',
    [CustomLayout.Vertical]:'垂直对称布局',
    [CustomLayout.Radial]:'辐射状布局'
}
 
 
 
export const getLayoutType = (maxLeafLen: number) => {
    if (maxLeafLen > 50) {
        return CustomLayout.Radial;
    } else if (30 < maxLeafLen) {
        return CustomLayout.Vertical;
    } else {
        return CustomLayout.NormalTree;
    }
};
 
 
export type OrgTreeItem = {
    treeId: string;
    logicId: string;
    model: any;
    type: 'agent' | 'metrics' | 'dimension';
    label: string;
    level: number;
    children?: OrgTreeItem[];
};