/** * @author herong 对话框组件 */ var CFWWin = _FW.fCreateClass(); /** * 对话框组件API */ CFWWin.prototype = { /** * 初始化 */ fInitialize : function(options) { }, /** * 处理控件重新布局(调整控件大小和位置,如果原先控件是隐藏的,那么可能需要手动调用它来重新调整)。 * 需要布局的,手动调用这个,传入父级dom,比如外层div,或者form * * @param oFindObj(必需) * 控件对象 使用举例: CFW.oWin.fnResizeObject(findObj); */ fnResizeObject : function(findObj) { // 查找节点对象里面的所有需要重新调整的节点 $('.fwresize', findObj).trigger('fwresize'); }, /** * 关闭DIV * * @param sDivID(必需) * 网页DIV的ID 使用举例: CFW.oWin.fnDivClose(sDivID); */ fnDivClose : function(sTabId) { var tabId = "#" + sTabId; $(tabId).fwwindow('close'); // $(tabId).hide(); }, /** * 打开DIV * * @param sDivID(必需) * 网页DIV的ID 使用举例: CFW.oWin.fnDivOpen(sDivID); */ fnDivOpen : function(sTabId) { var tabId = "#" + sTabId; $(tabId).fwwindow('open'); // $(tabId).show(); }, /** * 提示消息 * * @param sMsg * 消息 应用实例 * *
	 * CFW.oWin.fnAlert("hello world!");
	 * 
*/ fnAlert : function(sMsg) { alert(sMsg); }, /** * 提示窗口(带样式) * * @param sMsg * 消息 应用实例 * @param mArgs * 参数。窗口宽度(dialogWidth),窗口高度(dialogHeight) * *
	 * CFW.oWin.fnAlertStyle("hello world!");
	 * 或
	 * var mArgs = {'dialogWidth':'500px','dialogHeight':'250px'};
	 * CFW.oWin.fnAlertStyle("hello world!", "mArgs");
	 * 
*/ fnAlertStyle : function(sMsg, mArgs) { if(mArgs==null){ mArgs={type:'AppMsg'}; } this._fnAlert(sMsg, mArgs); }, /** * 提交form需要跟 配合起来使用 * * @param sf * 需要提交的foem * @param callBackFunction * 回调函数 * *
	 * CFW.oWin.fnSubmitForm("cxtjForm","testFresh()");
	 * 
*/ fnSubmitForm : function(sf,callBackFunction) { if(sf==null||sf==""){ alert("请输入要提交的Form"); return; } var form = document.getElementsByName(sf)[0]; if(callBackFunction==null){ callBackFunction = ""; } var height=$(window).height(); document.getElementById("div_body").style.display="none"; var formTarget = form.target; var backseq=$("#callBackFunction").attr("SEQ"); form.target = "callIframe_"+backseq; //$("#callIframe_"+backseq).height(height); form.submit(); //根据iframe中的内容高度来设置iframe高度 $("#callIframe_"+backseq).css("height","auto"); $("#"+form.target).unbind("load").load(function(){ var mainheight = $(this).contents().height();//页面内容的高度 var availHeight=document.documentElement.clientHeight;//工作区页面的高度 //alert("mainheight="+mainheight+"-------------------availHeight="+availHeight+"-------"+"-backseq---"+backseq); var contntH=mainheight; if(availHeight>mainheight){ contntH=availHeight; }else{ contntH=mainheight; } contntH=contntH-30; $(this).height(contntH); if($(this).attr("contentHeight")==undefined){ $(this).attr("contentHeight",contntH); } var doc = document, p = window; while(p = p.parent){ var frameId=$("iframe",p.document.getElementById('add_back_div')).attr("id"); if(frameId!="callIframe_"+backseq && contntH!=0 && frameId.indexOf("callIframe_")>-1){$("iframe",p.document.getElementById('add_back_div')).css("height",contntH+100);} if(p == top){ break; } } }); form.target =formTarget; document.getElementById("callBackFunction").value=callBackFunction; document.getElementById("add_back_div").style.display="block"; }, /** * 返回提交页面需要跟 配合起来使用 * * @param step * 返回前几个页面 * *
	 * CFW.oWin.fnGoCallBack(1);
	 * 
*/ fnGoCallBack : function(step) { if(step==null){ step = 1; } try{ var win=window; for(var i=0;i0){ var frameId=$("iframe",win.parent.document.getElementById('add_back_div')).attr("id"); var contentHeight=$("#"+frameId,win.parent.document.getElementById('add_back_div')).attr("contentHeight"); $("#"+frameId,win.parent.document.getElementById('add_back_div')).height(contentHeight); } //*/ }catch(e){ } }, /** * 确认提示对话窗口(带样式) * * @param sMsg * 消息 * @param mArgs * 参数。窗口宽度(dialogWidth),窗口高度(dialogHeight) *
	 * CFW.oWin.fnConfirmStyle("是否打印");
	 * 
	 * 或
	 * 
	 * var mArgs = {'dialogWidth':'500px','dialogHeight':'250px'};
	 * CFW.oWin.fnConfirmStyle("是否打印",mArgs);
	 * 
*/ fnConfirmStyle : function(sMsg, mArgs) { return this._fnConfirm(sMsg, mArgs); }, /** * 提示消息 * * @param sMsg * 消息 * @param fnCallback * 回调函数 应用实例 * *
	 * CFW.oWin.fnConfirm("是否打印", function(bResult) {
	 * 	if (bResult) {
	 * 
	 * 	} else {
	 * 
	 * 	}
	 * });
	 * 
*/ fnConfirm : function(sMsg, fnCallback) { // jQuery.fwmessager.confirm(msg,fn); //var fun = fun = window[fnCallback]; if (window.confirm(sMsg)) { if (fnCallback) { fnCallback.call(this,true); } } else if (fnCallback) { fnCallback.call(this,false); } return false; }, /** * 通用机构树弹出框 * * @param oOptions * 必须,JSON对象,具有属性 1. root:机构树的顶端机构的机构代码,例如'4419' 2. whereCls : * 树节点的查询条件,一般是'1=1'。 3. selected 已选结构的机构代码orgcocde 4. bussFuncId * 业务通办的业务ID * @return JSON对象,具有属性 1.title 机构名 2.key 机构代码 * *
	 * 例子:
	 * 	var rst = CFW.oWin.fnOpenOrgTree({root:orgCode,whereCls:'1=1'});
	 * if(!rst){//如果选择机构节点,则不处理
	 * 	return ;
	 * }else{
	 *  	document.qForm.ORGNAME.value = rst.title;
	 *  	document.qForm.BAE001.value = rst.key;
	 *  }
	 * 
*/ fnOpenOrgTree : function(oOptions) { var w = 350; var h = 500; var l = (screen.Width - w) / 2; var t = (screen.Height - h) / 2; var transpage = contextPath + "/jsp/framework/orgTree.jsp?"; var locStr = "dialogLeft:" + l + ";dialogTop:" + t; var position = "status:0;help:0;dialogWidth:" + w + "px;dialogHeight:" + h + "px;" + locStr; oOptions['_t'] = new Date().getTime(); var url = transpage + $.param(oOptions, true); return showModalDialog(url, null, position); }, _fnAlert : function(msg, args) { var parentdiv=$('
'); //创建一个父div parentdiv.attr('id','_exceptionWindow'); //给父div设置id parentdiv.addClass('window'); //添加css样式 parentdiv.css('display','none'); var msgdiv=$('
'); //创建一个子div msgdiv.attr('id','div_exception_context'); //给子div设置id msgdiv.css({ "width":"100%", "height":"100%" }); //添加css样式 msgdiv.appendTo(parentdiv); //将子div添加到父div中 var resultMsg = ''; msgdiv.empty().append(resultMsg); var dialogdiv=$('
'); //创建一个子div dialogdiv.attr('id','divMsgDialogBtn'); //给子div设置id dialogdiv.addClass('wfDialogBtn exception-btn-background'); //添加css样式 dialogdiv.css('display','block'); var confirmYbutton; var confirmNbutton; var closebutton; if(args['confrim'] == '1'){ confirmYbutton=$(''); //创建一个关闭按钮 confirmYbutton.attr('id','btn_confirm_yes'); confirmYbutton.addClass('buttonlink'); //添加css样式 confirmYbutton.attr('href','javascript:void(0);'); confirmYbutton.attr('keycomb',''); confirmYbutton.attr({"plain":"true"}); confirmYbutton.text('确认'); confirmYbutton.appendTo(dialogdiv); confirmNbutton=$(''); //创建一个关闭按钮 confirmNbutton.attr('id','btn_confirm_no'); confirmNbutton.addClass('buttonlink'); //添加css样式 confirmNbutton.attr('href','javascript:void(0);'); confirmNbutton.attr('keycomb',''); confirmNbutton.attr({"plain":"true"}); confirmNbutton.text('取消'); confirmNbutton.appendTo(dialogdiv); }else{ closebutton=$(''); //创建一个关闭按钮 closebutton.attr('id','btn_exception_close'); closebutton.addClass('buttonlink'); //添加css样式 closebutton.attr('href','javascript:void(0);'); closebutton.attr('keycomb',''); closebutton.attr({"plain":"true"}); closebutton.text('关闭'); closebutton.appendTo(dialogdiv); } dialogdiv.appendTo(parentdiv); //将子div添加到父div中 parentdiv.appendTo('body'); parentdiv.fwwindow({ title: '提示', noheader:true, width: 600, modal: true, shadow: false, closed: true, closable : false, height: 340 }); if(args['confrim'] == '1'){ confirmYbutton.linkbutton({plain:false}); confirmYbutton.unbind('click').click(function(){ parentdiv.fwwindow('close'); $('[name=exceptionForm]').remove(); parentdiv.fwwindow('destroy'); return 1; }); confirmNbutton.linkbutton({plain:false}); confirmNbutton.unbind('click').click(function(){ parentdiv.fwwindow('close'); $('[name=exceptionForm]').remove(); parentdiv.fwwindow('destroy'); return 0; }); }else{ closebutton.linkbutton({plain:false}); closebutton.unbind('click').click(function(){ parentdiv.fwwindow('close'); $('[name=exceptionForm]').remove(); parentdiv.fwwindow('destroy'); return 1; }); } var frag = document.createDocumentFragment(); var form = document.createElement("form"); form.name="exceptionForm"; form.action=contextPath + '/jsp/framework/alert.jsp?t='+new Date().getTime(); form.target='_exceptionFrame'; var str =" "; str+=" "; form.innerHTML=str; frag.appendChild(form); document.body.appendChild(frag); form.submit(); parentdiv.fwwindow('open'); }, _fnConfirm : function(msg, args) { args = args || {}; args['confrim'] = '1'; return this._fnAlert(msg, args); } };