Commit a476d46e authored by 张俊's avatar 张俊

菜单处理

parent 298b81c6
<template> <template>
<ul class="nav-list" v-if="list&&list.length"> <ul class="nav-list" v-if="list&&list.length">
<li v-for="(item, index) in list" v-show="item.show" :key="'nav_' + index"> <li v-for="(item, index) in list" v-show="item.menuType!==2" :key="'nav_' + index">
<template v-if="item.children && item.children.length"> <template v-if="item.children && item.children.length&&item.menuType==0">
<div <div
class="nav-item nav-more text-clip" class="nav-item nav-more text-clip"
:class="{ current: isCurrent([item.path]) }" :class="{ current: isCurrent([item.path]) }"
...@@ -9,8 +9,10 @@ ...@@ -9,8 +9,10 @@
> >
<span :style="{ paddingLeft: `${deep*2}em` }"> <span :style="{ paddingLeft: `${deep*2}em` }">
<!-- <img v-if="item.icon" :src="item.icon" alt=""> --> <!-- <img v-if="item.icon" :src="item.icon" alt=""> -->
<bg-icon v-if="item.icon" :icon="item.icon"></bg-icon> <bg-icon v-if="item.icon" style="color:#7c8292;" :icon="'#'+item.icon"></bg-icon>
{{ item.menuName }} {{ item.menuName }}
<bg-icon v-show="showMore[index] !== false" style="font-size:8px;position: absolute;right: 10px;top: 20px;" icon="#bg-ic-arrow-up"></bg-icon>
<bg-icon v-show="showMore[index] == false" style="font-size:8px;position: absolute;right: 10px;top: 20px;" icon="#bg-ic-arrow-down"></bg-icon>
</span> </span>
&ensp; &ensp;
</div> </div>
...@@ -26,7 +28,7 @@ ...@@ -26,7 +28,7 @@
<template v-else> <template v-else>
<div <div
class="nav-item text-clip" class="nav-item text-clip"
:class="{current:isCurrent(item.linkPath&&item.linkPath.length?[...item.linkPath,item.path]:[item.path])}" :class="{current:isCurrent(item.children&&item.children.length?[...getChildrenPath(item.children),item.path]:[item.path])}"
@click="$router.push(item.path)" @click="$router.push(item.path)"
> >
<span :style="{ paddingLeft: `${deep*2}em` }">{{ item.menuName }}</span> <span :style="{ paddingLeft: `${deep*2}em` }">{{ item.menuName }}</span>
...@@ -67,6 +69,15 @@ export default { ...@@ -67,6 +69,15 @@ export default {
this.showMore[index] = !flag this.showMore[index] = !flag
}, },
getChildrenPath(arr,temp=[]){
arr.forEach(e => {
temp.push(e.path)
if(e.children&&e.children.length){
this.getChildrenPath(e.children,temp)
}
});
return temp
},
isCurrent(path) { isCurrent(path) {
return ( return (
(this.highlightParentRule && this.highlightParentRule(path)) || false (this.highlightParentRule && this.highlightParentRule(path)) || false
......
...@@ -8,36 +8,36 @@ ...@@ -8,36 +8,36 @@
> >
<!-- LOGO --> <!-- LOGO -->
<div class="bg-logo" @click="gotoPage"> <router-link to="/" class="bg-logo">
<img style="width:140px;height:22px;" src="../assets/imgs/img_logo.png"/> <img style="width:140px;height:22px;" src="../assets/imgs/img_logo.png"/>
</div> </router-link>
<!-- 菜单 --> <!-- 菜单 -->
<div class="main-menu" v-if="userInfo&& userInfo.system_id"> <div class="main-menu" v-if="userInfo&& userInfo.system_id">
<!-- 前台菜单 --> <!-- 前台菜单 -->
<div class="font-menu" v-if="fontMenu&&fontMenu.length"> <div class="font-menu" v-if="fontMenu&&fontMenu.length">
<div class="nav-item" :style="path==item.path?{backgroundColor:'#2b4695'}:''" v-show="item.show" v-for="(item,index) in fontMenu" :key="'font'+index"> <div class="nav-item" :style="path==item.path?{backgroundColor:'#2b4695'}:''" v-show="item.menuType!==2" v-for="(item,index) in fontMenu" :key="'font'+index">
<span @click="menuAction(item.path,item)"> <span @click="menuAction(item.path,item)">
{{item.menuName}} {{item.menuName}}
<bg-icon v-if="item.children&&item.children.length" icon="#bg-ic-arrow-down" style="font-size:8px;margin-left: 3px;"></bg-icon> <bg-icon v-if="item.children&&item.children.length" icon="#bg-ic-arrow-down" style="font-size:8px;margin-left: 3px;"></bg-icon>
</span> </span>
<div class="menu-virtual"></div> <div class="menu-virtual"></div>
<div class="menu-list" v-if="item.children&&item.children.length"> <div class="menu-list" v-if="item.children&&item.children.length">
<div class="menu-item text_clip" @click="childMenuAction(it,item)" v-show="it.show" v-for="(it,idx) in item.children" :key="'font-children'+idx">{{it.menuName}}</div> <div class="menu-item text_clip" @click="childMenuAction(it,item)" v-show="it.menuType!==2" v-for="(it,idx) in item.children" :key="'font-children'+idx">{{it.menuName}}</div>
</div> </div>
</div> </div>
</div> </div>
<!-- 后管菜单 --> <!-- 后管菜单 -->
<div class="manager-menu" v-if="managerMenu&&managerMenu.length"> <div class="manager-menu" v-if="managerMenu&&managerMenu.length">
<div class="nav-item" :style="path==item.path?{backgroundColor:'#2b4695'}:''" v-show="item.show" v-for="(item,index) in managerMenu" :key="'manager'+index"> <div class="nav-item" :style="path==item.path?{backgroundColor:'#2b4695'}:''" v-show="item.menuType!==2" v-for="(item,index) in managerMenu" :key="'manager'+index">
<span @click="menuAction(item.path,item)"> <span @click="menuAction(item.path,item)">
{{item.menuName}} {{item.menuName}}
<bg-icon v-if="item.children&&item.children.length" icon="#bg-ic-arrow-down" style="font-size:8px;margin-left: 3px;"></bg-icon> <bg-icon v-if="item.children&&item.children.length" icon="#bg-ic-arrow-down" style="font-size:8px;margin-left: 3px;"></bg-icon>
</span> </span>
<div class="menu-virtual"></div> <div class="menu-virtual"></div>
<div class="menu-list" v-if="item.children&&item.children.length"> <div class="menu-list" v-if="item.children&&item.children.length">
<div class="menu-item text_clip" @click="childMenuAction(it,item)" v-show="it.show" v-for="(it,idx) in item.children" :key="'manager-children'+idx">{{it.menuName}}</div> <div class="menu-item text_clip" @click="childMenuAction(it,item)" v-show="it.menuType!==2" v-for="(it,idx) in item.children" :key="'manager-children'+idx">{{it.menuName}}</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -129,7 +129,7 @@ export default { ...@@ -129,7 +129,7 @@ export default {
fontMenu (state) { fontMenu (state) {
let temp = [] let temp = []
// state.menu.forEach(e => { // state.menu.forEach(e => {
// if(e.menuType=='font'){ // if(e.dict_group_id=='2cb4f767-fad7-44f2-afa3-f055e15dd2b6'){//font
// temp.push(e) // temp.push(e)
// } // }
// }); // });
...@@ -138,7 +138,7 @@ export default { ...@@ -138,7 +138,7 @@ export default {
managerMenu(state){ managerMenu(state){
let temp = [] let temp = []
// state.menu.forEach(e => { // state.menu.forEach(e => {
// if(e.menuType=='system'){ // if(e.dict_group_id=='64c156e0-bfff-4bfc-a63a-56effe130a25'){//system
// temp.push(e) // temp.push(e)
// } // }
// }); // });
...@@ -147,7 +147,7 @@ export default { ...@@ -147,7 +147,7 @@ export default {
systemMenu(state){ systemMenu(state){
let temp = [] let temp = []
state.menu.forEach(e => { state.menu.forEach(e => {
if(e.menuType=='manager'){ if(e.dict_group_id=='09938937-3db9-47de-b967-7777ea4ebb2d'){//manager
temp.push(e) temp.push(e)
} }
}); });
...@@ -192,14 +192,10 @@ export default { ...@@ -192,14 +192,10 @@ export default {
// }) // })
}, },
menuAction(n,parent) { menuAction(n,parent) {
//不存在则不跳转
if(!n){
return
}
if (n == "logout") { if (n == "logout") {
this.$axios.post(`/apaas/system/v5/user/logout`).then(res=>{ this.$axios.post(`/apaas/system/v5/user/logout`).then(res=>{
if(res.data.code=='200'){ if(res.data.code=='200'){
this.$router.push('/login') window.location.href = `/apaas/manage/ui/#/login`;
this.$store.commit('setUserInfo',null) this.$store.commit('setUserInfo',null)
clearCookie('bgToken') clearCookie('bgToken')
this.$message.success('退出成功') this.$message.success('退出成功')
...@@ -210,7 +206,7 @@ export default { ...@@ -210,7 +206,7 @@ export default {
}) })
} else if (n == "login") { } else if (n == "login") {
let path = this.$route.path; let path = this.$route.path;
window.location.href = `/login?redirect=${path}`; window.location.href = `/apaas/manage/ui/#/login?redirect=${path}`;
} else { } else {
//是否有子路由,有则寻找子路由的第一个进行跳转,无则直接进行跳转 //是否有子路由,有则寻找子路由的第一个进行跳转,无则直接进行跳转
//使用childMenuAction是模拟template中,子路径点击跳转使用childMenuAction, //使用childMenuAction是模拟template中,子路径点击跳转使用childMenuAction,
...@@ -223,16 +219,15 @@ export default { ...@@ -223,16 +219,15 @@ export default {
} }
}, },
childMenuAction(v,parent) { childMenuAction(v,parent) {
//最多只有2层目录,childMenuAction已经进入第一层,只需判断是否还有第二层即可
//有第二层则继续找第二层的第一个跳转
//无第二层则直接跳转
if(v.children&&v.children.length){ if(v.children&&v.children.length){
if(v.children[0].children){ for (let index = 0; index < v.children.length; index++) {
this.pathToUrl(v.children[0].children[0].path,parent) const e = v.children[index];
}else{ if(e.menuType!==2){
for (let index = 0; index < v.children.length; index++) { this.pathToUrl(e.path,parent)
const e = v.children[index]; break
if(e.show){
this.pathToUrl(e.path,parent)
break
}
} }
} }
}else{ }else{
...@@ -246,22 +241,19 @@ export default { ...@@ -246,22 +241,19 @@ export default {
}else{ }else{
//判断是否是同区域内跳转 //判断是否是同区域内跳转
//非同区域跳转需要改前缀,如apaas/portal/ui跳转到apaas/manage/ui //非同区域跳转需要改前缀,如apaas/portal/ui跳转到apaas/manage/ui
if(this.$store.state.menuObj[this.path]&&(parent.menuType==this.$store.state.menuObj[this.path].menuType||(['font','system'].includes(parent.menuType)&&['font','system'].includes(this.$store.state.menuObj[this.path].menuType)))){ if(this.$store.state.menuObj[this.path]&&(parent.dict_group_id==this.$store.state.menuObj[this.path].dict_group_id||(['2cb4f767-fad7-44f2-afa3-f055e15dd2b6','64c156e0-bfff-4bfc-a63a-56effe130a25'].includes(parent.dict_group_id)&&['2cb4f767-fad7-44f2-afa3-f055e15dd2b6','64c156e0-bfff-4bfc-a63a-56effe130a25'].includes(this.$store.state.menuObj[this.path].dict_group_id)))){
this.$router.push(path); this.$router.push(path);
}else{ }else{
let temp = '' let temp = ''
if(this.$store.state.menuObj[path].menuType=='font'||this.$store.state.menuObj[path].menuType=='system'){ if(this.$store.state.menuObj[path].dict_group_id=='2cb4f767-fad7-44f2-afa3-f055e15dd2b6'||this.$store.state.menuObj[path].dict_group_id=='64c156e0-bfff-4bfc-a63a-56effe130a25'){
temp = '/apaas/portal/ui/#' temp = '/apaas/portal/ui/#'
}else if(this.$store.state.menuObj[path].menuType=='manager'){ }else if(this.$store.state.menuObj[path].dict_group_id=='09938937-3db9-47de-b967-7777ea4ebb2d'){
temp = '/apaas/manage/ui/#' temp = '/apaas/manage/ui/#'
} }
window.open(temp+path) window.open(temp+path)
} }
} }
}, },
gotoPage(){
window.open(`/apaas/portal/ui/#/`)
},
intoCartDetail() { intoCartDetail() {
this.$router.push({ name: "shopCart" }); this.$router.push({ name: "shopCart" });
}, },
...@@ -458,7 +450,6 @@ export default { ...@@ -458,7 +450,6 @@ export default {
line-height: 1; line-height: 1;
margin: 0 50px 0 20px; margin: 0 50px 0 20px;
text-decoration: none; text-decoration: none;
cursor: pointer;
> span { > span {
font-size: 24px; font-size: 24px;
......
var adminMenu = [ var adminMenu = [
{ {
menuName: "工作台", menuName: "工作台",
path: "/workspace", path: "/workspace1",
parentPath:null, dict_group_id: "64c156e0-bfff-4bfc-a63a-56effe130a25", //0目录1菜单2子页面
name:"workspace", menuType: 0, //system:64c156e0-bfff-4bfc-a63a-56effe130a25:apaas后管,能力注册页等 font:2cb4f767-fad7-44f2-afa3-f055e15dd2b6:apaas前台页 manager:09938937-3db9-47de-b967-7777ea4ebb2d:apaas管理中心 知识中心:26d3903a-863e-4efc-b53e-0fb8772ddaa4
menuType:'system', //system:apaas后管,能力注册页等 font:apaas前台页 manager:apaas管理中心 children: [
show:true,
children:[{
menuName: "能力管理",
path: "/ability-manage",
show:true,
menuType:'system',
icon: "#bg-ic-ability",
parentPath:'/workspace',
children:[
{
name: "ui-service-test",
menuName: "ui服务测试",
path: "/ui-example",
menuType:'system',
parentPath:null,
},
{
name: "register-valid",
menuName: "注册认证",
path: "/register-valid",
menuType:'system',
parentPath:null,
},
{
name: "ability-register-step",
menuName:'能力注册',
path: "/ability-register/step",
parentPath:'/ability-manage',
menuType:'system',
},
{
name: "ability-register-desc",
menuName:'服务注册说明',
path: "/ability-register/desc",
linkPath:["/ability-register/desc"],
parentPath:'/ability-manage',
menuType:'system',
},
{
name: "ability-register-preview",
menuName:'服务注册说明',
path: "/ability-register/preview",
linkPath:["/ability-register/preview"],
parentPath:'/ability-manage',
menuType:'system',
},
{
name: "ability-register-set-mock",
menuName:'配置mock服务',
path: "/ability-register/set-mock",
parentPath:'/ability-manage',
menuType:'system',
},
{
name: "real-list",
menuName:'能力注册',
path: "/ability-manage/real-list",
parentPath:'/ability-manage',
linkPath:["/ability-register/step","/ability-register/set-mock"],
menuType:'system',
show:true,
},
{
name: "real-detail",
menuName:'能力注册详情',
path: "/ability-manage/real-list/detail",
parentPath:'/ability-manage',
menuType:'system',
},
{
name: "mock-list",
menuName:'mock能力',
path: "/ability-manage/mock-list",
parentPath:'/ability-manage',
linkPath:["/mock-register/step"],
show:true,
menuType:'system',
},
{
path:"/mock-register/step",
parentPath:'/ability-manage',
name:"mock-register-step",
menuName:"mock注册",
menuType:'system',
},
{
name: "mock-detail",
menuName:'mock能力详情',
path: "/ability-manage/mock-list/detail",
parentPath:'/ability-manage',
menuType:'system',
},
{
name: "sold-list",
menuName:'能力上下架管理',
path: "/ability-manage/sold-list",
parentPath:'/ability-manage',
linkPath:["/ability-manage/sold-list/service-test"],
show: true,
menuType:'system',
},
{
name: "service-test",
menuName:'服务测试',
path: "/ability-manage/sold-list/service-test",
parentPath:'/ability-manage',
menuType:'system',
},
]
},
{
name: "dict-config",
menuName:'字典配置',
path: "/dict-config",
parentPath:'/workspace',
menuType:'system',
icon: "#bg-ic-log",
show:true,
children: [
{
name: "business-list",
menuName:'业务分类',
path: "/dict-config/business-list",
parentPath:'/dict-config',
menuType:'system',
show:true,
},
{
name: "sectors-list",
menuName:'业务领域',
path: "/dict-config/sectors-list",
parentPath:'/dict-config',
menuType:'system',
show:true,
},
{
name: "openness-list",
menuName:'开放程度',
path: "/dict-config/openness-list",
parentPath:'/dict-config',
menuType:'system',
show:true,
}
]
}
]
},
{
name:"index",
menuName:"首页",
path: "/",
parentPath:null,
menuType:'font',
show:true,
},
{
menuName: "管理中心",
path: "/manage",
name:"manage",
parentPath:null,
menuType:'manager',
show: true,
children:[{
menuName: "开发管理",
path: "/develop",
parentPath:null,
menuType:'manager',
show:true,
icon: "#bg-ic-ability",
children:[
{
name: "account-manage",
menuName:'系统账号管理',
parentPath:null,
menuType:'manager',
show:true,
path: "/develop/account",
linkPath: ["/develop/account/add"]
},
{ {
name: "account-add-manage", menuName: "工作台首页",
menuName:'新建账号', path: "/workspace",
parentPath:'/develop/account', dict_group_id: "64c156e0-bfff-4bfc-a63a-56effe130a25",
menuType:'manager', menuType: 1, //system:apaas后管,能力注册页等 font:apaas前台页 manager:apaas管理中心
path: "/develop/account/add",
}, },
{ {
name: "account-detail-manage", menuName: "能力管理",
menuName:'账号详情', path: "/ability-manage",
parentPath: '/develop/account', dict_group_id: "64c156e0-bfff-4bfc-a63a-56effe130a25",
menuType:'manager', menuType: 0,
path: "/develop/account/detail", icon: "bg-ic-ability",
children: [
{
menuName: "能力注册",
path: "/ability-manage/real-list",
children: [
{
menuName: "能力注册",
path: "/ability-register/step",
dict_group_id: "64c156e0-bfff-4bfc-a63a-56effe130a25",
menuType: 2,
children: [
{
menuName: "服务注册说明",
path: "/ability-register/desc",
dict_group_id: "64c156e0-bfff-4bfc-a63a-56effe130a25",
menuType: 2,
},
{
menuName: "服务注册说明",
path: "/ability-register/preview",
dict_group_id: "64c156e0-bfff-4bfc-a63a-56effe130a25",
menuType: 2,
},
{
menuName: "ui服务测试",
path: "/ui-example",
dict_group_id: "64c156e0-bfff-4bfc-a63a-56effe130a25",
menuType: 2,
},
{
menuName: "注册认证",
path: "/register-valid",
dict_group_id: "64c156e0-bfff-4bfc-a63a-56effe130a25",
menuType: 2,
},
],
},
{
menuName: "配置mock服务",
path: "/ability-register/set-mock",
dict_group_id: "64c156e0-bfff-4bfc-a63a-56effe130a25",
menuType: 2,
},
{
menuName: "能力注册详情",
path: "/ability-manage/real-list/detail",
dict_group_id: "64c156e0-bfff-4bfc-a63a-56effe130a25",
menuType: 2,
},
],
dict_group_id: "64c156e0-bfff-4bfc-a63a-56effe130a25",
menuType: 1,
},
{
menuName: "mock能力",
path: "/ability-manage/mock-list",
children: [
{
path: "/mock-register/step",
menuName: "mock注册",
dict_group_id: "64c156e0-bfff-4bfc-a63a-56effe130a25",
menuType: 2,
},
{
menuName: "mock能力详情",
path: "/ability-manage/mock-list/detail",
dict_group_id: "64c156e0-bfff-4bfc-a63a-56effe130a25",
menuType: 2,
},
],
dict_group_id: "64c156e0-bfff-4bfc-a63a-56effe130a25",
menuType: 1,
},
{
menuName: "能力上下架管理",
path: "/ability-manage/sold-list",
children: [
{
menuName: "服务测试",
path: "/ability-manage/sold-list/service-test",
dict_group_id: "64c156e0-bfff-4bfc-a63a-56effe130a25",
menuType: 2,
},
],
dict_group_id: "64c156e0-bfff-4bfc-a63a-56effe130a25",
menuType: 1,
},
],
}, },
{ ],
name: "menu-manage",
menuName:'菜单管理',
parentPath:null,
menuType:'manager',
show:true,
path: "/develop/menu",
},
]
}, },
{ {
menuName: "系统管理", menuName: "首页",
path: "/system", path: "/",
parentPath:null, dict_group_id: "2cb4f767-fad7-44f2-afa3-f055e15dd2b6",
menuType:'manager', menuType: 1, //system:64c156e0-bfff-4bfc-a63a-56effe130a25:apaas后管,能力注册页等 font:2cb4f767-fad7-44f2-afa3-f055e15dd2b6:apaas前台页 manager:09938937-3db9-47de-b967-7777ea4ebb2d:apaas管理中心 知识中心:26d3903a-863e-4efc-b53e-0fb8772ddaa4
show:true, },
icon: "#bg-ic-ability", {
children:[ menuName: "管理中心",
{ path: "/manage",
name: "system-manage", dict_group_id: "09938937-3db9-47de-b967-7777ea4ebb2d",
menuName:'组织管理', menuType: 0, //system:64c156e0-bfff-4bfc-a63a-56effe130a25:apaas后管,能力注册页等 font:2cb4f767-fad7-44f2-afa3-f055e15dd2b6:apaas前台页 manager:09938937-3db9-47de-b967-7777ea4ebb2d:apaas管理中心 知识中心:26d3903a-863e-4efc-b53e-0fb8772ddaa4
parentPath:null, children: [
menuType:'manager',
show:true,
path: "/system/organization",
},
{
name: "paltform-user-manage",
menuName:'新增平台用户',
parentPath: '/system/organization',
menuType:'manager',
show:false,
path: "/system/organization/platform-user",
},
{
name: "system-user-manage",
menuName:'新增组织用户',
parentPath: '/system/organization',
menuType:'manager',
show: false,
path: "/system/organization/system-user",
},
{
name: "user-detail-manage",
menuName:'用户详情',
parentPath: '/system/organization',
menuType:'manager',
show: false,
path: "/system/organization/user-detail",
},
{ {
name: "org-detail-manage", menuName: "开发管理",
menuName:'组织详情', path: "/develop",
parentPath: '/system/organization', dict_group_id: "09938937-3db9-47de-b967-7777ea4ebb2d",
menuType:'manager', menuType: 0, //system:64c156e0-bfff-4bfc-a63a-56effe130a25:apaas后管,能力注册页等 font:2cb4f767-fad7-44f2-afa3-f055e15dd2b6:apaas前台页 manager:09938937-3db9-47de-b967-7777ea4ebb2d:apaas管理中心 知识中心:26d3903a-863e-4efc-b53e-0fb8772ddaa4
show: false, icon: "bg-ic-ability",
path: "/system/organization/org-detail", children: [
{
menuName: "系统账号管理",
dict_group_id: "09938937-3db9-47de-b967-7777ea4ebb2d",
menuType: 1, //system:64c156e0-bfff-4bfc-a63a-56effe130a25:apaas后管,能力注册页等 font:2cb4f767-fad7-44f2-afa3-f055e15dd2b6:apaas前台页 manager:09938937-3db9-47de-b967-7777ea4ebb2d:apaas管理中心 知识中心:26d3903a-863e-4efc-b53e-0fb8772ddaa4
path: "/develop/account",
children: [
{
menuName: "新建账号",
dict_group_id: "09938937-3db9-47de-b967-7777ea4ebb2d",
menuType: 2, //system:64c156e0-bfff-4bfc-a63a-56effe130a25:apaas后管,能力注册页等 font:2cb4f767-fad7-44f2-afa3-f055e15dd2b6:apaas前台页 manager:09938937-3db9-47de-b967-7777ea4ebb2d:apaas管理中心 知识中心:26d3903a-863e-4efc-b53e-0fb8772ddaa4
path: "/develop/account/add",
},
{
menuName: "账号详情",
dict_group_id: "09938937-3db9-47de-b967-7777ea4ebb2d",
menuType: 2, //system:64c156e0-bfff-4bfc-a63a-56effe130a25:apaas后管,能力注册页等 font:2cb4f767-fad7-44f2-afa3-f055e15dd2b6:apaas前台页 manager:09938937-3db9-47de-b967-7777ea4ebb2d:apaas管理中心 知识中心:26d3903a-863e-4efc-b53e-0fb8772ddaa4
path: "/develop/account/detail",
},
],
},
{
menuName: "菜单管理",
dict_group_id: "09938937-3db9-47de-b967-7777ea4ebb2d",
menuType: 1, //system:64c156e0-bfff-4bfc-a63a-56effe130a25:apaas后管,能力注册页等 font:2cb4f767-fad7-44f2-afa3-f055e15dd2b6:apaas前台页 manager:09938937-3db9-47de-b967-7777ea4ebb2d:apaas管理中心 知识中心:26d3903a-863e-4efc-b53e-0fb8772ddaa4
path: "/develop/menu",
},
],
}, },
{ {
name: "role-manage", menuName: "系统管理",
menuName:'角色管理', path: "/system",
parentPath:null, dict_group_id: "09938937-3db9-47de-b967-7777ea4ebb2d",
menuType:'manager', menuType: 0, //system:64c156e0-bfff-4bfc-a63a-56effe130a25:apaas后管,能力注册页等 font:2cb4f767-fad7-44f2-afa3-f055e15dd2b6:apaas前台页 manager:09938937-3db9-47de-b967-7777ea4ebb2d:apaas管理中心 知识中心:26d3903a-863e-4efc-b53e-0fb8772ddaa4
show:true, icon: "bg-ic-ability",
path: "/system/role", children: [
{
menuName: "组织管理",
dict_group_id: "09938937-3db9-47de-b967-7777ea4ebb2d",
menuType: 1, //system:64c156e0-bfff-4bfc-a63a-56effe130a25:apaas后管,能力注册页等 font:2cb4f767-fad7-44f2-afa3-f055e15dd2b6:apaas前台页 manager:09938937-3db9-47de-b967-7777ea4ebb2d:apaas管理中心 知识中心:26d3903a-863e-4efc-b53e-0fb8772ddaa4
path: "/system/organization",
children:[
{
menuName: "新增平台用户",
dict_group_id: "09938937-3db9-47de-b967-7777ea4ebb2d",
menuType: 2, //system:64c156e0-bfff-4bfc-a63a-56effe130a25:apaas后管,能力注册页等 font:2cb4f767-fad7-44f2-afa3-f055e15dd2b6:apaas前台页 manager:09938937-3db9-47de-b967-7777ea4ebb2d:apaas管理中心 知识中心:26d3903a-863e-4efc-b53e-0fb8772ddaa4
show: false,
path: "/system/organization/platform-user",
},
{
menuName: "新增组织用户",
dict_group_id: "09938937-3db9-47de-b967-7777ea4ebb2d",
menuType: 2, //system:64c156e0-bfff-4bfc-a63a-56effe130a25:apaas后管,能力注册页等 font:2cb4f767-fad7-44f2-afa3-f055e15dd2b6:apaas前台页 manager:09938937-3db9-47de-b967-7777ea4ebb2d:apaas管理中心 知识中心:26d3903a-863e-4efc-b53e-0fb8772ddaa4
show: false,
path: "/system/organization/system-user",
},
{
menuName: "用户详情",
dict_group_id: "09938937-3db9-47de-b967-7777ea4ebb2d",
menuType: 2, //system:64c156e0-bfff-4bfc-a63a-56effe130a25:apaas后管,能力注册页等 font:2cb4f767-fad7-44f2-afa3-f055e15dd2b6:apaas前台页 manager:09938937-3db9-47de-b967-7777ea4ebb2d:apaas管理中心 知识中心:26d3903a-863e-4efc-b53e-0fb8772ddaa4
show: false,
path: "/system/organization/user-detail",
},
{
menuName: "组织详情",
dict_group_id: "09938937-3db9-47de-b967-7777ea4ebb2d",
menuType: 2, //system:64c156e0-bfff-4bfc-a63a-56effe130a25:apaas后管,能力注册页等 font:2cb4f767-fad7-44f2-afa3-f055e15dd2b6:apaas前台页 manager:09938937-3db9-47de-b967-7777ea4ebb2d:apaas管理中心 知识中心:26d3903a-863e-4efc-b53e-0fb8772ddaa4
show: false,
path: "/system/organization/org-detail",
},
]
},
{
menuName: "角色管理",
dict_group_id: "09938937-3db9-47de-b967-7777ea4ebb2d",
menuType: 1, //system:64c156e0-bfff-4bfc-a63a-56effe130a25:apaas后管,能力注册页等 font:2cb4f767-fad7-44f2-afa3-f055e15dd2b6:apaas前台页 manager:09938937-3db9-47de-b967-7777ea4ebb2d:apaas管理中心 知识中心:26d3903a-863e-4efc-b53e-0fb8772ddaa4
path: "/system/role",
},
],
}, },
]
},
{
menuName: "配置管理",
path: "/config",
parentPath:null,
menuType:'manager',
show:true,
icon: "#bg-ic-ability",
children:[
{ {
name: "dict-manage", menuName: "配置管理",
menuName:'字典管理', path: "/config",
parentPath:null, dict_group_id: "09938937-3db9-47de-b967-7777ea4ebb2d",
menuType:'manager', menuType: 0, //system:64c156e0-bfff-4bfc-a63a-56effe130a25:apaas后管,能力注册页等 font:2cb4f767-fad7-44f2-afa3-f055e15dd2b6:apaas前台页 manager:09938937-3db9-47de-b967-7777ea4ebb2d:apaas管理中心 知识中心:26d3903a-863e-4efc-b53e-0fb8772ddaa4
show:true, icon: "bg-ic-ability",
path: "/config/dict", children: [
{
menuName: "字典管理",
dict_group_id: "09938937-3db9-47de-b967-7777ea4ebb2d",
menuType: 1, //system:64c156e0-bfff-4bfc-a63a-56effe130a25:apaas后管,能力注册页等 font:2cb4f767-fad7-44f2-afa3-f055e15dd2b6:apaas前台页 manager:09938937-3db9-47de-b967-7777ea4ebb2d:apaas管理中心 知识中心:26d3903a-863e-4efc-b53e-0fb8772ddaa4
path: "/config/dict",
},
],
}, },
],
]
}, },
] ];
},
]
function getName(str){
if(str=='/'){
return 'index'
}
let temp = str.slice(1)
temp = temp.replaceAll('/','-')
return temp
}
function getViews(path) { function getViews(path) {
// 首先把你需要动态路由的组件地址全部获取,示例项目主项目放入了main,如果直接放入page,需要去掉/main // 首先把你需要动态路由的组件地址全部获取,示例项目主项目放入了main,如果直接放入page,需要去掉/main
let pathArr = path.split('/') let pathArr = path.split("/");
let modules = {} let modules = {};
switch (pathArr.length) { switch (pathArr.length) {
case 2: case 2:
modules = import.meta.glob('../page/main/**/*.vue') modules = import.meta.glob("../page/main/**/*.vue");
break; break;
case 3: case 3:
modules = import.meta.glob('../page/main/**/*/*.vue') modules = import.meta.glob("../page/main/**/*/*.vue");
break; break;
case 4: case 4:
modules = import.meta.glob('../page/main/**/**/*/*.vue') modules = import.meta.glob("../page/main/**/**/*/*.vue");
break; break;
case 5: case 5:
modules = import.meta.glob('../page/main/**/**/**/*/*.vue') modules = import.meta.glob("../page/main/**/**/**/*/*.vue");
break; break;
default: default:
break; break;
} }
// 然后动态路由的时候这样来取 // 然后动态路由的时候这样来取
console.log(modules['../page/main' + path + '/index.vue']); console.log(modules["../page/main" + path + "/index.vue"]);
return modules['../page/main' + path + '/index.vue'] return modules["../page/main" + path + "/index.vue"];
} }
//处理路由方法 //处理路由方法
var menuToRouter = (menu)=>{ var menuToRouter = (menu) => {
menu.forEach(e => { menu.forEach((e) => {
if(e.children){ e.name = getName(e.path)
// 其他层级作为文件夹,只提供父级 if (e.children && e.menuType == 0) {
e.component = () => import('../page/parent/parent.vue') // 其他层级作为文件夹,只提供父级
menuToRouter(e.children) e.component = () => import("../page/parent/parent.vue");
}else{ menuToRouter(e.children);
console.log(`@/page/main${e.path}/index.vue`); } else if (e.children && e.menuType !== 0) {
//叶子层级需要加载到对应文件 console.log(`@/page/main${e.path}/index.vue`);
//对首页做兼容 //叶子层级需要加载到对应文件
if(e.path=='/'){ //对首页做兼容
e.component = () => import('../page/main/index/index.vue') if (e.path == "/") {
}else{ e.component = () => import("../page/main/index/index.vue");
e.component= getViews(e.path) } else {
} e.component = getViews(e.path);
} }
}); menuToRouter(e.children);
} } else {
console.log(`@/page/main${e.path}/index.vue`);
//叶子层级需要加载到对应文件
//对首页做兼容
if (e.path == "/") {
e.component = () => import("../page/main/index/index.vue");
} else {
e.component = getViews(e.path);
}
}
});
};
export default { export default {
adminMenu, adminMenu,
menuToRouter menuToRouter,
} };
\ No newline at end of file
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