From be33034f6a0fdc0e6c78a6236f209886e54a3cf5 Mon Sep 17 00:00:00 2001 From: OrangeM21 Date: Mon, 11 May 2020 11:06:19 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"[update]=E4=BF=AE=E6=94=B9=E8=B7=AF?= =?UTF-8?q?=E7=94=B1=E5=BC=95=E7=94=A8"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit db47db40ebc144afe36c8ec0837b5120b8e14399. --- src/router/index.js | 170 +++++++++++++++++++++++++++++++- src/views/applications/index.js | 13 +-- src/views/assets/index.js | 12 +-- src/views/audits/index.js | 12 +-- src/views/jobcenter/index.js | 11 +-- src/views/perms/index.js | 13 +-- src/views/sessions/index.js | 12 +-- src/views/tickets/index.js | 10 +- src/views/users/index.js | 16 +-- 9 files changed, 177 insertions(+), 92 deletions(-) diff --git a/src/router/index.js b/src/router/index.js index 754d7b4a0..983c2217a 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -24,7 +24,14 @@ import Layout from '@/layout' activeMenu: '/example/list' if set path, the sidebar will highlight the path you set } */ -const requireContext = require.context('@/views/', true, /\.js$/) +import UsersRoute from '@/views/users' +import AssetsRoute from '@/views/assets' +import ApplicationsRoute from '@/views/applications' +import PermsRoute from '@/views/perms' +import SessionsRoute from '@/views/sessions' +import OpsRoutes from '@/views/jobcenter' +import TicketsRoutes from '@/views/tickets' +import AuditsRoutes from '@/views/audits' /** * constantRoutes @@ -52,6 +59,71 @@ export const constantRoutes = [ } ] }, + { + path: '/users', + component: Layout, + redirect: '/users/users/', + name: 'Users', + meta: { + title: 'Users', + icon: 'users' + }, + children: UsersRoute + }, + { + path: '/assets', + component: Layout, + redirect: '/assets/assets/', + name: 'assets', + meta: { title: 'Assets', icon: 'inbox' }, + children: AssetsRoute + }, + { + path: '/applications/', + component: Layout, + redirect: '/applications/remote-apps/', + name: 'applications', + meta: { title: 'Applications', icon: 'th' }, + children: ApplicationsRoute + }, + { + path: '/perms/', + component: Layout, + redirect: '/perms/asset-permissions/', + name: 'Perms', + meta: { title: 'Perms', icon: 'edit' }, + children: PermsRoute + }, + { + path: '/terminal/', + component: Layout, + redirect: '/terminal/session-online/', + name: 'Sessions', + meta: { title: 'Sessions', icon: 'rocket' }, + children: SessionsRoute + }, + { + path: '/ops/', + component: Layout, + redirect: '/ops/tasks/', + name: 'JobCenter', + meta: { title: 'JobCenter', icon: 'coffee' }, + children: OpsRoutes + }, + { + path: '/tickets/', + component: Layout, + redirect: '/tickets/tickets/', + children: TicketsRoutes + }, + { + path: '/audits/', + component: Layout, + redirect: '/audits/login-log/', + name: 'Audits', + meta: { title: 'Audits', icon: 'history' }, + children: AuditsRoutes + }, { path: '/settings', component: Layout, @@ -69,8 +141,7 @@ export const constantRoutes = [ name: 'CeleryTaskLog', hidden: true, meta: { title: 'CeleryTaskLog' } - }, - ...requireContext.keys().map(key => requireContext(key).default) + } ] /** @@ -79,6 +150,99 @@ export const constantRoutes = [ */ // 权限路由 export const asyncRoutes = [ + // { + // path: '/nested', + // component: Layout, + // redirect: '/nested/menu1', + // name: 'Nested', + // meta: { + // title: 'Nested', + // icon: 'nested' + // }, + // children: [ + // { + // path: 'menu1', + // component: () => import('@/views/nested/menu1/index'), // Parent router-view + // name: 'Menu1', + // meta: { title: 'Menu1' }, + // children: [ + // { + // path: 'menu1-1', + // component: () => import('@/views/nested/menu1/menu1-1'), + // name: 'Menu1-1', + // meta: { title: 'Menu1-1' } + // }, + // { + // path: 'menu1-2', + // component: () => import('@/views/nested/menu1/menu1-2'), + // name: 'Menu1-2', + // meta: { title: 'Menu1-2' }, + // children: [ + // { + // path: 'menu1-2-1', + // component: () => import('@/views/nested/menu1/menu1-2/menu1-2-1'), + // name: 'Menu1-2-1', + // meta: { title: 'Menu1-2-1' } + // }, + // { + // path: 'menu1-2-2', + // component: () => import('@/views/nested/menu1/menu1-2/menu1-2-2'), + // name: 'Menu1-2-2', + // meta: { title: 'Menu1-2-2' } + // } + // ] + // }, + // { + // path: 'menu1-3', + // component: () => import('@/views/nested/menu1/menu1-3'), + // name: 'Menu1-3', + // meta: { title: 'Menu1-3' } + // } + // ] + // }, + // { + // path: 'menu2', + // component: () => import('@/views/nested/menu2/index'), + // meta: { title: 'menu2' } + // } + // ] + // }, + // { + // path: '/users', + // component: Layout, + // redirect: '/users/list', + // name: 'Users', + // meta: { + // title: 'Users', + // icon: 'nested' + // }, + // children: [ + // { + // path: 'user/list', + // component: () => import('@/views/users/UserList.vue'), // Parent router-view + // name: 'UserList', + // meta: { title: 'List' } + // }, + // { + // path: 'user/:id', + // component: () => import('@/views/users/UserCreate.vue'), // Parent router-view + // name: 'UserEdit', + // meta: { title: 'Edit' }, + // hidden: true + // } + // ] + // }, + // { + // path: 'external-link', + // component: Layout, + // children: [ + // { + // path: 'https://panjiachen.github.io/vue-element-admin-site/#/', + // meta: { title: 'External Link', icon: 'link' } + // } + // ] + // }, + // 404 page must be placed at the end !!! { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/views/applications/index.js b/src/views/applications/index.js index 1687beb50..593a5c2ea 100644 --- a/src/views/applications/index.js +++ b/src/views/applications/index.js @@ -1,6 +1,4 @@ -import Layout from '@/layout' - -const ApplicationsRoute = [ +export default [ { path: 'remote-apps', name: 'RemoteAppList', @@ -20,12 +18,3 @@ const ApplicationsRoute = [ meta: { title: 'DatabaseApp' } } ] - -export default { - path: '/applications/', - component: Layout, - redirect: '/applications/remote-apps/', - name: 'applications', - meta: { title: 'Applications', icon: 'th' }, - children: ApplicationsRoute -} diff --git a/src/views/assets/index.js b/src/views/assets/index.js index 547c34eb6..c0a650441 100644 --- a/src/views/assets/index.js +++ b/src/views/assets/index.js @@ -1,6 +1,4 @@ -import Layout from '@/layout' - -const AssetsRoute = [ +export default [ { path: 'assets', name: 'AssetList', @@ -169,11 +167,3 @@ const AssetsRoute = [ meta: { title: 'PlatformList' } } ] -export default { - path: '/assets', - component: Layout, - redirect: '/assets/assets/', - name: 'assets', - meta: { title: 'Assets', icon: 'inbox' }, - children: AssetsRoute -} diff --git a/src/views/audits/index.js b/src/views/audits/index.js index f438b27cf..8617fdefd 100644 --- a/src/views/audits/index.js +++ b/src/views/audits/index.js @@ -1,5 +1,4 @@ -import Layout from '@/layout' -const AuditsRoutes = [ +export default [ { path: 'login-log', name: 'LoginLog', @@ -31,12 +30,3 @@ const AuditsRoutes = [ meta: { title: 'BatchCommand' } } ] - -export default { - path: '/audits/', - component: Layout, - redirect: '/audits/login-log/', - name: 'Audits', - meta: { title: 'Audits', icon: 'history' }, - children: AuditsRoutes -} diff --git a/src/views/jobcenter/index.js b/src/views/jobcenter/index.js index e07d936f3..3a203b84c 100644 --- a/src/views/jobcenter/index.js +++ b/src/views/jobcenter/index.js @@ -1,5 +1,4 @@ -import Layout from '@/layout' -const OpsRoutes = [ +export default [ { path: 'tasks', name: 'TaskList', @@ -34,11 +33,3 @@ const OpsRoutes = [ meta: { title: 'BatchCommand' } } ] -export default { - path: '/ops/', - component: Layout, - redirect: '/ops/tasks/', - name: 'JobCenter', - meta: { title: 'JobCenter', icon: 'coffee' }, - children: OpsRoutes -} diff --git a/src/views/perms/index.js b/src/views/perms/index.js index 8ebb9dc6a..8e58c3804 100644 --- a/src/views/perms/index.js +++ b/src/views/perms/index.js @@ -1,5 +1,5 @@ -import Layout from '@/layout' -const PermsRoute = [ + +export default [ { path: 'asset-permissions', name: 'AssetPermissionList', @@ -82,12 +82,3 @@ const PermsRoute = [ meta: { title: 'DatabaseAppPermissionDetail', activeMenu: '/perms/database-app-permissions' } } ] -export default { - path: '/perms/', - component: Layout, - redirect: '/perms/asset-permissions/', - name: 'Perms', - meta: { title: 'Perms', icon: 'edit' }, - children: PermsRoute -} - diff --git a/src/views/sessions/index.js b/src/views/sessions/index.js index bd09db530..3dd76daa2 100644 --- a/src/views/sessions/index.js +++ b/src/views/sessions/index.js @@ -1,5 +1,5 @@ -import Layout from '@/layout' -const SessionsRoute = [ + +export default [ { path: 'session-online', name: 'SessionOnlineList', @@ -92,11 +92,3 @@ const SessionsRoute = [ hidden: true } ] -export default { - path: '/terminal/', - component: Layout, - redirect: '/terminal/session-online/', - name: 'Sessions', - meta: { title: 'Sessions', icon: 'rocket' }, - children: SessionsRoute -} diff --git a/src/views/tickets/index.js b/src/views/tickets/index.js index 7173e8e3a..973681377 100644 --- a/src/views/tickets/index.js +++ b/src/views/tickets/index.js @@ -1,5 +1,4 @@ -import Layout from '@/layout' -const TicketsRoutes = [ +export default [ { path: 'tickets', name: 'TicketsList', @@ -7,10 +6,3 @@ const TicketsRoutes = [ meta: { title: 'Tickets', icon: 'check-square-o' } } ] -export default { - path: '/tickets/', - component: Layout, - redirect: '/tickets/tickets/', - children: TicketsRoutes -} - diff --git a/src/views/users/index.js b/src/views/users/index.js index a1c9de138..0088c7b93 100644 --- a/src/views/users/index.js +++ b/src/views/users/index.js @@ -1,5 +1,4 @@ -import Layout from '@/layout' -const UsersRoute = [ +export default [ { path: 'users', component: () => import('./users/UserList.vue'), // Parent router-view @@ -55,16 +54,3 @@ const UsersRoute = [ meta: { title: 'UserGroupDetail', activeMenu: '/users/groups' } } ] - -export default { - path: '/users', - component: Layout, - redirect: '/users/users/', - name: 'Users', - meta: { - title: 'Users', - icon: 'users' - }, - children: UsersRoute -} -