提交 29a49dd4 authored 作者: sin's avatar sin

- 修复 tree 节点查找问题

上级 4812df2c
...@@ -266,7 +266,6 @@ class RoleList extends PureComponent { ...@@ -266,7 +266,6 @@ class RoleList extends PureComponent {
render() { render() {
const { list, data } = this.props; const { list, data } = this.props;
const { pageNo, pageSize, count, roleTreeData, checkedKeys, assignModalLoading } = data; const { pageNo, pageSize, count, roleTreeData, checkedKeys, assignModalLoading } = data;
const { modalVisible, modalType, initValues, roleAssignVisible } = this.state; const { modalVisible, modalType, initValues, roleAssignVisible } = this.state;
......
...@@ -22,20 +22,21 @@ function findNodes(id, nodes) { ...@@ -22,20 +22,21 @@ function findNodes(id, nodes) {
break; break;
} else if (node.children) { } else if (node.children) {
const childNodes = findNodes(id, node.children); const childNodes = findNodes(id, node.children);
res.push(node.key);
for (let j = 0; j < childNodes.length; j += 1) { for (let j = 0; j < childNodes.length; j += 1) {
res.push(childNodes[j]); res.push(childNodes[j]);
} }
break;
} }
} }
return res; return res;
} }
export function findAllNodes(resourceIds, nodes) { export function findAllNodes(resourceIds, nodes) {
console.log('resourceIds', resourceIds);
const findNodesArray = []; const findNodesArray = [];
for (let i = 0; i < resourceIds.length; i += 1) { for (let i = 0; i < resourceIds.length; i += 1) {
const findNodesData = findNodes(resourceIds[i], nodes); const findNodesData = findNodes(resourceIds[i], nodes);
console.log('findNodesData', findNodesData);
if (findNodesData) { if (findNodesData) {
for (let j = 0; j < findNodesData.length; j += 1) { for (let j = 0; j < findNodesData.length; j += 1) {
const jD = findNodesData[j]; const jD = findNodesData[j];
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论