20260728173026
This commit is contained in:
1 parent
63588bd217
commit
5ec7aadef9
25 files changed
+627
-462
No files matched your search
@@ -84,23 +84,17 @@ export const usePermissionStore = defineStore("permissions", () => {
|
||||
return request;
|
||||
}
|
||||
|
||||
function resolvePageId(code, expectedType) {
|
||||
function resolvePageId(code) {
|
||||
const module = moduleByCode.value.get(String(code || ""));
|
||||
if (!module || (expectedType && module.b_module_type !== expectedType)) return "";
|
||||
if (!module) return "";
|
||||
if (module.b_module_type === "page") return String(module.b_id || "");
|
||||
if (module.b_module_type === "data") return String(module.b_parent_id || "");
|
||||
return "";
|
||||
}
|
||||
|
||||
function canModule(moduleCode) {
|
||||
if (isG3soft.value || !moduleCode) return true;
|
||||
const pageId = resolvePageId(moduleCode);
|
||||
return !!pageId && grantedPageSet.value.has(pageId);
|
||||
}
|
||||
|
||||
function canData(dataCode) {
|
||||
if (isG3soft.value || !dataCode) return true;
|
||||
const pageId = resolvePageId(dataCode, "data");
|
||||
function canAccess(moduleId) {
|
||||
if (isG3soft.value || !moduleId) return true;
|
||||
const pageId = resolvePageId(moduleId);
|
||||
return !!pageId && grantedPageSet.value.has(pageId);
|
||||
}
|
||||
|
||||
@@ -130,8 +124,7 @@ export const usePermissionStore = defineStore("permissions", () => {
|
||||
|
||||
return {
|
||||
load,
|
||||
canModule,
|
||||
canData,
|
||||
canAccess,
|
||||
canPower,
|
||||
clear,
|
||||
grantedPageIds,
|
||||
|
||||
Reference in new issue
Block a user