|
|
@@ -27,6 +27,10 @@ export const usePermissionStore = defineStore("pure-permission", {
|
|
|
handleWholeMenus(routes: any[]) {
|
|
|
// 合并静态和动态路由,按 path 去重(动态路由 backstage 优先)
|
|
|
const merged = this.constantMenus.concat(routes);
|
|
|
+ console.log("[handleWholeMenus] constantMenus ranks:",
|
|
|
+ this.constantMenus.map((m: any) => `${m.meta?.title}(${m.meta?.rank},${m.path})`));
|
|
|
+ console.log("[handleWholeMenus] routes ranks:",
|
|
|
+ routes.map((m: any) => `${m.meta?.title}(${m.meta?.rank},${m.path})`));
|
|
|
const pathMap = new Map<string, any>();
|
|
|
for (const r of merged as any[]) {
|
|
|
if (!pathMap.has(r.path)) {
|
|
|
@@ -35,6 +39,7 @@ export const usePermissionStore = defineStore("pure-permission", {
|
|
|
// 后端路由覆盖静态路由时,若后端无 rank 则继承静态的 rank
|
|
|
const existing = pathMap.get(r.path);
|
|
|
if (r.meta?.rank == null && existing?.meta?.rank != null) {
|
|
|
+ console.log(`[handleWholeMenus] inherit rank: ${r.path} ← ${existing.meta.rank}`);
|
|
|
r.meta.rank = existing.meta.rank;
|
|
|
}
|
|
|
pathMap.set(r.path, r);
|