var managerTree = ""; var isSingle = false; var h = 500; (function($) { $.tree = function(e, o) { var param = ""; if(o.tabParam ==undefined)o.tabParam = ""; else{ for(var i=0;i0)param = param.substring(1); } if(o.root ==undefined) o.root = ""; if(o.groot ==undefined) o.groot = ""; if(o.isMultiDept ==undefined) o.isMultiDept = ""; if(o.userState ==undefined) o.userState = "1"; if(o.mainPost==undefined)o.mainPost="";//岗位显示参数(1、只显示主岗,0、只显示副岗,空显示所有) var wh = $(window).height()-200; o = $.extend({ url : getProjectName() + "/loadDeptUserTree.do?filter=" +o.filter+"&type="+o.type+"&root="+o.root+"&groot="+o.groot+"&mainPost="+o.mainPost +"¶m="+param+"&isMultiDept="+o.isMultiDept+"&userState="+o.userState+"&t=" + new Date().getTime(), height:wh, width:550, type:"user", selectId:"", iframeName:"", buttons:[{ text : '确定', onclick : function(item, dialog) { var idObj = o.win.getElementsByName(o.backId); var nameObj = o.win.getElementsByName(o.backName); if(idObj.length==0)idObj = o.win.getElementById(o.backId); if(nameObj.length==0)nameObj = o.win.getElementById(o.backName); var checkList = findIframeByJquery("deptTreeFrame",".checkList"); var ids = ""; var names=""; $("li",checkList).each(function(){ var selectId = $(this).attr("id"); selectId = selectId.substring(selectId.indexOf("_")+1); names += ","+$(this).text(); ids +=","+selectId; }); if(ids!=""){ ids = ids.substring(1); } if(names!=""){ names = names.substring(1); } if(o.okpress){ o.okpress(ids, names); }else{ $(idObj).val(ids); $(nameObj).change(); $(nameObj).val(names); } dialog.close(); } }, { text : '取消', onclick : function(item, dialog) { dialog.close(); } } ] }, o); var action = { openTree : function() { type = o.type; if(o.tab==undefined)o.tab=""; $.ligerDialog.open({ url : o.url+"&selectId="+o.selectId+"&tab="+o.tab, height : o.height, width : o.width, buttons :o.buttons, isHidden:false, name:"deptTreeFrame" }); } }; $(e).unbind("click"); $(e).bind("click",function() { var selectObj = $(e).parents("body").find("#"+o.backId); if($(selectObj).length == 0)selectObj = $("input[name='"+o.backId+"']",$(e).parents("body")); o.selectId = $(selectObj).val(); action.openTree(); }); }; $.fn.bindTree = function(options) { $.tree(this, options); }; })(jQuery); function loadDeptTree(e,options){ $(e).bindTree(options); }