|
@@ -27,7 +27,7 @@ import { intersection } from 'lodash-es';
|
|
|
|
|
|
interface PermissionState {
|
|
|
// Permission code list
|
|
|
- permCodeList: string[] ;
|
|
|
+ permCodeList: string[];
|
|
|
// Whether the route has been dynamically added
|
|
|
isDynamicAddedRoute: boolean;
|
|
|
// To trigger a menu update
|
|
@@ -70,7 +70,7 @@ export const usePermissionStore = defineStore({
|
|
|
setPermCodeList(codeList: string[]) {
|
|
|
this.permCodeList = codeList;
|
|
|
},
|
|
|
- getCheckPerm(value:string|string[]): boolean{
|
|
|
+ getCheckPerm(value: string | string[]): boolean {
|
|
|
const permCodeList = this.permCodeList;
|
|
|
if (!value) {
|
|
|
return false;
|
|
@@ -78,7 +78,7 @@ export const usePermissionStore = defineStore({
|
|
|
if (!isArray(value)) {
|
|
|
return permCodeList?.includes(value);
|
|
|
}
|
|
|
- return (intersection(value, permCodeList)).length > 0;
|
|
|
+ return intersection(value, permCodeList).length > 0;
|
|
|
},
|
|
|
setBackMenuList(list: Menu[]) {
|
|
|
this.backMenuList = list;
|
|
@@ -104,7 +104,7 @@ export const usePermissionStore = defineStore({
|
|
|
},
|
|
|
async changePermissionCode() {
|
|
|
const codeList = await getPermCode();
|
|
|
- const permsList = codeList.map(ele => ele.perms)
|
|
|
+ const permsList = codeList.map((ele) => ele.perms);
|
|
|
this.setPermCodeList(permsList);
|
|
|
},
|
|
|
async buildRoutesAction(): Promise<AppRouteRecordRaw[]> {
|
|
@@ -195,7 +195,7 @@ export const usePermissionStore = defineStore({
|
|
|
let routeList: AppRouteRecordRaw[] = [];
|
|
|
try {
|
|
|
routeList = (await getMenuList()) as AppRouteRecordRaw[];
|
|
|
- this.changePermissionCode();
|
|
|
+ await this.changePermissionCode();
|
|
|
} catch (error) {
|
|
|
console.error(error);
|
|
|
}
|