Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lyvision001 opened this issue Oct 1, 2024 · 0 comments

Comments

@lyvision001
Copy link

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);
}
}
});
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant