|
|
|
|
@ -17,7 +17,7 @@ import { menuData1, menuData2 } from './config/menuData';
|
|
|
|
|
import { IconSearch, IconPlus } from '@arco-design/web-react/icon';
|
|
|
|
|
import { Selected } from '@/pages/ideContainer/types';
|
|
|
|
|
import { useDispatch, useSelector } from 'react-redux';
|
|
|
|
|
import { updateMenuData, updateFlowData } from '@/store/ideContainer';
|
|
|
|
|
import { updateMenuData, updateFlowData, updateCurrentAppData } from '@/store/ideContainer';
|
|
|
|
|
import { addApp, getProjectEnv, editApp, deleteApp } from '@/api/apps';
|
|
|
|
|
import _ from 'lodash';
|
|
|
|
|
import { getAppInfoNew } from '@/api/appRes';
|
|
|
|
|
@ -281,10 +281,26 @@ const SideBar: React.FC<SideBarProps> = ({
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const findMenuItem = (menuItems: any[], key: string): any => {
|
|
|
|
|
for (const item of menuItems) {
|
|
|
|
|
if (item.key === key) {
|
|
|
|
|
return item;
|
|
|
|
|
}
|
|
|
|
|
if (item.children) {
|
|
|
|
|
const found = findMenuItem(item.children, key);
|
|
|
|
|
if (found) return found;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 更新 menuData 中的数据
|
|
|
|
|
dispatch(updateMenuData({ ...menuData, [identity]: currentMenu }));
|
|
|
|
|
// 更新 flowData 中的数据
|
|
|
|
|
dispatch(updateFlowData({ [data.id]: res.data }));
|
|
|
|
|
// 更新 currentAppData 中的数据
|
|
|
|
|
dispatch(updateCurrentAppData({ ...findMenuItem(menuData[identity], children.key) }));
|
|
|
|
|
|
|
|
|
|
// 同时更新本地 menu 状态以触发重新渲染
|
|
|
|
|
setMenu(prevMenu => {
|
|
|
|
|
|