更改校端权限

This commit is contained in:
chenxing
2026-09-07 09:32:38 +08:00
parent 9200fa2135
commit 7e37f2ada6
15 changed files with 461 additions and 120 deletions
+14 -2
View File
@@ -22,12 +22,16 @@ export interface IModule {
export interface IdefaultStore {
curStatsDate: Date;
userRole: UserRoleEnum;
/** 管理端访问范围(GetUserScope 返回,后端单点判定):BUREAU 区域组 / SCHOOL 可管理学校组 */
userScope: { bureauGroupId?: number | null; schoolGroupIds?: number[] | null };
lenLevel: Array<SchLenLevel>;
subjects: Array<Subject>;
/** 系统字典(GetSysDict 接口返回) */
sysDict: Record<string, any>;
/** 模块列表(当前写死,后续接入接口) */
modules: Array<IModule>;
/** 角色是否已落定(App.vue GetUserScope/降级判定完成后置 true,路由守卫依赖) */
roleLoaded: boolean;
}
export const useDefaultStore = defineStore("defaultStore", {
@@ -35,10 +39,12 @@ export const useDefaultStore = defineStore("defaultStore", {
return {
curStatsDate: new Date(),
userRole: UserRoleEnum.School,
userScope: { bureauGroupId: null, schoolGroupIds: null },
lenLevel: [],
subjects: [],
sysDict: {},
modules: [],
roleLoaded: false,
};
},
actions: {
@@ -48,6 +54,12 @@ export const useDefaultStore = defineStore("defaultStore", {
setUserRole(role: UserRoleEnum) {
this.userRole = role;
},
setUserScope(scope: { bureauGroupId?: number | null; schoolGroupIds?: number[] | null }) {
this.userScope = scope || { bureauGroupId: null, schoolGroupIds: null };
},
setRoleLoaded(loaded: boolean) {
this.roleLoaded = loaded;
},
setSchLenLevel(len: Array<SchLenLevel>) {
this.lenLevel = len;
},
@@ -61,9 +73,9 @@ export const useDefaultStore = defineStore("defaultStore", {
this.sysDict = {};
}
},
/** 获取模块列表(数据来源见 src/assets/config/menu.ts,后续接入接口无缝替换) */
/** 获取模块列表(数据源 src/assets/config/menu.ts,按当前级别过滤菜单权限矩阵) */
async fetchModules() {
this.modules = await getMenuList();
this.modules = await getMenuList(this.userRole);
},
},
getters: {