From 8e94e3f60a91e536d69e643b4dc13804b79370bc Mon Sep 17 00:00:00 2001
From: wupengfei <834520024@qq.com>
Date: 星期二, 05 八月 2025 17:40:06 +0800
Subject: [PATCH] feat: 页面

---
 src/hooks/useAccess.ts |   54 +++++++++---------------------------------------------
 1 files changed, 9 insertions(+), 45 deletions(-)

diff --git a/src/hooks/useAccess.ts b/src/hooks/useAccess.ts
index 73ac9b2..0c61411 100644
--- a/src/hooks/useAccess.ts
+++ b/src/hooks/useAccess.ts
@@ -4,6 +4,7 @@
   useAccess as useBoleAccess,
   useGroupColumns as useBoleGroupColumns,
   useGroupOperationBtns as useBoleGroupOperationBtns,
+  DaPengAccessAdapter,
 } from '@bole-core/components';
 import type { Ref, ComputedRef } from 'vue';
 import { myClient } from '@/constants/query';
@@ -29,61 +30,24 @@
 
   const moduleId = route.meta.moduleId;
 
-  const groupName = 'default';
-
   return useBoleAccess({
-    queryKey: ['menuServices/getMenu', { moduleId }],
+    queryKey: ['baseModuleServices/getCurrentSubModuleList', { moduleId }],
     service: async () => {
-      const res = await menuServices.getMenu({ id: moduleId });
-      const group = res.groups.find((g) => g.group === groupName);
-      const pageButtonLocation = group?.buttonLocations?.find?.(
-        (buttonLocation) => buttonLocation.location === SubModuleKey[SubModuleType.PageButton]
+      const res = await menuServices.getMenu(
+        { id: moduleId },
+        {
+          showLoading: false,
+        }
       );
-      const dataButtonLocation = group?.buttonLocations?.find?.(
-        (buttonLocation) => buttonLocation.location === SubModuleKey[SubModuleType.DataButton]
-      );
-      return {
-        pageButton: menuButtonAdapter(pageButtonLocation, SubModuleType.PageButton),
-        dataButton: menuButtonAdapter(dataButtonLocation, SubModuleType.DataButton),
-        column: menuFieldsAdapter(group?.fields ?? []),
-      };
+      return DaPengAccessAdapter.menuAdapter({ groups: res.groups, moduleId });
     },
     ...options,
   });
 }
 
-function menuButtonAdapter(buttonLocation: API.GetMenuQueryResultButtonLocation, buttonType) {
-  const buttons = buttonLocation?.buttons ?? [];
-  return buttons.map((x) => ({
-    id: x.id,
-    moduleId: '',
-    parentId: '',
-    enCode: x.code,
-    name: x.name,
-    sortCode: x.sort,
-    buttonType: buttonType,
-    hasCheck: x.isChecked,
-  }));
-}
-
-function menuFieldsAdapter(fields: API.GetMenuQueryResultField[]) {
-  return fields.map((x) => ({
-    id: x.id,
-    moduleId: '',
-    parentId: '',
-    enCode: x.code,
-    name: x.name,
-    sortCode: x.sort,
-    width: Number(x.width),
-    hasCheck: x.isChecked,
-    fixed: false,
-    isShow: true,
-  }));
-}
-
 export function useClearSubModule() {
   function clearSubModule() {
-    myClient.removeQueries({ queryKey: ['menuServices/getMenu'] });
+    myClient.removeQueries({ queryKey: ['baseModuleServices/getCurrentSubModuleList'] });
   }
 
   return { clearSubModule };

--
Gitblit v1.9.1