hotgo icon indicating copy to clipboard operation
hotgo copied to clipboard

修复角色权限>数据权限>自定义部门时,列表无法显示的问题

Open lyvision001 opened this issue 1 year ago • 0 comments

80D4745EDE9B692D2D76FED9B0E4BC24 1、修改/src/views/permission/role/editDataAuth.vue loadDeptList方法内deptList.value = res.list 语句。 2、修改为:buildTree(res.list); 3、增加方法: function buildTree(res) { // 初始化节点映射表 const nodeMap = new Map(); // 增加每个节点的 children、label、key res.forEach(node => { node.children = []; node.label = node.name; node.key = node.id; nodeMap.set(node.id, node); }); // 遍历所有节点,构建树形结构 res.forEach(node => { if (node.pid === 0) { deptList.value.push(node); } else { const parent = nodeMap.get(node.pid); if (parent) { parent.children.push(node); } } }); };

lyvision001 avatar Oct 01 '24 09:10 lyvision001