|
|
|
@ -387,65 +387,33 @@ const dealMenuFromInterface=(_list,pName="")=>{
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
*判断某个菜单是否存在
|
|
|
|
|
* parentId: ""获取一级菜单或其子菜单是否存在;["","","",]获取多级菜单或其子菜单是否存在
|
|
|
|
|
* 注:数组的值的先后顺序一定是按照菜单的由父到子的顺序
|
|
|
|
|
*jurisdictionAry 目标菜单路径 id 从第一级开始
|
|
|
|
|
* */
|
|
|
|
|
OfficeMenuConfig.menuIsExist=(parentId,childId=null)=>{
|
|
|
|
|
let i = 0;
|
|
|
|
|
if (Array.isArray(parentId)){
|
|
|
|
|
let len = parentId.length;
|
|
|
|
|
let menu = _.cloneDeep(secondMenuList);
|
|
|
|
|
let count = 0;
|
|
|
|
|
/********找到最里层的菜单********/
|
|
|
|
|
while(count < len){
|
|
|
|
|
let parId = parentId[count];
|
|
|
|
|
for (i = 0; i < menu.length; i ++){
|
|
|
|
|
if (menu[i].id === parId){
|
|
|
|
|
menu = _.cloneDeep(menu[i].children);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (menu === undefined || menu === null || menu.length === 0 || menu[0].parentId !== parId){//当某个父级菜单不存在时,直接返回false
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
count += 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/********查找结束***************/
|
|
|
|
|
|
|
|
|
|
if (childId === null){
|
|
|
|
|
return true;
|
|
|
|
|
}else{
|
|
|
|
|
if (menu && menu.length > 0){
|
|
|
|
|
for (i = 0; i < menu.length; i++){
|
|
|
|
|
if (menu[i].id === childId){
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
for (i = 0; i < secondMenuList.length; i++){
|
|
|
|
|
if (secondMenuList[i].id === parentId){
|
|
|
|
|
if(childId === null){
|
|
|
|
|
return true;
|
|
|
|
|
}else{
|
|
|
|
|
let children = secondMenuList[i].children;
|
|
|
|
|
if (children !== null && children !== undefined){
|
|
|
|
|
for (let j = 0; j < children.length; j++){
|
|
|
|
|
if (children[j].id === childId){
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
OfficeMenuConfig.menuIsExist=(jurisdictionAry = [])=>{
|
|
|
|
|
let isExist = true;
|
|
|
|
|
if (jurisdictionAry && this.TypesCheck.isArray(jurisdictionAry) && jurisdictionAry.length > 0){
|
|
|
|
|
let ary = secondMenuList;
|
|
|
|
|
for (let i = 0; i < jurisdictionAry.length; i++){
|
|
|
|
|
let menuString = jurisdictionAry[i];
|
|
|
|
|
if (ary.some((item)=>{return item.id === menuString})){
|
|
|
|
|
let menu = ary.filter((item)=>{return item.id === menuString})[0]
|
|
|
|
|
if (i < jurisdictionAry.length - 1){
|
|
|
|
|
if (menu.children && menu.children.length > 0){
|
|
|
|
|
ary = menu.children;
|
|
|
|
|
}else{
|
|
|
|
|
isExist = false;
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
isExist = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
isExist = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
return isExist;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|