Commit 0070297fe11ceb3a013721ae35ffd4ad56ad1065

Authored by gst
1 parent 71ec44a5

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

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 */
... ... @@ -128,7 +128,7 @@ export function handleTree(data, id, parentId, children, rootId) {
128 128 id = id || 'id'
129 129 parentId = parentId || 'parentId'
130 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 133 const cloneData = JSON.parse(JSON.stringify(data))
134 134 //循环所有项
... ...