We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
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); } } }); };
The text was updated successfully, but these errors were encountered:
No branches or pull requests
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);
}
}
});
};
The text was updated successfully, but these errors were encountered: