var menuInfoList = undefined; var menuInfoList = undefined; var menuInfo = undefined; $(function(){ $('.office-box-list').height(250).jScrollPane({"autoReinitialise": true,"overflow":true}); $('.office-btns').on('click',function(){ //设置对话框中的值 $("#txtMenuID").val(""); $("#txtMenuUUID").val(""); $("#txtMenuID").removeAttr('readOnly'); $("#txtFatherMenuID").val(""); $("#txtMenuName").val(""); $("#txtMenuUrl").val(""); $("#txtMenuSort").val(""); $("#txtMenuKey").val(""); //加载菜单选项 var contents=$('.office-box').get(0); var artBox=art.dialog({ lock: true, artIcon:'add', opacity:0.4, width: 550, padding:'0px 0px', title:'新增菜单', content: contents, ok: function () { var menuID = $("#txtMenuID").val(); var pMenuID = $("#txtFatherMenuID").val(); var menuName = $("#txtMenuName").val(); var menuUrl = $("#txtMenuUrl").val(); var menuSort = $("#txtMenuSort").val(); var menuKey = $("#txtMenuKey").val(); if(!menuID){ Commonjs.alert('菜单ID不能为空'); document.getElementById("txtMenuID").focus(); return false; } if(!pMenuID){ Commonjs.alert('父菜单ID不能为空'); document.getElementById("txtFatherMenuID").focus(); return false; } if(!menuName){ Commonjs.alert('菜单名称不能为空'); document.getElementById("txtMenuName").focus(); return false; } if(!menuKey){ Commonjs.alert('菜单名称不能为空'); document.getElementById("txtMenuKey").focus(); return false; } //保存菜单 var menuID = saveOrUpdateMenu(menuID,pMenuID,menuName,menuUrl,menuSort,menuKey,null); loadTb(1); }, cancel: true }); return false; }) loadTb(1); }) function loadTb(index){ var Service = {}; $('#pagenumber').val(index); var pageIndex = index-1; var pageSize = 10; var page = {}; Service.HosId = Commonjs.hospitalId; page.PIndex = pageIndex; page.PSize = pageSize; var code = 2005; var param = {}; var params = Commonjs.getParams(code,Service,page);//获取参数 param.Api = "QueryAllMenuByPage"; param.Params = Commonjs.jsonToString(params); var d = Commonjs.ajax('../account_callAccountApi.do',param,false); if(d.RespCode=10000){ if(d.Page.PCount!=undefined){ if(d.Page.PCount!=0){ $("#totalcount").val(d.Page.PCount); }else{ if(d.Page.PIndex==0)$("#totalcount").val(0); } }else{ $("#totalcount").val(0); } Page($("#totalcount").val(),d.Page.PSize,'pager'); menuInfoList = d.Data; var str = "菜单ID菜单名称链接地址父菜单ID排序操作"; if(!menuInfoList.length){ str += ""; str +=""+menuInfoList.MenuId+""; str +=""+menuInfoList.MenuName+""; str +=""+menuInfoList.Value+""; str +=""+menuInfoList.PMenuId+""; str +=""+menuInfoList.Sort+""; str +=""; str +=""; }else{ for(var i=0;i"; str +=""+obj.MenuName+""; str +=""+obj.Value+""; str +=""+obj.PMenuId+""; str +=""+obj.Sort+""; str +=""; str +=""; } } $("#tb").html(str); }else{ //异常提示 Page(0,pageSize,'pager'); Commonjs.alert(d.RespMessage); } } function updateMenuInfo(menuUUID){ var d = undefined; if(!menuInfoList.length){ d = menuInfoList; }else{ for(var i=0;i"+menuInfoList.MenuName+""; str +=""; str +=""; //str +=""; str +="" str +=""; }else{ for(var i=0;i"+obj.MenuName+""; str +=""; str +=""; //str +=""; str +="" str +=""; } } return str; } function saveRoleMenu(menuId,roleId,state){ if(state<=0) return; var Service = {}; var page = {}; var code = 2005; Service.MenuId = menuId; Service.RoleId = roleId; Service.State = state; var param = {}; var params = Commonjs.getParams(code,Service);//获取参数 param.Api = "SaveRoleMenu"; param.Params = Commonjs.jsonToString(params); var d = Commonjs.ajax('../account_callAccountApi.do',param,false); if(d.RespCode!=10000){ //异常提示 Commonjs.alert(d.RespMessage); } } function getMenuIdByKey(key){ if(!menuInfoList.length){ if(key==menuInfoList.Key){ return menuInfoList.MenuId; } }else{ for(var i=0;i0){ Commonjs.alert('该职务下已有用户,不能删除!'); return false; }else if(d.Data==0){ return true; }else{ return false; } }else{ //异常提示 Commonjs.alert(d.RespMessage); return false; } } //分页 function Page(totalcounts, pagecount,pager) { $("#"+pager).pager( { totalcounts : totalcounts, pagesize : 10, pagenumber : $("#pagenumber").val(), pagecount : parseInt(totalcounts/pagecount)+(totalcounts%pagecount >0?1:0), buttonClickCallback : function(al) { $("#pagenumber").val(al); loadTb(al); } }); } function myPrint(msg){ art.dialog({ lock : true, artIcon : 'error', opacity : 0.4, width : 250, title : '提示', time : 3, content : msg, ok : function() { } }); }