Commit 0070297fe11ceb3a013721ae35ffd4ad56ad1065
1 parent
71ec44a5
根节点为子部门时,树状结构显示问题
Showing
1 changed file
with
2 additions
and
2 deletions
ruoyi-ui/src/utils/ruoyi.js
| 1 | -/** | 1 | +/** |
| 2 | * 通用js方法封装处理 | 2 | * 通用js方法封装处理 |
| 3 | * Copyright (c) 2019 ruoyi | 3 | * Copyright (c) 2019 ruoyi |
| 4 | */ | 4 | */ |
| @@ -128,7 +128,7 @@ export function handleTree(data, id, parentId, children, rootId) { | @@ -128,7 +128,7 @@ export function handleTree(data, id, parentId, children, rootId) { | ||
| 128 | id = id || 'id' | 128 | id = id || 'id' |
| 129 | parentId = parentId || 'parentId' | 129 | parentId = parentId || 'parentId' |
| 130 | children = children || 'children' | 130 | children = children || 'children' |
| 131 | - rootId = rootId || 0 | 131 | + rootId = rootId || Math.min.apply(Math,data.map(item => { return item[parentId] })) || 0 |
| 132 | //对源数据深度克隆 | 132 | //对源数据深度克隆 |
| 133 | const cloneData = JSON.parse(JSON.stringify(data)) | 133 | const cloneData = JSON.parse(JSON.stringify(data)) |
| 134 | //循环所有项 | 134 | //循环所有项 |