update 优化 菜单管理 增加激活菜单与扩展属性字段
This commit is contained in:
@@ -44,6 +44,8 @@ export interface MenuVO extends BaseEntity {
|
||||
visible: string;
|
||||
status: string;
|
||||
icon: string;
|
||||
activeMenu: string;
|
||||
ext: string;
|
||||
remark: string;
|
||||
}
|
||||
|
||||
@@ -63,6 +65,8 @@ export interface MenuForm {
|
||||
visible?: string;
|
||||
status?: string;
|
||||
icon?: string;
|
||||
activeMenu?: string;
|
||||
ext?: string;
|
||||
remark?: string;
|
||||
query?: string;
|
||||
perms?: string;
|
||||
|
||||
@@ -97,8 +97,9 @@ const childrenMenus = computed(() => {
|
||||
|
||||
// 默认激活的菜单
|
||||
const activeMenu = computed(() => {
|
||||
let path = route.path;
|
||||
if (path === '/index') {
|
||||
const { meta } = route;
|
||||
let path = meta.activeMenu || route.path;
|
||||
if (path === '/index' || route.path === '/index') {
|
||||
path = '/system/user';
|
||||
}
|
||||
let activePath = path;
|
||||
|
||||
@@ -47,8 +47,8 @@ export const usePermissionStore = defineStore('permission', () => {
|
||||
};
|
||||
const generateRoutes = async (): Promise<RouteRecordRaw[]> => {
|
||||
const res = await getRouters();
|
||||
const { data } = res;
|
||||
let text = JSON.stringify(data);
|
||||
const data = Array.isArray(res.data) ? res.data : [];
|
||||
const text = JSON.stringify(data);
|
||||
const sdata = JSON.parse(text);
|
||||
const rdata = JSON.parse(text);
|
||||
const defaultData = JSON.parse(text);
|
||||
@@ -65,7 +65,7 @@ export const usePermissionStore = defineStore('permission', () => {
|
||||
setTopbarRoutes(defaultRoutes);
|
||||
// 路由name重复检查
|
||||
duplicateRouteChecker(asyncRoutes, sidebarRoutes);
|
||||
return new Promise<RouteRecordRaw[]>(resolve => resolve(rewriteRoutes));
|
||||
return rewriteRoutes;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -313,7 +313,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col v-if="form.visible !== '0'" :span="12">
|
||||
<el-form-item label="激活路径" prop="form.remark">
|
||||
<el-form-item label="激活路径" prop="activeMenu">
|
||||
<template #label>
|
||||
<span>
|
||||
<el-tooltip content="隐藏菜单填写默认激活路由,比如激活父菜单的路由 /system/user" placement="top">
|
||||
@@ -324,7 +324,12 @@
|
||||
激活路由
|
||||
</span>
|
||||
</template>
|
||||
<el-input v-model="form.remark" placeholder="请输入激活路径" />
|
||||
<el-input v-model="form.activeMenu" placeholder="请输入激活路径" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" maxlength="500" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -398,7 +403,9 @@ const initFormData = {
|
||||
isFrame: 'N',
|
||||
isCache: 'Y',
|
||||
visible: '0',
|
||||
status: '0'
|
||||
status: '0',
|
||||
activeMenu: '',
|
||||
remark: ''
|
||||
};
|
||||
const data = reactive<PageData<MenuForm, MenuQuery>>({
|
||||
form: { ...initFormData },
|
||||
|
||||
Reference in New Issue
Block a user