yinq 11 months ago
commit f34b421c77

@ -5,6 +5,8 @@ Vue.use(Router)
/* Layout */ /* Layout */
import Layout from '@/layout' import Layout from '@/layout'
import BoardIndex from '@/layout/boardIndex'
import ModelIndex from '@/layout/modelIndex'
/** /**
* Note: 路由配置项 * Note: 路由配置项
@ -70,7 +72,7 @@ export const constantRoutes = [
path: 'index', path: 'index',
component: () => import('@/views/index_v1'), component: () => import('@/views/index_v1'),
name: 'Index', name: 'Index',
meta: { title: '首页', icon: 'dashboard', affix: true } meta: {title: '首页', icon: 'dashboard', affix: true}
} }
] ]
}, },
@ -84,10 +86,102 @@ export const constantRoutes = [
path: 'profile', path: 'profile',
component: () => import('@/views/system/user/profile/index'), component: () => import('@/views/system/user/profile/index'),
name: 'Profile', name: 'Profile',
meta: { title: '个人中心', icon: 'user' } 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',}
},
]
},
] ]
// 动态路由,基于用户权限动态去加载 // 动态路由,基于用户权限动态去加载
@ -102,7 +196,7 @@ export const dynamicRoutes = [
path: 'role/:userId(\\d+)', path: 'role/:userId(\\d+)',
component: () => import('@/views/system/user/authRole'), component: () => import('@/views/system/user/authRole'),
name: 'AuthRole', name: 'AuthRole',
meta: { title: '分配角色', activeMenu: '/system/user' } meta: {title: '分配角色', activeMenu: '/system/user'}
} }
] ]
}, },
@ -116,7 +210,7 @@ export const dynamicRoutes = [
path: 'user/:roleId(\\d+)', path: 'user/:roleId(\\d+)',
component: () => import('@/views/system/role/authUser'), component: () => import('@/views/system/role/authUser'),
name: 'AuthUser', name: 'AuthUser',
meta: { title: '分配用户', activeMenu: '/system/role' } meta: {title: '分配用户', activeMenu: '/system/role'}
} }
] ]
}, },
@ -130,7 +224,7 @@ export const dynamicRoutes = [
path: 'index/:dictId(\\d+)', path: 'index/:dictId(\\d+)',
component: () => import('@/views/system/dict/data'), component: () => import('@/views/system/dict/data'),
name: 'Data', name: 'Data',
meta: { title: '字典数据', activeMenu: '/system/dict' } meta: {title: '字典数据', activeMenu: '/system/dict'}
} }
] ]
}, },
@ -144,7 +238,7 @@ export const dynamicRoutes = [
path: 'index/:jobId(\\d+)', path: 'index/:jobId(\\d+)',
component: () => import('@/views/monitor/job/log'), component: () => import('@/views/monitor/job/log'),
name: 'JobLog', name: 'JobLog',
meta: { title: '调度日志', activeMenu: '/monitor/job' } meta: {title: '调度日志', activeMenu: '/monitor/job'}
} }
] ]
}, },
@ -158,7 +252,7 @@ export const dynamicRoutes = [
path: 'index/:tableId(\\d+)', path: 'index/:tableId(\\d+)',
component: () => import('@/views/tool/gen/editTable'), component: () => import('@/views/tool/gen/editTable'),
name: 'GenEdit', name: 'GenEdit',
meta: { title: '修改生成配置', activeMenu: '/tool/gen' } meta: {title: '修改生成配置', activeMenu: '/tool/gen'}
} }
] ]
}, },
@ -172,7 +266,7 @@ export const dynamicRoutes = [
path: "index/:materialCode(\\d+)", path: "index/:materialCode(\\d+)",
component: () => import("@/views/production/baseBomInfo/childBom"), component: () => import("@/views/production/baseBomInfo/childBom"),
name: "childBom", name: "childBom",
meta: { title: "查看生产子BOM信息", activeMenu: "/production/baseBomInfo" }, meta: {title: "查看生产子BOM信息", activeMenu: "/production/baseBomInfo"},
}, },
], ],
}, },
@ -186,7 +280,7 @@ export const dynamicRoutes = [
path: "index/:materialCode(\\d+)", path: "index/:materialCode(\\d+)",
component: () => import("@/views/base/orderBomInfo/childIndex"), component: () => import("@/views/base/orderBomInfo/childIndex"),
name: "childBom", name: "childBom",
meta: { title: "查看订单子BOM信息", activeMenu: "/base/orderBomInfo" }, meta: {title: "查看订单子BOM信息", activeMenu: "/base/orderBomInfo"},
}, },
], ],
}, },
@ -197,10 +291,10 @@ export const dynamicRoutes = [
permissions: ["base:qualityInspectionItem:list"], permissions: ["base:qualityInspectionItem:list"],
children: [ children: [
{ {
path:"index/:parentId(\\d+)", path: "index/:parentId(\\d+)",
component:() => import("@/views/base/qualityInspectionItem/childIndex"), component: () => import("@/views/base/qualityInspectionItem/childIndex"),
name:"childQuality", name: "childQuality",
meta: {title: "质检项缺陷信息",activeMenu: "/base/qualityInspectionItem"}, meta: {title: "质检项缺陷信息", activeMenu: "/base/qualityInspectionItem"},
}, },
], ],
}, },
@ -211,10 +305,10 @@ export const dynamicRoutes = [
permissions: ["base:productLine:list"], permissions: ["base:productLine:list"],
children: [ children: [
{ {
path:"index/:productLineCode", path: "index/:productLineCode",
component:() => import("@/views/base/productStation/index"), component: () => import("@/views/base/productStation/index"),
name:"childStation", name: "childStation",
meta: {title: "工位信息",activeMenu: "/base/productStation"}, meta: {title: "工位信息", activeMenu: "/base/productStation"},
}, },
], ],
}, },
@ -225,10 +319,10 @@ export const dynamicRoutes = [
permissions: ["base:processStation:list"], permissions: ["base:processStation:list"],
children: [ children: [
{ {
path:"index/:processCode", path: "index/:processCode",
component:() => import("@/views/base/productStation/index"), component: () => import("@/views/base/productStation/index"),
name:"childStation", name: "childStation",
meta: {title: "工位信息",activeMenu: "/base/productStation"}, meta: {title: "工位信息", activeMenu: "/base/productStation"},
}, },
], ],
}, },
@ -239,10 +333,10 @@ export const dynamicRoutes = [
permissions: ["base:storeInfo:list"], permissions: ["base:storeInfo:list"],
children: [ children: [
{ {
path:"index/:storeCode", path: "index/:storeCode",
component:() => import("@/views/base/spaceInfo/index"), component: () => import("@/views/base/spaceInfo/index"),
name:"childSpaceInfo", name: "childSpaceInfo",
meta: {title: "货道信息",activeMenu: "/base/spaceInfo"}, meta: {title: "货道信息", activeMenu: "/base/spaceInfo"},
}, },
], ],
}, },
@ -253,10 +347,10 @@ export const dynamicRoutes = [
permissions: ["base:storeInfo:list"], permissions: ["base:storeInfo:list"],
children: [ children: [
{ {
path:"index/:storeCode", path: "index/:storeCode",
component:() => import("@/views/report/inventoryStatistics/index"), component: () => import("@/views/report/inventoryStatistics/index"),
name:"inventoryStatistics", name: "inventoryStatistics",
meta: {title: "库存统计",activeMenu: "/report/inventoryStatistics"}, meta: {title: "库存统计", activeMenu: "/report/inventoryStatistics"},
}, },
], ],
}, },
@ -267,10 +361,10 @@ export const dynamicRoutes = [
permissions: ["base:processStation:list"], permissions: ["base:processStation:list"],
children: [ children: [
{ {
path:"index/:productLineCode", path: "index/:productLineCode",
component:() => import("@/views/base/processStation/index"), component: () => import("@/views/base/processStation/index"),
name:"SubordinateWorkers", name: "SubordinateWorkers",
meta: {title: "工序信息",activeMenu: "/base/processStation"}, meta: {title: "工序信息", activeMenu: "/base/processStation"},
}, },
], ],
}, },
@ -290,6 +384,6 @@ Router.prototype.replace = function push(location) {
export default new Router({ export default new Router({
mode: 'history', // 去掉url中的# mode: 'history', // 去掉url中的#
scrollBehavior: () => ({ y: 0 }), scrollBehavior: () => ({y: 0}),
routes: constantRoutes routes: constantRoutes
}) })

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

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

Loading…
Cancel
Save