- 优化 tree,查找问题,undefined异常
This commit is contained in:
parent
3575c6255c
commit
0c8a79a8ed
|
@ -101,7 +101,6 @@ export default {
|
|||
*roleAssignResource({ payload }, { call }) {
|
||||
const { id, resourceIds, roleTreeData } = payload;
|
||||
const assignNodes = findAllNodes(resourceIds, roleTreeData);
|
||||
|
||||
const params = {
|
||||
id,
|
||||
resourceIds: arrayToStringParams(assignNodes),
|
||||
|
|
|
@ -200,9 +200,7 @@ export default {
|
|||
// const resultMenuData = data;
|
||||
if (data !== 'all') {
|
||||
const moveChildrenMenusData = moveChildrenMenus(antMenuData);
|
||||
console.log('moveChildrenMenusData', moveChildrenMenusData);
|
||||
const buildTreeMenuData = buildTreeMenu(antMenuData, moveChildrenMenusData, data);
|
||||
console.log('buildTreeMenuData', buildTreeMenuData);
|
||||
menuData = buildTreeMenuData;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,19 +3,7 @@
|
|||
import React, { PureComponent, Fragment } from 'react';
|
||||
import { connect } from 'dva';
|
||||
import moment from 'moment';
|
||||
import {
|
||||
Card,
|
||||
Form,
|
||||
Input,
|
||||
Select,
|
||||
Spin,
|
||||
Button,
|
||||
Modal,
|
||||
message,
|
||||
Table,
|
||||
Divider,
|
||||
Tree,
|
||||
} from 'antd';
|
||||
import { Card, Form, Input, Spin, Button, Modal, message, Table, Divider, Tree } from 'antd';
|
||||
import PageHeaderWrapper from '@/components/PageHeaderWrapper';
|
||||
|
||||
import styles from './RoleList.less';
|
||||
|
@ -39,10 +27,6 @@ const CreateForm = Form.create()(props => {
|
|||
});
|
||||
};
|
||||
|
||||
const selectStyle = {
|
||||
width: 200,
|
||||
};
|
||||
|
||||
const title = modalType === 'add' ? '添加一个 Role' : '更新一个 Role';
|
||||
const okText = modalType === 'add' ? '添加' : '更新';
|
||||
return (
|
||||
|
|
|
@ -20,15 +20,13 @@ function findNodes(id, nodes) {
|
|||
if (node.key === id) {
|
||||
res.push(node.key);
|
||||
break;
|
||||
} else {
|
||||
} else if (node.children) {
|
||||
const childNodes = findNodes(id, node.children);
|
||||
if (childNodes.length) {
|
||||
res.push(node.key);
|
||||
for (let j = 0; j < childNodes.length; j += 1) {
|
||||
res.push(childNodes[j]);
|
||||
}
|
||||
break;
|
||||
res.push(node.key);
|
||||
for (let j = 0; j < childNodes.length; j += 1) {
|
||||
res.push(childNodes[j]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
|
|
Loading…
Reference in New Issue