zhangwei
3 天以前 51d0f634f6fe65d4718c5c0170f2e94e05ea787b
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
import { RouteRecordRaw } from 'vue-router';
 
/**
 * 建议:路由 path 路径与文件夹名称相同,找文件可浏览器地址找,方便定位文件位置
 *
 * 路由meta对象参数说明
 * meta: {
 *      title:          菜单栏及 tagsView 栏、菜单搜索名称(国际化)
 *      isLink:        是否超链接菜单,开启外链条件,`1、isLink: 链接地址不为空 2、isIframe:false`
 *      isHide:        是否隐藏此路由
 *      isKeepAlive:   是否缓存组件状态
 *      isAffix:       是否固定在 tagsView 栏上
 *      isIframe:      是否内嵌窗口,开启条件,`1、isIframe:true 2、isLink:链接地址不为空`
 *      roles:         当前路由权限标识,取角色管理。控制路由显示、隐藏。超级管理员:admin 普通角色:common
 *      icon:          菜单、tagsView 图标,阿里:加 `iconfont xxx`,fontawesome:加 `fa xxx`
 * }
 */
 
// 扩展 RouteMeta 接口
declare module 'vue-router' {
    interface RouteMeta {
        title?: string;
        isLink?: string;
        isHide?: boolean;
        isPublic?: boolean;
        isKeepAlive?: boolean;
        isAffix?: boolean;
        isIframe?: boolean;
        roles?: string[];
        icon?: string;
    }
}
 
/**
 * 定义动态路由
 * 前端添加路由,请在顶级节点的 `children 数组` 里添加
 * @description 未开启 isRequestRoutes 为 true 时使用(前端控制路由),开启时第一个顶级 children 的路由将被替换成接口请求回来的路由数据
 * @description 各字段请查看 `/@/views/system/menu/component/addMenu.vue 下的 ruleForm`
 * @returns 返回路由菜单数据
 */
export const dynamicRoutes: Array<RouteRecordRaw> = [
    {
        path: '/',
        name: '/',
        component: () => import('/@/layout/index.vue'),
        redirect: '/dashboard/home',
        meta: {
            isKeepAlive: true,
        },
        children: [],
    },
    {
        path: '/platform/job/dashboard',
        name: 'jobDashboard',
        component: () => import('/@/views/system/job/dashboard.vue'),
        meta: {
            title: '任务看板',
            isLink: window.__env__.VITE_API_URL + '/schedule',
            isHide: true,
            isKeepAlive: true,
            isAffix: false,
            isIframe: true,
            icon: 'ele-Clock',
        },
    },
    {
        path: '/develop/database/visual',
        name: 'databaseVisual',
        component: () => import('/@/views/system/database/component/visualTable.vue'),
        meta: {
            title: '库表可视化',
            isHide: true,
            isKeepAlive: true,
            isAffix: false,
            // isIframe: true,
            icon: 'ele-View',
        },
    },
];
 
/**
 * 定义404、401界面
 * @link 参考:https://next.router.vuejs.org/zh/guide/essentials/history-mode.html#netlify
 */
export const notFoundAndNoPower = [
    {
        path: '/:path(.*)*',
        name: 'notFound',
        component: () => import('/@/views/error/404.vue'),
        meta: {
            title: 'message.staticRoutes.notFound',
            isHide: true,
        },
    },
    {
        path: '/401',
        name: 'noPower',
        component: () => import('/@/views/error/401.vue'),
        meta: {
            title: 'message.staticRoutes.noPower',
            isHide: true,
        },
    },
];
 
/**
 * 定义静态路由(默认路由)
 * 此路由不要动,前端添加路由的话,请在 `dynamicRoutes 数组` 中添加
 * @description 前端控制直接改 dynamicRoutes 中的路由,后端控制不需要修改,请求接口路由数据时,会覆盖 dynamicRoutes 第一个顶级 children 的内容(全屏,不包含 layout 中的路由出口)
 * @returns 返回路由菜单数据
 */
export const staticRoutes: Array<RouteRecordRaw> = [
    {
        path: '/login',
        name: 'login',
        component: () => import('/@/views/login/index.vue'),
        meta: {
            title: '登录',
            isPublic: true,
        },
    },{
        path: '/$callTel',
        name: '$callTel',
        component: () => import('/@/components/callTel/index.vue'),
        meta: {
            title: '拨号',
            isPublic: true,
        },
    },
    /**
     * 提示:写在这里的为全屏界面,不建议写在这里
     * 请写在 `dynamicRoutes` 路由数组中
     */
    // {
    //     path: '/visualizingDemo1',
    //     name: 'visualizingDemo1',
    //     component: () => import('/@/views/visualizing/demo1.vue'),
    //     meta: {
    //         title: 'message.router.visualizingLinkDemo1',
    //     },
    // },
    // {
    //     path: '/visualizingDemo2',
    //     name: 'visualizingDemo2',
    //     component: () => import('/@/views/visualizing/demo2.vue'),
    //     meta: {
    //         title: 'message.router.visualizingLinkDemo2',
    //     },
    // },
];