/** * 选择机构弹出窗口 * @param options * @returns options.fn * @author zhangsm {@link http://www.esung.com 翼星软件(jiàn)科技有限公(gōng)司(sī)} */ function selectOrg(options){ var orgId = options.orgId; var refresh=false; var url = _ContextPath+'/jsp/common/dialog/dialogOrg.jsp?orgId=' + orgId ; var reload = options.reload || false; if(reload){ try{ $('#dlg-selectOrg').remove(); }catch(e){} } var dlg = $('#dlg-selectOrg'); if (!dlg.length){ dlg = $('
').appendTo('body'); dlg.dialog({ title:options.caption?options.caption:'选择机构', width:options.width?options.width:450, height:options.height?options.height:480, closed:true, collapsible:false, maximizable:true, modal:true, href: url, onLoad:function(){ bindEvents(options); } }); } else { refresh = true; } function bindEvents(options){ $('#dialogOrgTree').unbind('dblclick').bind('dblclick', function(){ var node = $('#dialogOrgTree').tree('getSelected'); options.fn(node); dlg.dialog('close'); }); $('#selectOrg-OK').unbind('click').bind('click', function(){ var node = $('#dialogOrgTree').tree('getSelected'); options.fn(node); if(node){ dlg.dialog('close'); }else{ $.messager.alert("提示", "请选择机构!", "error"); } }); $('#selectOrg-Cancel').unbind('click').bind('click', function(){ dlg.dialog('close'); }); } bindEvents(options); dlg.dialog('open'); if(refresh){ dlg.dialog("refresh",url); } }