| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- import type { Route } from '#/global'
- import type { RouteRecordRaw } from 'vue-router'
- import useSettingsStore from '@/store/modules/settings'
- import generatedRoutes from 'virtual:generated-pages'
- import { setupLayouts } from 'virtual:meta-layouts'
- import organizationManagement from './modules/organization'
- import personnel from './modules/personnel'
- // 固定路由(默认路由)
- const constantRoutes: RouteRecordRaw[] = [
- {
- path: '/login',
- name: 'login',
- component: () => import('@/views/login.vue'),
- meta: {
- title: '登录',
- },
- },
- {
- path: '/:all(.*)*',
- name: 'notFound',
- component: () => import('@/views/[...all].vue'),
- meta: {
- title: '找不到页面',
- },
- },
- ]
- // 系统路由
- const systemRoutes: RouteRecordRaw[] = [
- {
- path: '/',
- component: () => import('@/layouts/index.vue'),
- meta: {
- title: () => useSettingsStore().settings.home.title,
- breadcrumb: false,
- },
- children: [
- {
- path: '',
- component: () => import('@/views/index.vue'),
- meta: {
- title: () => useSettingsStore().settings.home.title,
- icon: 'i-ant-design:home-twotone',
- breadcrumb: false,
- },
- },
- {
- path: 'reload',
- name: 'reload',
- component: () => import('@/views/reload.vue'),
- meta: {
- title: '重新加载',
- breadcrumb: false,
- },
- },
- ],
- },
- ]
- // 动态路由(异步路由、导航栏路由)
- const asyncRoutes: Route.recordMainRaw[] = [
- {
- meta: {
- title: '组织架构',
- icon: 'i-uim:box',
- },
- children: [
- personnel
- ],
- },
- {
- meta: {
- title: '租户管理',
- icon: 'i-uim:box',
- },
- children: [
- organizationManagement
- ],
- },
- {
- meta: {
- title: '租户运营',
- icon: 'i-uim:box',
- },
- children: [
- ],
- },
- {
- meta: {
- title: '数据中心',
- icon: 'i-uim:box',
- },
- children: [
- ],
- },
- {
- meta: {
- title: '增值服务',
- icon: 'i-uim:box',
- },
- children: [
- ],
- },
- {
- meta: {
- title: '基础设置',
- icon: 'i-uim:box',
- },
- children: [
- ],
- },
- ]
- const constantRoutesByFilesystem = generatedRoutes.filter((item) => {
- return item.meta?.enabled !== false && item.meta?.constant === true
- })
- const asyncRoutesByFilesystem = setupLayouts(generatedRoutes.filter((item) => {
- return item.meta?.enabled !== false && item.meta?.constant !== true && item.meta?.layout !== false
- }))
- export {
- asyncRoutes,
- asyncRoutesByFilesystem,
- constantRoutes,
- constantRoutesByFilesystem,
- systemRoutes,
- }
|