数据库结构分类

This commit is contained in:
liaoboping 2025-09-28 11:12:29 +08:00
parent 8c8c548f70
commit 4aca5a138e
3 changed files with 92 additions and 26 deletions

View File

@ -10,13 +10,13 @@ const constantRouterComponents = {
BlankLayout: BlankLayout,
RouteView: RouteView,
PageView: PageView,
'403': () => import(/* webpackChunkName: "error" */ '@/views/exception/403'),
'404': () => import(/* webpackChunkName: "error" */ '@/views/exception/404'),
'500': () => import(/* webpackChunkName: "error" */ '@/views/exception/500'),
403: () => import(/* webpackChunkName: "error" */ '@/views/exception/403'),
404: () => import(/* webpackChunkName: "error" */ '@/views/exception/404'),
500: () => import(/* webpackChunkName: "error" */ '@/views/exception/500'),
// 你需要动态引入的页面组件
WorkplaceEquipment: () => import('@/views/dashboard/WorkplaceEquipment'),
Analysis: () => import('@/views/dashboard/Analysis')
Analysis: () => import('@/views/dashboard/Analysis'),
// 'TestWork': () => import(/* webpackChunkName: "TestWork" */ '@/views/dashboard/TestWork')
}
@ -24,7 +24,7 @@ const constantRouterComponents = {
const notFoundRouter = {
path: '*',
redirect: '/404',
hidden: true
hidden: true,
}
// 根级菜单
@ -36,9 +36,72 @@ const rootRouter = {
component: 'BasicLayout',
// redirect: '/dashboard/equipment',
meta: {
title: '首页'
title: '首页',
},
children: []
children: [],
}
const systemNav = {
id: '_67ed94a37b03415c8ee77a8991e79745',
title: '系统管理',
key: 'System',
name: '系统管理',
component: 'BasicLayout',
redirect: '/system/userlist',
parentId: '',
icon: 'dashboard',
children: [
{
id: '_1',
title: '菜单管理',
key: 'MenuList',
name: '菜单管理',
component: 'isystem/menuList',
redirect: null,
parentId: '67ed94a37b03415c8ee77a8991e79745',
icon: 'dashboard',
},
{
id: '_5114bf6a963f41149ab2435c86551927',
title: '用户管理',
key: 'UserList',
name: '用户管理',
component: 'isystem/userList',
redirect: null,
parentId: '67ed94a37b03415c8ee77a8991e79745',
icon: 'dashboard',
},
{
id: '_230a5ebe7cdc41acb997122d6de2d86f',
title: '角色管理',
key: 'RoleList',
name: '角色管理',
component: 'isystem/roleList',
redirect: null,
parentId: '67ed94a37b03415c8ee77a8991e79745',
icon: 'dashboard',
},
{
id: '_2fd1683b13c241be84c34185ff55028e',
title: '字典管理',
key: 'DictIndex',
name: '字典管理',
component: 'isystem/dict/dictlist',
redirect: null,
parentId: '67ed94a37b03415c8ee77a8991e79745',
icon: 'dashboard',
},
{
id: '_85924f8619f1451e847c9f69705f360f',
title: '系统日志',
key: 'LogList',
name: '系统日志',
component: 'isystem/logList',
redirect: null,
parentId: '67ed94a37b03415c8ee77a8991e79745',
icon: 'dashboard',
},
],
}
/**
@ -75,11 +138,11 @@ const rootRouter = {
// })
// })
// }
export const generatorDynamicRouter = token => {
export const generatorDynamicRouter = (token) => {
return new Promise((resolve, reject) => {
loginService
.getCurrentUserNav()
.then(res => {
.then((res) => {
console.log('generatorDynamicRouter response:', res)
const data = res.data
const childrenNav = []
@ -87,11 +150,14 @@ export const generatorDynamicRouter = token => {
// 后端数据, 根级树数组, 根级 PID
listToTree(data, childrenNav, '')
console.log('childrenNav', childrenNav)
if (process.env.NODE_ENV !== 'production') {
childrenNav.push(systemNav)
}
const routers = generator(childrenNav)
console.log('routers', routers)
resolve(routers)
})
.catch(err => {
.catch((err) => {
reject(err)
})
})
@ -104,8 +170,8 @@ export const generatorDynamicRouter = token => {
* @param parent
* @returns {*}
*/
export const generator = (routerMap, parent) => {
return routerMap.map(item => {
export const generator = (routerMap, parent) => {
return routerMap.map((item) => {
const { title, show, hideChildren, hiddenHeaderContent, target, icon } = item || item.meta || {}
const currentRouter = {
// 如果路由设置了 path则作为默认 path否则 路由地址 动态拼接生成如 /dashboard/workplace
@ -123,9 +189,9 @@ export const generatorDynamicRouter = token => {
title: title,
icon: icon || undefined,
hiddenHeaderContent: hiddenHeaderContent,
target: target
target: target,
// permission: item.name
}
},
}
// 是否设置了隐藏菜单
if (show === false) {
@ -157,13 +223,13 @@ export const generatorDynamicRouter = token => {
* @param parentId 父ID
*/
const listToTree = (list, tree, parentId) => {
list.forEach(item => {
list.forEach((item) => {
// 判断是否为父级菜单
if (item.parentId === parentId) {
const child = {
...item,
key: item.key || item.name,
children: []
children: [],
}
// 迭代 list 找到当前菜单相符合的所有子菜单
listToTree(list, child.children, item.id)

View File

@ -28,49 +28,49 @@ export default {
{
title: '作战力量数据库',
image: require('@/assets/images/simulation-scene/database/zzllsjk.png'),
path: '/databaseSystem/zzllsjk',
path: '/bzstlsjk/zzllsjk',
},
{
title: '保障力量数据库',
image: require('@/assets/images/simulation-scene/database/bzllsjk.png'),
path: '/databaseSystem/bzllsjk',
path: '/bzstlsjk/bzllsjk',
},
{
title: '保障环境数据库',
image: require('@/assets/images/simulation-scene/database/bzhjsjk.png'),
path: '/databaseSystem/bzhjsjk',
path: '/bzstlsjk/bzhjsjk',
},
{
title: '装备数据库',
image: require('@/assets/images/simulation-scene/database/bzhjsjk.png'),
path: '/databaseSystem/zbsjk',
path: '/bzstlsjk/zbsjk',
},
],
ywyylsjk: [
{
title: '想定数据库',
image: require('@/assets/images/simulation-scene/database/xdsjk.png'),
path: '/databaseSystem/xdsjk',
path: '/ywyylsjk/xdsjk',
},
{
title: '方案数据库',
image: require('@/assets/images/simulation-scene/database/fasjk.png'),
path: '/databaseSystem/fasjk',
path: '/ywyylsjk/fasjk',
},
{
title: '进程数据库',
image: require('@/assets/images/simulation-scene/database/jcsjk.png'),
path: '/databaseSystem/jcsjk',
path: '/ywyylsjk/jcsjk',
},
{
title: '图形数据库',
image: require('@/assets/images/simulation-scene/database/txsjk.png'),
path: '/databaseSystem/txsjk',
path: '/bzstlsjk/txsjk',
},
{
title: '运行记录数据库',
image: require('@/assets/images/simulation-scene/database/yxjlsjk.png'),
path: '/databaseSystem/yxjlsjk',
path: '/ywyylsjk/yxjlsjk',
},
],
}

View File

@ -42,7 +42,7 @@ export default {
moduleCode: 'db_system',
moduleName: '数据库子系统',
icon: require('@/assets/images/simulation-scene/system-icon/database.png'),
modulePath: '/databaseSystem/zzllsjk',
modulePath: '/bzstlsjk/zzllsjk',
},
{
moduleCode: 'simulation_system',