配置日志查询菜单切换修改.

This commit is contained in:
zhangwq
2018-12-14 14:17:09 +08:00
parent c81d9aef22
commit e644766312
2 changed files with 34 additions and 29 deletions

View File

@@ -100,8 +100,8 @@ var toLogSearch = function(index){
// 保存配置界面URL // 保存配置界面URL
$("#searchForm").each(function(){ $("#searchForm").each(function(){
var cfgUrl = $(this).attr("action"); var cfgUrl = $(this).attr("action");
sessionStorage.removeItem('cfgUrl'); sessionStorage.removeItem('cfg_url');
sessionStorage.setItem('cfgUrl',cfgUrl); sessionStorage.setItem('cfg_url',cfgUrl);
}); });
var td = document.getElementById(index+"logTotal"); var td = document.getElementById(index+"logTotal");
@@ -122,7 +122,7 @@ var toLogSearch = function(index){
} }
var switchMenu = function(topMenuId,functionId){ var switchMenu = function(topMenuId,functionId,oldMenuName){
// 顶部菜单切换 menuId Policies/86 Logs/152 // 顶部菜单切换 menuId Policies/86 Logs/152
$(".hor-menu ul li",parent.document).each(function(){ $(".hor-menu ul li",parent.document).each(function(){
var id = $(this).children("a").attr("id"); var id = $(this).children("a").attr("id");
@@ -144,8 +144,15 @@ var switchMenu = function(topMenuId,functionId){
middleMenu.push($(this).attr("menu-name")); middleMenu.push($(this).attr("menu-name"));
} }
}); });
if(functionId == 8){
middleMenu.pop(); if(topMenuId == 152){
if(functionId == 8 || functionId == 35){// HTTP or Mail
lastMenuName = middleMenu[0];
}
sessionStorage.removeItem('old_memu_name');
sessionStorage.setItem('old_memu_name',middleMenu[middleMenu.length-1]);
}else{
lastMenuName = oldMenuName;
} }
// 左侧菜单切换 // 左侧菜单切换
@@ -153,38 +160,34 @@ var switchMenu = function(topMenuId,functionId){
var id = $(this).attr("id") var id = $(this).attr("id")
if(id.indexOf(topMenuId) != -1){ if(id.indexOf(topMenuId) != -1){
$(this).removeClass("hide"); $(this).removeClass("hide");
// 收回展开的菜单 // 收回展开的菜单
$(this).find("li").each(function(index){ $(this).find("li").each(function(index){
$(this).children("a").children("span").next().removeClass("open"); $(this).children("a").children("span").next().removeClass("open");
$(this).children("ul").hide(); $(this).children("ul").hide();
}); });
var count = 0;
// 选中左侧菜单 // 选中左侧菜单
$(this).children("li").each(function(){ $(this).find("li").each(function(index){
if($(this).attr("menu-name") == firstMenuName){ if($(this).attr("menu-name") == lastMenuName){
$(this).addClass("active open");// 选中主菜单 count++;
$(this).children("a").children("span").next().addClass("open");// $(this).children("a").trigger("click");// 选中底层菜单
$(this).children("ul").show(); $(this).parents("li").each(function(){
$(this).addClass("active open");
$(this).find("li").each(function(){ $(this).children("a").children("span").next().addClass("open");
if($.inArray($(this).attr("menu-name"),middleMenu) != -1){ $(this).children("ul").show();
$(this).addClass("active open");
$(this).children("a").children("span").next().addClass("open");
$(this).children("ul").show();
}
if($(this).attr("menu-name") == lastMenuName){
//$(this).addClass("active");
$(this).children("a").trigger("click");
return false;
}
}); });
if(topMenuId == 86){
if(functionId == 35 && count == 1){// HTTP/Mail(Advanced)
return true;
}
return false;
}
} }
}); });
}else{ }else{
$(this).addClass("hide"); $(this).addClass("hide");
} }
}); });
//loading('onloading'); //loading('onloading');

View File

@@ -86,8 +86,10 @@ function getPixelsCount(str, strFontSize){
} }
function back(){ function back(){
// 获取配置界面URl并跳转 // 获取配置界面URl并跳转
var url = sessionStorage.getItem('cfgUrl'); var url = sessionStorage.getItem('cfg_url');
switchMenu("86"); var oldMenuName = sessionStorage.getItem('old_memu_name');
var functionId = url.substr(url.lastIndexOf("=")+1);
switchMenu("86",functionId,oldMenuName);
window.location.href = url; window.location.href = url;
} }
//对Date的扩展将 Date 转化为指定格式的String //对Date的扩展将 Date 转化为指定格式的String