修改路由

master
夜笙歌 9 months ago
parent 09cce23982
commit 4f3098b9c1

@ -5,6 +5,8 @@ Vue.use(Router)
/* Layout */
import Layout from '@/layout'
import BoardIndex from '@/layout/boardIndex'
import ModelIndex from '@/layout/modelIndex'
/**
* Note: 路由配置项
@ -87,7 +89,99 @@ export const constantRoutes = [
meta: {title: '个人中心', icon: 'user'}
}
]
}
},
{
path: '',
component: BoardIndex,
redirect: 'board',
meta: {
title: "看板管理",
icon: "chart",
},
children: [
{
path: 'Liner',
component: () => import('@/views/board/liner/index'),
name: 'Liner',
meta: {title: '内胆', icon: '404',}
},
{
path: 'caseShell2',
name: 'CaseShell2',
component: () => import('@/views/board/caseShell/index2'),
meta: {title: '箱壳前后板', icon: 'dashboard',}
},
{
path: 'foaming',
name: 'Foaming',
query: "{\"id\": 1}",
component: () => import('@/views/board/foaming/index'),
meta: {title: '一线箱体发泡', icon: 'dashboard',}
},
{
path: 'foaming3',
name: 'Foaming3',
query: "{\"id\": 2}",
component: () => import('@/views/board/foaming/index'),
meta: {title: '二线箱体发泡', icon: 'dashboard',}
},
{
path: 'foaming2',
name: 'Foaming2',
component: () => import('@/views/board/foaming/index2'),
meta: {title: '箱门匹配', icon: 'dashboard',}
},
{
path: 'pourInto',
name: 'PourInto',
component: () => import('@/views/board/pourInto/index'),
meta: {title: '总装工序', icon: 'dashboard',}
},
{
path: 'finalAssembly',
name: 'FinalAssembly',
component: () => import('@/views/board/finalAssembly/index'),
meta: {title: '总装', icon: 'dashboard',}
},
{
path: 'scanDown',
name: 'ScanDown',
query: "{\"id\": 1}",
component: () => import('@/views/board/scanDown/index'),
meta: {title: '一线成品入库', icon: 'dashboard',}
},
{
path: 'scanDown2',
name: 'ScanDown2',
query: "{\"id\": 2}",
component: () => import('@/views/board/scanDown/index'),
meta: {title: '二线成品入库', icon: 'dashboard',}
},
{
path: 'week',
name: 'Week',
component: () => import('@/views/board/week/index'),
meta: {title: '综合看板', icon: 'dashboard',}
},
]
},
{
path: 'model',
component: ModelIndex,
redirect: 'model',
meta: {
title: "参观大屏管理",
icon: "chart",
},
children: [
{
path: 'index',
component: () => import('@/views/model/model'),
name: 'index',
meta: {title: '模型', icon: '404',}
},
]
},
]
// 动态路由,基于用户权限动态去加载

@ -40,6 +40,8 @@ const permission = {
const rdata = JSON.parse(JSON.stringify(res.data))
const sidebarRoutes = filterAsyncRouter(sdata)
const rewriteRoutes = filterAsyncRouter(rdata, false, true)
console.log('sidebarRoutes',sidebarRoutes)
console.log('rewriteRoutes',rewriteRoutes)
const asyncRoutes = filterDynamicRoutes(dynamicRoutes);
rewriteRoutes.push({ path: '*', redirect: '/404', hidden: true })
router.addRoutes(asyncRoutes);
@ -56,7 +58,7 @@ const permission = {
// 遍历后台传来的路由字符串,转换为组件对象
function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) {
return asyncRouterMap.filter(route => {
let data = asyncRouterMap.filter(route => {
if (type && route.children) {
route.children = filterChildren(route.children)
}
@ -86,6 +88,8 @@ function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) {
}
return true
})
console.log('data',data)
return data
}
function filterChildren(childrenMap, lastRouter = false) {

@ -37,6 +37,7 @@ module.exports = {
[process.env.VUE_APP_BASE_API]: {
// target: `http://10.11.43.2:8080`,
target: `http://localhost:8080`,
// target: `http://localhost:6061`,
changeOrigin: true,
pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: ''

Loading…
Cancel
Save