feat(auth): 统一数据库运维菜单路由并添加装置单位及监测点限值配置功能
- 统一数据库监控菜单路径到 /system-ops/dbms 入口 - 添加 isDbmsMenu 函数处理多种数据库菜单路径匹配 - 在动态路由中增加多个数据库监控路径的重定向规则 - 添加设备单位配置功能包括新增 EquipmentUnitForm 接口定义 - 添加监测点限值配置功能包括新增 OverlimitDetail 接口定义 - 在装置表单中添加单位配置按钮并集成单位调试功能 - 在监测点表单中添加限值配置按钮并集成限值调试功能 - 添加电压等级变更时的默认容量和变比同步逻辑 - 配置监测点表单中的线路类型选择选项 - 添加装置表单中比率输入组的高度紧凑样式 - 新增数据库运维静态路由配置和别名支持
This commit is contained in:
55
frontend/src/routers/modules/check-dbms-route-contract.mjs
Normal file
55
frontend/src/routers/modules/check-dbms-route-contract.mjs
Normal file
@@ -0,0 +1,55 @@
|
||||
import { readFileSync } from 'node:fs'
|
||||
import { dirname, resolve } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
const root = resolve(dirname(fileURLToPath(import.meta.url)), '../..')
|
||||
const read = path => readFileSync(resolve(root, path), 'utf8')
|
||||
|
||||
const staticRouterSource = read('routers/modules/staticRouter.ts')
|
||||
const authStoreSource = read('stores/modules/auth.ts')
|
||||
|
||||
const expectedPaths = [
|
||||
'/systemMonitor/dbms',
|
||||
'/systemMonitor/dbms/index',
|
||||
'/systemMonitor/databaseMonitor',
|
||||
'/systemMonitor/databaseMonitor/index',
|
||||
'/systemMonitor/database-monitor',
|
||||
'/systemMonitor/database-monitor/index',
|
||||
'/system-ops/database-monitor',
|
||||
'/system-ops/database-monitor/index'
|
||||
]
|
||||
|
||||
const errors = []
|
||||
|
||||
const dbmsRouteIndex = staticRouterSource.indexOf("name: 'systemOpsDbms'")
|
||||
if (dbmsRouteIndex === -1) {
|
||||
errors.push('staticRouter.ts must define the systemOpsDbms route')
|
||||
} else {
|
||||
const nextRouteIndex = staticRouterSource.indexOf('\n {', dbmsRouteIndex + 1)
|
||||
const routeBlock = staticRouterSource.slice(dbmsRouteIndex, nextRouteIndex === -1 ? undefined : nextRouteIndex)
|
||||
for (const path of expectedPaths) {
|
||||
if (!routeBlock.includes(`'${path}'`)) {
|
||||
errors.push(`systemOpsDbms route alias must include ${path}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const snippet of [
|
||||
'function isDbmsMenu',
|
||||
"if (isDbmsMenu(menu))",
|
||||
"return '/system-ops/dbms'",
|
||||
"menu.name = 'systemOpsDbms'",
|
||||
"menu.component = '@/views/system-ops/dbms/index.vue'"
|
||||
]) {
|
||||
if (!authStoreSource.includes(snippet)) {
|
||||
errors.push(`auth.ts must include DBMS menu normalization snippet: ${snippet}`)
|
||||
}
|
||||
}
|
||||
|
||||
if (errors.length) {
|
||||
console.error('dbms route contract failed:')
|
||||
for (const error of errors) console.error(`- ${error}`)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
console.log('dbms route contract passed')
|
||||
@@ -25,7 +25,16 @@ const COMPONENT_PATH_ALIASES: Record<string, string> = {
|
||||
'/steady/steady-trend': '/steady/steadyTrend',
|
||||
'/steady/steady-trend/index': '/steady/steadyTrend/index',
|
||||
'/steady/check-square': '/steady/checksquare',
|
||||
'/steady/check-square/index': '/steady/checksquare/index'
|
||||
'/steady/check-square/index': '/steady/checksquare/index',
|
||||
// 数据库监控菜单统一落到 system-ops/dbms 页面,兼容后端菜单常见 component 写法。
|
||||
'/systemMonitor/dbms': '/system-ops/dbms',
|
||||
'/systemMonitor/dbms/index': '/system-ops/dbms/index',
|
||||
'/systemMonitor/databaseMonitor': '/system-ops/dbms',
|
||||
'/systemMonitor/databaseMonitor/index': '/system-ops/dbms/index',
|
||||
'/systemMonitor/database-monitor': '/system-ops/dbms',
|
||||
'/systemMonitor/database-monitor/index': '/system-ops/dbms/index',
|
||||
'/system-ops/database-monitor': '/system-ops/dbms',
|
||||
'/system-ops/database-monitor/index': '/system-ops/dbms/index'
|
||||
}
|
||||
const STATIC_ROUTE_NAMES = new Set([
|
||||
'layout',
|
||||
@@ -42,6 +51,7 @@ const STATIC_ROUTE_NAMES = new Set([
|
||||
'checksquare',
|
||||
'systemMonitor',
|
||||
'diskMonitor',
|
||||
'systemOpsDbms',
|
||||
'403',
|
||||
'404',
|
||||
'500'
|
||||
|
||||
@@ -198,6 +198,25 @@ export const staticRouter: RouteRecordRaw[] = [
|
||||
title: '磁盘监控'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/system-ops/dbms',
|
||||
name: 'systemOpsDbms',
|
||||
alias: [
|
||||
'/systemMonitor/dbms',
|
||||
'/systemMonitor/dbms/index',
|
||||
'/systemMonitor/databaseMonitor',
|
||||
'/systemMonitor/databaseMonitor/index',
|
||||
'/systemMonitor/database-monitor',
|
||||
'/systemMonitor/database-monitor/index',
|
||||
'/system-ops/database-monitor',
|
||||
'/system-ops/database-monitor/index'
|
||||
],
|
||||
component: () => import('@/views/system-ops/dbms/index.vue'),
|
||||
meta: {
|
||||
cacheName: 'DbmsView',
|
||||
title: '数据库运维'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/:pathMatch(.*)*',
|
||||
component: () => import('@/components/ErrorMessage/404.vue')
|
||||
|
||||
Reference in New Issue
Block a user