routes.ts
3.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
import { setupLayouts } from 'virtual:meta-layouts'
import generatedRoutes from 'virtual:generated-pages'
import type { RouteRecordRaw } from 'vue-router'
import DataAssess from './modules/dataAsset';
import DataMeta from './modules/dataMeta';
import DataQuality from './modules/dataQuality';
import DataInventory from './modules/dataInventory';
import type { Route } from '#/global'
import useSettingsStore from '@/store/modules/settings'
/** 路由配置的meta信息接口注释。 */
interface metaInfoRaw {
// 是否使用keepAlive缓存,大部分页面都要用。
cache: boolean;
/** 若是菜单第一级节点需要配置false,下级节点,不需要配置,默认为true. */
sidebar: boolean;
/** 是否是编辑页面,若是编辑页面,则叉掉,会提示当前修改尚未保存,是否确认关闭。 */
editPage: boolean;
/** 有些页面,需要根据不同的参数即fullPath来判断是否缓存,如详情页面,查看日志信息等,需要配置为true。 */
reuse: boolean;
}
// 固定路由(默认路由)
const constantRoutes: RouteRecordRaw[] = [
{
path: '/login',
name: 'login',
component: () => import('@/views/login.vue'),
meta: {
title: '登录',
},
},
{
path: '/register',
name: 'register',
component: () => import('@/views/register.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: 'login',
// name: 'login',
// component: () => import('@/views/login.vue'),
// meta: {
// title: () => useSettingsStore().settings.home.title,
// breadcrumb: false,
// },
// },
{
path: 'reload',
name: 'reload',
component: () => import('@/views/reload.vue'),
meta: {
title: '重新加载',
breadcrumb: false,
},
},
{
path: 'setting',
name: 'personalSetting',
component: () => import('@/views/personal/setting.vue'),
meta: {
title: '个人设置',
cache: 'personalEditPassword',
},
},
{
path: 'edit/password',
name: 'personalEditPassword',
component: () => import('@/views/personal/edit.password.vue'),
meta: {
title: '修改密码',
},
},
],
},
]
// 动态路由(异步路由、导航栏路由)
const asyncRoutes: Route.recordMainRaw[] = [
{
meta:{
title: '首页',
},
children: [
],
},
{
meta: {
title: '数据资产管理',
},
children: [
...DataAssess,
],
},
{
meta: {
title: '元数据',
},
children: [
...DataMeta,
],
},
{
meta: {
title: '数据质量',
},
children: [
...DataQuality,
],
}, {
meta: {
title: '数据盘点',
},
children: [
...DataInventory,
],
},
]
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 {
constantRoutes,
systemRoutes,
asyncRoutes,
constantRoutesByFilesystem,
asyncRoutesByFilesystem,
}