旭捷内部项目管理系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

97 lines
2.8 KiB

//公共参数
var authTrees;//权限树结构
var titleName = $("#current_titleName").val();
//页面加载完事件
$(function(){
if(titleName != null && titleName != ""){
$("#titleName").text(titleName);
}else {
window.location.href="/login";
}
getAuthTrees()
// getMenu();
//加载权限树
// getAuthTree();
//加载树结构标签
initAuthMenu();
//清除所有cookie函数
// cleanCookie();
});
function getAuthTrees(){
var returnPage = JSON.parse(localStorage.getItem("returnPage"))
var titleName = JSON.parse(localStorage.getItem("titleName"))
if ( returnPage != null ){
authTrees = returnPage
$("#titleName").text(titleName);
}else {
var menuId = $("#menuId").val();
var list = JSON.parse(localStorage.getItem("authTrees"))
var filter = list.filter(item => item.menuId==menuId );
authTrees = filter[0].list
titleName = filter[0].name
returnPage = filter[0].list
localStorage.setItem("returnPage",JSON.stringify(returnPage))
localStorage.setItem("titleName",JSON.stringify(titleName))
}
/*
var menuId = $("#menuId").val();
var list = JSON.parse(localStorage.getItem("authTrees"))
var filter = list.filter(item => item.menuId =menuId );
authTrees = filter[0].list
var titleName = filter[0].name
var returnPage = JSON.parse(filter[0].list)
localStorage.setItem("returnPage",returnPage)
localStorage.setItem("titleName",titleName)
*/
}
//初始化树结构
function initAuthMenu(){
//权限的标签
var authTags = '';
//循环处理标签
if(authTrees != null){
for(var i = 0; i < authTrees.length; i++){
//处理标签逻辑
authTag = processMenuTags(authTrees[i]);
authTags += authTag;
}
//替换标签
$("#main-menu").append(authTags);
}
}
//处理权限的菜单
function processMenuTags(authTree){
//公共参数
var id = authTree.menuId;
var menuId = $("#menuId").val();
var url = ""
var currentName = "&titleName=" + authTree.name + "&superiorName=" + titleName + "&superiorId=" + menuId;
if(authTree.type == 0){
url = "/pda/publicMenu"
}else {
url = authTree.url
}
url = url + "?menuId=" + authTree.menuId + "&token=" + $.cookie("token") + currentName;
var name = authTree.name;
var authTag = '<div data-v-45aee492="" class="ivu-row" style ="margin: 20px;margin-top: -3px;">';
authTag += '<div data-v-45aee492="" class="ivu-col ivu-col-span-13 ivu-col-offset-5" style="width: 105%;margin-left: -7px;">';
authTag += '<a data-v-45aee492="" type="button" id="'+id+'" href="'+url+'"';
authTag += 'class="ivu-btn ivu-btn-primary ivu-btn-long" >'; //style = "border-color: #FF7F24;"
authTag += '<span style="font-size: 20px">'+name+'</span>';
authTag += '</a></div></div>';
return authTag;
}
// 返回时跳转的页面
function getPageUrl(){
var url = '/pda/pdaBase'
var data = {}
axget(url, data, ()=>{})
}