Commit 9019a882 authored by 李苏's avatar 李苏 💬

修改common引用方式

parent 76d11a74
...@@ -6,6 +6,9 @@ import ParentView from '@/components/ParentView' ...@@ -6,6 +6,9 @@ import ParentView from '@/components/ParentView'
import InnerLink from '@/layout/components/InnerLink' import InnerLink from '@/layout/components/InnerLink'
import views from 'common' import views from 'common'
import vue from 'vue' import vue from 'vue'
import commonList from "common/src/commonList"
/* 引入common */
const permission = { const permission = {
state: { state: {
...@@ -90,23 +93,10 @@ const permission = { ...@@ -90,23 +93,10 @@ const permission = {
newData.forEach(x => x.children && (x.children = filter(x.children))) newData.forEach(x => x.children && (x.children = filter(x.children)))
return newData return newData
} }
let newPowerRoutes=filter(powerRoutes) let newPowerRoutes=filter(powerRoutes)
console.log(newPowerRoutes,'icon') let newCommonList=filter(commonList.list)
/* 转化菜单格式*/ /* 转化菜单格式*/
let delArr=[] let delArr=[]
menus.forEach((item,index)=>{
let routeInfo=routing(item.mkid)
routeInfo.menusBizType=item.menusBizType||false
if(routeInfo&&routeInfo.meta){
routeInfo.meta.url=menus[index].url
routeInfo.meta.icon=menus[index].icon||''
}
menus[index]={...menus[index],...routeInfo}
if(menus[index].component==undefined){
menus[index]={}
}
})
let newmenus=[] let newmenus=[]
menus.forEach((mi,i)=>{ menus.forEach((mi,i)=>{
let length= Object.keys(mi) let length= Object.keys(mi)
...@@ -115,7 +105,7 @@ const permission = { ...@@ -115,7 +105,7 @@ const permission = {
} }
}) })
res.data=[...dgmk(newmenus,0),...newPowerRoutes] res.data=[...newCommonList,...newPowerRoutes]
const sdata = JSON.parse(JSON.stringify(res.data)) const sdata = JSON.parse(JSON.stringify(res.data))
const rdata = JSON.parse(JSON.stringify(res.data)) const rdata = JSON.parse(JSON.stringify(res.data))
const sidebarRoutes = filterAsyncRouter(sdata) const sidebarRoutes = filterAsyncRouter(sdata)
...@@ -153,8 +143,9 @@ function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) { ...@@ -153,8 +143,9 @@ function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) {
route.component = InnerLink route.component = InnerLink
} else { } else {
if(route.commonComponent){ if(route.commonComponent){
let a=views[route.commonComponent]
route.component=views[route.commonComponent] route.component = loadCommonView(route.component)
console.log( route)
}else{ }else{
route.component = loadView(route.component) route.component = loadView(route.component)
} }
...@@ -184,570 +175,7 @@ function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) { ...@@ -184,570 +175,7 @@ function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) {
return outarr return outarr
} }
function routing(mkid){
let componentInfo={}
if(mkid=="101001300"){
componentInfo={
commonComponent:'appVersion',
component: "system/appVersion/index",
hidden:false,
meta:{
"title": "移动端版本",
"icon": "user",
"noCache": false,
"link": null,
"mkid":101001300,
},
name:'AppVersion',
path:"appVersion"
}
}
/* 工作任务*/
else if(mkid=='120130000'){
componentInfo={
commonComponent:'workTask',
component: "development/workTask/index",
hidden:false,
meta:{
"title": "工作任务",
"icon": "user",
"noCache": false,
"link": null,
"mkid":120130000,
},
name:'workTask',
path:"workTask"
}
}
else if(mkid=='120140000'){
componentInfo={
commonComponent:'taskLog',
component: "development/taskLog/index",
hidden:false,
meta:{
"title": "任务日志",
"icon": "user",
"noCache": false,
"link": null,
"mkid":120140000,
},
name:'taskLog',
path:"taskLog"
}
}
else if(mkid=='101000200'){
componentInfo={
commonComponent:'roleManagement',
component: "system/roleManagement/index",
hidden:false,
meta:{
"title": "角色管理",
"icon": "user",
"noCache": false,
"link": null,
"mkid":101000200,
},
name:'roleManagement',
path:"roleManagement"
}
}
/* 应用组件注册*/
else if(mkid=='101000900'){
componentInfo={
commonComponent:'appComponents',
component: "system/appComponents/index",
hidden:false,
meta:{
"title": "应用组件",
"icon": "user",
"noCache": false,
"link": null,
"mkid":101000900,
},
name:'appComponents',
path:"appComponents"
}
}
else if(mkid=='101000100'){
componentInfo={
commonComponent:'userManagement',
component: "system/userManagement/index",
hidden:false,
meta:{
"title": "用户管理",
"icon": "user",
"noCache": false,
"link": null,
"mkid":101000100,
},
name:'userManagement',
path:"userManagement"
}
}
else if(mkid=='101000300'){
componentInfo={
commonComponent:'departmentManagement',
component: "system/departmentManagement/index",
hidden:false,
meta:{
"title": "部门维护",
"icon": "user",
"noCache": false,
"link": null,
"mkid":101000300,
},
name:'departmentManagement',
path:"departmentManagement"
}
}
else if(mkid=='101000400'){
componentInfo={
commonComponent:'parameterSetting',
component: "system/parameterSetting/index",
hidden:false,
meta:{
"title": "参数设置",
"icon": "user",
"noCache": false,
"link": null,
"mkid":101000400,
},
name:'parameterSetting',
path:"parameterSetting"
}
}
else if(mkid=='101000800'){
componentInfo={
commonComponent:'menuManage',
component: "system/menuManage/index",
hidden:false,
meta:{
"title": "菜单管理",
"icon": "user",
"noCache": false,
"link": null,
"mkid":101000800,
},
name:'menuManage',
path:"menuManage"
}
}
else if(mkid=='101000820'){
componentInfo={
commonComponent:'appmenuManage',
component: "system/appmenuManage/index",
hidden:false,
meta:{
"title": "APP菜单管理",
"icon": "user",
"noCache": false,
"link": null,
"mkid":101000820,
},
name:'appmenuManage',
path:"appmenuManage"
}
}
else if(mkid=='101009800'){
componentInfo={
commonComponent:'cache',
component: "system/cache/index",
hidden:false,
meta:{
"title": "缓存",
"icon": "user",
"noCache": false,
"link": null,
"mkid":101009800,
},
name:'cache',
path:"cache"
}
}
/* 系统注册*/
else if(mkid=='101001200'){
componentInfo={
commonComponent:'registration',
component: "system/registration/index",
hidden:false,
meta:{
"title": "系统注册",
"icon": "user",
"noCache": false,
"link": null,
"mkid":101001200,
},
name:'registration',
path:"registration"
}
}
else if(mkid=='101001000'){
componentInfo={
commonComponent:'moduleManage',
component: "system/moduleManage/index",
hidden:false,
meta:{
"title": "模块管理",
"icon": "user",
"noCache": false,
"link": null,
"mkid":101001000,
},
name:'moduleManage',
path:"moduleManage"
}
}
/* 菜单管理*/
else if(mkid=='101000500'){
componentInfo={
commonComponent:'auxiliaryInput',
component: "system/auxiliaryInput/index",
hidden:false,
meta:{
"title": "辅助输入",
"icon": "user",
"noCache": false,
"link": null,
"mkid":101000300,
},
name:'auxiliaryInput',
path:"auxiliaryInput"
}
}
/* 打印模板*/
else if(mkid=='101000700'){
componentInfo={
commonComponent:'printTemplate',
component: "system/printTemplate/index",
hidden:false,
meta:{
"title": "打印模板",
"icon": "user",
"noCache": false,
"link": null,
"mkid":101000700,
},
name:'printTemplate',
path:"printTemplate"
}
}
else if(mkid=='101000000'){
componentInfo={
component: "Layout",
alwaysShow: true,
hidden: false,
name: "System",
path: "/system",
redirect: "noRedirect",
meta: {title: "系统管理", icon: "system", noCache: false, link: null,mkid:101000000}
}
}
/* 我的事务*/
else if(mkid=='105002100'){
componentInfo={
commonComponent:'mytodo',
component: "workflow/mytodo/index",
hidden:false,
meta:{
"title": "我的待办",
"icon": "user",
"noCache": false,
"link": null,
"mkid":105002100,
},
name:'mytodo',
path:"mytodo"
}
}
else if(mkid=='105000900'){
componentInfo={
commonComponent:'todoItems',
component: "workflow/todoItems/index",
hidden:false,
meta:{
"title": "查询待办事务",
"icon": "user",
"noCache": false,
"link": null,
"mkid":105000900,
},
name:'todoItems',
path:"todoItems"
}
}
else if(mkid=='105000100'){
componentInfo={
commonComponent:'workflowDefinition',
component: "workflow/workflowDefinition/index",
hidden:false,
meta:{
"title": "工作流定义",
"icon": "user",
"noCache": false,
"link": null,
"mkid":105000100,
},
name:'workflowDefinition',
path:"workflowDefinition"
}
}
/* 工作流程*/
else if(mkid=='105000000'){
componentInfo={
component: "Layout",
alwaysShow: true,
hidden: false,
name: "workflow",
path: "/workflow",
redirect: "noRedirect",
meta: {title: "工作流", icon: "system", noCache: false, link: null,mkid:105000000}
}
}
else if(mkid=='120100601'){
componentInfo={
commonComponent:'dataTableIndex',
component: "system/parameterSetting/dataTableIndex/index",
hidden:false,
meta:{
"title": "数据表索引",
"noCache": false,
"link": null,
"mkid":120100601,
},
name:'dataTableIndex',
path:"dataTableIndex"
}
}
else if(mkid=='120100501'){
componentInfo={
commonComponent:'triggerVersion',
component: "system/parameterSetting/triggerVersion/index",
hidden:false,
meta:{
"title": "N触发器版本",
"noCache": false,
"link": null,
"mkid":120100501,
},
name:'triggerVersion',
path:"triggerVersion"
}
}
else if(mkid=='120100401'){
componentInfo={
commonComponent:'trigger',
component: "system/parameterSetting/trigger/index",
hidden:false,
meta:{
"title": "触发器",
"noCache": false,
"link": null,
"mkid":120100401,
},
name:'trigger',
path:"trigger"
}
}
/* 120100201 数据表版本*/
else if(mkid=='120100201'){
componentInfo={
commonComponent:'dataTableVersion',
component: "system/parameterSetting/dataTableVersion/index",
hidden:false,
meta:{
"title": "数据表版本",
"noCache": false,
"link": null,
"mkid":120100201,
},
name:'dataTableVersion',
path:"dataTableVersion"
}
}
/* 120100201 数据表版本*/
else if(mkid=='120100701'){
componentInfo={
commonComponent:'dataTableIndexVersion',
component: "development/dictionary/dataTableIndexVersion/index",
hidden:false,
meta:{
"title": "N数据表索引版本",
"noCache": false,
"link": null,
"mkid":120100701,
},
name:'dataTableIndexVersion',
path:"dataTableIndexVersion"
}
}
/* 120100201 数据表*/
else if(mkid=='120100101'){
componentInfo={
commonComponent:'dataTable',
component: "system/parameterSetting/dataTable/index",
hidden:false,
meta:{
"title": "数据表",
"noCache": false,
"link": null,
"mkid":120100101,
},
name:'dataTable',
path:"dataTable"
}
}
/* 初始数据版本*/
else if(mkid=='120100301'){
componentInfo={
commonComponent:'initTableVersion',
component: "system/parameterSetting/initTableVersion/index",
hidden:false,
meta:{
"title": "初始化数据表版本",
"noCache": false,
"link": null,
"mkid":120100301,
},
name:'initTableVersion',
path:"initTableVersion"
}
}
/* 研发数据字典*/
else if(mkid=='120100000'){
componentInfo={
commonComponent:'dictionary',
component: "development/dictionary/index",
alwaysShow: true,
hidden: false,
name: "dictionary",
path: "/development/dictionary",
redirect: "noRedirect",
meta: {title: "数据字典", icon: "system", noCache: false, link: null,mkid:120100000}
}
}
/* 组件维护*/
else if(mkid=='120120101'){
componentInfo={
commonComponent:'componentMaintenance',
component: "development/functionManagement/componentMaintenance/index",
hidden:false,
meta:{
/* 下载数据表程序未完成*/
"title": "组件维护",
"noCache": false,
"link": null,
"mkid":120120101,
},
name:'componentMaintenance',
path:"componentMaintenance"
}
}
/* 模块维护*/
else if(mkid=='120120102'){
componentInfo={
commonComponent:'moduleMaintenance',
component: "development/functionManagement/moduleMaintenance/index",
hidden:false,
meta:{
/* 下载数据表程序未完成*/
"title": "模块维护",
"noCache": false,
"link": null,
"mkid":120120102,
},
name:'moduleMaintenance',
path:"moduleMaintenance"
}
}
/* 产品维护*/
else if(mkid=='120110101'){
componentInfo={
commonComponent:'productMaintenance',
component: "development/productManagement/productMaintenance/index",
hidden:false,
meta:{
/* 下载数据表程序未完成*/
"title": "N产品维护",
"noCache": false,
"link": null,
"mkid":120110101,
},
name:'productMaintenance',
path:"productMaintenance"
}
} /* 发布计划*/
else if(mkid=='120111001'){
componentInfo={
commonComponent:'releasePlan',
component: "development/productManagement/releasePlan/index",
hidden:false,
meta:{
/* 下载数据表程序未完成*/
"title": "N发布计划",
"noCache": false,
"link": null,
"mkid":120111001,
},
name:'releasePlan',
path:"releasePlan"
}
}
else if(mkid=='120111101'){
componentInfo={
commonComponent:'regCode',
component: "regCode",
hidden:false,
meta:{
/* 下载数据表程序未完成*/
"title": "(未写)注册码",
"noCache": false,
"link": null,
"mkid":120111101,
},
name:'regCode',
path:"regCode"
}
}
/* 产品管理*/
else if(mkid=='120110000'){
componentInfo={
commonComponent:'productManagement',
component: "development/productManagement/index",
alwaysShow: true,
hidden: false,
name: "productManagement",
path: "/development/productManagement",
redirect: "noRedirect",
meta: {title: "产品管理", icon: "system", noCache: false, link: null,mkid:120110000}
}
}
/* 功能管理*/
else if(mkid=='120120000'){
componentInfo={
commonComponent:'functionManagement',
component: "development/functionManagement/index",
alwaysShow: true,
hidden: false,
name: "functionManagement",
path: "/development/functionManagement",
redirect: "noRedirect",
meta: {title: "功能管理", icon: "system", noCache: false, link: null,mkid:120120000}
}
}
else if(mkid=='120000000'){
componentInfo={
component: "Layout",
alwaysShow: true,
hidden: false,
name: "Development",
path: "/development",
redirect: "noRedirect",
meta: {title: "研发工作", icon: "system", noCache: false, link: null,mkid:120000000}
}
}
return componentInfo
}
function filterChildren(childrenMap, lastRouter = false) { function filterChildren(childrenMap, lastRouter = false) {
var children = [] var children = []
...@@ -801,5 +229,16 @@ export const loadView = (view) => { ...@@ -801,5 +229,16 @@ export const loadView = (view) => {
} }
} }
export const loadCommonView = (view) => {
/* 改为common路由*/
if (process.env.NODE_ENV === 'development') {
return (resolve) => require([`common/src/views/${view}`], resolve)
} else {
// 使用 import 实现生产环境的路由懒加载
// return () => import(`@/views/${view}`)
return (resolve) => require([`common/src/views/${view}`], resolve)
}
}
export default permission export default permission
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment