This commit is contained in:
ygx
2026-03-21 19:33:01 +08:00
18 changed files with 910 additions and 358 deletions

View File

@@ -181,6 +181,17 @@ function extractRelativePath(childPath: string, parentPath: string): string {
* @param parentIsFull 父级菜单的 is_full 字段
* @returns 子路由配置数组
*/
/** 许可授权中心菜单路径(严格匹配末段,避免 menu_path 中含 query 等导致误伤其它菜单如用户管理) */
const LICENSE_CENTER_VIEW = 'ops/pages/system-settings/license-center'
function isLicenseCenterMenuPath(fullPath: string): boolean {
const path = String(fullPath ?? '')
.trim()
.split('?')[0]
.replace(/\/+$/, '')
return path.endsWith('/license-center') || path === 'license-center'
}
function transformChildRoutes(
children: ServerMenuItem[],
parentComponent?: string,
@@ -188,10 +199,17 @@ function transformChildRoutes(
parentIsFull?: boolean
): AppRouteRecordRaw[] {
return children.map((child) => {
// 优先使用子菜单自己的 component否则继承父级的 component
const componentPath = child.component || parentComponent
// 计算子路由的相对路径
const childFullPath = child.menu_path || child.path || ''
const childFullPath = String(child.menu_path ?? child.path ?? '').trim()
// 已配置 component 的菜单绝不覆盖;仅对许可页做路径/code 兜底,避免 includes 误匹配
let componentPath = child.component || parentComponent
if (
!child.component &&
(isLicenseCenterMenuPath(childFullPath) || child.code === 'LicenseCenter')
) {
componentPath = LICENSE_CENTER_VIEW
}
const relativePath = extractRelativePath(childFullPath, parentPath || '')
const route: AppRouteRecordRaw = {

View File

@@ -32,6 +32,16 @@ const OPS: AppRouteRecordRaw = {
roles: ['*'],
},
},
{
path: 'license-center',
name: 'OpsLicenseCenter',
component: () => import('@/views/ops/pages/system-settings/license-center/index.vue'),
meta: {
locale: 'menu.ops.systemSettings.licenseCenter',
requiresAuth: true,
roles: ['*'],
},
},
{
path: 'web-test',
name: 'WebTest',

View File

@@ -1,43 +1,4 @@
import { DEFAULT_LAYOUT } from '../base'
import { AppRouteRecordRaw } from '../types'
import type { AppRouteRecordRaw } from '../types'
const REMOTE: AppRouteRecordRaw = {
// path: '/dc',
// name: 'DC',
// component: DEFAULT_LAYOUT,
// meta: {
// locale: 'menu.dc',
// requiresAuth: true,
// icon: 'icon-desktop',
// order: 99,
// hideInMenu: true,
// },
// children: [
// {
// path: 'detail',
// name: 'DCDetail',
// component: () => import('@/views/ops/pages/dc/detail/index.vue'),
// meta: {
// locale: 'menu.dc.detail',
// requiresAuth: true,
// roles: ['*'],
// // is_full: true,
// isNewTab: true,
// },
// },
// {
// path: 'remote',
// name: 'DCRemote',
// component: () => import('@/views/ops/pages/dc/remote/index.vue'),
// meta: {
// locale: 'menu.dc.remote',
// requiresAuth: true,
// roles: ['*'],
// // is_full: true,
// isNewTab: true,
// },
// },
// ],
}
export default REMOTE
/** 占位:勿导出空对象 `{}`,否则会被当作一条无效路由加入 router导致部分菜单匹配异常 */
export default [] as AppRouteRecordRaw[]