text: (function($){window["BIONE"]={};BIONE.cookies=function(){var fn=function(){};fn.prototype.get=function(name){var cookieValue="";var search=name+"=";if(document.cookie.length>0){offset=document.cookie.indexOf(search);if(offset!=-1){offset+=search.length;end=document.cookie.indexOf(";",offset);if(end==-1)end=document.cookie.length;cookieValue=decodeURIComponent(document.cookie.substring(offset,end))}}return cookieValue};fn.prototype.set=function(cookieName,cookieValue,DayValue){var expire="";var day_value=1;if(DayValue!=null){day_value=DayValue}expire=new Date((new Date).getTime()+day_value*864e5);expire="; expires="+expire.toGMTString();document.cookie=cookieName+"="+encodeURIComponent(cookieValue)+";path=/"+expire};fn.prototype.remvoe=function(cookieName){var expire="";expire=new Date((new Date).getTime()-1);expire="; expires="+expire.toGMTString();document.cookie=cookieName+"="+escape("")+";path=/"+expire};return new fn}();BIONE.tip=function(message,time){var top=window.top;if(top.wintip){try{top.wintip.hide();top.wintip.doClose()}catch(e){console.log(e)}top.wintip=null}top.wintip=$.ligerDialog.tip({content:message});var tipid=top.wintip.id;top.closeTip=function(tipid){console.log(tipid);console.log(top.wintip.id);if(top.wintip.id==tipid)top.wintip.hide()};if(time==null)time=60*1e3;top.setTimeout(function(){top.closeTip(tipid)},time)};BIONE.prevLoadImage=function(rootpath,paths){for(var i in paths){$("<img />").attr("src",rootpath+paths[i])}};BIONE.showLoading=function(message){message=message||"正在加载中...";$("body").append("<div class='jloading'>"+message+"</div>");$.ligerui.win.mask()};BIONE.hideLoading=function(message){$("body > div.jloading").remove();$.ligerui.win.unmask({id:(new Date).getTime()})};BIONE.showSuccess=function(message,callback,config){if(typeof message=="function"||arguments.length==0){callback=message;message="操作成功!"}$.ligerDialog.success(message,"提示信息",callback,config)};BIONE.showError=function(message,callback,config){if(typeof message=="function"||arguments.length==0){callback=message;message="操作失败!"}$.ligerDialog.error(message,"提示信息",callback,config)};BIONE.prevDialogImage=function(rootPath){rootPath=rootPath||"";BIONE.prevLoadImage(rootPath+"lib/ligerUI/skins/Aqua/images/win/",["dialog-icons.gif"]);BIONE.prevLoadImage(rootPath+"lib/ligerUI/skins/Gray/images/win/",["dialogicon.gif"])};BIONE.ajax=function(options,callback){var p=options||{};var type=p.type||"get";var url=p.url;var async=p.async||"true";var dataType=p.dataType||"json";$.ajax({cache:false,async:async,url:url,dataType:dataType,type:type,data:p.data,beforeSend:function(){BIONE.loading=true;if(p.beforeSend)p.beforeSend();else BIONE.showLoading(p.loading)},complete:function(){if(p.complete){p.complete()}else{if(typeof BIONE!="undefined"){BIONE.loading=false;BIONE.hideLoading()}}},success:callback,error:function(result,b){if(result.status!=200){BIONE.tip("发现系统错误 <BR>错误码："+result.status)}}})};BIONE.getPageMenuNo=function(){var menuno=$("#MenuNo").val();if(!menuno){menuno=getQueryStringByName("MenuNo")}return menuno};BIONE.createButton=function(options){var p=$.extend({appendTo:$("body")},options||{});if(p.operNo&&top.window["protectedResOperNo"]){if($.inArray(p.operNo,top.window["protectedResOperNo"])!=-1){if(!top.window["authorizedResOperNo"]||$.inArray(p.operNo,top.window["authorizedResOperNo"])==-1){return}}}var hasIcon=false;if(p.icon){hasIcon=true}var btnHtml="<div ";if(p.id){btnHtml=btnHtml+'id="'+p.id+'" class="l-btn'}else{btnHtml=btnHtml+'class="l-btn'}if(hasIcon){btnHtml=btnHtml+" l-btn-hasicon"}btnHtml+='"><span></span></div>';var btn=$(btnHtml);var $i=null;if(p.icon){$i=$('<i class="icon-'+p.icon+'" style ="color : #fff;line-height:2em"> </i> ');btn.prepend($i)}if(p.width){btn.width(p.width)}if(p.click){btn.click(p.click)}if(p.text){if($i)$i.html("&nbsp"+p.text);else $("span",btn).html(p.text)}if(typeof p.appendTo=="string"){var space=30;var iconwidth=0;var prewidth=0;var num=$(p.appendTo+" .l-btn").length;p.appendTo=$(p.appendTo);if(num!=0)prewidth=p.appendTo.width();if(hasIcon)iconwidth=10;if(false!=p.isCountWidth){p.appendTo.width(prewidth+parseInt(p.width)+space+iconwidth)}}btn.appendTo(p.appendTo)};BIONE.bulidFilterGroup=function(form){if(!form)return null;var group={op:"and",rules:[]};$(":input",form).not(":submit, :reset, :image,:button, [disabled]").each(function(){if(!this.name)return;if($(this).val()==null||$(this).val()=="")return;if($(this).attr("field")==null||$(this).attr("field")=="")return;var ltype=$(this).attr("ltype");var optionsJSON=$(this).attr("ligerui"),options="";if(optionsJSON){options=JSON2.parse(optionsJSON)}var field=$(this).attr("field");var op=$(this).attr("op")||"=";var type=$(this).attr("vt")||"string";var value=$(this).val();if(ltype=="select"&&options&&options.valueFieldID){value=$("#"+options.valueFieldID).val();name=options.valueFieldID}group.rules.push({op:op,field:field,value:value,type:type})});return group};BIONE.addSearchButtons=function(form,grid,btnContainer){if(!form)return;form=$(form);if(btnContainer){BIONE.createButton({appendTo:btnContainer,text:"搜索",icon:"search",click:function(){BIONE.validate($("#formsearch"));if($("#formsearch").valid()){var rule=BIONE.bulidFilterGroup(form);if(rule.rules.length){grid.setParm("condition",JSON2.stringify(rule));grid.setParm("newPage",1);grid.options.newPage=1}else{grid.setParm("condition","");grid.setParm("newPage",1);grid.options.newPage=1}grid.loadData()}}});BIONE.createButton({appendTo:btnContainer,text:"重置",icon:"refresh2",click:function(){$(":input",form).not(":submit, :reset,:hidden,:image,:button, [disabled]").each(function(){$(this).val("")});$(":input[ltype=combobox]",form).each(function(){var ligerid=$(this).attr("data-ligerid"),ligerItem=$.ligerui.get(ligerid);if(ligerid&&ligerItem&&ligerItem.clear){ligerItem.clear()}else{$(this).val("")}});$(":input[ltype=select]",form).each(function(){var ligerid=$(this).attr("data-ligerid"),ligerItem=$.ligerui.get(ligerid);if(ligerid&&ligerItem&&ligerItem.clear){ligerItem.clear()}else{$(this).val("")}})}})}};BIONE.setFormDefaultBtn=function(cancleCallback,savedCallback){var buttons=[];if(cancleCallback){buttons.push({text:"取消",onclick:cancleCallback})}if(savedCallback){buttons.push({text:"保存",onclick:savedCallback})}BIONE.addFormButtons(buttons)};BIONE.addFormButtons=function(buttons,flag){if(!buttons)return;var formbar=$("div.form-bar");if(formbar.length==0&&flag)formbar=$('<div class="form-bar"><div class="form-bar-inner"></div></div>').appendTo("body");if(!(buttons instanceof Array)){buttons=[buttons]}$(buttons).each(function(i,o){var btn=$('<div class="l-dialog-btn"><div class="l-dialog-btn-l"></div><div class="l-dialog-btn-r"></div><div class="l-dialog-btn-inner"></div></div> ');$("div.l-dialog-btn-inner:first",btn).html(o.text||"BUTTON");if(o.onclick){btn.bind("click",function(){o.onclick(o)})}if(o.width){btn.width(o.width)}$("> div:first",formbar).append(btn)})};BIONE.loadForm=function(mainform,options){options=options||{};function f_loadform(data){for(var p in data){var ele=$("[name="+p+"]");if(ele.is(":checkbox,:radio")){ele[0].checked=data[p]?true:false}else if(ele.is(":text")&&ele.attr("ltype")=="date"){if(data[p]){var date=null;if(data[p].time){date=new Date(data[p].time)}else{var tdate;if(typeof data[p]=="string"&&data[p].indexOf("-")!=-1&&data[p].length>=10){tdate=new Date(new Number(data[p].substr(0,4)),new Number(data[p].substr(5,2))-1,new Number(data[p].substr(8,2)))}else{tdate=new Date(data[p])}date=new Date(tdate)}var yy=date.getFullYear();var Mm=date.getMonth()+1<10?"0"+(date.getMonth()+1):date.getMonth()+1;var dd=date.getDate()<10?"0"+date.getDate():date.getDate();ele.val(yy+"-"+Mm+"-"+dd)}}else if(ele.attr("ltype")=="radiolist"||ele.attr("ltype")=="checkboxlist"){$.ligerui.get(ele.attr("data-ligerid")).setValue(data[p])}else{ele.val(data[p])}}var managers=$.ligerui.find($.ligerui.controls.Input);for(var i=0,l=managers.length;i<l;i++){var o=managers[i];o.updateStyle();if(o.inputText){o.inputText.blur()}if(managers[i]instanceof $.ligerui.controls.TextBox)o.checkValue()}BIONE.hideLoading()}BIONE.ajax(options,f_loadform)};BIONE.submitForm=function(mainform,successOwn,error){if(!mainform)mainform=$("form:first");if(mainform.valid()){mainform.ajaxSubmit({dataType:"json",success:function(result){BIONE.hideLoading();successOwn(result)},beforeSubmit:function(formData,jqForm,options){$(":checkbox,:radio",jqForm).each(function(){if(!existInFormData(formData,this.name)&&this.name){formData.push({name:this.name,type:this.type,value:this.checked})}});for(var i=0,l=formData.length;i<l;i++){var o=formData[i];if(o.type=="checkbox"||o.type=="radio"){o.value=$("[name="+o.name+"]",jqForm)[0].checked?"true":"false"}}},beforeSend:function(a,b,c){BIONE.showLoading("正在保存数据中...")},complete:function(){},error:function(result){BIONE.hideLoading();BIONE.tip("发现系统错误 <BR>错误码："+result.status)}})}else{BIONE.showInvalid()}function existInFormData(formData,name){for(var i=0,l=formData.length;i<l;i++){var o=formData[i];if(o.name==name)return true}return false}};BIONE.showInvalid=function(validator){validator=validator||BIONE.validator;if(!validator)return;var message='<div class="invalid">存在'+validator.errorList.length+"个字段验证不通过，请检查!</div>";$.ligerDialog.error(message)};BIONE.validate=function(form,options){if(typeof form=="string")form=$(form);else if(typeof form=="object"&&form.NodeType==1)form=$(form);options=$.extend({ignore:"",errorPlacement:function(lable,element){if(element.hasClass("l-textarea")){element.addClass("l-textarea-invalid")}else if(element.hasClass("l-text-field")){element.parent().addClass("l-text-invalid")}var nextCell=element.parents("li:first").next("li");nextCell.find("div.l-exclamation").remove();$('<div class="l-exclamation" title="'+lable.html()+'"></div>').appendTo(nextCell).ligerTip()},success:function(lable){var element=$("#"+lable.attr("for"));if(!element.attr("id"))element=$("input[name='"+lable.attr("for")+"']:last");var nextCell=element.parents("li:first").next("li");if(element.hasClass("l-textarea")){element.removeClass("l-textarea-invalid")}else if(element.hasClass("l-text-field")){element.parent().removeClass("l-text-invalid")}nextCell.find("div.l-exclamation").remove();$(".l-verify-tip").remove()},width:200},options||{});BIONE.validator=form.validate(options);return BIONE.validator};BIONE.loadToolbar=function(grid,btns,toolbarBtnItemClick){if(!grid.toolbarManager)return;if(!btns||!btns.length)return;var items=[];for(var i=0,l=btns.length;i<l;i++){var o=btns[i];if(o.operNo&&top.window["protectedResOperNo"]){if($.inArray(o.operNo,top.window["protectedResOperNo"])!=-1){if(!top.window["authorizedResOperNo"]||$.inArray(o.operNo,top.window["authorizedResOperNo"])==-1){continue}}}if(!o.color)o.color="#3c8dbc";items[items.length]={click:o.click||toolbarBtnItemClick,text:o.text,icon:o.icon,id:o.operNo,menu:o.menu,color:o.color};items[items.length]={line:true}}grid.toolbarManager.set("items",items)};BIONE.loadTreeToolbar=function(grid,btns,toolbarBtnItemClick){if(!grid.treetoolbarManager)return;if(!btns||!btns.length)return;var items=[];for(var i=0,l=btns.length;i<l;i++){var o=btns[i];if(o.operNo&&top.window["protectedResOperNo"]){if($.inArray(o.operNo,top.window["protectedResOperNo"])!=-1){if(!top.window["authorizedResOperNo"]||$.inArray(o.operNo,top.window["authorizedResOperNo"])==-1){continue}}}items[items.length]={click:o.click||toolbarBtnItemClick,text:o.text,icon:o.icon,id:o.operNo,menu:o.menu};items[items.length]={line:true}}grid.toolbarManager.set("items",items)};BIONE.setGridDoubleClick=function(grid,btnID,btnItemClick){btnItemClick=btnItemClick||toolbarBtnItemClick;if(!btnItemClick)return;grid.bind("dblClickRow",function(rowdata){var item=BIONE.findToolbarItem(grid,btnID);if(!item)return;grid.select(rowdata);btnItemClick(item)})};BIONE.closeDialog=function(dialogName,message,flag,data,time){var main=parent||window;var dialog=main.jQuery.ligerui.get(dialogName);if(dialog.beforeClose!=null&&typeof dialog.beforeClose=="function"&&flag!=null&&flag==true){dialog.beforeClose(data)}dialog.close();if(message){main.BIONE.tip(message,time)}};BIONE.closeDialogAndReloadParent=function(dialogName,gridName,message){var main=parent||window;var dialog=main.jQuery.ligerui.get(dialogName);dialog.close();main.jQuery.ligerui.get(gridName).loadData();if(message){main.BIONE.tip(message)}};BIONE.closeIconDialog=function(dialogName,src){var main=parent||window;var dialog=main.jQuery.ligerui.get(dialogName);var c=main.jQuery.ligerui.get(dialog.options.comboxName);c._changeValue(src,src);dialog.close()};BIONE.commonOpenToolDialog=function commonOpenDialog(title,name,width,height,url,comboxName,beforeClose){var _dialog=$.ligerui.get(name);if(_dialog){$.ligerui.remove(name)}_dialog=$.ligerDialog.open({height:height,width:width,url:url,name:name,id:name,title:title,showMax:true,showMin:true,comboxName:comboxName,isResize:false,isDrag:false,isHidden:false});if(beforeClose!=null&&typeof beforeClose=="function"){_dialog.beforeClose=beforeClose}return _dialog};BIONE.commonOpenDialog=function commonOpenDialog(title,name,width,height,url,comboxName,beforeClose){var mheight=document.body.scrollHeight-10;var mwidth=document.body.clientWidth+5;if(mwidth>0&&width>mwidth){width=mwidth}if(mheight>0&&height>mheight){height=mheight}var _dialog=$.ligerui.get(name);if(_dialog){$.ligerui.remove(name)}_dialog=$.ligerDialog.open({height:height,width:width,url:url,name:name,id:name,title:title,comboxName:comboxName,isResize:false,isDrag:true,isHidden:false});if(beforeClose!=null&&typeof beforeClose=="function"){_dialog.beforeClose=beforeClose}return _dialog};BIONE.commonOpenSmallDialog=function commonOpenSmallDialog(title,name,url,beforeClose){var width=600;var height=320;var _dialog=$.ligerui.get(name);if(_dialog){$.ligerui.remove(name)}_dialog=$.ligerDialog.open({height:height,width:width,url:url,name:name,id:name,title:title,isResize:false,isDrag:true,isHidden:false});if(beforeClose!=null&&typeof beforeClose=="function"){_dialog.beforeClose=beforeClose}return _dialog};BIONE.commonOpenFullDialog=function commonOpenFullDialog(title,name,url,comboxName,beforeClose){if(url.indexOf("=")!=-1&&url.indexOf("?")!=-1){url=url+"&d="+(new Date).getTime()}else{url=url+"?d="+(new Date).getTime()}var height=document.body.clientHeight-10;var width=document.body.clientWidth+5;var _dialog=$.ligerui.get(name);if(_dialog){$.ligerui.remove(name)}_dialog=$.ligerDialog.open({height:height,width:width,url:url,name:name,id:name,title:title,comboxName:comboxName,isResize:false,isDrag:false,isHidden:false});if(beforeClose!=null&&typeof beforeClose=="function"){_dialog.beforeClose=beforeClose}return _dialog};BIONE.commonOpenLargeDialog=function commonOpenLargeDialog(title,name,url,beforeClose){var width=800;var height=460;var _dialog=$.ligerui.get(name);if(_dialog){$.ligerui.remove(name)}_dialog=$.ligerDialog.open({height:height,width:width,url:url,name:name,id:name,title:title,isResize:false,isDrag:true,isHidden:false});if(beforeClose!=null&&typeof beforeClose=="function"){_dialog.beforeClose=beforeClose}return _dialog};BIONE.commonOpenIconDialog=function commonOpenLargeDialog(title,name,url,comboxName,beforeClose){var width=480;var height=350;var _dialog=$.ligerui.get(name);if(_dialog){$.ligerui.remove(name)}_dialog=$.ligerDialog.open({height:height,width:width,url:url,name:name,id:name,title:title,isResize:false,isDrag:false,isHidden:false,comboxName:comboxName});if(beforeClose!=null&&typeof beforeClose=="function"){_dialog._beforeClose=beforeClose}return _dialog};BIONE.refreshAsyncTreeNodes=function(treeObj,paramName,paramValue,reloadType){if(treeObj&&treeObj.setting&&paramValue!=null){if(reloadType==null||reloadType==""){reloadType="refresh"}if(paramName==null||paramName==""){paramName="id"}var refreshNode=treeObj.getNodeByParam(paramName,paramValue,null);treeObj.reAsyncChildNodes(refreshNode,reloadType,false)}};BIONE.paramTransformer=function(paramValue,url,paramTypeNo){var result="";var data="";if(paramTypeNo){data="paramTypeNo="+paramTypeNo+"&paramValue="+paramValue}else{data="paramValue="+paramValue}$.ajax({cache:false,async:false,url:url,dataType:"text",type:"post",data:data,success:function(data){result=data}});return result};BIONE.BIONETree=function(target,options){if(!$.fn.zTree||typeof $.fn.zTree=="undefined"||!target||typeof target=="undefined"){return null}var defaultOpt={dataType:"local",nodes:[],url:false,ajaxType:"json",method:"post",dataFilter:null,onceInit:false,commonParam:[],autoParam:[],keepParent:false,keepLeaf:false,idKey:"id",pIdKey:"upId",rootPIdKey:null,checkedKey:"checked",childrenKey:"children",nameKey:"text",tipKey:"",checkbox:false,chkStyle:"checkbox",radioType:"level",chkedEft_p:true,chkedEft_c:true,chkOffEft_p:true,chkOffEft_c:true,editEnable:false,removeTitle:"remove",showRemoveBtn:true,autoCancelSelected:true,selectedMulti:false,showTip:true,showIcon:true,showLine:true,beforeCheck:null,beforeClick:null,beforeRemove:null,onCheck:null,onClick:null,onRemove:null};var p=defaultOpt;if(options&&typeof options=="object"){if(options.dataType&&typeof options.dataType!="undefine"&&(options.dataType=="local"||options.dataType=="server")){p.dataType=options.dataType}if(options.nodes&&typeof options.nodes=="object"){if(options.nodes instanceof Array){p.nodes=options.nodes}}if(options.url&&typeof options.url!="undefined"){p.url=options.url}if(options.ajaxType&&typeof options.ajaxType!="undefined"){p.ajaxType=options.ajaxType}if(options.method&&typeof options.method!="undefined"){if(options.method.toLowerCase()=="get"||options.method.toLowerCase()=="post"){p.method=options.method.toLowerCase()}}if(options.onceInit&&typeof options.onceInit!="undefined"){p.onceInit=options.onceInit}if(options.commonParam&&typeof options.commonParam!="undefined"){if(typeof options.commonParam=="object"){if(options.commonParam instanceof Array){var paramArray=options.commonParam;var newObj={};var newArray=[];if(paramArray.length>0&&paramArray.length%2!=0){for(var tmp=0;tmp<paramArray.length-1;tmp++){newArray.push(paramArray[tmp])}}else{newArray=paramArray}for(var i=0;i<newArray.length;i+=2){newObj[newArray[i]]=newArray[i+1]}p.commonParam=newObj}else{p.commonParam=options.commonParam}}}if(options.autoParam&&typeof options.autoParam=="object"&&options.autoParam instanceof Array){p.autoParam=options.autoParam}if(options.keepParent&&typeof options.keepParent!="undefined"){p.keepParent=options.keepParent}if(options.keepLeaf&&typeof options.keepLeaf!="undefined"){p.keepLeaf=options.keepLeaf}if(options.idKey&&typeof options.idKey!="undefined"){p.idKey=options.idKey}if(options.pIdKey&&typeof options.pIdKey!="undefined"){p.pIdKey=options.pIdKey}if(options.rootPIdKey&&typeof options.rootPIdKey!="undefined"){p.rootPIdKey=options.rootPIdKey}if(options.checkedKey&&typeof options.checkedKey!="undefined"){p.checkedKey=options.checkedKey}if(options.childrenKey&&typeof options.childrenKey!="undefined"){p.childrenKey=options.childrenKey}if(options.nameKey&&typeof options.nameKey!="undefined"){p.nameKey=options.nameKey}if(options.tipKey&&typeof options.tipKey!="undefined"){p.tipKey=options.tipKey}if(options.autoCancelSelected&&typeof options.autoCancelSelected!="undefined"){p.autoCancelSelected=options.autoCancelSelected}if(options.selectedMulti&&typeof options.selectedMulti!="undefined"){p.selectedMulti=options.selectedMulti}if(options.showTip&&(typeof options.showTip=="boolean"||typeof options.showTip=="function")){p.showTip=options.showTip}if(options.showIcon&&(typeof options.showIcon=="boolean"||typeof options.showIcon=="function")){p.showIcon=options.showIcon}if(options.showLine&&typeof options.showLine!="undefined"){p.showLine=options.showLine}if(options.checkbox&&typeof options.checkbox=="boolean"){p.checkbox=options.checkbox}if(options.chkStyle&&typeof options.chkStyle!="undefined"&&(options.chkStyle=="checkbox"||options.chkStyle=="radio")){p.chkStyle=options.chkStyle}if(options.chkedEft_p&&typeof options.chkedEft_p=="boolean"){p.chkedEft_p=options.chkedEft_p}if(options.chkedEft_c&&typeof options.chkedEft_c=="boolean"){p.chkedEft_c=options.chkedEft_c}if(options.chkOffEft_p&&typeof options.chkOffEft_p=="boolean"){p.chkOffEft_p=options.chkOffEft_p}if(options.chkOffEft_c&&typeof options.chkOffEft_c=="boolean"){p.chkOffEft_c=options.chkOffEft_c}if(options.editEnable&&typeof options.editEnable=="boolean"){p.editEnable=options.editEnable}if(options.removeTitle&&typeof options.removeTitle!="undefined"){p.removeTitle=options.removeTitle}if(options.showRemoveBtn&&typeof options.showRemoveBtn!="undefined"){p.showRemoveBtn=options.showRemoveBtn}if(options.beforeCheck&&typeof options.beforeCheck=="function"){p.beforeCheck=options.beforeCheck}if(options.beforeClick&&typeof options.beforeClick=="function"){p.beforeClick=options.beforeClick}if(options.beforeRemove&&typeof options.beforeRemove=="function"){p.beforeRemove=options.beforeRemove}if(options.onCheck&&typeof options.onCheck=="function"){p.onCheck=options.onCheck}if(options.onClick&&typeof options.onClick=="function"){p.onClick=options.onClick}if(options.onRemove&&typeof options.onRemove=="function"){p.onRemove=options.onRemove}}var setting={};var nodes=[];var view={autoCancelSelected:p.autoCancelSelected,selectedMulti:p.selectedMulti,showLine:p.showLine,showTip:true,showIcon:true};if(p.showTip){if(typeof p.showTip=="function"){view.showTip=p.showTip}else if(typeof p.showTip=="boolean"){view.showTip=p.showTip}}if(p.showIcon){if(typeof p.showIcon=="function"){view.showIcon=p.showIcon}}if(p.editEnable){var edit={enable:true,removeTitle:p.removeTitle,showRemoveBtn:p.showRemoveBtn};if(p.showRemoveBtn){if(typeof p.showRemoveBtn=="function"){edit.showRemoveBtn=p.showRemoveBtn}}setting.edit=edit}var data={keep:{leaf:p.keepLeaf,parent:p.keepParent},key:{checked:p.checkedKey,children:p.childrenKey,name:p.nameKey,title:p.tipKey},simpleData:{enable:true,idKey:p.idKey,pIdKey:p.pIdKey,rootPId:p.rootPIdKey}};if(p.checkbox){var check={enable:true,chkStyle:p.chkStyle,radioType:p.radioType};var type={Y:"",N:""};var yTmp="";if(p.chkedEft_p){yTmp=yTmp+"p"}if(p.chkedEft_c){yTmp=yTmp+"s"}var nTmp="";if(p.chkOffEft_p){nTmp=nTmp+"p"}if(p.chkOffEft_c){nTmp=nTmp+"s"}type.Y=yTmp;type.N=nTmp;check.chkboxType=type;setting.check=check}var callback={beforeCheck:null,beforeClick:null,beforeRemove:null,onCheck:null,onClick:null,onRemove:null};if(p.beforeCheck!=null&&typeof p.beforeCheck=="function"){callback.beforeCheck=p.beforeCheck}if(p.beforeClick!=null&&typeof p.beforeClick=="function"){callback.beforeClick=p.beforeClick}if(p.beforeRemove!=null&&typeof p.beforeRemove=="function"){callback.beforeRemove=p.beforeRemove}if(p.onCheck!=null&&typeof p.onCheck=="function"){callback.onCheck=p.onCheck}if(p.onClick!=null&&typeof p.onClick=="function"){callback.onClick=p.onClick}if(p.onRemove!=null&&typeof p.onRemove=="function"){callback.onRemove=p.onRemove}setting.callback=callback;if(p.dataType=="local"){nodes=p.nodes}else if(p.dataType=="server"&&p.url&&p.onceInit){var async={enable:false,dataType:p.ajaxType,type:p.method,url:p.url,otherParam:p.commonParam};setting.async=async;$.ajax({cache:false,async:false,url:p.url,dataType:p.ajaxType,data:p.commonParam,type:p.method,success:function(result){if(result&&typeof result=="object"){if(result instanceof Array){for(var j=0;j<p.nodes.length;j++){nodes.push(p.nodes[j])}for(var i=0;i<result.length;i++){nodes.push(result[i])}}}},error:function(result,b){}})}else if(p.dataType=="server"&&p.url&&!p.onceInit){data.simpleData.enable=false;var async={enable:true,dataType:p.ajaxType,type:p.method,url:p.url,otherParam:p.commonParam,autoParam:p.autoParam};setting.async=async}setting.view=view;setting.data=data;var returnTree=$.fn.zTree.init(target,setting,nodes);returnTree.baseNodes=p.nodes;returnTree["getTreeById"]=function(treeId){if(treeId!=null){return $.fn.zTree.getZTreeObj(treeId)}};if(p.dataType=="server"&&!p.onceInit&&p.url){returnTree["refreshTree"]=function(treeNode){var treeObj=this;if(treeNode){treeObj.reAsyncChildNodes(treeNode,"refresh")}else{treeObj.reAsyncChildNodes(null,"refresh")}}}else if(p.dataType=="server"&&p.url&&p.onceInit){returnTree["refreshTree"]=function(){var treeObj=this;treeObj.removeAll();$.ajax({cache:false,async:false,url:treeObj.setting.async.url,dataType:treeObj.setting.async.ajaxType,data:treeObj.setting.async.commonParam,type:treeObj.setting.async.method,success:function(result){if(result&&typeof result=="object"){if(result instanceof Array){var nodes=treeObj.baseNodes;for(var i=0;i<result.length;i++){nodes.push(result[i])}treeObj.addNodes(null,nodes)}}},error:function(result,b){}})}}returnTree["removeAll"]=function(){var treeObj=this;var nodes=treeObj.getNodes();var tIdArray=[];if(nodes!=null){for(var i=0;i<nodes.length;i++){tIdArray.push(nodes[i].tId)}for(var j=0;j<tIdArray.length;j++){var nodeReal=treeObj.getNodeByParam("tId",tIdArray[j],null);if(nodeReal!=null){treeObj.removeChildNodes(nodeReal);treeObj.removeNode(nodeReal)}}}};return returnTree};BIONE.getFormatDate=function(dateobj,dateformat){var date=null;if(dateobj.time){date=new Date(dateobj.time)}else{date=new Date(dateobj)}if(isNaN(date))return null;var format=dateformat;var o={"M+":date.getMonth()+1,"d+":date.getDate(),"h+":date.getHours(),"m+":date.getMinutes(),"s+":date.getSeconds(),"q+":Math.floor((date.getMonth()+3)/3),S:date.getMilliseconds()};if(/(y+)/.test(format)){format=format.replace(RegExp.$1,(date.getFullYear()+"").substr(4-RegExp.$1.length))}for(var k in o){if(new RegExp("("+k+")").test(format)){format=format.replace(RegExp.$1,RegExp.$1.length==1?o[k]:("00"+o[k]).substr((""+o[k]).length))}}return format};BIONE.loadTree=function(url,component,data,initData,expandFlag,topFlag,loaded){$.ajax({cache:false,async:true,url:url,dataType:"json",data:data,type:"post",beforeSend:function(){var $w=window.top;if(topFlag==false){$w=window}$w.BIONE.loading=true;$w.BIONE.showLoading("正在加载数据中...")},complete:function(){var $w=window.top;if(topFlag==false){$w=window}$w.BIONE.loading=false;$w.BIONE.hideLoading()},success:function(result){var nodes=component.getNodes();if(typeof initData=="function"){result=initData(result)}var num=nodes.length;for(var i=0;i<num;i++){component.removeNode(nodes[0],false)}if(result.length>0){component.addNodes(null,result,false);if(expandFlag==null||!expandFlag==false){component.expandAll(true)}}if(typeof loaded=="function"){result=loaded()}},error:function(result,b){}})};BIONE.polling=function(interval,maxConnections){var g=this,ctx=function(){var contextPath=document.location.pathname;var index=contextPath.substr(1).indexOf("/");contextPath=contextPath.substr(0,index+1);delete index;return contextPath}();window.tipCache=window.tipCache||[];interval=interval||3e5;maxConnections=maxConnections||200;window.refreshMsg=function(timeout,flag){var messagesUrl=ctx+"/bione/msgNoticeLog/showMsgState?d="+(new Date).getTime();$.ajax({url:messagesUrl,dataType:"json",error:function(request,error,status){g.polling(interval)},success:function(data){if(data.msgSts){$("#msg span").attr("class","new");$("#msg span").html('<B>有新消息</B><a style="color:red">('+data.msgNum+")</a>")}else{$("#msg span").attr("class","old");$("#msg span").html("消息")}if(flag){g.polling(g.recomputTimeout(timeout,data["count"]))}}})};this.recomputTimeout=function(timeout,current){return!current?timeout:(1+current/maxConnections)*timeout};this.polling=function(timeout){setTimeout(function(){window.refreshMsg(timeout,true)},timeout)};window.refreshMsg(interval,false);this.polling(interval)}})(jQuery);
  