| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- 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;i<o.tabParam.length;i++){
- var tab = o.tabParam[i];
- var tabIndex = tab["tab"];
- var root = tab["root"];
- var ttype = tab["ttype"];
- var tabName = tab["tabName"];
- var tabId = tab["id"];
- var isMultiDept = tab["isMultiDept"];
- var action = tab["action"];
- if(tabIndex==undefined)tabIndex="";
- if(isMultiDept==undefined)isMultiDept="";
- if(root==undefined)root="";
- if(ttype==undefined)ttype="";
- if(tabName==undefined)tabName="";
- if(tabId==undefined)tabId="";
- if(action==undefined){
- action="";
- }else{
- action=action.replace("&","!");
- }
- param+="$"+tabIndex+"_"+root+"_"+isMultiDept+"_"+ttype+"_"+tabName+"_"+tabId+"_"+action;
- }
- if(param.length>0)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);
- }
|