Bläddra i källkod

feat(auth): 调整菜单显示逻辑以适配不同业务类型

- 修改“菜单管理”仅在特色美食(1)时显示
- 修改“酒单管理”仅在酒吧(2)时显示
- 修改“设施与服务”仅在洗浴汗蒸(4)和运动健身(7)时显示
- 新增“门店基础信息”、“门店头图”、“官方相册”在所有业务类型下均显示
- 修改“人员配置”在美食(1)和KTV(3)时不显示,其余业务类型显示
- 注释掉原有子菜单可见性检查及递归处理逻辑
congxuesong 1 vecka sedan
förälder
incheckning
4d9f0f5fe0
1 ändrade filer med 30 tillägg och 24 borttagningar
  1. 30 24
      src/stores/modules/auth.ts

+ 30 - 24
src/stores/modules/auth.ts

@@ -64,22 +64,28 @@ export const useAuthStore = defineStore({
           // 根据 businessSection 判断菜单显示
           if (menu.meta && menu.meta.title) {
             switch (menu.meta.title) {
-              case "酒单管理":
-                // 为“酒吧”(2) 时显示酒单管理
-                menu.meta.isHide = businessSection !== 2;
-                break;
               case "菜单管理":
-                // 为“酒吧”(2) 时不显示菜单管理
-                menu.meta.isHide = businessSection === 2;
+                // 只在特色美食(1) 时显示菜单管理
+                menu.meta.isHide = businessSection !== 1;
                 break;
-              case "人员配置":
-                // 为“酒吧”(2) 时显示人员配置(即人员管理),否则不显示
+              case "酒单管理":
+                // 只在酒吧(2) 时显示酒单管理
                 menu.meta.isHide = businessSection !== 2;
                 break;
               case "设施与服务":
-                // 为4(洗浴汗蒸) 和 7(运动健身) 时显示设施与服务,否则不显示
+                // 只在洗浴汗蒸(4) 和 运动健身(7) 时显示设施与服务
                 menu.meta.isHide = ![4, 7].includes(businessSection);
                 break;
+              case "门店基础信息":
+              case "门店头图":
+              case "官方相册":
+                // 所有业务类型都显示
+                menu.meta.isHide = false;
+                break;
+              case "人员配置":
+                // 美食(1)和KTV(3)不显示人员配置,其他业务类型都显示
+                menu.meta.isHide = [1, 3].includes(businessSection);
+                break;
               case "食品经营许可证":
                 // 特色美食(1) 和 酒吧(2):正常显示
                 // KTV(3)、洗浴汗蒸(4)、按摩足疗(5)、丽人美发(6)、运动健身(7):仅提供餐食时显示
@@ -99,23 +105,23 @@ export const useAuthStore = defineStore({
           }
 
           // 处理子菜单
-          if (menu.children && menu.children.length > 0) {
-            // 检查子菜单中是否有需要显示的菜单项
-            let hasVisibleChild = false;
-            menu.children.forEach((child: any) => {
-              if (!child.meta?.isHide) {
-                hasVisibleChild = true;
-              }
-            });
+          // if (menu.children && menu.children.length > 0) {
+          //   // 检查子菜单中是否有需要显示的菜单项
+          //   let hasVisibleChild = false;
+          //   menu.children.forEach((child: any) => {
+          //     if (!child.meta?.isHide) {
+          //       hasVisibleChild = true;
+          //     }
+          //   });
 
-            // 如果父菜单本身被隐藏,但有可见子菜单,则显示父菜单
-            if (menu.meta?.isHide && hasVisibleChild) {
-              menu.meta.isHide = false;
-            }
+          //   // 如果父菜单基础信息、头图、相册本身被隐藏,但有可见子菜单,则显示父菜单
+          //   if (menu.meta?.isHide && hasVisibleChild) {
+          //     menu.meta.isHide = false;
+          //   }
 
-            // 递归处理子菜单
-            processMenus(menu.children);
-          }
+          //   // 递归处理子菜单
+          //   processMenus(menu.children);
+          // }
         });
       };