fix: 权限排序异常

This commit is contained in:
xuziqiang
2024-06-19 16:22:19 +08:00
parent 5d7d8cc4de
commit 8a554f5871
4 changed files with 9 additions and 11 deletions

View File

@@ -21,7 +21,7 @@ export function transformRouteToMenu(route: RouteRecordRaw, parentCode = '') {
const _menu: ModuleMenu = {
code,
icon: (route.meta?.icon || ' ') as string,
sort: (route.meta?.index || 999) as number,
sort: (isNumber(route.meta?.index) ? route.meta?.index : 999) as number,
label: (route.meta?.title || ' ') as string,
type: (route.meta?.type || 'menus') as string,
// name: dealOp(route) as string,

View File

@@ -65,6 +65,7 @@ export const useRouteStore = defineStore({
routeModule[i].menus && loop(routeModule[i].menus);
}
}
loop(this.routeModule);
this.routeModuleObject = routeModuleObject;
function loopRoute(routeList) {
@@ -90,9 +91,10 @@ export const useRouteStore = defineStore({
});
// const initPcResource = { application: {}, menus: [] };
let initPcResource = [];
// this.routeModule.sort((a, b) => {
// return a.route?.meta?.index - b.route?.meta?.index;
// });
this.routeModule.sort((a, b) => {
return a.route?.meta?.index - b.route?.meta?.index;
});
const info = JSON.parse(JSON.stringify(this.routeModule));
initRouteMouleList(info);
function initRouteMouleList(info) {
@@ -116,9 +118,6 @@ export const useRouteStore = defineStore({
});
}
// initPcResource.application = appConfig.resourceInfo?.application as object;
console.log(info);
return;
initPcResource = appConfig.resourceInfo?.dealReosurceList
? appConfig.resourceInfo?.dealReosurceList(info)
: info;