import { Tree  } from 'antd';

function MenuTree(props){
    const {data,checkEv,checkeds} = props;
    //console.log(42,checkeds)
    //菜单选中事件
    function onCheck(checkedKeys,e){
        const {checkedNodes} = e;
        const sourceIds  = [];
        checkedNodes.map((it)=>{
            if(it.softwareResourceId){
                sourceIds.push(it.softwareResourceId);
            }
        });
        checkEv(checkedKeys,sourceIds)
    }
    function onSelect(){

    }
    const treeData = data?[data]:null;
    return (
        <Tree
            checkable
            defaultCheckedKeys={checkeds?checkeds.softwareMenuIds:[]}
            onCheck={onCheck}
            onSelect={onSelect}
            treeData={treeData}
        />
    )
}

export default MenuTree;