表格优化

This commit is contained in:
仲么了
2023-12-27 10:39:40 +08:00
parent e1299a5520
commit d42936398e
6 changed files with 232 additions and 61 deletions

View File

@@ -50,11 +50,103 @@ const init = () => {
/**
* 后台初始化请求,获取站点配置,动态路由等信息
*/
const arr = [
{
id: 1,
pid: 0,
type: 'menu',
title: '控制台',
name: 'dashboard',
path: 'dashboard',
icon: 'fa fa-dashboard',
menu_type: 'tab',
url: '',
component: '/src/views/dashboard/index.vue',
keepalive: 'dashboard',
extend: 'none',
children: [
{
id: 94,
pid: 1,
type: 'button',
title: '查看',
name: 'dashboard/index',
path: '',
icon: '',
menu_type: null,
url: '',
component: '',
keepalive: 0,
extend: 'none'
}
]
},
{
id: 3,
pid: 0,
type: 'menu',
title: '测试1',
name: 'test',
path: 'test',
icon: 'fa fa-dashboard',
menu_type: 'tab',
url: '',
component: '/src/views/dashboard/test.vue',
keepalive: 'test',
extend: 'none'
},
{
id: 2,
pid: 0,
type: 'menu_dir',
title: '权限管理',
name: 'auth',
path: 'auth',
icon: 'fa fa-group',
menu_type: null,
url: '',
component: '',
keepalive: 0,
extend: 'none',
children: [
{
id: 3,
pid: 2,
type: 'menu',
title: '角色管理',
name: 'auth/role',
path: 'auth/role',
icon: 'fa fa-group',
menu_type: 'tab',
url: '',
component: '/src/views/auth/role.vue',
keepalive: 'auth/role',
extend: 'none',
children: []
},
{
id: 13,
pid: 2,
type: 'menu',
title: '菜单规则管理',
name: 'auth/menu',
path: 'auth/menu',
icon: 'el-icon-Grid',
menu_type: 'tab',
url: '',
component: '/src/views/auth/menu/index.vue',
keepalive: 'auth/menu',
extend: 'none',
children: []
}
]
}
]
getRouteMenu().then((res: any) => {
const handlerMenu = (data: any) => {
data.forEach((item: any) => {
item.path = item.routeName || item.title
item.name = item.routeName || item.title
item.name = item.title
item.component = '/src/views/dashboard/index.vue'
item.type = item.children && item.children.length > 0 ? 'menu_dir' : 'menu'
item.menu_type = item.children && item.children.length > 0 ? null : 'tab'
@@ -64,7 +156,7 @@ const init = () => {
})
}
handlerMenu(res.data)
handleAdminRoute(res.data)
handleAdminRoute([...arr, ...res.data])
// 预跳转到上次路径
if (route.params.to) {