// 根据栏目ID、需求的栏目级数,获取左侧栏目名称、地址 function getLeftMenuList(menuid, insertPanelID, deepLevel) { // 首先验证其是否为空,然后验证其是否为数字 // deepLevel = 1; if (!isInteger(menuid)) { return; } if (!isInteger(deepLevel)) { return; } var columnid = parseInt(GetQueryString("column")); if (!isInteger(menuid)) return; if (columnid != menuid) menuid = columnid; // $.getJSON('handlers/cistcDicMenu.ashx', { 'menuid': menuid, 'leftmenu': 1, 'deepLevel': deepLevel }, function (pageData) { $.getJSON('handlers/cistcMenu.ashx', { 'menuid': menuid, 'leftmenu': 1, 'deepLevel': deepLevel }, function (pageData) { var RMenus = pageData.menus; var Uptd = document.getElementById("topMenu"); var LeftMenuSmall = document.getElementById("leftMenuSmall"); var LeftMenuMedium = document.getElementById("leftMenuMedium"); var innerHtml = ""; for (var i = 0; i < RMenus.length; i++) { if (RMenus[i].ParentMenuId == 8) { // 主栏目样式单 // 创建li及其样式 var li = document.createElement("li"); if (RMenus[i].MenuId == "" || RMenus[i].MenuId == menuid) { li.setAttribute("class", "uk-open"); } else { li.setAttribute("class", "uk-active"); } li.innerHTML = "" + RMenus[i].MenuName + ""; Uptd.appendChild(li); // 左侧隐藏栏目样式单 if (LeftMenuSmall != null) { var liLeft = document.createElement("li"); liLeft.setAttribute("id", "leftS" + RMenus[i].MenuId); if (RMenus[i].MenuId == menuid) liLeft.setAttribute("class", "uk-active"); liLeft.innerHTML = "" + RMenus[i].MenuName + ""; LeftMenuSmall.appendChild(liLeft); } } else if (LeftMenuSmall != null && LeftMenuMedium != null) { //左侧菜单子菜单 // 小屏幕左侧菜单 var liS = document.createElement("li"); // 中等以上屏幕左侧菜单 var liM = document.createElement("li"); liS.setAttribute("id", "leftS" + RMenus[i].MenuId); liM.setAttribute("id", "leftM" + RMenus[i].MenuId); // 鼠标响应事件 var onclickHTML; //港澳台职能 // if (RMenus[i].MenuId == 706) { // liS.setAttribute("onclick", "Showzhineng(706)"); // liM.setAttribute("onclick", "Showzhineng(706)"); // } //支部工作 // if (RMenus[i].MenuId == 466) { // liS.setAttribute("onclick", "ShowInfoList2(466)"); // liM.setAttribute("onclick", "ShowInfoList2(466)"); // } if (RMenus[i].MenuTypeId == 5) { // 信息类栏目 if (RMenus[i].ParentMenuId == '232') { // 资料:大事记栏目 // liS.setAttribute("onclick", "ShowInfoCenterList(205, '" + RMenus[i].MenuName + "')"); // liM.setAttribute("onclick", "ShowInfoCenterList(205, '" + RMenus[i].MenuName + "')"); onclickHTML = "ShowInfoCenterList(205, '" + RMenus[i].MenuName + "')"; } else if (RMenus[i].ParentMenuId == '234') { // 资料:科技外交掠影栏目 // liS.setAttribute("onclick", "ShowInfoList(220)"); // liM.setAttribute("onclick", "ShowInfoList(220)"); onclickHTML = "ShowInfoList(220)"; } //合作司联系方法 else if (RMenus[i].MenuId == '213') { // 资料:科技外交掠影栏目 // liS.setAttribute("onclick", "Showlinks(213)"); // liM.setAttribute("onclick", "Showlinks(213)"); onclickHTML = "Showlinks(213)"; } //合作司职能 else if (RMenus[i].MenuId == '210') { // 资料:科技外交掠影栏目 // liS.setAttribute("onclick", "Showzhineng(210)"); // liM.setAttribute("onclick", "Showzhineng(210)"); onclickHTML = "Showzhineng(210)"; } else { // 一般信息栏目 // liS.setAttribute("onclick", "ShowInfoList2(" + RMenus[i].MenuId + ")"); // liM.setAttribute("onclick", "ShowInfoList2(" + RMenus[i].MenuId + ")"); onclickHTML = "ShowInfoList2(" + RMenus[i].MenuId + ")"; } } else if (RMenus[i].MenuTypeId == 31) { //地方科技外事主管部门 // liS.setAttribute("onclick", "ShowDistrictInfo(219)"); // liM.setAttribute("onclick", "ShowDistrictInfo(219)"); onclickHTML = "ShowDistrictInfo(219)"; } else if (RMenus[i].MenuTypeId == 7) { //处室业务子栏目 if (RMenus[i].ParentMenuId == '212') { // liS.setAttribute("onclick", "ShowAssemblyActInfo(212, " + RMenus[i].MenuId + ",'" + RMenus[i].MenuName + "')"); // liM.setAttribute("onclick", "ShowAssemblyActInfo(212, " + RMenus[i].MenuId + ",'" + RMenus[i].MenuName + "')"); onclickHTML = "ShowAssemblyActInfo(212, " + RMenus[i].MenuId + ",'" + RMenus[i].MenuName + "')"; } //合作司机构设置 if (RMenus[i].MenuId == '215') { // liS.setAttribute("onclick", "Showinstitution(212)"); // liM.setAttribute("onclick", "Showinstitution(212)"); onclickHTML = "Showinstitution(212)"; } //司领导介绍 if (RMenus[i].MenuId == '211') { // liS.setAttribute("onclick", "ShowLeaderPic1(211)"); // liM.setAttribute("onclick", "ShowLeaderPic1(211)"); onclickHTML = "ShowLeaderPic1(211)"; } //支部工作 if (RMenus[i].MenuId == '466') { // liS.setAttribute("onclick", "ShowLeaderPic1(211)"); // liM.setAttribute("onclick", "ShowLeaderPic1(211)"); onclickHTML = "ShowInfoList2(466)"; } } else if (RMenus[i].MenuTypeId == 48) { //合作司领导 if (RMenus[i].MenuId == '346') { // // liS.setAttribute("onclick", "ShowLeader1(346)"); // liM.setAttribute("onclick", "ShowLeader1(346)"); onclickHTML = "ShowLeader1(346)"; } else if (RMenus[i].MenuId == '347') { // // liS.setAttribute("onclick", "ShowLeader2(347)"); // liM.setAttribute("onclick", "ShowLeader2(347)"); onclickHTML = "ShowLeader3(347,30)"; //onclickHTML = "getLeaderNameArray(columnid, 1, 2, id, 'leadername')"; } else { // 一般信息栏目 onclickHTML = "ShowInfoList(" + RMenus[i].MenuId + ")"; } } else if (RMenus[i].MenuTypeId == 39) { //合作司相关部门 // liS.setAttribute("onclick", " ShowDicDepartment(217)"); // liM.setAttribute("onclick", " ShowDicDepartment(217)"); onclickHTML = "ShowDicDepartment(217)"; } else if (RMenus[i].MenuTypeId == 29) { // 项目类栏目 // liS.setAttribute("onclick", "ShowProjectList(" + RMenus[i].MenuId + ")"); // liM.setAttribute("onclick", "ShowProjectList(" + RMenus[i].MenuId + ")"); onclickHTML = "ShowProjectList(" + RMenus[i].MenuId + ")"; } var space = ""; for (var j = 0; j < RMenus[i].MenuLevel; j++) { space += " "; } // 外部链接直接跳转 if (RMenus[i].MenuUrl.indexOf("http://") >= 0) { liS.innerHTML = "" + space + RMenus[i].MenuName + ""; liM.innerHTML = "" + space + RMenus[i].MenuName + ""; } else { // liS.innerHTML = "" + RMenus[i].MenuName + ""; // liM.innerHTML = "" + space + RMenus[i].MenuName + ""; var innerhtml; innerhtml = ''; innerhtml += space + RMenus[i].MenuName; innerhtml += ''; liS.innerHTML = innerhtml; liM.innerHTML = innerhtml; } var parentSli = document.getElementById("leftS" + RMenus[i].ParentMenuId); var parentMli = document.getElementById("leftM" + RMenus[i].ParentMenuId); if (parentSli != null) { // 找到父菜单 var ul = document.createElement("ul"); ul.setAttribute("class", "uk-nav-sub"); ul.appendChild(liS); parentSli.setAttribute("class", "uk-parent") // LeftMenuSmall.lastChild.appendChild(ul); parentSli.appendChild(ul); } else { // 未找到父菜单 // LeftMenuSmall.appendChild(liS); } if (parentMli != null) { // 找到父菜单 var ul = document.createElement("ul"); ul.setAttribute("class", "uk-nav-sub"); ul.appendChild(liM); // var leftMli = document.getElementById("leftM" + RMenus[i].ParentMenuId); parentMli.setAttribute("class", "uk-parent"); // LeftMenuMedium.lastChild.appendChild(ul); parentMli.appendChild(ul); } else { // 未找到父菜单,且是网站二级栏目:一级栏目Level为0,二级栏目Level为1. if (RMenus[i].MenuLevel < 2) { LeftMenuMedium.appendChild(liM); } } } } // Uptd.appendChild(li); }); } // 获取url中的参数值 function GetQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); var r = window.location.search.substr(1).match(reg); if (r != null) return unescape(r[2]); return null; } // 判断输入是否为整数 function isInteger(obj) { return typeof obj === 'number' && obj % 1 === 0 } // 判断输入是否为正整数 function isABSInteger(obj) { return Math.floor(obj) === obj }