|
|
|
|
@ -183,9 +183,13 @@ const SideBar: React.FC<SideBarProps> = ({
|
|
|
|
|
case 'scene':
|
|
|
|
|
const menuData = _.cloneDeep(menuData1);
|
|
|
|
|
const newSubMenuData = _.cloneDeep(subMenuData);
|
|
|
|
|
const subMenuKey = Object.keys(newSubMenuData)[0];
|
|
|
|
|
const subMenuValue: any = Object.values(newSubMenuData)[0];
|
|
|
|
|
|
|
|
|
|
// 遍历所有 subMenuKey 来构建子菜单数据结构
|
|
|
|
|
Object.keys(newSubMenuData).forEach(subMenuKey => {
|
|
|
|
|
const subMenuValue: any = _.cloneDeep(newSubMenuData[subMenuKey]);
|
|
|
|
|
const menuIndex = menuData.findIndex(v => v.key === subMenuKey);
|
|
|
|
|
|
|
|
|
|
if (menuIndex !== -1) {
|
|
|
|
|
// 构建数据结构,这是目录默认需要的数据结构
|
|
|
|
|
subMenuValue.forEach(v => {
|
|
|
|
|
v.title = v.name;
|
|
|
|
|
@ -193,6 +197,7 @@ const SideBar: React.FC<SideBarProps> = ({
|
|
|
|
|
v.path = 'compFlow';
|
|
|
|
|
v.parentKey = subMenuKey;
|
|
|
|
|
v.icon = '/ideContainer/icon/app.png';
|
|
|
|
|
if (subMenuKey !== 'appFlow') {
|
|
|
|
|
v.children = [
|
|
|
|
|
{
|
|
|
|
|
title: '事件',
|
|
|
|
|
@ -205,8 +210,12 @@ const SideBar: React.FC<SideBarProps> = ({
|
|
|
|
|
icon: '/ideContainer/icon/list.png'
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
menuData[menuIndex]['children'] = subMenuValue;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
dispatch(updateMenuData({ 'scene': menuData }));
|
|
|
|
|
return menuData;
|
|
|
|
|
case 'componentDevelopment' :
|
|
|
|
|
@ -256,7 +265,6 @@ const SideBar: React.FC<SideBarProps> = ({
|
|
|
|
|
const parentKey = menu[activeKey]?.key;
|
|
|
|
|
const currentMenu = _.cloneDeep(menuData[identity]);
|
|
|
|
|
const index = currentMenu.findIndex(v => v.key === parentKey);
|
|
|
|
|
// const res: any = await getProjectEnv(data.id);
|
|
|
|
|
const res: any = await getAppInfoNew(data.id);
|
|
|
|
|
if (res.code === 200) {
|
|
|
|
|
const children = currentMenu[index].children.find(v => v.id === data.id);
|
|
|
|
|
@ -483,13 +491,15 @@ const SideBar: React.FC<SideBarProps> = ({
|
|
|
|
|
onSelect={async (_selectedKeys, info) => {
|
|
|
|
|
const selectedNode = info.node;
|
|
|
|
|
const originalData = selectedNode.props.dataRef;
|
|
|
|
|
if (selected?.parentKey === 'appList') {
|
|
|
|
|
await getProjectEnvData(originalData);
|
|
|
|
|
|
|
|
|
|
// 调用外部传入的菜单选择处理函数
|
|
|
|
|
originalData.key && onMenuSelect?.({ ...originalData } as Selected);
|
|
|
|
|
}
|
|
|
|
|
}}
|
|
|
|
|
style={{ background: 'transparent' }} // 移除背景色
|
|
|
|
|
renderExtra={renderNodeExtra}
|
|
|
|
|
renderExtra={selected?.parentKey === 'appList' ? renderNodeExtra : null}
|
|
|
|
|
>
|
|
|
|
|
{renderMenuItems(menu[activeKey]?.children)}
|
|
|
|
|
</Tree>
|
|
|
|
|
|