feat(auth): 优化权限模块菜单数据处理逻辑
- 添加showMenuList、flatMenuList和breadcrumbList状态字段 - 修改getter方法直接返回缓存的状态数据 - 新增refreshDerivedMenus方法统一处理菜单衍生数据计算 - 在重置授权存储时清理新增的菜单相关状态 - 避免每次路由跳转时重复深拷贝整个菜单树结构 feat(checksquare): 完善校验功能组件和业务逻辑 - 新增测量点对话框组件用于显示监测点详细信息 - 添加校验台账工具函数解析测量点详情 - 实现任务表格删除功能包括确认提示和数据刷新 - 更新任务表格将缺失率字段替换为数据完整性字段 - 重构详情面板使用标签页展示不同类型的校验详情 - 优化摘要表格样式包括紧凑布局和危险颜色标识 - 统一详情对话框尺寸样式保持界面一致性 - 实现数据完整性字段的百分比单位去除处理 refactor(influxdb): 简化数据库启动流程移除命令行包装器 - 直接通过influxd.exe启动InfluxDB服务 - 移除对cmd.exe包装器的依赖和进程ID记录 - 保持进程管理和停止功能的完整性
This commit is contained in:
@@ -89,12 +89,6 @@ router.beforeEach(async (to, from, next) => {
|
||||
}
|
||||
}
|
||||
|
||||
syncHomeStateWithMenus()
|
||||
logRouterPerf('before-each-menu-sync', guardStart, {
|
||||
path: to.path,
|
||||
from: from.path,
|
||||
hasActivateInfo: authStore.activateInfoLoadedGet
|
||||
})
|
||||
await authStore.setRouteName(to.name as string)
|
||||
|
||||
if (!authStore.activateInfoLoadedGet) {
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import { fileURLToPath } from 'url'
|
||||
|
||||
const currentDir = path.dirname(fileURLToPath(import.meta.url))
|
||||
const srcRoot = path.resolve(currentDir, '../..')
|
||||
|
||||
const files = {
|
||||
router: path.resolve(srcRoot, 'routers/index.ts'),
|
||||
authStore: path.resolve(srcRoot, 'stores/modules/auth.ts'),
|
||||
utils: path.resolve(srcRoot, 'utils/index.ts')
|
||||
}
|
||||
|
||||
const read = file => fs.readFileSync(file, 'utf8')
|
||||
|
||||
const routerSource = read(files.router)
|
||||
const authStoreSource = read(files.authStore)
|
||||
const utilsSource = read(files.utils)
|
||||
|
||||
const expectations = [
|
||||
{
|
||||
name: 'auth store owns cached flat/show/breadcrumb menu state',
|
||||
pass:
|
||||
/flatMenuList:\s*\[\]/.test(authStoreSource) &&
|
||||
/showMenuList:\s*\[\]/.test(authStoreSource) &&
|
||||
/breadcrumbList:\s*\{\}/.test(authStoreSource)
|
||||
},
|
||||
{
|
||||
name: 'auth store refreshes derived menus when auth menu list changes',
|
||||
pass: /refreshDerivedMenus\(\)/.test(authStoreSource) && /this\.refreshDerivedMenus\(\)/.test(authStoreSource)
|
||||
},
|
||||
{
|
||||
name: 'menu derivation helpers avoid JSON stringify deep clone',
|
||||
pass:
|
||||
!/getFlatMenuList[\s\S]*JSON\.parse\(JSON\.stringify/.test(utilsSource) &&
|
||||
!/getShowMenuList[\s\S]*JSON\.parse\(JSON\.stringify/.test(utilsSource)
|
||||
},
|
||||
{
|
||||
name: 'router beforeEach does not sync home state on every navigation',
|
||||
pass: !/before-each-menu-sync/.test(routerSource)
|
||||
},
|
||||
{
|
||||
name: 'router syncs home state after dynamic menu initialization',
|
||||
pass: /syncHomeStateWithMenus\(\)/.test(routerSource) && /first-sync-home-state/.test(routerSource)
|
||||
}
|
||||
]
|
||||
|
||||
const failures = expectations.filter(item => !item.pass)
|
||||
|
||||
if (failures.length) {
|
||||
console.error('Menu navigation performance contract failed:')
|
||||
failures.forEach(item => console.error(`- ${item.name}`))
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
console.log('Menu navigation performance contract passed')
|
||||
@@ -63,6 +63,16 @@ export const staticRouter: RouteRecordRaw[] = [
|
||||
title: 'MMS 映射'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/tools/mmsMapping/deviceTypes',
|
||||
name: 'toolMmsMappingDeviceTypes',
|
||||
alias: ['/tools/mmsmapping/deviceTypes', '/tools/mms-mapping/device-types'],
|
||||
component: () => import('@/views/tools/mmsMapping/deviceTypes/index.vue'),
|
||||
meta: {
|
||||
cacheName: 'MmsDeviceTypesView',
|
||||
title: '设备类型校验'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/tools/addData',
|
||||
name: 'toolAddData',
|
||||
|
||||
Reference in New Issue
Block a user