mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
Merge branch 'dev' of https://gitee.com/xlsea/ruoyi-plus-soybean into dev
This commit is contained in:
@ -194,8 +194,8 @@ const local: App.I18n.Schema = {
|
||||
system_dept: 'Dept Management',
|
||||
system_post: 'Post Management',
|
||||
monitor: 'Monitor Management',
|
||||
'monitor_login-infor': 'Login Log',
|
||||
'monitor_oper-log': 'Operate Log',
|
||||
monitor_logininfor: 'Login Log',
|
||||
monitor_operlog: 'Operate Log',
|
||||
system_client: 'Client Management',
|
||||
system_notice: 'Notice Management',
|
||||
'social-callback': 'Social Callback',
|
||||
@ -207,7 +207,11 @@ const local: App.I18n.Schema = {
|
||||
system_role: 'Role Management',
|
||||
demo: 'Demo',
|
||||
demo_demo: 'Demo Table',
|
||||
demo_tree: 'Demo Tree'
|
||||
demo_tree: 'Demo Tree',
|
||||
exception: 'Exception',
|
||||
exception_403: '403',
|
||||
exception_404: '404',
|
||||
exception_500: '500'
|
||||
},
|
||||
page: {
|
||||
login: {
|
||||
|
||||
@ -194,8 +194,8 @@ const local: App.I18n.Schema = {
|
||||
system_dept: '部门管理',
|
||||
system_post: '岗位管理',
|
||||
monitor: '系统监控',
|
||||
'monitor_login-infor': '登录日志',
|
||||
'monitor_oper-log': '操作日志',
|
||||
monitor_logininfor: '登录日志',
|
||||
monitor_operlog: '操作日志',
|
||||
system_client: '客户端管理',
|
||||
system_notice: '通知公告',
|
||||
'social-callback': '单点登录回调',
|
||||
@ -207,7 +207,11 @@ const local: App.I18n.Schema = {
|
||||
system_role: '角色管理',
|
||||
demo: '测试',
|
||||
demo_demo: '测试单表',
|
||||
demo_tree: '测试树表'
|
||||
demo_tree: '测试树表',
|
||||
exception: '异常页',
|
||||
exception_403: '403',
|
||||
exception_404: '404',
|
||||
exception_500: '500'
|
||||
},
|
||||
page: {
|
||||
login: {
|
||||
|
||||
@ -26,9 +26,9 @@ export const views: Record<LastLevelRouteKey, RouteComponent | (() => Promise<Ro
|
||||
demo_tree: () => import("@/views/demo/tree/index.vue"),
|
||||
home: () => import("@/views/home/index.vue"),
|
||||
monitor_cache: () => import("@/views/monitor/cache/index.vue"),
|
||||
"monitor_login-infor": () => import("@/views/monitor/login-infor/index.vue"),
|
||||
monitor_logininfor: () => import("@/views/monitor/logininfor/index.vue"),
|
||||
monitor_online: () => import("@/views/monitor/online/index.vue"),
|
||||
"monitor_oper-log": () => import("@/views/monitor/oper-log/index.vue"),
|
||||
monitor_operlog: () => import("@/views/monitor/operlog/index.vue"),
|
||||
system_client: () => import("@/views/system/client/index.vue"),
|
||||
system_config: () => import("@/views/system/config/index.vue"),
|
||||
system_dept: () => import("@/views/system/dept/index.vue"),
|
||||
|
||||
@ -123,12 +123,12 @@ export const generatedRoutes: GeneratedRoute[] = [
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'monitor_login-infor',
|
||||
path: '/monitor/login-infor',
|
||||
component: 'view.monitor_login-infor',
|
||||
name: 'monitor_logininfor',
|
||||
path: '/monitor/logininfor',
|
||||
component: 'view.monitor_logininfor',
|
||||
meta: {
|
||||
title: 'monitor_login-infor',
|
||||
i18nKey: 'route.monitor_login-infor'
|
||||
title: 'monitor_logininfor',
|
||||
i18nKey: 'route.monitor_logininfor'
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -141,12 +141,12 @@ export const generatedRoutes: GeneratedRoute[] = [
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'monitor_oper-log',
|
||||
path: '/monitor/oper-log',
|
||||
component: 'view.monitor_oper-log',
|
||||
name: 'monitor_operlog',
|
||||
path: '/monitor/operlog',
|
||||
component: 'view.monitor_operlog',
|
||||
meta: {
|
||||
title: 'monitor_oper-log',
|
||||
i18nKey: 'route.monitor_oper-log'
|
||||
title: 'monitor_operlog',
|
||||
i18nKey: 'route.monitor_operlog'
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@ -163,6 +163,10 @@ function transformElegantRouteToVueRoute(
|
||||
const routeMap: RouteMap = {
|
||||
"root": "/",
|
||||
"not-found": "/:pathMatch(.*)*",
|
||||
"exception": "/exception",
|
||||
"exception_403": "/exception/403",
|
||||
"exception_404": "/exception/404",
|
||||
"exception_500": "/exception/500",
|
||||
"403": "/403",
|
||||
"404": "/404",
|
||||
"500": "/500",
|
||||
@ -174,9 +178,9 @@ const routeMap: RouteMap = {
|
||||
"login": "/login/:module(pwd-login|code-login|register|reset-pwd|bind-wechat)?",
|
||||
"monitor": "/monitor",
|
||||
"monitor_cache": "/monitor/cache",
|
||||
"monitor_login-infor": "/monitor/login-infor",
|
||||
"monitor_logininfor": "/monitor/logininfor",
|
||||
"monitor_online": "/monitor/online",
|
||||
"monitor_oper-log": "/monitor/oper-log",
|
||||
"monitor_operlog": "/monitor/operlog",
|
||||
"social-callback": "/social-callback",
|
||||
"system": "/system",
|
||||
"system_client": "/system/client",
|
||||
|
||||
@ -71,7 +71,9 @@ export const useRouteStore = defineStore(SetupStoreId.Route, () => {
|
||||
const authRoutesMap = new Map<string, ElegantConstRoute>([]);
|
||||
|
||||
routes.forEach(route => {
|
||||
parseRouter(route);
|
||||
if (authRouteMode.value === 'dynamic') {
|
||||
parseRouter(route);
|
||||
}
|
||||
authRoutesMap.set(route.name, route);
|
||||
});
|
||||
|
||||
@ -90,61 +92,60 @@ export const useRouteStore = defineStore(SetupStoreId.Route, () => {
|
||||
}
|
||||
|
||||
function parseRouter(route: ElegantConstRoute, parent?: ElegantConstRoute) {
|
||||
if (authRouteMode.value === 'dynamic') {
|
||||
// @ts-expect-error no query field
|
||||
const query = route.query ? String(route.query) : undefined;
|
||||
route.path = route.path.startsWith('//') ? route.path.substring(1) : route.path;
|
||||
route.path = parent ? parent.path + route.path : route.path;
|
||||
route.meta = route.meta ? route.meta : { title: route.name };
|
||||
const isLayout = route.component === 'Layout';
|
||||
const isFramePage = route.component === 'FrameView';
|
||||
const isParentLayout = route.component === 'ParentView';
|
||||
|
||||
route.name = route.component!;
|
||||
if (['layout.base', 'iframe-page'].includes(route.component!)) {
|
||||
const name = humpToLine(route.path.substring(1).replace('/', '_'));
|
||||
route.name = parent ? `${parent.name}_${name}` : name;
|
||||
}
|
||||
route.path = route.path.startsWith('/') ? route.path : `/${route.path}`;
|
||||
route.path = parent ? parent.path + route.path : route.path;
|
||||
|
||||
route.meta = route.meta ? route.meta : { title: route.name };
|
||||
|
||||
if (route.meta.icon) {
|
||||
if (route.meta.icon.startsWith('icon-')) {
|
||||
route.meta.localIcon = route.meta.icon.replace('icon-', 'menu-');
|
||||
delete route.meta.icon;
|
||||
}
|
||||
}
|
||||
|
||||
// @ts-expect-error no hidden field
|
||||
route.meta.hideInMenu = Boolean(route.hidden) || false;
|
||||
// 是否需要keepAlive
|
||||
route.meta.keepAlive = !route.meta.noCache || false;
|
||||
|
||||
if (route.component !== 'layout.base') {
|
||||
route.component = parent ? `view.${route.component}` : `layout.base$view.${route.component}`;
|
||||
}
|
||||
|
||||
if (route.component.endsWith('iframe-page')) {
|
||||
route.component = 'view.iframe-page';
|
||||
if (query) {
|
||||
route.props = {
|
||||
url: query
|
||||
};
|
||||
} else {
|
||||
route.meta.href = String(route.meta.link);
|
||||
const randomValue = Math.random().toString(36).slice(2, 12);
|
||||
route.path = `/iframe-page/${randomValue}`;
|
||||
route.name = `iframe_page_${randomValue}`;
|
||||
}
|
||||
}
|
||||
|
||||
delete route.meta.link;
|
||||
delete route.meta.noCache;
|
||||
// @ts-expect-error no query field
|
||||
delete route.query;
|
||||
// @ts-expect-error no hidden field
|
||||
delete route.hidden;
|
||||
route.name = route
|
||||
.component!.replace(/\/index$/, '')
|
||||
.replace(/\//g, '_')
|
||||
.replace(/([A-Z])/g, '-$1')
|
||||
.toLowerCase();
|
||||
if (isLayout || isFramePage || isParentLayout) {
|
||||
const name = humpToLine(route.path.substring(1).replace('/', '_'));
|
||||
route.name = parent ? `${parent.name}_${name}` : name;
|
||||
}
|
||||
|
||||
if (route.children) {
|
||||
route.children.forEach(child => parseRouter(child, route));
|
||||
if (route.meta.icon?.startsWith('local-icon-')) {
|
||||
route.meta.localIcon = route.meta.icon.replace('local-icon-', 'menu-');
|
||||
delete route.meta.icon;
|
||||
}
|
||||
|
||||
// @ts-expect-error no hidden field
|
||||
route.meta.hideInMenu = route.hidden;
|
||||
// 是否需要keepAlive
|
||||
route.meta.keepAlive = !route.meta.noCache;
|
||||
|
||||
if (isFramePage) {
|
||||
if (route.meta.link) {
|
||||
route.meta.href = String(route.meta.link);
|
||||
route.path = '';
|
||||
route.name = Math.random().toString(36).slice(2, 12);
|
||||
} else {
|
||||
route.props = {
|
||||
// @ts-expect-error no query field
|
||||
url: route.query
|
||||
};
|
||||
}
|
||||
route.component = parent ? 'view.iframe-page' : 'layout.base$view.iframe-page';
|
||||
} else if (!isLayout && !isParentLayout) {
|
||||
route.component = parent ? `view.${route.name}` : `layout.base$view.${route.name}`;
|
||||
} else {
|
||||
route.component = isParentLayout ? undefined : 'layout.base';
|
||||
}
|
||||
|
||||
delete route.meta.link;
|
||||
delete route.meta.noCache;
|
||||
// @ts-expect-error no query field
|
||||
delete route.query;
|
||||
// @ts-expect-error no hidden field
|
||||
delete route.hidden;
|
||||
|
||||
route.children?.forEach(child => parseRouter(child, route));
|
||||
}
|
||||
|
||||
const removeRouteFns: (() => void)[] = [];
|
||||
|
||||
20
src/typings/elegant-router.d.ts
vendored
20
src/typings/elegant-router.d.ts
vendored
@ -17,6 +17,10 @@ declare module "@elegant-router/types" {
|
||||
export type RouteMap = {
|
||||
"root": "/";
|
||||
"not-found": "/:pathMatch(.*)*";
|
||||
"exception": "/exception";
|
||||
"exception_403": "/exception/403";
|
||||
"exception_404": "/exception/404";
|
||||
"exception_500": "/exception/500";
|
||||
"403": "/403";
|
||||
"404": "/404";
|
||||
"500": "/500";
|
||||
@ -28,9 +32,9 @@ declare module "@elegant-router/types" {
|
||||
"login": "/login/:module(pwd-login|code-login|register|reset-pwd|bind-wechat)?";
|
||||
"monitor": "/monitor";
|
||||
"monitor_cache": "/monitor/cache";
|
||||
"monitor_login-infor": "/monitor/login-infor";
|
||||
"monitor_logininfor": "/monitor/logininfor";
|
||||
"monitor_online": "/monitor/online";
|
||||
"monitor_oper-log": "/monitor/oper-log";
|
||||
"monitor_operlog": "/monitor/operlog";
|
||||
"social-callback": "/social-callback";
|
||||
"system": "/system";
|
||||
"system_client": "/system/client";
|
||||
@ -68,6 +72,10 @@ declare module "@elegant-router/types" {
|
||||
RouteKey,
|
||||
| "root"
|
||||
| "not-found"
|
||||
| "exception"
|
||||
| "exception_403"
|
||||
| "exception_404"
|
||||
| "exception_500"
|
||||
>;
|
||||
|
||||
/**
|
||||
@ -101,6 +109,7 @@ declare module "@elegant-router/types" {
|
||||
CustomRouteKey,
|
||||
| "root"
|
||||
| "not-found"
|
||||
| "exception"
|
||||
>;
|
||||
|
||||
/**
|
||||
@ -119,9 +128,9 @@ declare module "@elegant-router/types" {
|
||||
| "demo_tree"
|
||||
| "home"
|
||||
| "monitor_cache"
|
||||
| "monitor_login-infor"
|
||||
| "monitor_logininfor"
|
||||
| "monitor_online"
|
||||
| "monitor_oper-log"
|
||||
| "monitor_operlog"
|
||||
| "system_client"
|
||||
| "system_config"
|
||||
| "system_dept"
|
||||
@ -145,6 +154,9 @@ declare module "@elegant-router/types" {
|
||||
CustomRouteKey,
|
||||
| "root"
|
||||
| "not-found"
|
||||
| "exception_403"
|
||||
| "exception_404"
|
||||
| "exception_500"
|
||||
>;
|
||||
|
||||
/**
|
||||
|
||||
@ -5,7 +5,7 @@ import { menuIconTypeOptions, menuIsFrameOptions, menuTypeOptions } from '@/cons
|
||||
import { fetchCreateMenu, fetchUpdateMenu } from '@/service/api/system';
|
||||
import { useFormRules, useNaiveForm } from '@/hooks/common/form';
|
||||
import { getLocalMenuIcons } from '@/utils/icon';
|
||||
import { humpToLine, isNotNull } from '@/utils/common';
|
||||
import { isNotNull } from '@/utils/common';
|
||||
import { $t } from '@/locales';
|
||||
import SvgIcon from '@/components/custom/svg-icon.vue';
|
||||
|
||||
@ -93,7 +93,7 @@ const localIconOptions = localIcons.map<SelectOption>(item => ({
|
||||
<span>{item}</span>
|
||||
</div>
|
||||
),
|
||||
value: `icon-${item}`
|
||||
value: `local-icon-${item}`
|
||||
}));
|
||||
|
||||
function handleInitModel() {
|
||||
@ -102,8 +102,7 @@ function handleInitModel() {
|
||||
|
||||
if (props.operateType === 'edit' && props.rowData) {
|
||||
Object.assign(model, props.rowData);
|
||||
model.component = model.component?.replaceAll('_', '/');
|
||||
iconType.value = model.icon?.startsWith('icon-') ? '2' : '1';
|
||||
iconType.value = model.icon?.startsWith('local-icon-') ? '2' : '1';
|
||||
|
||||
if (model.isFrame !== '2') {
|
||||
const queryObj: { [key: string]: string } = JSON.parse(model.queryParam || '{}');
|
||||
@ -123,6 +122,7 @@ async function handleSubmit() {
|
||||
menuId,
|
||||
parentId,
|
||||
menuName,
|
||||
icon,
|
||||
orderNum,
|
||||
queryParam,
|
||||
isFrame,
|
||||
@ -140,20 +140,13 @@ async function handleSubmit() {
|
||||
model.queryParam = JSON.stringify(queryObj);
|
||||
}
|
||||
|
||||
let icon;
|
||||
if (model.icon) {
|
||||
icon = iconType.value === '1' ? model.icon : model.icon?.replace('menu-', 'icon-');
|
||||
}
|
||||
const path = model.path?.startsWith('/') ? model.path?.substring(1) : model.path;
|
||||
|
||||
let path = model.path;
|
||||
let component = model.component;
|
||||
if (isFrame !== '1') {
|
||||
component = 'iframe-page';
|
||||
path = model.path;
|
||||
} else if (model.menuType === 'C') {
|
||||
component = humpToLine(model.component?.replaceAll('/', '_') || '');
|
||||
} else if (model.menuType === 'M') {
|
||||
component = 'layout.base';
|
||||
if (isFrame === '1' && menuType === 'M') {
|
||||
component = 'Layout';
|
||||
} else {
|
||||
component = 'FrameView';
|
||||
}
|
||||
|
||||
// request
|
||||
@ -277,7 +270,7 @@ function onCreate() {
|
||||
<NFormItemGi v-if="!isBtn" :span="24" path="path">
|
||||
<template #label>
|
||||
<div class="flex-center">
|
||||
<FormTip content="访问的路由地址,如:`/user`,如外网地址需内链访问则以 `http(s)://` 开头" />
|
||||
<FormTip content="访问的路由地址,如:`user`,如外网地址需内链访问则以 `http(s)://` 开头" />
|
||||
<span>{{ model.isFrame !== '0' ? '路由地址' : '外链地址' }}</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user