MenuTree.js 675 B

12345678910111213141516171819202122232425262728293031
  1. import { Tree } from 'antd';
  2. function MenuTree(props){
  3. const {data,checkEv} = props;
  4. //菜单选中事件
  5. function onCheck(checkedKeys,e){
  6. const {checkedNodes} = e;
  7. const sourceIds = [];
  8. checkedNodes.map((it)=>{
  9. if(it.softwareResourceId){
  10. sourceIds.push(it.softwareResourceId);
  11. }
  12. });
  13. checkEv(checkedKeys,sourceIds)
  14. }
  15. function onSelect(){
  16. }
  17. const treeData = data?[data]:null;
  18. return (
  19. <Tree
  20. checkable
  21. onCheck={onCheck}
  22. onSelect={onSelect}
  23. treeData={treeData}
  24. />
  25. )
  26. }
  27. export default MenuTree;