/*导航菜单begin====================*/
//导航一级菜单
var accordionJson = "";
function GetAccordionMenu() {
var html = "";
getAjax("/Home/LoadAccordionMenu", "", function (data) {
accordionJson = eval("(" + data + ")");
$.each(accordionJson, function (i) {
if (accordionJson[i].ParentId == '9f8ce93a-fc2d-4914-a59c-a6b49494108f') {
html += "<li title=" + accordionJson[i].FullName + ">";
html += "<div class=\"link\"><img src='../Content/Images/Icon16/" + accordionJson[i].Icon + "'>";
html += "<span>" + accordionJson[i].FullName + "</span><i class=\"chevron-down\"></i>";
html += "</div>";
html += GetSubmenu(accordionJson[i].ModuleId, "b-children");
html += "</li>";
}
});
})
$("#accordion").append(html);
}
//导航子菜单
function GetSubmenu(ModuleId, _class) {
var submenu = "<ul class=\"submenu " + _class + "\">";
$.each(accordionJson, function (i) {
if (accordionJson[i].ParentId == ModuleId) {
if (IsBelowMenu(accordionJson[i].ModuleId) > 0) {
submenu += "<li title=" + accordionJson[i].FullName + "><a class=\"link\"><img src='../Content/Images/Icon16/" + accordionJson[i].Icon + "'><span>" + accordionJson[i].FullName + "</span><i class=\"submenu-chevron-down\"></i></a>";
submenu += GetSubmenu(accordionJson[i].ModuleId, "c-children")
submenu += "</li>";
} else {
submenu += "<li title=" + accordionJson[i].FullName + " οnclick=\"AddTabMenu('" + accordionJson[i].ModuleId + "', '" + RootPath() + accordionJson[i].Location + "', '" + accordionJson[i].FullName + "', '" + accordionJson[i].Icon + "','true');linkAddTabMenu()\"><img src='../Content/Images/Icon16/" + accordionJson[i].Icon + "'><a><span>" + accordionJson[i].FullName + "</span></a></li>";
}
}
});
submenu += "</ul>";
return submenu;
}
//判断是否有子节点
function IsBelowMenu(ModuleId) {
var count = 0;
$.each(accordionJson, function (i) {
if (accordionJson[i].ParentId == ModuleId) {
count++;
return false;
}
});
return count;
}
/*导航菜单end====================*/
</script>