mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-13 04:46:44 +08:00
增加一个显示名称机构名称的访求 cutOrgNamePath
This commit is contained in:
@@ -18,8 +18,31 @@ export const cutFullName = (fullName,num) => {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return newName;
|
||||
};
|
||||
|
||||
|
||||
/**截取机构名称路径namePath最后两段,不包含第一个 */
|
||||
export const cutOrgNamePath = (namePath) => {
|
||||
let newName=namePath;
|
||||
if(newName){
|
||||
let names=newName.split('/');
|
||||
let len=names.length;
|
||||
//使用最后两们
|
||||
if(len>3){
|
||||
newName=names[len-2]+'/'+names[len-1];
|
||||
}else if(len==2){
|
||||
//去掉第一位,只是取第二位
|
||||
newName=names[1];
|
||||
}
|
||||
// if(names.length>1){
|
||||
// newName=names[1];
|
||||
// if(num==2){
|
||||
// if(names.length>2){
|
||||
// newName+="/"+names[2];
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
return newName;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user