Commit 5c4f0c5503cf9412cc5baa62e6d97bcf658784bd

Authored by 若依
Committed by Gitee
2 parents d596d5bb 0070297f

!65 根节点为子部门时,树状结构显示问题

Merge pull request !65 from GSTong/master
Showing 1 changed file with 2 additions and 2 deletions
ruoyi-ui/src/utils/ruoyi.js
1   -/**
  1 +/**
2 2 * 通用js方法封装处理
3 3 * Copyright (c) 2019 ruoyi
4 4 */
... ... @@ -131,7 +131,7 @@ export function handleTree(data, id, parentId, children, rootId) {
131 131 id = id || 'id'
132 132 parentId = parentId || 'parentId'
133 133 children = children || 'children'
134   - rootId = rootId || 0
  134 + rootId = rootId || Math.min.apply(Math,data.map(item => { return item[parentId] })) || 0
135 135 //对源数据深度克隆
136 136 const cloneData = JSON.parse(JSON.stringify(data))
137 137 //循环所有项
... ...