riku
2025-11-27 63d9a9c62fd34f4b48a157e0bc57dd82ee09a197
src/constants/menu.js
@@ -13,7 +13,7 @@
  });
}
const MENU_FYSP = [
const _MENU_FYSP = [
  // {
  //   icon: 'Search',
  //   name: '巡查审核',
@@ -164,7 +164,8 @@
      {
        path: '/fysp/config/domainCatalog',
        icon: 'List',
        name: '值域目录'
        name: '值域目录',
        debug: true
      }
    ]
  },
@@ -259,4 +260,32 @@
  }
];
const MENU_FYSP = () => {
  // 深拷贝原始菜单数组,避免修改原数据
  const menuCopy = JSON.parse(JSON.stringify(_MENU_FYSP));
  // 递归处理菜单项
  const processMenuItem = (item) => {
    // 如果当前项有children属性
    if (item.children && Array.isArray(item.children)) {
      // 根据环境过滤children数组
      item.children = item.children.filter(child => {
        // 递归处理子项的children
        processMenuItem(child);
        // 开发环境保留所有项(包括debug: true的),生产环境过滤掉debug: true的项
        // 注意:只有设置了debug: true的项才需要在非开发环境过滤
        // 如果没有debug属性,应该保留
        return import.meta.env.DEV || child.debug !== true;
      });
    }
    return item;
  };
  // 处理整个菜单数组
  return menuCopy.map(processMenuItem);
};
export { MENU_FYSP, MENU_FYTZ, MENU_FYPW, MENU_COMMON };