Blame view

HHECS.Web/src/router/index.js 9.64 KB
胡菁 authored
1
2
3
import Vue from "vue";
import Router from "vue-router";
import i18n from "@/i18n";
胡菁 authored
4
胡菁 authored
5
Vue.use(Router);
胡菁 authored
6
7

/* Layout */
胡菁 authored
8
import Layout from "@/layout";
胡菁 authored
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

/**
 * Note: sub-menu only appear when route children.length >= 1
 * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
 *
 * hidden: true                   if set true, item will not show in the sidebar(default is false)
 * alwaysShow: true               if set true, will always show the root menu
 *                                if not set alwaysShow, when item has more than one children route,
 *                                it will becomes nested mode, otherwise not show the root menu
 * redirect: noRedirect           if set noRedirect will no redirect in the breadcrumb
 * name:'router-name'             the name is used by <keep-alive> (must set!!!)
 * meta : {
    roles: ['admin','editor']    control the page roles (you can set multiple roles)
    title: 'title'               the name show in sidebar and breadcrumb (recommend set)
    icon: 'svg-name'/'el-icon-x' the icon show in the sidebar
    breadcrumb: false            if set false, the item will hidden in breadcrumb(default is true)
    activeMenu: '/example/list'  if set path, the sidebar will highlight the path you set
  }
 */

/**
 * constantRoutes
 * a base page that does not have permission requirements
 * all roles can be accessed
 */
export const constantRoutes = [
陈嘉新 authored
35
36
37
38
39
    {
        path: "/login",
        component: () => import("@/views/login/index"),
        hidden: true,
    },
40
陈嘉新 authored
41
42
43
44
45
    {
        path: "/404",
        component: () => import("@/views/404"),
        hidden: true,
    },
46
陈嘉新 authored
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
    {
        path: "/",
        component: Layout,
        redirect: "/mainPage",
        children: [
            {
                path: "mainPage",
                name: "mainPage",
                component: () => import("@/views/main/index"),
                meta: {
                    title: "system.mainPage",
                    icon: "el-icon-house",
                    affix: true,
                },
            },
        ],
    },
    {
陈嘉新 authored
65
        path: "/systemPermission/index",
陈嘉新 authored
66
        component: Layout,
陈嘉新 authored
67
        redirect: "/systemPermission",
陈嘉新 authored
68
        name: "权限管理",
胡菁 authored
69
        meta: {
陈嘉新 authored
70
71
            title: "权限管理",
            icon: "quanxian",
胡菁 authored
72
        },
陈嘉新 authored
73
74
75
        children: [
            {
                path: "role",
陈嘉新 authored
76
                component: () => import("@/views/systemPermission/permission/role"), // Parent router-view
陈嘉新 authored
77
78
79
80
81
                name: "role",
                meta: { title: "角色管理", icon: "juese" },
            },
            {
                path: "user",
陈嘉新 authored
82
                component: () => import("@/views/systemPermission/permission/user"),
陈嘉新 authored
83
84
85
86
                name: "user",
                meta: { title: "用户管理", icon: "yonghu" },
            },
        ],
87
88
    },
陈嘉新 authored
89
90
91
92
93
94
95
96
    {
        path: "/system/index",
        component: Layout,
        hidden: true,
        redirect: "noredirect",
        children: [
            {
                path: "system",
陈嘉新 authored
97
                component: (resolve) => require(["@/views/systemPermission/index"], resolve),
陈嘉新 authored
98
99
100
101
102
                name: "system",
                meta: { title: "授权", icon: "" },
            },
        ],
    },
103
陈嘉新 authored
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
    {
        path: "/example",
        component: Layout,
        redirect: "/example/taskManage",
        name: "任务管理",
        meta: { title: "任务管理", icon: "task" },
        children: [
            {
                path: "主任务",
                name: "主任务",
                component: () => import("@/views/taskManage/taskModel_host"),
                meta: { title: "主任务", icon: "main-task" },
            },
            {
                path: "堆垛机任务",
                name: "堆垛机任务",
                component: () => import("@/views/taskManage/taskModel_stacker"),
                meta: { title: "堆垛机任务", icon: "ddj-task" },
            },
            // {
            //     path: 'CRGV任务',
            //     name: 'CRGV任务',
            //     component: () => import('@/views/taskManage/taskModel_CRGV'),
            //     meta: { title: 'CRGV任务', icon: 'crgv-task' }
            // },
            // {
            //     path: 'RGV任务',
            //     name: 'RGV任务',
            //     component: () => import('@/views/taskManage/taskModel_RGV'),
            //     meta: { title: 'RGV任务', icon: 'rgv-task' }
            // }
        ],
    },
王硕 authored
137
陈嘉新 authored
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
    {
        path: "/systemManage",
        component: Layout,
        redirect: "/systemManage/dict",
        name: "系统管理",
        meta: { title: "系统管理", icon: "xitongshezhi" },
        children: [
            {
                path: "dict",
                name: "字典管理",
                component: () => import("@/views/systemManage/dict"),
                meta: { title: "字典管理", icon: "zidianguanli" },
            },
            {
                path: "config",
                name: "系统配置",
                component: () => import("@/views/systemManage/config"),
                meta: { title: "系统配置", icon: "xitongpeizhi" },
            },
            {
                path: "timer",
                name: "定时器",
                component: () => import("@/views/systemManage/timer"),
                meta: { title: "定时器", icon: "dingshiqi" },
            },
        ],
    },
    {
        path: "/basicData",
        component: Layout,
        redirect: "/basicData/warehouse",
        name: "基础数据",
        meta: { title: "基础数据", icon: "jichushuju" },
        children: [
            {
                path: "warehouse",
                name: "仓库管理",
                component: () => import("@/views/basicData/warehouse"),
                meta: { title: "仓库管理", icon: "cangkuguanli" },
            },
            {
                path: "location",
                name: "库位管理",
                component: () => import("@/views/basicData/location"),
                meta: { title: "库位管理", icon: "kuwei" },
            },
            {
                path: "container",
                name: "容器管理",
                component: () => import("@/views/basicData/container"),
                meta: { title: "容器管理", icon: "rongqi" },
            },
        ],
    },
    {
        path: "/logManage",
        component: Layout,
        children: [
            {
                path: "index",
                name: "日志管理",
                component: () => import("@/views/logManage/index"),
                meta: { title: "日志", icon: "form" },
            },
        ],
    },
陈嘉新 authored
204
205
206
207
208
209
210
211
212
213
214
    {
        path: '/map',
        component: Layout,
        redirect: '/mapSystem',
        children: [{
            path: 'mapSystem',
            name: 'mapSystem',
            component: () => import('@/views/map/mapSystem'),
            meta: { title: '图形管理', icon: 'el-icon-house', affix: true }
        }]
    },
陈嘉新 authored
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
    // {
    //   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'),
    //       name: 'Menu2',
    //       meta: { title: 'menu2' }
    //     }
    //   ]
    // },
273
陈嘉新 authored
274
275
276
277
278
279
280
281
282
283
    // {
    //   path: 'external-link',
    //   component: Layout,
    //   children: [
    //     {
    //       path: 'https://panjiachen.github.io/vue-element-admin-site/#/',
    //       meta: { title: 'External Link', icon: 'link' }
    //     }
    //   ]
    // },
284
陈嘉新 authored
285
286
    // 404 page must be placed at the end !!!
    { path: "*", redirect: "/404", hidden: true },
胡菁 authored
287
];
胡菁 authored
288
胡菁 authored
289
export const asyncRoutes = [];
胡菁 authored
290
291

const createRouter = () =>
陈嘉新 authored
292
293
294
295
296
    new Router({
        // mode: 'history', // require service support
        scrollBehavior: () => ({ y: 0 }),
        routes: constantRoutes,
    });
胡菁 authored
297
胡菁 authored
298
const router = createRouter();
胡菁 authored
299
300

// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
陈嘉新 authored
301
302
303
export function resetRouter () {
    const newRouter = createRouter();
    router.matcher = newRouter.matcher; // reset router
胡菁 authored
304
305
}
胡菁 authored
306
export default router;