export const menuMap = {
    functionRoot: [
        {name: '结构(A)', key: 'str_01'},
        {name: '多级添加(N)', key: 'str_02'},
        {name: '删除根结点()', key: 'str_03'},
        {name: '添加上级()', key: 'str_04'},
        {name: '属性(Q)', key: 'str_05'},
    ],
    functionFail: [
        {name: '预防措施(G)', key: 'fai_01'},
        {name: '探测措施(B)', key: 'fai_02'},
        {name: '初始措施状态(F)', key: 'fai_03'},
        {name: '优化措施状态(F)', key: 'fai_031'},
        {name: '措施组(V)', key: 'fai_04'},
        {name: '失效网(T)', key: 'fai_05'},
        {name: '剪切(Ctrl+X)', key: 'fai_06'},
        {name: '复制(Ctrl+C)', key: 'fai_07'},
        {name: '合并(Ctrl+E)', key: 'fai_08'},
        {name: '删除(Delete)', key: 'fai_09'},

        {name: '同级上移(Up)', key: 'str_11'},
        {name: '同级下移（Down）', key: 'str_12'},
        // { name: '折叠/展开(Num+)', key: 'str_13' },
        // { name: '层级折叠/展开(Ctrl +(Num+))', key: 'str_14' },

        {name: '属性(Q)', key: 'fai_10'},
    ],
    structureRoot: [
        {name: '结构(A)', key: 'str_01'},
        {name: '多级添加(N)', key: 'str_02'},
        // { name: '功能(S)', key: 'str_03' },
        // { name: '产品特性(W)', key: 'str_04' },
        {name: '复制(Ctrl+C)', key: 'str_05'},
        // { name: '删除根结点', key: 'str_06' },
        // { name: '添加上级', key: 'str_07' },
        {name: '属性(Q)', key: 'str_08'},
    ],
    structureSon: [
        {name: '结构(A)', key: 'str_01'},
        {name: '多级添加(N)', key: 'str_02'},
        // { name: '功能(S)', key: 'str_03' },
        // { name: '产品特性(W)', key: 'str_04' },
        {name: '剪切(Ctrl+X)', key: 'str_051'},
        {name: '复制(Ctrl+C)', key: 'str_052'},
        {name: '合并(Ctrl+E)', key: 'str_053'},
        {name: '删除(Delete)', key: 'str_06'},

        {name: '同级上移(Up)', key: 'str_09'},
        {name: '同级下移（Down）', key: 'str_10'},
        // { name: '折叠/展开(Num+)', key: 'str_11' },
        // { name: '层级折叠/展开(Ctrl +(Num+))', key: 'str_12' },

        {name: '属性(Q)', key: 'str_08'},
    ],
    option: [{
        name: '操作1',
        key: 'caozuo1',
    },
        {
            name: '操作2',
            key: 'caozuo2',
        },
    ],
};
const treeMenu = (item) => {
    item.action = menuMap[item.type] || [];
    if (item.children) {
        item.children.forEach((element) => {
            treeMenu(element);
        });
    }
};

//处理树 返回菜单
export default (tree) => {
    tree.forEach((element) => {
        treeMenu(element);
    });
    // console.log(tree);
    return tree;
};
