1.优化运维管理中渠道列表选择渠道的筛选错误问题
2.优化渠道运维管理目录菜单权限
This commit is contained in:
@@ -7,6 +7,22 @@ const BUILTIN_CHANNEL_LAYOUT_PATHS = [
|
||||
'/system/dept'
|
||||
]
|
||||
|
||||
/** 运维页里不需要按渠道分栏的页面 */
|
||||
const NO_CHANNEL_LAYOUT_PATHS = [
|
||||
'/safeguard/dict',
|
||||
'/safeguard/attachment',
|
||||
'/safeguard/database',
|
||||
'/safeguard/server',
|
||||
'/safeguard/cache',
|
||||
'/safeguard/email-log'
|
||||
]
|
||||
|
||||
/** 日志页:左侧首项为「全部」,dept_id=0 表示不按渠道过滤 */
|
||||
const ALL_CHANNEL_SCOPE_PATHS = [
|
||||
'/safeguard/login-log',
|
||||
'/safeguard/oper-log'
|
||||
]
|
||||
|
||||
export function isSuperAdminUser(): boolean {
|
||||
const userStore = useUserStore()
|
||||
return Number(userStore.info?.id ?? 0) === 1
|
||||
@@ -28,6 +44,20 @@ export function isRoleChannelRoute(route: Pick<RouteLocationNormalized, 'path' |
|
||||
return route.path.startsWith('/system/role')
|
||||
}
|
||||
|
||||
export function isAllChannelScopeRoute(route: Pick<RouteLocationNormalized, 'path' | 'meta'>): boolean {
|
||||
if (route.meta?.channelScope === 'all') {
|
||||
return true
|
||||
}
|
||||
return ALL_CHANNEL_SCOPE_PATHS.some((item) => route.path.startsWith(item))
|
||||
}
|
||||
|
||||
export function isNoChannelLayoutRoute(route: Pick<RouteLocationNormalized, 'path' | 'meta'>): boolean {
|
||||
if (route.meta?.noChannelLayout === true) {
|
||||
return true
|
||||
}
|
||||
return NO_CHANNEL_LAYOUT_PATHS.some((item) => route.path.startsWith(item))
|
||||
}
|
||||
|
||||
export function shouldWrapSuperAdminChannelLayout(route: RouteLocationNormalized): boolean {
|
||||
if (!isSuperAdminUser()) {
|
||||
return false
|
||||
@@ -35,10 +65,10 @@ export function shouldWrapSuperAdminChannelLayout(route: RouteLocationNormalized
|
||||
if (route.meta?.isFullPage) {
|
||||
return false
|
||||
}
|
||||
if (route.meta?.noChannelLayout === true) {
|
||||
const path = route.path
|
||||
if (isNoChannelLayoutRoute(route)) {
|
||||
return false
|
||||
}
|
||||
const path = route.path
|
||||
for (let i = 0; i < BUILTIN_CHANNEL_LAYOUT_PATHS.length; i++) {
|
||||
if (path.startsWith(BUILTIN_CHANNEL_LAYOUT_PATHS[i])) {
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user