/*
 * 自动完成控件
 * 创建人：qinnailin
 * 创建时间：2014/8/1
 *
 *
 * 
 */
(function(A){A.fn.autoComplete=function(C){var D=A.extend({url:"",data:null,source:"",value:null,key:"id",text:"name",maxSize:10,width:"auto",change:function(H){},offset:null},C||{});var B=A(this);var G;var E;A(B).parent().append('<ul class="typeahead dropdown-menu"></ul>');A(this).attr("autocomplete","off");if(D.width=="auto"){A(".dropdown-menu").width(A(B).width())}else{if(!isNaN(D.width)){A(".dropdown-menu").width(D.width)}}if(D.offset!=null){A(B).next(".dropdown-menu").css({top:D.offset.Top+"px",left:D.offset.Left+"px"})}A(B).keyup(function(){var J=A(B).val();if(J==""){if(D.value){A("input[name="+D.value+"]").val("")}A(B).siblings("ul:first").hide();A(B).siblings("ul:first li").remove();E="";return}if(E!=J){E=J}else{return false}if(D.data){var H=new Array();A.each(D.data,function(K,L){if(L[D.text].indexOf(J)>-1){H.push(L)}});G=H;F(H)}else{if(D.url!=""){var I="{"+A(B).attr("name")+":'"+J+"',maxSize:"+D.maxSize+"}";A.get(D.url,stringToJSON(I),function(L){G=L;if(D.source!=""){var M=L;var K=D.source.split(".");A.each(K,function(N,O){if(O!=""){M=M[O]}});G=M}F(G)})}}});function F(L){if(L&&L.length>0){var H="";var K="<li style='display:inline'><a data-id='{{"+D.key+"}}' href='javascript:' >{{"+D.text+"}}</a></li>";for(var I=0;I<L.length&&I<10;I++){var J=L[I];H+=K.fill(J)}A(B).siblings("ul:first").html(H).show()}}A(document).ready(function(){A(".dropdown").on("click","ul li a",function(){var J=A(this).text();var K=A(this).attr("data-id");A(B).val(J);if(D.value){A("input[name="+D.value+"]").val(K)}A(B).siblings("ul:first").hide();A(B).focus();var I;for(var H=0;H<G.length;H++){if(G[H][D.key]==K){I=G[H];break}}E="";D.change(I)});A(".dropdown").on("mousemove","ul",function(){if(A(".dropdown").find(".active").get(0)){A(".dropdown").find(".active").removeClass("active")}});A(B).keyup(function(I){if(event.keyCode==40){if(A(".dropdown").find(".active").get(0)){A(".dropdown").find(".active").removeClass("active").next("li").addClass("active");if(!A(".dropdown").find(".active").get(0)){A(".dropdown").find("li:first").addClass("active")}}else{A(".dropdown").find("li:first").addClass("active")}}else{if(event.keyCode==38){if(A(".dropdown").find(".active").get(0)){A(".dropdown").find(".active").removeClass("active").prev("li").addClass("active");if(!A(".dropdown").find(".active").get(0)){A(".dropdown").find("li:last").addClass("active")}}else{A(".dropdown").find("li:last").addClass("active")}}else{if(event.keyCode==13){var K;var H;if(A(".dropdown").find(".active").get(0)){H=A(".dropdown").find(".active>a").eq(0)}else{H=A(".dropdown").find("li:first>a")}var L=A(H).text();var M=A(H).attr("data-id");A(B).val(L);if(D.value){A("input[name="+D.value+"]").val(M)}A(B).siblings("ul:first").hide();A(B).focus();for(var J=0;J<G.length;J++){if(G[J][D.key]==M){K=G[J];break}}E="";D.change(K)}}}})})}})(jQuery);
/*
 * 基础类
 * 创建人：qinnailin
 * 创建时间：2014/7/16 
 *
 *
 * 
 */
var isparent=false;if(top.location==self.location){isparent=true}if("addEventListener" in document){window.addEventListener("message",function(e){var func=e.data;if(func&&func!=""){window.eval(func)}},false)}else{if("attachEvent" in document){window.attachEvent("onmessage",function(e){var func=e.data;if(func&&func!=""){window.eval(func)}})}}function crossdomain(A,B){if(B!=null){var C=typeof(B);if(C=="string"&&B!=""){B="'"+B+"'"}else{B=B+""}}else{B=""}window.parent.postMessage(""+A+"("+B+")","*")}$(document).ready(function(){$(document).ajaxStart(function(){try{if(loading&&!document.getElementById("show-middle-modal-content")){loading(true)}}catch(e){}});$(document).ajaxError(function(){try{if(loading){errormsg("服务器发生错误！！")}}catch(e){}});$(document).ajaxSuccess(function(e,req,s){if(s.dataTypes&&s.dataTypes.length>0&&s.dataTypes[1]=="json"){var data=eval("("+req.responseText+")");if(data.login==true||data.login==""){if(parent.window){parent.window.location.reload()}else{window.location.reload()}return false}if(data.utrymsg&&data.utrymsg!=""){alertui(data.utrymsg)}}try{if(loading){setTimeout("loading(false)",500)}}catch(e){}});$(window).resize(function(){setLayout()});setLayout()});function resertLayout(){if($(".main-box").get(0)){var D=getborder($("body"));var A=parseFloat($(window).height())-parseFloat(D);var C=$(".main-box").eq(0);if($(".main-box").eq(0).height()!=(A-getborder(C))){setLayout()}}if(parseInt($.browser.version)<8){for(var B=0;B<12;B++){if(parseFloat($(".span"+B).width())>0){$(".span"+B).width(parseFloat($(".span"+B).width()-1))}}setLayout()}}function setLayout(){if($(".main-box").get(0)){var C=getborder($("body"));var A=parseFloat($(window).height())-parseFloat(C);var B=$(".main-box").eq(0);$(".main-box").eq(0).height(A-getborder(B))}if($(".layout-box").get(0)){$(".layout-box").each(function(D,E){if($(E).find(".layout-center").get(0)){var F=$(E).find(".layout-center").eq(0);findlayout(F)}})}}function getborder(A){return getotborder(A)+getodborder(A)}function getborderSm(A){var B=$(A).css("margin-top");var F=$(A).css("margin-bottom");var C=$(A).css("border-top-width");var G=$(A).css("border-bottom-width");var E=0;if(B){var D=parseFloat(B.replace("px",""));if(!isNaN(D)){E+=D}}if(F){var D=parseFloat(F.replace("px",""));if(!isNaN(D)){E+=D}}if(C){var D=parseFloat(C.replace("px",""));if(!isNaN(D)){E+=D}}if(G){var D=parseFloat(G.replace("px",""));if(!isNaN(D)){E+=D}}return E}function getwborder(A){return getolwborder(A)+getorwborder(A)}function getolwborder(A){var B=$(A).css("padding-left");var C=$(A).css("margin-left");var D=$(A).css("border-left-width");var F=0;if(B){var E=parseFloat(B.replace("px",""));if(!isNaN(E)){F+=E}}if(C){var E=parseFloat(C.replace("px",""));if(!isNaN(E)){F+=E}}if(D){var E=parseFloat(D.replace("px",""));if(!isNaN(E)){F+=E}}return F}function getorwborder(A){var C=$(A).css("padding-right");var E=$(A).css("margin-right");var F=$(A).css("border-right-width");var D=0;if(C){var B=parseFloat(C.replace("px",""));if(!isNaN(B)){D+=B}}if(E){var B=parseFloat(E.replace("px",""));if(!isNaN(B)){D+=B}}if(F){var B=parseFloat(F.replace("px",""));if(!isNaN(B)){D+=B}}return D}function getotborder(A){var B=$(A).css("padding-top");var C=$(A).css("margin-top");var D=$(A).css("border-top-width");var F=0;if(B){var E=parseFloat(B.replace("px",""));if(!isNaN(E)){F+=E}}if(C){var E=parseFloat(C.replace("px",""));if(!isNaN(E)){F+=E}}if(D){var E=parseFloat(D.replace("px",""));if(!isNaN(E)){F+=E}}return F}function getontborder(A){var B=$(A).css("margin-top");var C=$(A).css("border-top-width");var E=0;if(B){var D=parseFloat(B.replace("px",""));if(!isNaN(D)){E+=D}}if(C){var D=parseFloat(C.replace("px",""));if(!isNaN(D)){E+=D}}return E}function getodborder(A){var C=$(A).css("padding-bottom");var E=$(A).css("margin-bottom");var F=$(A).css("border-bottom-width");var D=0;if(C){var B=parseFloat(C.replace("px",""));if(!isNaN(B)){D+=B}}if(E){var B=parseFloat(E.replace("px",""));if(!isNaN(B)){D+=B}}if(F){var B=parseFloat(F.replace("px",""));if(!isNaN(B)){D+=B}}return D}function getondborder(A){var D=$(A).css("margin-bottom");var E=$(A).css("border-bottom-width");var C=0;if(D){var B=parseFloat(D.replace("px",""));if(!isNaN(B)){C+=B}}if(E){var B=parseFloat(E.replace("px",""));if(!isNaN(B)){C+=B}}return C}function findlayout(I){var D=$(I).prev(".layout-top");var F=D.height()+getborder(D);var G=$(I).next(".layout-bottom");var A=G.height()+getborder(G);var E=$(I).parents(".layout-box");var C=E.height()-getborderSm($(E));var H=C-A-F-getborder(I);I.height(H);if($(I).find(".layout-center").get(0)){var B=$(I).find(".layout-center").eq(0);findlayout(B)}}Array.prototype.remove=function(C){if(isNaN(C)||C>this.length){return false}for(var A=0,B=0;A<this.length;A++){if(this[A]!=this[C]){this[B++]=this[A]}}this.length-=1};String.prototype.fill=function(A){if(typeof A==="object"&&A){return this.replace(/{{(.+?)}}/g,function(B,D){var C=A[D];if(C==undefined||C==null){return B}else{if(typeof(C)=="object"){return stringify(C)}else{return C}}})}};String.prototype.replaceo=function(A,B){return this.replace("{{"+A+"}}",B)};var queryString={__init__:function(){var B=window.location.search.slice(1).split(/\&/g);for(var A=0;A<B.length;A++){var C=/^(.+)[?=\\=](.+)/g,D=C.exec(B[A]);if(D){this[D[1]]=D[2]}}}};queryString.__init__();function getrequestparam(A){var C;var E=window.location.search.slice(1).split(/\&/g);for(var B=0;B<E.length;B++){var D=/^(.+)[?=\\=](.+)/g,F=D.exec(E[B]);if(F){C[F[1]]=F[2]}}return C[A]}function stringToJSON(obj){try{return eval("("+obj+")")}catch(e){alert("你的数据不符合规范！请检查！")}}var stringify=function(B){if(window.JSON){return JSON.stringify(B)}var F=typeof(B);if(F!="object"||B===null){if(F=="string"){B='"'+B+'"'}return String(B)}else{var C,E,D=[],A=(B&&B.constructor==Array);var G=arguments.callee;for(C in B){E=B[C];F=typeof(E);if(B.hasOwnProperty(C)){if(F=="string"){E='"'+E+'"'}else{if(F=="object"&&E!==null){E=G(E)}}D.push((A?"":'"'+C+'":')+String(E))}}return(A?"[":"{")+String(D)+(A?"]":"}")}};
/*
 * 多级联动
 * 创建人：qinnailin
 * 创建时间：2014/11/14
 *
 *
 * 
 */
!(function(B){var A=function(D,C){this.init("cascade",D,C)};A.prototype={constructor:A,init:function(C,F,E){this.type=C,this.$element=B(F),this.opstions=this.getOpstions(E);this.$id=B(F).attr("id");var D=this;if(this.opstions.url==""&&this.opstions.data!=null){this.load()}else{if(this.opstions.url!=""){B.getJSON(this.opstions.url,function(G){D.opstions.data=G;D.load()})}}},getOpstions:function(C){return C=B.extend({},B.fn[this.type].defaults,C)},load:function(){var C=this;this.$items=new Array();if(C.opstions.items){B.each(C.opstions.items,function(D,E){var F=C.$id+"-child-"+D;if(!B("#"+F).get(0)){C.$element.append('<label style="float:left;margin:5px;">'+E.title+':</label><div id="'+F+'" fm-name="'+E.name+'" style="float:left;margin-left:5px;" ></div>')}var G=B("#"+F).selectbox({data:[],param:E.param,defaults:null,change:function(H){C.change(D,H)}});C.$items.push(G)});C.$items[0].reload(C.opstions.data[C.opstions.items[0].name])}},change:function(C,G){if(C==this.opstions.items.length-1){return false}var D=new Array();var E=this.opstions.items[C+1];var F=E.pid;B.each(this.opstions.data[E.name],function(H,I){if(I[F]==G){D.push(I)}});this.$items[C+1].reload(D)}};B.fn.cascade=function(C){return this.each(function(){var D=B(this),E=D.data("cascade");if(!E){D.data("cascade",(E=new A(this,C)))}if(typeof C=="string"){B.getJSON(C,function(F){E.opstions.data=F;E.load()})}})};B.fn.cascade.defaults={url:"",data:null,items:[]}})(window.jQuery);
/*
 * 图表插件
 * 创建人：qinnailin
 * 创建时间：2014/8/25 
 *
 *
 * 
 */
(function(A){A.extend({init:function(B){var C=A.extend(true,{"echarts":"plugIn/charts/echarts","echarts/chart/bar":"plugIn/charts/echarts-map","echarts/chart/line":"plugIn/charts/echarts-map","echarts/chart/pie":"plugIn/charts/echarts-map","echarts/chart/radar":"plugIn/charts/echarts-map"},B);require.config({paths:C})}});A.fn.extend({bar:function(E){var D=A.extend(true,{title:"",subtitle:"",showtype:"V",data:null,url:"",afterCreate:null,showtag:true,async:{enable:false,url:"",params:{},filer:"Id",name:"-",sleep:1000,size:20,insert:false}},E);var G=A(this);var I;var H;if(D.url!=""){A.getJSON(D.url,function(L){D.data=L;var K=B();J(K)})}else{var F=B();J(F)}function B(){var K,P,O,N;if((D.data==null||D.data.length==0)&&D.async.enable){D.data=A.initEmpty([D.async.name],D.async.size)}if(D.showtype=="V"||D.showtype=="v"){K="category";P="value";O=D.data.category;N=null}else{K="value";P="category";O=null;N=D.data.category}var Q=new Array();var L=new Array();A.each(D.data.values,function(R,S){Q.push({name:S.name,type:"bar",data:S.value});if(D.async.enable){H=S[D.async.filer]}L.push(S.name)});var M={title:{text:D.title,subtext:D.subtitle},tooltip:{show:true},legend:{data:L},xAxis:[{type:K,data:O}],yAxis:[{type:P,data:N}],series:Q};if(!D.showtag){M.legend=null}if(!D.showtag&&D.title==""&&D.subtitle==""){M["grid"]={y:10,x:30,y2:30,x2:10}}return M}function J(K){require(["echarts","echarts/chart/bar"],function(M){I=M.init(A(G).get(0));I.setOption(K);if(D.afterCreate){D.afterCreate(I)}if(D.async.enable){var L;clearInterval(L);L=setInterval(function(){var N=D.async.params;N["filer"]=H;A.getJSON(D.async.url,N,function(O){A.each(O,function(P,Q){I.addData([[0,Q.value,true,D.async.insert,Q.key]]);H=Q.value})})},D.async.sleep)}})}var C={reload:function(L){if(!I){alertui("请等待图标加载完毕后调用！");return false}I.clear();if(L instanceof Object){D.data=L;var K=B();I.setOption(K);I.refresh()}else{D.data=null;D.url=L;A.getJSON(D.url,function(N){D.data=N;var M=B();I.setOption(M);I.refresh()})}}};return C},line:function(E){var D=A.extend(true,{title:"",subtitle:"",data:null,showtype:"V",url:"",symbol:"",smooth:true,showtag:true,dataZoom:{show:false,realtime:true,start:0,end:100},afterCreate:null,async:{enable:false,url:"",params:{},filer:"Id",name:"-",sleep:1000,size:20,insert:false}},E);var G=A(this);var I;var H;if(D.url!=""){A.getJSON(D.url,function(L){D.data=L;var K=B();J(K)})}else{var F=B();J(F)}function B(){var N,M;if((D.data==null||D.data.length==0)&&D.async.enable){D.data=A.initEmpty([D.async.name],D.async.size)}if(D.showtype=="V"||D.showtype=="v"){N={type:"category",boundaryGap:false,data:D.data.category};M={type:"value"}}else{M={type:"category",boundaryGap:false,data:D.data.category};N={type:"value"}}var O=new Array();var K=new Array();A.each(D.data.values,function(P,Q){O.push({name:Q.name,type:"line",symbol:D.symbol,smooth:D.smooth,data:Q.value});if(D.async.enable){H=Q[D.async.filer]}K.push(Q.name)});var L={title:{text:D.title,subtext:D.subtitle},tooltip:{show:true,trigger:"axis"},dataZoom:D.dataZoom,legend:{data:K},xAxis:[N],yAxis:[M],series:O};if(!D.showtag){L.legend=null}if(!D.showtag&&D.title==""&&D.subtitle==""){L["grid"]={y:10,x:30,y2:30,x2:10}}return L}function J(K){require(["echarts","echarts/chart/line"],function(M){I=M.init(A(G).get(0));I.setOption(K);if(D.afterCreate){D.afterCreate(I)}if(D.async.enable){var L;clearInterval(L);L=setInterval(function(){var N=D.async.params;N["filer"]=H;A.getJSON(D.async.url,N,function(O){A.each(O,function(P,Q){I.addData([[0,Q.value,true,D.async.insert,Q.key]]);H=Q.value})})},D.async.sleep)}})}var C={reload:function(L){if(!I){alertui("请等待图标加载完毕后调用！");return false}I.clear();if(L instanceof Object){D.data=L;var K=B();I.setOption(K);I.refresh()}else{D.data=null;D.url=L;I.showLoading();A.getJSON(D.url,function(N){D.data=N;var M=B();I.setOption(M);I.refresh();I.hideLoading()})}}};return C},pie:function(C){var D=A.extend(true,{title:"",titleX:"center",subtitle:"",data:null,url:"",legendPos:"left",showlable:true,itemStyle:{normal:{label:{show:true},labelLine:{show:true}}},afterCreate:null},C);var B=A(this);if(D.url!=""){A.getJSON(D.url,function(F){D.data=F;E()})}else{E()}function E(){var I=new Array();var F=new Array();A.each(D.data,function(J,K){F.push(K.name)});var H={normal:{label:{show:true},labelLine:{show:true}}};if(!D.showlable){H={normal:{label:{show:false},labelLine:{show:false}}}}var G={title:{text:D.title,subtext:D.subtitle,x:D.titleX},tooltip:{trigger:"item",formatter:"{b} : {c} ({d}%)"},legend:{orient:"vertical",x:D.legendPos,data:F},series:[{type:"pie",itemStyle:H,radius:"55%",center:["50%","60%"],data:D.data}]};require(["echarts","echarts/chart/pie"],function(K){var J=K.init(A(B).get(0));J.setOption(G);if(D.afterCreate){D.afterCreate(J)}})}},radar:function(C){var D=A.extend(true,{title:"",subtitle:"",style:null,data:null,url:"",afterCreate:null},C);var B=A(this);if(D.url!=""){A.getJSON(D.url,function(F){D.data=F;E()})}else{E()}function E(){var I=new Array();var F=new Array();A.each(D.data.values,function(J,K){F.push(K.name)});var H={};if(D.style=="fill"){H={areaStyle:{type:"default"}}}var G={title:{text:D.title,subtext:D.subtitle},tooltip:{trigger:"axis"},legend:{orient:"vertical",x:"right",y:"bottom",data:F},polar:[{indicator:D.data.indicator}],series:[{type:"radar",itemStyle:{normal:H},data:D.data.values}]};require(["echarts","echarts/chart/radar"],function(K){var J=K.init(A(B).get(0));J.setOption(G);if(D.afterCreate){D.afterCreate(J)}})}},charts:function(D,B,E){var C=A(this);require(["echarts","echarts/chart/"+D],function(G){var F=G.init(A(C).get(0));F.setOption(B);if(E){E(F)}})}});A.extend({initEmpty:function(G,B){var D=new Array();var E=new Array();for(var C=0;C<B;C++){D.push("-");E.push(0)}var F=new Array();A.each(G,function(I,J){F.push({name:J,value:E})});var H={category:D,values:F};return H}})})(jQuery);
/*
 * 页面数据填充控件
 * 创建人：qinnailin
 * 创建时间：2014/7/5 
 */
(function($){$.fn.Detail=function(options){var ops=$.extend({data:null,url:"",source:"",idname:"id",afterCreate:null},options||{});var objthis=$(this);var template=$(objthis).html();var requrl="";if(queryString[ops.idname]){var urlparam=ops.idname+"="+queryString[ops.idname];if(ops.url.indexOf("?")>-1){requrl=ops.url+"&"+urlparam}else{requrl=ops.url+"?"+urlparam}loadData()}else{if(ops.url!=""&&ops.data==null){requrl=ops.url;loadData()}else{loadData()}}function loadData(){if(requrl!=""){$.getJSON(requrl,function(rd){var data;if(ops.source==""){data=rd}else{var temp=rd;var item=ops.source.split(".");$.each(item,function(i,n){if(n!=""){temp=temp[n]}});data=temp}$(objthis).html(template.fill(data));converfunc();if(ops.afterCreate){ops.afterCreate()}})}else{if(ops.data){$(objthis).html(template.fill(ops.data));converfunc()}}}function converfunc(){var clist=$(objthis).find("[fm-conver]");$.each(clist,function(i,n){var txt=$(n).html();var convfn=$(n).attr("fm-conver");var fn=eval(convfn);var cvres=fn(txt);$(n).html(cvres)})}var func={load:function(obj){if(obj instanceof Object){requrl="";ops.data=obj;loadData()}else{var urlparam=ops.idname+"="+obj;if(ops.url.indexOf("?")>-1){requrl=ops.url+"&"+urlparam}else{requrl=ops.url+"?"+urlparam}loadData()}},reload:function(){loadData()},refresh:function(){window.location.reload()}};return func}})(jQuery);
/*
 * js上传控件
 * 创建人：qinnailin
 * 创建时间：2014/9/10
 *
 * 
 */
(function(A){A.fn.extend({jsUpload:function(C){var B=A(this);var E=A.extend(true,{element:A(B).get(0),debug:false,multiple:false,maxConnections:3,showStart:true,autoUpload:false,request:{endpoint:"/data/upload.aspx",params:{},customHeaders:{},forceMultipart:false,inputName:"qqfile"},validation:{allowedExtensions:[],sizeLimit:2*1024*1024,minSizeLimit:0,stopOnFirstInvalidFile:true},showMessage:function(H){if(typeof alertui=="function"){alertui(H)}else{alert(H)}}},C);if(!E.showStart){var G=E.callbacks.onUpload;E.callbacks.onUpload=function(J,H,I){meddleloading(true);if(G){G(J,H,I)}};var F=E.callbacks.onComplete;E.callbacks.onComplete=function(J,H,I){if(F){F(J,H,I)}meddleloading(false)}}var D=new qq.FineUploader(E);A(document).ready(function(){A(B).on("click",".qq-doupload-button",function(){D.uploadStoredFiles()})});if(!E.showStart){A(D._listElement).hide()}return D}})})(jQuery);
/*
 * 手风琴菜单
 * 创建人：qinnailin
 * 创建时间：2014/8/10 
 *
 *
 * 
 */
(function(A){A.fn.FoldMenu=function(H){var E=A.extend(true,{url:"",data:null,source:"",child:"Child",key:"Id",text:"Name",width:220,selected:function(J){}},H);var G=A(this);A(G).addClass("fm-fold").css("width",E.width);B();function B(){if(E.url==""&&E.data!=null){C()}else{if(E.url!=""){A.getJSON(E.url,function(L){var K=L;var J=E.source.split(".");A.each(J,function(M,N){if(N!=""){K=K[N]}});E.data=K;C()})}}}function C(){var J='<ul class="menu-one" '+(E.width!=220?"style='width:"+E.width+"px'":"")+">";var K="<li "+(E.width!=220?"style='width:"+E.width+"px'":"")+' ><div class="header"><span class="txt">{{'+E.text+'}}</span><span class="arrow"></span></div>{{childs}}</li>';A.each(E.data,function(L,M){J+=K.fill(M).replaceo("childs",I(M[E.child]))});J+="</ul>";A(G).html(J);D()}function I(K){if(K&&K.length>0){var J='<ul class="menu-two" '+(E.width!=220?"style='width:"+E.width+"px'":"")+" >";var L="<li "+(E.width!=220?"style='width:"+E.width+"px'":"")+'  ><a href="javascript:" data-sel="{{Selected}}" data-id="{{'+E.key+'}}" >{{'+E.text+"}}</a></li>";A.each(K,function(M,N){J+=L.fill(N)});J+="</ul>";return J}else{return""}}function D(){A(G).find("a").each(function(J,K){if(A(K).attr("data-sel").toUpperCase()=="TRUE"){A(K).parents("ul").show();A(K).parents("li").addClass("menu-show");E.selected(A(K).attr("data-id"));return}});A(G).find("li").eq(0).addClass("firstChild");A(G).find("ul").each(function(J,K){A(K).find("li").eq(0).addClass("firstChild")})}A(document).ready(function(){A(G).on("click",".header",function(){if(A(this).parent("li").hasClass("menu-show")){A(this).next("ul").slideUp(300);A(this).parent("li").removeClass("menu-show")}else{A(this).next("ul").slideDown(300);A(this).parent("li").addClass("menu-show")}A(this).parent("li").siblings("li").removeClass("menu-show").find("ul").slideUp(300)});A(G).on("click","a",function(){var J=A(this).attr("data-id");E.selected(J)})});var F={};return F}})(jQuery);
/*
 * form表单验证及初始化
 *创建人：qinnailin
 * 创建时间：2014/7/16 
 *
 *
 标签说明：
 fm-form="ajax" form使用ajax提交数据 不加入标签为普通提交
 fm-null="用户名不能为空！" 空验证
 fm-len="4,20,用户名长度必须大于4小于20！"  字符长度验证，
 fm-ajax="/user/has,用户名已存在!"  ajax验证
 fm-eq="pwd,两次输入密码不一致！" 相等验证 pwd为对比标签的name
 fm-reg="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*,请输入正确的邮箱格式！" 正则表达式验证
 fm-group="radio,请选择性别！"  radio组验证 fm-group在radio外层
 fm-group="checkbox,2,4,请任选2项！最多4项！" checkbox 组验证 fm-group在checkbox外层
 fm-neq="-1,请选择地区!" 非验证 值不等于 -1
 * 
 */
(function($){$.fn.Form=function(options){var ops=$.extend(true,{url:"",data:null,source:"",idname:"id",success:function(data){infomsg("数据提交成功！")},error:function(data){errormsg("数据提交失败!")},offset:{top:0,left:0},afterLoad:null},options);var objthis=$(this);var requrl="";if(queryString[ops.idname]){var urlparam=ops.idname+"="+queryString[ops.idname];if(ops.url.indexOf("?")>-1){requrl=ops.url+"&"+urlparam}else{requrl=ops.url+"?"+urlparam}loadData()}else{if(ops.url!=""&&ops.data==null){requrl=ops.url;loadData()}}function loadData(){if(requrl!=""){$.getJSON(requrl,function(rd){var data;if(ops.source==""){data=rd}else{var temp=rd;var item=ops.source.split(".");$.each(item,function(i,n){if(n!=""){temp=temp[n]}});data=temp}if(data){$(objthis).find("[name]").each(function(i,item){var name=$(item).attr("name");if(($(item).is("input[type=checkbox]")||$(item).is("input[type=radio]"))){if($(item).val()==data[name]){$(item).attr("checked",true)}else{$(item).removeAttr("checked")}}else{if($(item).is("input")){$(item).val(data[name])}else{if($(item).is("select")){$(item).find("option[value="+data[name]+"]").attr("selected",true)}else{$(item).html(data[name])}}}})}converfunc();if(ops.afterLoad){ops.afterLoad(data)}})}else{if(ops.data){var data=ops.data;$(objthis).find("[name]").each(function(i,item){var name=$(item).attr("name");if(($(item).is("input[type=checkbox]")||$(item).is("input[type=radio]"))&&$(item).val()==data[name]){$(item).attr("checked",true)}else{if($(item).is("input")){$(item).val(data[name])}else{if($(item).is("select")){$(item).find("option[value="+data[name]+"]").attr("selected",true)}else{$(item).html(data[name])}}}})}converfunc()}}function converfunc(){var clist=$(objthis).find("[fm-conver]");$.each(clist,function(i,n){if($(n).is("input")){var txt=$(n).val();var convfn=$(n).attr("fm-conver");var fn=eval(convfn);var cvres=fn(txt);$(n).val(cvres)}else{var txt=$(n).html();var convfn=$(n).attr("fm-conver");var fn=eval(convfn);var cvres=fn(txt);$(n).html(cvres)}})}$.fn.vnull=function(){if($(this).val()==""){$(this).showError($(this).attr("fm-null"))}else{$(this).showSuccess()}};$.fn.vlen=function(){var v=$(this).attr("fm-len").split(",");var min=v[0]?parseInt(v[0]):0;var len=$(this).val().length;if(len<min||(v[1]!=""&&len>parseInt(v[1]))){$(this).showError(v[2])}else{$(this).showSuccess()}};$.fn.veq=function(){var v=$(this).attr("fm-eq").split(",");var tagv=$("[name="+v[0]+"]").val();if($(this).val()!=tagv){$(this).showError(v[1])}else{$(this).showSuccess()}};$.fn.vgroup=function(){var v=$(this).attr("fm-group").split(",");if(v[0]=="radio"){var radio=$(this).find("input:radio:checked").val();if(!radio){$(this).removeClass("success").addClass("error");$(this).showError(v[1])}else{$(this).removeClass("error").addClass("success");$(this).showSuccess()}}else{if(v[0]=="checkbox"){var size=$(this).find("input:checked").size();if((v[1]!=""&&size<parseInt(v[1]))||(v[2]!=""&&size>parseInt(v[2]))){$(this).removeClass("success").addClass("error");$(this).showError(v[3])}else{$(this).removeClass("error").addClass("success");$(this).showSuccess()}}}};$.fn.vneq=function(){var v=$(this).attr("fm-neq").split(",");if($(this).val()==v[0]){$(this).showError(v[1])}else{$(this).showSuccess()}};$.fn.vreg=function(){var v=$(this).attr("fm-reg").split(",");var msg="";var reqexpstr="";if(v.length>2){msg=v[v.length-1];var str=$(this).attr("fm-reg");reqexpstr=str.substring(0,str.lastIndexOf(","))}else{msg=v[1];reqexpstr=v[0]}var r=RegExp(reqexpstr);if(!r.test($(this).val())){$(this).showError(msg)}else{$(this).showSuccess()}};$.fn.vajax=function(){var v=$(this).attr("fm-ajax").split(",");if($(this).attr("fm-ajax-res")=="false"){var v=$(this).attr("fm-ajax").split(",");$(this).showError(v[1])}else{if($(this).attr("fm-ajax-res")==""){valid=false;$(this).showError(v[1])}}};function validation(){valid=true;$(objthis).find("[fm-null]").each(function(i,n){$(n).vnull()});$(objthis).find("[fm-len]").each(function(i,n){$(n).vlen()});$(objthis).find("[fm-eq]").each(function(i,n){$(n).veq()});$(objthis).find("[fm-group]").each(function(i,n){$(n).vgroup()});$(objthis).find("[fm-neq]").each(function(i,n){$(n).vneq()});$(objthis).find("[fm-reg]").each(function(i,n){$(n).vreg()});$(objthis).find("[fm-ajax]").each(function(i,n){$(n).vajax()})}$(document).ready(function(){$(objthis).submit(function(){validation();var valid=$(objthis).find(".error").get(0);if(!valid){if($(objthis).attr("fm-form")&&$(objthis).attr("fm-form")=="ajax"){$.ajax({url:this.action,type:this.method,cache:false,data:$(this).serialize(),success:function(result){ops.success(result)},error:function(result){ops.error(result)}});return false}else{return true}}else{return false}return false});$(objthis).on("blur","input[fm-ajax]",function(){var oth=$(this);var v=$(oth).attr("fm-ajax").split(",");var key=$(this).attr("name");var val=$(this).val();if(val!=""){var data=key+"="+val;$.ajax({url:v[0],type:"get",data:data,success:function(result){if(result.flag){$(oth).attr("fm-ajax-res","true");$(this).showSuccess()}else{$(oth).showError(v[1]);$(oth).attr("fm-ajax-res","false")}},error:function(result){$(oth).showError("数据请求失败");$(oth).attr("fm-ajax-res","false")}})}});$(objthis).on("blur","input",function(){var oth=$(this);var alen=$(oth).get(0).attributes.length;for(var i=0;i<alen;i++){var name=$(oth).get(0).attributes[i].name;switch(name){case"fm-null":$(oth).vnull();break;case"fm-len":$(oth).vlen();break;case"fm-eq":$(oth).veq();break;case"fm-neq":$(oth).vneq();break;case"fm-reg":$(oth).vreg();break;default:}}});$(objthis).on("blur","textarea",function(){var oth=$(this);var alen=$(oth).get(0).attributes.length;for(var i=0;i<alen;i++){var name=$(oth).get(0).attributes[i].name;switch(name){case"fm-null":$(oth).vnull();break;case"fm-len":$(oth).vlen();break;default:}}});$(objthis).on("blur","select",function(){var oth=$(this);var alen=$(oth).get(0).attributes.length;for(var i=0;i<alen;i++){var name=$(oth).get(0).attributes[i].name;switch(name){case"fm-neq":$(oth).vneq();break;default:}}});$(objthis).on("focus","input",function(){$(this).removeError()});$(objthis).on("click","input:radio",function(){$(this).parent(".error").removeError()});$(objthis).on("click","input:checkbox",function(){$(this).parent(".error").removeError()});$(objthis).on("focus","textarea",function(){$(this).removeError()});$(objthis).on("focus","select",function(){$(this).removeError()});$(objthis).on("change","input",function(){$(this).removeError()});$(objthis).on("change","textarea",function(){$(this).removeError()});$(objthis).on("change","select",function(){$(this).removeError()})});var func={load:function(opst){if(opst instanceof Object){ops.data=opst;requrl="";loadData()}else{var urlparam=ops.idname+"="+id;if(ops.url.indexOf("?")>-1){requrl=ops.url+"&"+urlparam}else{requrl=ops.url+"?"+urlparam}loadData()}},reload:function(){window.location.reload()},refresh:function(){loadData()},reset:function(){$(objthis)[0].reset();$(objthis).find("input").val("")},closemsg:function(){$("div.u_warn").remove()},validation:function(){$(objthis).find(".error").removeClass("error");validation();return !$(objthis).find(".error").get(0)}};return func};$.fn.showError=function(msg){$(this).removeClass("error").addClass("error");$(this).attr("data-title",msg).Tooltip({placement:"bottom",template:'<div class="tooltip form"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'})};$.fn.showSuccess=function(){$(this).removeClass("error");$(this).attr("data-title","");$(".tooltip").remove()};$.fn.removeError=function(){$(this).removeClass("error");$(this).attr("data-title","");$(".tooltip").remove()}})(jQuery);
/*
 * 列表控件 带分页的表格控件
 *创建人：qinnailin
 * 创建时间：2014/7/4 
 */
(function($){$.fn.Grid=function(options){var ops=$.extend(true,{url:"",data:null,dataformat:{data:"Data",count:"Count"},click:null,dbclick:null,method:"Get",dataType:"json",sortMultiple:true,putJson:true,cache:true,page:{click:null,pageSize:30,pageIndex:1,back:"上一页",next:"下一页",reqindex:"pageindex",reqsize:"pagesize",lazy:null},afterLoad:null},options);var objthis=$(this);var thisid=$(objthis).attr("id");var template;var ajaxData;if(!document.getElementById(thisid+"_template")){template=findTemp(objthis,ops);$("body").append("<script type='text/template' id='"+thisid+"_template' >"+template+"</script>")}else{template=$("#"+thisid+"_template").html()}var tempbox=findTempBox(objthis);tempbox.html("");var pagecount=0;var listcount=0;var pageIndex=1;var requesturl="";var sortdata={};var func={reload:function(){pageIndex=1;if($(objthis).find("[fm-pagerbox]").get(0)){$(objthis).find("[fm-pagerbox]").find(".pageindex").text(1)}initReqUrl();loaddata()},refresh:function(){ops.data=null;loaddata()},load:function(opst){if(opst instanceof Object){ops.data=opst}else{ops.data=null;ops.url=opst}pageIndex=1;initReqUrl();loaddata()},getData:function(){return ops.data},getAjaxData:function(){return ajaxData}};function initReqUrl(){var pagediv=$(objthis).find("[fm-pagerbox]").html();if(pagediv!=undefined){var urlparam=ops.page.reqindex+"="+((ops.page.pageIndex-1)+pageIndex)+"&"+ops.page.reqsize+"="+ops.page.pageSize;if(ops.url.indexOf("?")>-1){requesturl=ops.url+"&"+urlparam}else{requesturl=ops.url+"?"+urlparam}}else{requesturl=ops.url}}initReqUrl();loaddata();function loaddata(){if(ops.url==""&&ops.data!=null){fillData(ops,template);if(ops.page.lazy){ops.url=ops.page.lazy.url;listcount=ops.page.lazy.count;bindPager()}converfunc();if(ops.afterLoad){ops.afterLoad()}}else{if(ops.url!=""){var value=$(objthis).find("[fm-search]").serialize();var daval;if(ops.putJson){if(value){var sstr=value.split("&");var temp=new Array();for(var i=0;i<sstr.length;i++){var v=sstr[i].split("=");if(v[1]){temp.push(v[0]+":'"+v[1]+"'")}}daval=temp.join(",");daval='{jsonStr:"{'+daval+"}\",sort:'"+stringify(sortdata)+"'}";daval=eval("("+daval+")")}else{if(jsonsize(sortdata)>0){daval="{sort:'"+stringify(sortdata)+"'}";daval=stringToJSON(daval)}}}else{if(!$(objthis).find("form[fm-search]").get(0)){$(objthis).append("<form fm-search ></form>")}if($(objthis).find("form[fm-search]").find("input[name=sort]").get(0)){if(jsonsize(sortdata)>0){$(objthis).find("form[fm-search]").find("input[name=sort]").val(stringify(sortdata))}}else{if(jsonsize(sortdata)>0){$(objthis).find("form[fm-search]").append("<input type='hidden' name='sort' value='"+stringify(sortdata)+"' />")}}daval=$(objthis).find("[fm-search]").serialize()}$.ajax({url:requesturl,data:daval,type:ops.method,dataType:ops.dataType,cache:ops.cache,success:function(result){try{if(result.utrymsg&&result.utrymsg!=""){return false}}catch(e){}ajaxData=result;listcount=result[ops.dataformat.count];ops.data=result[ops.dataformat.data];fillData(ops,template);converfunc();var pager=$(objthis).find("[fm-pagerbox]").html();if(pager!=undefined){pagecount=GetCountPage(listcount,ops.page.pageSize);$(objthis).find("[fm-pagerbox]").find(".pagecount").text(pagecount);if(pagecount==pageIndex){$(objthis).find("[fm-pagerbox]").find(".next").addClass("active")}else{$(objthis).find("[fm-pagerbox]").find(".next").removeClass("active")}}if(ops.afterLoad){ops.afterLoad(result)}},error:function(result){errormsg("数据获取失败！")}})}}}function bindPager(){var pages='<p class="page_num"><a href="javascript:" class="page_pre back"></a><span class="fir_page pageindex">1</span><span class="line_page">/</span><span class="las_page pagecount">1</span><a href="javascript:" class="page_nex next"></a><input type="text" class="goTo_page" /><input type="button" class="btn gotobtn" value="跳页" /></p>';$(objthis).find("[fm-pagerbox]").html(pages)}function converfunc(){var clist=$(objthis).find("[fm-conver]");$.each(clist,function(i,n){var txt=$(n).html();var convfn=$(n).attr("fm-conver");var fn=eval(convfn);var cvres=fn(txt);$(n).html(cvres)})}$(document).ready(function(){bindPager();if(ops.click!=null){$(objthis).on("click","[fm-row]",function(){var id=$(this).attr("fm-row");var data=ops.data[id];ops.click(data,$(this))})}if(ops.dbclick!=null){$(objthis).on("dblclick","[fm-row]",function(){var id=$(this).attr("fm-row");var data=ops.data[id];ops.dbclick(data,$(this))})}$(objthis).on("click","[fm-pagerbox]>p>a",function(){if($(this).hasClass("active")){return}if($(this).hasClass("back")){if(pageIndex==1){$(this).addClass("active");return}if(--pageIndex>1){$(this).removeClass("active")}$(objthis).find("[fm-pagerbox]").find(".next").removeClass("active");$(objthis).find("[fm-pagerbox]").find(".pageindex").text(pageIndex);bindPageEvent()}else{if($(this).hasClass("next")){if(++pageIndex<pagecount){$(this).removeClass("active")}$(objthis).find("[fm-pagerbox]").find(".back").removeClass("active");$(objthis).find("[fm-pagerbox]").find(".pageindex").text(pageIndex);bindPageEvent()}}});$(objthis).on("click","[fm-pagerbox]>p>.gotobtn",function(){var val=parseInt($(objthis).find("[fm-pagerbox]>p>input.goTo_page").val());if(pageIndex!=val&&val>=ops.page.pageIndex&&val<=pagecount){pageIndex=val;initReqUrl();loaddata();if(ops.page.click){ops.page.click(pageIndex,ops.page.pageSize,listcount)}}$(objthis).find("[fm-pagerbox]").find(".pageindex").text(pageIndex)});$(objthis).find("form[fm-search]").eq(0).submit(function(){func.reload();return false});$(objthis).find("[fm-sort]").addClass("sort_head");$(objthis).find("[fm-sort]").each(function(i,n){$(n).append("<a class='sort_pre_next' ></a>")});$(objthis).on("click","[fm-sort]",function(){if(!ops.sortMultiple){$(this).siblings("[fm-sort]").children("a").removeClass("sort_pre").remove("sort_next").addClass("sort_pre_next")}var value=-1;var oth=$(this).children("a");if($(oth).hasClass("sort_pre_next")){$(oth).removeClass("sort_pre_next").addClass("sort_pre");value=0}else{if($(oth).hasClass("sort_pre")){$(oth).removeClass("sort_pre").addClass("sort_next");value=1}else{if($(oth).hasClass("sort_next")){$(oth).removeClass("sort_next").addClass("sort_pre_next");value=-1}}}sortsetdata($(this),value)})});function jsonsize(obj){var count=0;for(var i in obj){count++}return count}function sortsetdata(obj,val){if(!ops.sortMultiple){sortdata={}}var key=$(obj).attr("fm-sort");sortdata['"'+key+'"']=val;if(val=-1){try{delete sortdata[key]}catch(e){}}pageIndex=1;initReqUrl();if($(objthis).find("[fm-pagerbox]").get(0)){$(objthis).find("[fm-pagerbox]").find(".pageindex").text(1)}var str=stringify(sortdata).replace(/\\"/g,"");sortdata=stringToJSON(str);loaddata()}function pageChange(){initReqUrl();loaddata()}function bindPageEvent(){pageChange();if(ops.page.click!=null){ops.page.click(pageIndex,ops.page.pageSize,listcount)}}function GetCountPage(pageCount,pageSize){if(pageCount<pageSize){return 1}else{if(pageCount>0){if(pageCount%pageSize==0){return maxpage=pageCount/pageSize}else{return parseInt((pageCount/pageSize))+1}}}return 0}function fillData(ops,template){var d=ops.data;$(tempbox).empty();if(d&&d.length>0){try{$.each(d,function(i,n){$(tempbox).append($(template.fill(n).replaceo("fm-row-num",i)).data("jsondata",n))})}catch(e){console.debug(template);console.debug(e)}}}function setTempRow(temp){var obj=$(temp).attr("fm-row","{{fm-row-num}}").get(0);var div=document.createElement("div");div.appendChild(obj);return $(div).html()}function findTemp(obj,ops){var temphtml=$(obj).find("[fm-body]").html();if(ops.click!=null||ops.dbclick!=null){temphtml=setTempRow(temphtml)}return temphtml}function findTempBox(obj){return $(obj).find("[fm-body]")}return func}})(jQuery);
/*
 * GridTree表格树控件 不用表格做，肯定有问题
 * 创建人：qinnailin
 * 创建时间：2015/1/5 
 */
!(function(B){var A=function(D,C){this.init("GridTree",D,C)};A.prototype={init:function(C,G,E){var F;this.type=C,this.$element=B(G),this.$id=B(G).attr("id"),this.options=F=this.getoptions(E),this.tempBox=this.getTempBox(),this.template=this.getTemp();this.tempBox.addClass("fm-ulgtree");this.tempBox.html("");this.loadData();var D=this;this.tempBox.on("click","span.switch",function(){var J=B(this).parents("li").eq(0);var K=B(this).siblings("span.chk").hasClass("checkbox_true_full_focus");if(!J.children("div").hasClass("t_open")){var L=J.data("rowdata");if(L[D.options.dataFormat.open]){var H="";if(F.param){H="{";var I=new Array();B.each(F.param,function(M,N){I.push("'"+F.param[M]+"':'"+L[F.param[M]]+"'")});H+=I.join(",");H+="}"}B.getJSON(F.url,stringToJSON(H),function(M){var P;if(F.source!=""){var O=M;var N=F.source.split(".");B.each(N,function(Q,R){if(R!=""){O=O[R]}});P=O}D.fillAjaxNode(J,L,P,K);D.open(J)})}else{if(L[D.options.dataFormat.child]){D.fillNode(J,L,K);D.open(J)}else{D.open(J)}}}else{D.fold(J)}return false});this.tempBox.on("click","span.chk",function(){var H=B(this);D.checked(H);return false});this.tempBox.on("click",".cols",function(){D.selected(B(this));return false})},getoptions:function(C){return B.extend({},B.fn[this.type].defaults,C)},getTempBox:function(){this.$element.addClass("box-border").append("<div><ul></ul></div>").append("<div><ul></ul></div>");var E=this.$element.children("div").eq(0);E.addClass("row-fluid");E.children("ul").addClass("ul_grid_title");var C=this.$element.children("div").eq(1);C.addClass("row-fluid");var D=C.children("ul").addClass("ul_grid");return D},getTemp:function(){var F=this.options;var D=this;var E='<span class="line" {{layer}} ></span><span class="button switch center"></span>';if(F.treeModel=="checkbox"){E+='<span  class="button chk checkbox_false_full" ></span>'}E+='<span {{diyicon}} class="button {{icon2}}"></span>';var G="<div class='cols t_close' >";var C="<li><div class='cols'>";if(!F.header){alert("gridtree标头不可为空！");return false}B.each(F.header,function(I,J){var H;if(J.tree){H="<div>"+E+"<span class='text'>{{"+J.key+"}}</span></div>"}else{H="<div>{{"+J.key+"}}</div>"}if(J.width){G+=B(H).css("width",J.width+F.unit).get(0).outerHTML;C+=B("<div>"+J.name+"</div>").css("width",J.width+F.unit).get(0).outerHTML}else{alert("宽度是必填项！！");return false}});G+="</div>";C+="</div></li>";D.$element.find(".ul_grid_title").append(C);return G},loadData:function(){var D=this.options,C=this;if(D.data!=null){C.fillRoot(D.data);if(D.afterLoad){D.afterLoad()}}else{if(D.url!=""){B.getJSON(D.url,{_r_t:(D.cache?0:Math.random())},function(H){var F=H;if(D.source!=""){var G=H;var E=D.source.split(".");B.each(E,function(I,J){if(J!=""){G=G[J]}});F=G}C.fillRoot(F);if(D.afterLoad){D.afterLoad()}})}}},fillRoot:function(E){var D=this.options,C=this;B.each(E,function(J,I){I["tag_id"]=J;var K=I[D.dataFormat.child];I["icon2"]="ico";var M=C.filltrRootData(I),N=I,G=0,H,L;G=I["tag_id"].toString().split("_").length-1;G=G==-1?0:G;if(D.expand!=0){N=C.copyobject(I)}M=(I[D.dataFormat.selected]?'<li class="selected" >':"<li>")+M+"</li>";var F=B(M);F.remove().appendTo(C.tempBox);H=C.tempBox.find("li:last");L=H.find(".chk");if(L&&I[D.dataFormat.checked]){L.addClass("checkbox_true_full_focus").removeClass("checkbox_false_full")}D.bindNode(I,H);if(K&&K.length>0&&D.expand!=0){C.fillChild(K,H,"");N[D.dataFormat.child]=null}H.data("rowdata",N);if(D.expand!=0){C.open(F)}})},fillChild:function(F,D,M){var G=this.options,O=this,Q=D.children("ul");if(!Q.get(0)){D.append("<ul></li>");Q=D.children("ul")}for(var I=0;I<F.length;I++){var J=F[I];J["tag_id"]=M+"_"+I;var E=J[G.dataFormat.child];J["icon2"]=(E&&E.length>0)?"ico":"docu";var P=O.filltrData(J);var R=J;var N=0;N=J["tag_id"].toString().split("_").length-1;N=N==-1?0:N;P=(J[G.dataFormat.selected]?'<li class="selected" >':"<li>")+P+"</li>";var C=B(P);C.remove().appendTo(Q);var H=Q.find("li:last");var L=H.find(".switch").eq(0),K=H.find(".chk").eq(0);if(J["icon2"]=="docu"&&!L.hasClass("docu")){L.addClass("docu")}if(K&&J[G.dataFormat.checked]){K.addClass("checkbox_true_full_focus").removeClass("checkbox_false_full")}G.bindNode(J,H);if(E&&E.length>0&&G.expand!=0){if(G.expand>0&&N>G.expand){H.data("rowdata",R);continue}else{O.fillChild(E,H,J["tag_id"]);O.open(C);R[G.dataFormat.child]=null;H.data("rowdata",R)}}}},fillNode:function(D,E,R){var H=this.options,O=this,M=E.tag_id,G=E[O.options.dataFormat.child];D.data("rowdata",O.copyobject(E));D.append("<ul></ul>");var Q=D.children("ul").eq(0);for(var J=0;J<G.length;J++){var K=G[J];K["tag_id"]=M+"_"+J;var F=K[H.dataFormat.child];K["icon2"]=(F&&F.length>0)||(K[H.dataFormat.open])?"ico":"docu";var P=O.filltrData(K);var E=K;P="<li>"+P+"</li>";var C=B(P);if(R&&H.multiple){C.find(".chk").addClass("checkbox_true_full_focus")}Q.append(C);var I=Q.children("li:last"),N;var L=I.find(".switch").eq(0);if(K["icon2"]=="docu"&&!L.hasClass("docu")){L.addClass("docu")}N=I.find(".chk").eq(0);if(N&&K[H.dataFormat.checked]){N.addClass("checkbox_true_full_focus").removeClass("checkbox_false_full")}I.data("rowdata",E)}},fillAjaxNode:function(P,N,L,C){var K=this.options,J=this,O=N.tag_id,Q=L;N[J.options.dataFormat.open]=false;P.data("rowdata",N);P.append("<ul></ul>");var I=P.children("ul").eq(0);for(var G=0;G<Q.length;G++){var H=Q[G];H["tag_id"]=O+"_"+G;var F=H[K.dataFormat.child];H["icon2"]=(F&&F.length>0)||(H[K.dataFormat.open])?"ico":"docu";var M=J.filltrData(H);var L=H;var R=B("<li>"+M+"</li>");if(C&&K.multiple){R.find(".chk").addClass("checkbox_true_full_focus")}I.append(R);var E=I.children("li:last"),D;var S=E.find(".switch").eq(0);if(H["icon2"]=="docu"&&!S.hasClass("docu")){S.addClass("docu")}D=E.find(".chk").eq(0);if(D&&H[K.dataFormat.checked]){D.addClass("checkbox_true_full_focus").removeClass("checkbox_false_full")}E.data("rowdata",L)}},copyobject:function(E){var D={};for(var C in E){if(C.toString()!=this.options.dataFormat.child){D[C]=E[C]}}return D},filltrRootData:function(H){var G=this.options,E=this,D=0;if(H){var C=E.template.fill(H).replaceo("layer","style=''").replaceo("diyicon",G.dataFormat.icon!=null?((H[G.dataFormat.icon]&&H[G.dataFormat.icon]!="")?'style="background: url('+H[G.dataFormat.icon]+') 0 0 no-repeat;"':""):"").replaceo("selected",H[G.dataFormat.selected]?'fm-sel="selected"':"").replaceo("data-id",H.tag_id);var F=false;if(G.clazz>0&&G.expand&&G.clazz<=(D+1)){F=true}return C}else{return""}},filltrData:function(H){var G=this.options,E=this,D=0;D=H["tag_id"].toString().split("_").length-1;D=D==-1?0:D;if(H){var C=E.template.fill(H).replaceo("diyicon",G.dataFormat.icon!=null?((H[G.dataFormat.icon]&&H[G.dataFormat.icon]!="")?'style="background: url('+H[G.dataFormat.icon]+') 0 0 no-repeat;"':""):"").replaceo("selected",H[G.dataFormat.selected]?'fm-sel="selected"':"").replaceo("data-id",H.tag_id).replaceo("layer","style='padding-left:"+(D*18)+"px;'");var F=false;if(G.clazz>0&&G.expand&&G.clazz<=(D+1)){F=true}return C}else{return""}},serialize:function(G,C){var F=new Array(),E=this,D=this.options;B.each(G,function(H,J){var K=J[D.dataFormat.child];var I=E.copyobject(J);I["tag_id"]=C?C+"_"+H:H;F.push(I);if(K&&K.length>0){var L=E.serialize(K,I["tag_id"]);B.each(L,function(N,M){F.push(M)})}I["icon2"]=(K&&K.length>0||!C)?"ico":"docu"});return F},open:function(D){D.children("div.t_close").addClass("t_open").removeClass("t_close");var C=D.children("ul").show(200)},fold:function(D){D.children("div.t_open").addClass("t_close").removeClass("t_open");var C=D.children("ul").hide(200)},findParent:function(F){var E=F.prevAll("tr");var G=F.attr("id");var D=G.lastIndexOf("_");G=G.substring(0,D);for(var C=0;C<E.length;C++){if(B(E[C]).attr("id")==G){return B(E[C])}}return F},checkChild:function(D){var C=D.children("ul").children("li");C.each(function(E,F){B(F).find(".chk").addClass("checkbox_true_full_focus").removeClass("checkbox_false_full")})},noCheckChild:function(D){var C=D.children("ul").children("li");C.each(function(E,F){B(F).find(".chk").addClass("checkbox_false_full").removeClass("checkbox_true_full_focus")})},selected:function(D){var F=D.parents("li").data("rowdata");var C=this.options;var E=true;if(C.beforeSelect){E=C.beforeSelect(F,D);if(E==undefined){E=true}}if(E){if(D.parent("li").hasClass("selected")){D.parent("li").removeClass("selected")}else{if(!this.options.multiple){this.$element.find("li").removeClass("selected");D.parent("li").addClass("selected")}else{D.parent("li").addClass("selected");this.options.selected(F)}}}},checked:function(E){var D=E.parents("li").eq(0);var G=E.parents("li").data("rowdata");var C=this.options;var F=true;if(C.beforeCheck){F=C.beforeCheck(G,E);if(F==undefined){F=true}}if(F){if(!this.options.multiple){this.$element.find(".checkbox_true_full_focus").addClass("checkbox_false_full").removeClass("checkbox_true_full_focus")}if(E.hasClass("checkbox_false_full")){E.addClass("checkbox_true_full_focus").removeClass("checkbox_false_full");if(!this.options.multiple){return false}this.checkChild(D)}else{E.addClass("checkbox_false_full").removeClass("checkbox_true_full_focus");this.noCheckChild(D)}}},getCheckNodes:function(){var C=new Array();this.$element.find(".checkbox_true_full_focus").each(function(D,E){var F=B(E).parents("li").eq(0);C.push(F.data("rowdata"))});return C},getSelectNodes:function(){var C=new Array();this.$element.find(".selected").each(function(D,E){C.push(B(E).data("rowdata"))});return C},setSelected:function(C){C.addClass("selected")},setChecked:function(D){var C=$li.find(".chk").eq(0);if(C&&n[ops.dataFormat.checked]){C.addClass("checkbox_true_full_focus").removeClass("checkbox_false_full")}},reload:function(){this.$element.find(".fm-ulgtree").html("");this.loadData()}};B.fn.GridTree=function(D){var C=B(this);var E=C.data("GridTree");if(!E){C.data("GridTree",(E=new A(this,D)))}else{E.options=B.extend(false,C.GridTree.defaults,D)}return E};B.fn.GridTree.defaults={url:"",data:null,expand:-1,dataFormat:{child:"Child",checked:"Checked",selected:"Selected",icon:"Icon",open:"Open"},param:null,source:"Data",cache:true,treeModel:"default",multiple:false,selected:function(C){},checked:function(C){},afterLoad:null,beforeSelect:function(C,D){},beforeCheck:function(C,D){},bindNode:function(C,D){},unit:"%",header:null}})(window.jQuery);(function(A){A.fn.leftMenu=function(B){var C=A.extend(true,{url:"",data:null,model:"mini",box:"li"},B)}})(jQuery);
/*
 * jqueryui 模态窗口拓展类
 *创建人：qinnailin
 * 创建时间：2014/7/20 
 *
 *
 * 
 */
var basic_modal_content_count=0;(function(A){A.fn.modal_n=function(D){var E=A.extend(true,{title:"",url:null,modal:true,resizable:false,width:"auto",timeout:null,beforeClose:function(){if(E.modal==undefined||E.modal){if(!isparent){if(A(".ui-widget-overlay").size()<2){crossdomain("closebgmodel","")}}}},afterCreate:null,closeText:""},D);var C=A(this);var B=A(C).html();if(E.url){A.get(E.url,function(G){B=G;F()})}else{F()}function F(){if(A(C).is("script")){var G=A(C).attr("data-mun");if(!G){G=++basic_modal_content_count;A("body").append("<div id='basic-modal-content-"+G+"' class='basic-modal-content' style='display:none;overflow: visible;'></div>");A(C).attr("data-mun",G)}else{if(!document.getElementById("basic-modal-content-"+G)){A("body").append("<div id='basic-modal-content-"+G+"' class='basic-modal-content' style='display:none;overflow: visible;'></div>")}}C=A("#basic-modal-content-"+G)}A(C).html(B);try{A(C).dialog(E)}catch(H){alert("请引入jqueryui插件")}A(C).dialog({close:function(J,I){A(C).dialog("destroy");if(A(C).hasClass("basic-modal-content")){A(C).html("")}if(E.close){E.close()}}});if(E.modal){if(!isparent){crossdomain("showbgmodel","")}}if(E.timeout){setTimeout("closemodel("+num+")",E.timeout)}if(E.afterCreate){E.afterCreate()}A(C).find(".layout-center").each(function(I,J){findlayout(A(J))})}};A.fn.close=function(){if(A(this).is("script")){var B=A(this).attr("data-mun");if(!B){A(this).dialog("close");A(this).html("")}else{closemodel(B)}}else{A(this).dialog("close")}}})(jQuery);closemodel=function(A){$("#basic-modal-content-"+A).dialog("close");$("#basic-modal-content-"+A).html("")};function alertui(A){if(!document.getElementById("message-basic-modal-content")){$("body").append("<div id='message-basic-modal-content' style='display:none;overflow: visible;'></div>")}var C=true;if($(".ui-widget-overlay").get(0)){C=false}var B=$.extend(true,{modal:C,resizable:false,width:"250",clear:true,title:"提示!",beforeClose:function(){$("#message-basic-modal-content").html("").hide();if(!isparent){if(C){crossdomain("closebgmodel","")}}},buttons:[{text:"确定",click:function(){$("#message-basic-modal-content").dialog("close");if(!isparent){if(C){crossdomain("closebgmodel","")}}}}]},{});if(!isparent&&C){crossdomain("showbgmodel","")}$("#message-basic-modal-content").html("<div>"+A+"</div>");$("#message-basic-modal-content").dialog(B);return false}function confirmui(A,B,D){if(!document.getElementById("message-basic-modal-content")){$("body").append("<div id='message-basic-modal-content' style='display:none;overflow: visible;'></div>")}var E=true;if($(".ui-widget-overlay").get(0)){E=false}var C=$.extend(true,{modal:E,resizable:false,width:"350",clear:true,title:"提示!",beforeClose:function(){$("#message-basic-modal-content").html("").hide();if(!isparent){if(E){crossdomain("closebgmodel","")}}},buttons:[{text:"确定",click:function(){B();$("#message-basic-modal-content").dialog("close");if(!isparent){if(E){crossdomain("closebgmodel","")}}}},{text:"取消",click:function(){$("#message-basic-modal-content").dialog("close");if(!isparent){if(E){crossdomain("closebgmodel","")}}if(D){D()}}}]},{});if(!isparent&&E){crossdomain("showbgmodel","")}$("#message-basic-modal-content").html(A);$("#message-basic-modal-content").dialog(C);return false}loading=function(A){if(isparent){if(A==true){var B='<div class="alert fade in loading"><span></span>数据加载中……</div>';ClosemsgModa()}else{ClosemsgModal()}}else{crossdomain("loading",A)}};meddleloading=function(A,C){if($("#show-middle-modal-content").get(0)&&A){$("#show-middle-modal-content-msg").html(C)}else{if(isparent){if(A==true){var B='<div class="meddileloading" ><div></div><span id="show-middle-modal-content-msg" >'+(C?C:"数据加载中……")+"</span></div>";closeMiddleModal()}else{closeMiddleModal()}}else{crossdomain("meddleloading",A)}}};errormsg=function(B){if(isparent){var A='<div class="alert alert-error"><strong>提示！</strong>{{msg}}</div>';showmsghtml(A.replaceo("msg","<b style='color:red;'>"+B+"</b>"));setTimeout("ClosemsgModal()",2500)}else{crossdomain("errormsg",B)}};infomsg=function(B){if(isparent){var A='<div class="alert alert-info"><strong>提示！</strong>{{msg}}</div>';showmsghtml(A.replaceo("msg",B));setTimeout("ClosemsgModal()",2000)}else{crossdomain("infomsg",B)}};function ClosemsgModal(){$("#msgshow-modal-content").html("");$("#msgshow-modal-content").hide()}function showmsghtml(A){if(!document.getElementById("msgshow-modal-content")){$("body").append("<div id='msgshow-modal-content' style='width:200px;' ></div>")}if(!document.getElementById("styleshowmsghtml")){$("#styleshowmodal").remove();$("body").append("<style id='styleshowmsghtml' >#msgshow-modal-content{z-index: 9999;height:35px;display:none;}</style>")}$("#msgshow-modal-content").html(A);var D=document.documentElement.clientWidth;var C=document.documentElement.clientHeight;var B=$(document).scrollTop();$("#msgshow-modal-content").css({"position":"absolute","top":B,"left":(D-100)/2}).animate({top:B+5},500);$("#msgshow-modal-content").show()}function showMiddleModalHtml(A){if(!document.getElementById("show-middle-modal-content")){$("body").append("<div id='show-middle-modal-content' ></div>")}if(!document.getElementById("show-middle-modal-content-bg")){$("body").append("<div id='show-middle-modal-content-bg' ></div>")}if(!document.getElementById("styleshowMiddlehtml")){$("#styleshowMiddlehtml").remove();$("head").append("<style id='styleshowMiddlehtml' >#show-middle-modal-content{position:absolute;z-index: 9999;height:35px;display:none;}#show-middle-modal-content-bg{z-index: 9998;display:none;position: fixed;top: 0;left: 0;width: 100%;height: 100%;background: #666666  50% 50% repeat;opacity: .5;filter: Alpha(Opacity=50);}</style>")}$("#show-middle-modal-content").html(A);$("#show-middle-modal-content").show();$("#show-middle-modal-content-bg").show();var F=$("#show-middle-modal-content").height();var E=$("#show-middle-modal-content").children().width();var D=document.documentElement.clientWidth;var C=document.documentElement.clientHeight;var B=$(document).scrollTop();$("#show-middle-modal-content").css({"top":((C-F)/2)+B,"left":(D-E)/2})}function closeMiddleModal(){$("#show-middle-modal-content").remove();$("#show-middle-modal-content-bg").remove()}
/*
 * selectbox控件
 * 创建人：qinnailin
 * 创建时间：2014/11/13 
 *
 *
 * 
 */
!(function(C){var B=function(E,D){this.init("selectbox",E,D)};var A=0;B.prototype={constructor:B,init:function(M,D,I){this.type=M;this.$element=C(D);this.options=this.getOptions(I);if(!C(D).hasClass("fmSelectbox")){C(D).addClass("fmSelectbox")}var K=C(D).width();var O=C(D).height();var E=C(D).attr("fm-name");var L=false;var H;var N=this;if(!C(D).children("select").get(0)){C(D).append("<select style='display:none;' name='"+E+"' ></select>");L=true;H=C(D).children("select")}else{H=C(D).children("select");if(!C(H).attr("name")){C(H).attr("name",C(D).attr("fm-name"))}C(H).hide()}this.selthis=H;if(C(D).children("ul").get(0)){C(H).empty();C(D).find("ul>li").each(function(P,Q){var S=C(this).attr("val");var R=C(this).text();C(H).append("<option value='"+S+"' >"+R+"</option>")});C(D).children("ul").remove()}this.defaultval=this.options.defaults?this.options.defaults[1]:C(H).val();this.defaulttext=this.options.defaults?this.options.defaults[0]:C(H).children("option[value='"+this.defaultval+"']").text();C(D).append("<span style='height:"+O+"px;' >"+this.defaulttext+"<em></em></span>");var F=C(D).children("span");this.spanthis=F;C(D).append("<div style='width:"+(K-2)+"px;display:none;'><ul class='ul_sel'></ul></div>");var J=C(D).children("div");if(L){if(this.options.url==""&&this.options.data!=null){this.loadData()}else{if(this.options.url!=""){var G=this.options;C.getJSON(G.url,function(S){var P;if(G.source==""){P=S}else{var R=S;var Q=G.source.split(".");C.each(Q,function(T,U){if(U!=""){R=R[U]}});P=R}N.setData(P);N.loadData()})}}}C(F).click(function(P){if(C(D).hasClass("disabled")){return false}if(C(J).find("li").length>0){N.hideshowbox();P.stopPropagation()}else{N.showlist();P.stopPropagation()}});C(D).on("click","div>ul>li",function(){var Q=C(this).attr("val");var P=C(this).text();N.setvalue(Q,P);N.hideshowbox();if(N.options.change){N.options.change(C(H).val())}});C(document).click(function(){if(A<=0){N.hideshowbox()}});C(D).hover(function(){A++},function(){A--})},reqdata:function(){var D=this;var E=this.options;C.getJSON(E.url,function(I){var F;if(E.source==""){F=I}else{var H=I;var G=E.source.split(".");C.each(G,function(J,K){if(K!=""){H=H[K]}});F=H}D.setData(F);D.loadData()})},getOptions:function(D){return C.extend({},C.fn[this.type].defaults,D,this.$element.data())},loadData:function(){var F=this.options;if(F==undefined){return false}var D=this.selthis;if(this.options.defaults){D.append("<option value='"+this.options.defaults[1]+"' >"+this.options.defaults[0]+"</option>")}C.each(F.data,function(G,H){D.append("<option value='"+H[F.param.key]+"'>"+H[F.param.text]+"</option>")});if(this.defaultval!=C(this.selthis).val()){this.defaultval=C(this.selthis).val();this.defaulttext=C(this.selthis).children("option[value='"+this.defaultval+"']").text();this.spanthis.text(this.defaulttext).append("<em></em>")}if(this.options.initval){var E=C(this.selthis).children("option[value='"+this.options.initval+"']").text();this.setvalue(this.options.initval,E)}if(this.options.afterLoad){this.options.afterLoad()}},setvalue:function(E,D){C(this.selthis).children("option").siblings().removeAttr("selected");C(this.selthis).children("option[value="+E+"]").attr("selected","true");C(this.spanthis).text(D).append("<em></em>")},showlist:function(){var D=this.$element.children("div");C(".fmSelectbox>div").hide();C(D).children("ul").html("");C(this.selthis).children("option").each(function(F,G){if(C(G).val()!=C(this.selthis).val()){C(D).children("ul").append("<li val='"+C(G).val()+"' >"+C(G).text()+"</li>")}});var E=parseFloat(C(D).find("ul>li").eq(0).height());if(this.options.height>0){if(C(D).find("ul>li").size()*E>this.options.height){C(D).height(this.options.height);C(D).css("overflow-y","scroll")}}else{if(C(D).find("ul>li").size()<=10){C(D).height(C(D).find("ul>li").size()*E);C(D).css("overflow-y","hidden")}else{C(D).height(10*E);C(D).css("overflow-y","scroll")}}if(C(D).find("ul>li").size()>0){C(D).show()}},setData:function(D){this.options.data=D},hideshowbox:function(){var D=this.$element.children("div");C(D).hide();C(D).children("ul").empty();A=0},getVal:function(){return this.selthis.val()},getText:function(){return this.spanthis.text()},setSelected:function(D){var E=this.selthis.children("option[value='"+D+"']").text();this.setvalue(D,E)},clear:function(){var D=this.$element.children("div");C(D).children("ul").html("");this.selthis.html("");this.spanthis.text("").append("<em></em>");this.defaultval=""},reload:function(D){this.clear();if(D instanceof Object){this.options.data=D;this.loadData();var G=this.selthis.val();if(this.options.change){this.options.change(G)}}else{var F=this.options;var E=this;C.getJSON(D,function(L){var H;if(F.source==""){H=L}else{var J=L;var I=F.source.split(".");C.each(I,function(M,N){if(N!=""){J=J[N]}});H=J}E.setData(H);E.loadData();var K=E.selthis.val();if(F.change){F.change(K)}})}}};C.fn.selectbox=function(E){var D=C(this);var F=D.data("selectbox");if(!F){D.data("selectbox",(F=new B(this,E)))}else{F.options=C.extend(false,D.selectbox.defaults,E);F.clear();if(F.options.data!=null){F.loadData()}else{F.reqdata()}}return F};C.fn.selectbox.defaults={url:"",data:null,source:"",defaults:["--请选择--",-1],param:{key:"id",text:"name"},height:0,change:null,initval:null,afterLoad:null}})(window.jQuery);
/*
 * splitter
 * 创建人：qinnailin
 * 创建时间：2015/1/21
 */
!(function(E){var C=function(){this.init()};var A=false,D,B=true;C.prototype={constructor:C,init:function(){var F=this;E(".splitter").each(function(G,H){F.splitter(H)});E(".splitter").on("mousedown",".layout-splitter",function(G){D=E(this);A=true;if(E(this).width()>4){B=false}else{B=true}document.onselectstart=new Function("event.returnValue=false")});E(document).mouseup(function(G){A=false;D=null;document.onselectstart=new Function("event.returnValue=true")});E(document).mousemove(function(G){if(A&&B){var H=F.mouseCoords(G);F.checkWidth(D,H)}else{if(A){var H=F.mouseCoords(G);F.checkHeight(D,H)}}})},splitter:function(G){var L=E(G),I=L.width()-getwborder(L),P=L.height()-getontborder(L),N=L.children(".layout-left"),H=L.children(".layout-right"),M=L.children(".layout-up"),F=L.children(".layout-down"),Q=N.width(),S=M.height(),T=F.height(),R=Q>0?Q:I*0.2,J=Q>0?(I-R-4):I*0.8-4,K=(S>0||T>0)?(S>0?S:(P-T-4)):P*0.5-2,U=(S>0||T>0)?(T>5?T:(P-K-4)):P*0.5-2,O=E("<div></div>");U=P>K+U+4?P-K-4:U;O.addClass("layout-splitter");if(N.get(0)&&H.get(0)){O.css("width","4px").css("cursor","col-resize").css("height","100%").css("float","left");O.addClass("splitter-L");N.after(O);N.css("width",R).css("height","100%").css("float","left");H.css("width",J).css("height","100%").css("float","left")}else{if(M.get(0)&&F.get(0)){O.css("width","100%").css("cursor","row-resize").css("height","4px");O.addClass("splitter-H");M.after(O);M.css("height",K);F.css("height",U)}}},checkWidth:function(H,M){var G=H.parent(".splitter"),J=G.width()-getwborder(G),L=G.children(".layout-left"),I=G.children(".layout-right"),K=this.getPosition(L).left,N=M.x-K,N=N<50?50:N,O=N-4,O=O>J-50?J-50:O,F=J-O-4;L.width(O);I.width(F)},checkHeight:function(H,M){var G=H.parent(".splitter"),K=G.height(),L=G.children(".layout-up"),F=G.children(".layout-down"),J=this.getPosition(L).top,O=M.y-J,O=O<5?5:O,N=O-4,N=N>K-5?K-5:N,I=K-N-4;L.height(N);F.height(I)},getPosition:function(F){return E.extend({},F.offset(),{width:F[0].offsetWidth,height:F[0].offsetHeight})},mouseCoords:function(F){if(F.pageX||F.pageY){return{x:F.pageX,y:F.pageY}}return{x:F.clientX+document.body.scrollLeft-document.body.clientLeft,y:F.clientY+document.body.scrollTop-document.body.clientTop}}};E(document).ready(function(){var F=new C()})})(jQuery);
/*
 * utab
 * 创建人：qinnailin
 * 创建时间：2014/11/18
 *
 *
 * 
 */
(function(A){A.fn.utab=function(C){var D=A.extend(true,{},C);var B=A(this);A(document).ready(function(){A(B).find(".tab-content>div:first").addClass("tab-pane").addClass("active").siblings("div").addClass("tab-pane");A('<ul class="nav nav-tabs"></ul>').insertBefore(A(B).find(".tab-content"));A(B).find(".tab-pane").each(function(F,G){var E="tab-div-box-fm-"+F;A(G).attr("data-tag",E);var H=A(G).attr("data-name");A(B).find("ul.nav-tabs").append("<li><a href='javascript:' data-tag='"+E+"' >"+H+"</a></li>")});A(B).find("ul>li:first").addClass("active");A(B).find("ul.nav-tabs").on("click","li>a",function(){var E=A(B).find("ul.nav-tabs>li").index(A(this).parent("li"));A(this).parent("li").addClass("active").siblings("li").removeClass("active");A(B).find(".tab-content>div").eq(E).addClass("active").siblings("div").removeClass("active")})})}})(jQuery);(function(A){A.fn.extend({time:function(C){var F=A.extend(true,{format:"HH:mm:ss",minTime:null,maxTime:null,zindex:500,onclose:null},C);var B=A(this);var D;var G={hour:0,minute:0,second:0};var E={getPosition:function(H){return A.extend({},(H?{top:0,left:0}:A(B).offset()),{width:B[0].offsetWidth,height:B[0].offsetHeight})},create:function(){var N=this.getPosition();var M,L,H;if(A(B).val()==""){var O=new Date();G.hour=M=O.getHours();G.minute=L=O.getMinutes();G.second=H=O.getSeconds()}else{var K=A(B).val();var J=K.split(":");G.hour=M=J[0];if(J.length>=2){G.minute=L=J[1]}if(J.length>=3){G.second=H=J[2]}}var I="<div  class='timepicker time-picker-wrap' style='display: block; z-index:"+F.zindex+"'><table><tbody><tr class='time-board-wrap'><td class='hour-picker-wrap'><div class='scoreboard'><div class='increase-button'><span></span></div><div class='score'><span>"+M+"</span></div><div class='decrease-button'><span></span></div></div></td><td>:</td><td class='minute-picker-wrap'><div class='scoreboard'><div class='increase-button'><span></span></div><div class='score'><span>"+L+"</span></div><div class='decrease-button'><span></span></div></div></td><td>:</td><td class='second-picker-wrap'><div class='scoreboard'><div class='increase-button'><span></span></div><div class='score'><span>"+H+"</span></div><div class='decrease-button'><span></span></div></div></td></tr><tr class='button-wrap'><td class='clear-wrap' colspan='2'><span>清除</span></td><td></td><td class='close-wrap' colspan='2'><span>关闭</span></td></tr></tbody></table></div>";A(B).after(I);D=A(B).next(".timepicker");A(D).css({top:(N.top+N.height),left:N.left});A(D).on("click",".close-wrap",function(){if(G.hour!=0||G.minute!=0||G.second!=0){A(B).val(G.hour+":"+G.minute+":"+G.second)}if(F.onclose){F.onclose(G)}E.hide()});A(D).on("click",".clear-wrap",function(){A(B).val("");E.hide()});A(D).on("click",".hour-picker-wrap .increase-button",function(){var Q=A(this).next(".score").children("span").text();var P=(parseInt(Q)+1);if(P>23){P=0}G.hour=P;A(this).next(".score").children("span").text(P)});A(D).on("click",".hour-picker-wrap .decrease-button",function(){var Q=A(this).prev(".score").children("span").text();var P=(parseInt(Q)-1);if(P<0){P=23}G.hour=P;A(this).prev(".score").children("span").text(P)});A(D).on("click",".minute-picker-wrap .increase-button",function(){var Q=A(this).next(".score").children("span").text();var P=(parseInt(Q)+1);if(P>59){P=0}G.minute=P;A(this).next(".score").children("span").text(P)});A(D).on("click",".minute-picker-wrap .decrease-button",function(){var Q=A(this).prev(".score").children("span").text();var P=(parseInt(Q)-1);if(P<0){P=59}G.minute=P;A(this).prev(".score").children("span").text(P)});A(D).on("click",".second-picker-wrap .increase-button",function(){var P=A(this).next(".score").children("span").text();var Q=(parseInt(P)+1);if(Q>59){Q=0}G.second=Q;A(this).next(".score").children("span").text(Q)});A(D).on("click",".second-picker-wrap .decrease-button",function(){var P=A(this).prev(".score").children("span").text();var Q=(parseInt(P)-1);if(Q<0){Q=59}G.second=Q;A(this).prev(".score").children("span").text(Q)});A(window).click(function(P){if(P.srcElement!=A(B).get(0)&&A(P.srcElement).parents(".timepicker").get(0)!=A(D).get(0)){E.hide()}})},show:function(){if(A(B).val()==""){var K=new Date();G.hour=K.getHours();G.minute=K.getMinutes();G.second=K.getSeconds()}else{var J=A(B).val();var H=J.split(":");G.hour=H[0];if(H.length>=2){G.minute=H[1]}if(H.length>=3){G.second=H[2]}}A(D).find(".hour-picker-wrap .score>span").eq(0).text(G.hour);A(D).find(".minute-picker-wrap .score>span").eq(0).text(G.minute);A(D).find(".second-picker-wrap .score>span").eq(0).text(G.second);var I=this.getPosition();A(D).css({top:(I.top+I.height),left:I.left});A(D).show()},hide:function(){A(D).hide()}};A(B).focus(function(){if(A(D).get(0)){E.show();var I=A(B).val();if(I!=""){var H=I.split(":");hour=H[0];if(H.length>=2){minute=H[1]}if(H.length>=3){second=H[2]}}}else{E.create()}});A(B).keyup(function(){A(B).val("")})}})})(jQuery);
/*
 * Tooltip 仿bootstrap-tooltip
 * 创建人：qinnailin
 * 创建时间：2014/11/18
 *
 *
 * 
 */
!(function(B){var A=function(D,C){this.init("Tooltip",D,C)};A.prototype={constructor:A,init:function(C,F,E){this.type=C;this.$element=B(F);this.options=this.getOptions(E);this.setContent();var D=this.options.trigger=="hover"?"mouseenter":"focus";var G=this.options.trigger=="hover"?"mouseleave":"blur";this.$element.on(D,B.proxy(this.enter,this));this.$element.on(G,B.proxy(this.leave,this))},enter:function(C){var D=B(C.currentTarget)[this.type](this.options).data(this.type);D.show()},leave:function(C){var D=B(C.currentTarget)[this.type](this.options).data(this.type);D.hide()},getOptions:function(C){C=B.extend({},B.fn[this.type].defaults,C,this.$element.data());return C},show:function(){var I,E,G,C=this.options.placement,D,H;I=this.tip();I.remove().css({top:0,left:0,display:"block"}).appendTo(document.body);var F=this.getTitle();if(F==""){return false}I.find(".tooltip-inner").html(F);E=this.getPosition();D=I[0].offsetWidth;H=I[0].offsetHeight;switch(C){case"top":G={top:E.top-H,left:E.left+E.width/2-D/2};break;case"left":G={top:E.top-H/2+E.height/2,left:E.left-D};break;case"right":G={top:E.top-H/2+E.height/2,left:E.left+E.width};break;case"bottom":G={top:E.top+E.height,left:E.left+E.width/2-D/2};break;default:}I.addClass("fade").addClass(C).addClass("in").css(G)},hide:function(){B(".tooltip").remove()},getPosition:function(){return B.extend({},this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight})},setContent:function(){var C=this.$element;C.attr("data-title",C.attr("title")).removeAttr("title")},tip:function(){return B(this.options.template)},getTitle:function(){var C=this.$element;return C.attr("data-title")}};B.fn.Tooltip=function(C){return this.each(function(){var D=B(this);var E=D.data("Tooltip");if(!E){D.data("Tooltip",(E=new A(this,C)))}if(typeof C=="string"&&C!=""){E.options.placement=C}})};B.fn.Tooltip.defaults={placement:"top",trigger:"hover",template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'}})(window.jQuery);
/*
 * 树控件
 * 创建人：qinnailin
 * 创建时间：2014/7/9 
 */
(function(A){A.fn.Tree=function(J){var F=A.extend(true,{url:null,data:null,treeModel:"default",multiple:false,key:"Id",text:"Name",child:"Child",expand:false,clazz:0,source:"",onlyleaf:false,selected:function(R){},afterLoad:null},J);var I=A(this);var K=F.expand?"open":"close";var B;var H=0;var M='<li {{selected}} ><span class="button switch {{icon1}}" ></span>';if(F.treeModel=="checkbox"){M+='<span  class="button chk checkbox_false_full" ></span>'}M+='<a  data-id="{{'+F.key+'}}" ><span {{diyicon}} class="button {{icon2}}"></span><span >{{'+F.text+"}}</span></a>{{child}}</li>";if(F.url==null&&F.data!=null){A(I).html(G());C();O();if(F.afterLoad){F.afterLoad()}}else{D()}A(document).ready(function(){if(F.treeModel=="default"){A(I).on("click","a",function(){var T=A(this);var U=A(T).attr("data-id");var S=A(T).find(".ico_docu").get(0);if(F.onlyleaf&&S==undefined){return false}if(!F.multiple){A(I).find("a").removeClass("curSelectedNode")}if(A(T).hasClass("curSelectedNode")){A(T).removeClass("curSelectedNode")}else{A(T).addClass("curSelectedNode")}var R=A(T).parent("li").parent("ul").prev("a").attr("data-id");if(U){B={key:U,pid:R?R:0};F.selected(B)}})}A(I).on("click","span.switch",function(){var S=A(this);var R=A(S);if(R.attr("class").search("_close")>0){var T=P(R,"close");A(S).removeClass(T).addClass(T.replace("_close","_open"))}else{if(R.attr("class").search("_open")>0){var T=P(R,"open");A(S).removeClass(T).addClass(T.replace("_open","_close"))}}R=A(S).siblings("a").children("span");if(R.attr("class").search("_close")>0){var T=P(R,"close");A(S).siblings("a").children("span").removeClass(T).addClass(T.replace("_close","_open"))}else{if(R.attr("class").search("_open")>0){var T=P(R,"open");A(S).siblings("a").children("span").removeClass(T).addClass(T.replace("_open","_close"))}}A(S).parent("li").find("ul").each(function(U,V){if(A(this).prevAll("span.switch").attr("class").search("_open")>0){A(this).show()}else{A(this).hide()}})});A(I).on("click","span.chk",function(){var V=A(this);var S=A(V).siblings("ul").get(0);if(S&&!F.multiple){return}if(!F.multiple){if(A(V).hasClass("checkbox_true_full_focus")){A(I).find(".chk").removeClass("checkbox_true_full_focus").addClass("checkbox_false_full")}else{A(I).find(".chk").removeClass("checkbox_true_full_focus").addClass("checkbox_false_full");A(V).removeClass("checkbox_false_full").addClass("checkbox_true_full_focus");var X=A(V).next("a").attr("data-id");var R=A(V).parent("li").parent("ul").prev("a").attr("data-id");if(X){B={key:X,pid:R?R:0};F.selected(B)}}}else{if(A(V).hasClass("checkbox_false_full")){A(V).removeClass("checkbox_false_full").addClass("checkbox_true_full_focus");A(V).siblings("ul").find(".chk").removeClass("checkbox_false_full").addClass("checkbox_true_full_focus");var X=A(V).next("a").attr("data-id");var R=A(V).parent("li").parent("ul").prev("a").attr("data-id");if(X){B={key:X,pid:R?R:0};F.selected(B)}}else{A(V).removeClass("checkbox_true_full_focus").addClass("checkbox_false_full");var W=A(V).parent("li").parent("ul");var T=A(W).find(".checkbox_true_full_focus").size();A(V).parent("li").parents("ul").siblings(".chk").removeClass("checkbox_true_full_focus").addClass("checkbox_false_full");var U=A(V).siblings("ul").find(".chk").removeClass("checkbox_true_full_focus").addClass("checkbox_false_full")}Q(A(V))}})});function D(){A.getJSON(F.url,function(U){var R;if(F.source==""){R=U}else{var T=U;var S=F.source.split(".");A.each(S,function(V,W){if(W!=""){T=T[W]}});R=T}F.data=R;A(I).html(G());C();O();if(F.afterLoad){F.afterLoad()}})}function P(T,V){var R=T.attr("class").split(" ");var U;for(var S in R){if(V=="close"){U=R[S].match(/(.+?_close)/g)}else{U=R[S].match(/(.+?_open)/g)}if(U){break}}return U+""}function C(){if(K=="close"){A(I).find(".fm-tree ul").hide()}else{A(I).find(".fm-tree ul").show();if(F.clazz>0){A(I).find("span.ico_close").parent("a").siblings("ul").hide()}}}function O(){A(I).find("li.selected").each(function(R,S){if(F.treeModel=="default"){if(A(S).children("ul").size()==0){A(S).children("a").addClass("curSelectedNode");A(S).parents("ul").show();A(S).parents("ul").siblings("span.switch").each(function(T,U){var V=P(A(U),"close");A(U).removeClass(V).addClass(V.replace("_close","_open"))});A(S).parents("ul").siblings("a").each(function(T,U){var V=P(A(U).children("span"),"close");A(U).children("span").removeClass(V).addClass(V.replace("_close","_open"))})}}else{if(F.treeModel=="checkbox"){if(A(S).children("ul").size()==0){A(S).children("span.chk").removeClass("checkbox_false_full").addClass("checkbox_true_full_focus")}else{A(S).find("span.chk").removeClass("checkbox_false_full").addClass("checkbox_true_full_focus")}A(S).parents("ul").show();A(S).find("ul").show();A(S).parents("ul").siblings("span.switch").each(function(T,U){var V=P(A(U),"close");A(U).removeClass(V).addClass(V.replace("_close","_open"))});A(S).find("ul").siblings("span.switch").each(function(T,U){var V=P(A(U),"close");A(U).removeClass(V).addClass(V.replace("_close","_open"))});A(S).parents("ul").siblings("a").each(function(T,U){var V=P(A(U).children("span"),"close");A(U).children("span").removeClass(V).addClass(V.replace("_close","_open"))});A(S).find("ul").siblings("a").each(function(T,U){var V=P(A(U).children("span"),"close");A(U).children("span").removeClass(V).addClass(V.replace("_close","_open"))})}}})}function G(){var R='<ul class="unstyled fm-tree">';A.each(F.data,function(S,T){var U="roots_"+K;if(S>0&&S<F.data.length-1){U="center_"+K}else{if(S>0){U="bottom_"+K}}H=0;R+=L(T,U,"ico_"+K,F.data.length-1==S)});R+="</ul>";return R}function L(V,T,U,R){if(V){var S=false;if(F.clazz>0&&F.expand&&F.clazz-1<=H++){S=true}return M.replaceo("child",E(V[F.child],R,S)).replaceo(F.key,V[F.key]).replaceo(F.text,V[F.text]).replaceo("icon1",T).replaceo("diyicon",(V.Icon&&V.Icon!="")?'style="background: url('+V.Icon+') 0 0 no-repeat;"':"").replaceo("selected",V.Selected?'class="selected"':"").replaceo("icon2",U)}else{return""}}function E(U,S,T){if(U&&U.length>0){var R="<ul ";R+=S?">":'class="line" >';A.each(U,function(V,W){var Y="ico_"+(T?"close":K);var X=U.length-1==V?"bottom_"+(T?"close":K):"center_"+(T?"close":K);if(!W[F.child]||W[F.child].length==0){Y="ico_docu";X=U.length-1==V?"bottom_docu":"center_docu"}R+=L(W,X,Y,U.length-1==V)});R+="</ul>";return R}else{return""}}var N={remove:function(S,R){},getSelected:function(){B=new Array();if(F.treeModel=="default"){var R=A(I).find("a.curSelectedNode");A.each(R,function(T,U){var V=A(U).attr("data-id");var S=A(U).parent("li").parent("ul").prev("a").attr("data-id");if(V){B.push({key:V,pid:S?S:0,text:A(U).parent("li").children("a").text()})}})}else{if(F.treeModel=="checkbox"){var R=A(I).find("span.checkbox_true_full_focus");A.each(R,function(T,U){var V=A(U).next("a").attr("data-id");var S=A(U).parent("li").parent("ul").prev("a").attr("data-id");if(V){B.push({key:V,pid:S?S:0,text:A(U).parent("li").children("a").text()})}})}}return B},reload:function(){D()},refresh:function(){A(I).html(G());C()},setSelected:function(T){if(F.multiple){if(T instanceof Object){A.each(T,function(U,V){var W=A(I).find("[data-id="+V+"]").eq(0);if(A(W).get(0)){A(W).siblings(".chk").removeClass("checkbox_false_full").addClass("checkbox_true_full_focus")}if(A(W).nextAll("ul").get(0)){A(W).nextAll("ul").find(".chk").removeClass("checkbox_false_full").addClass("checkbox_true_full_focus")}Q(A(W).siblings(".chk"))})}else{var R=T.split(",");A.each(R,function(U,V){var W=A(I).find("[data-id="+V+"]").eq(0);if(A(W).get(0)){A(W).siblings(".chk").removeClass("checkbox_false_full").addClass("checkbox_true_full_focus");if(F.treeModel!="checkbox"){A(W).addClass("curSelectedNode")}}if(A(W).nextAll("ul").get(0)){A(W).nextAll("ul").find(".chk").removeClass("checkbox_false_full").addClass("checkbox_true_full_focus")}Q(A(W).siblings(".chk"))})}}else{var S=A(I).find("[data-id="+T+"]").eq(0);if(F.treeModel!="checkbox"){A(S).addClass("curSelectedNode")}if(!A(S).nextAll("ul").get(0)){A(S).siblings(".chk").removeClass("checkbox_false_full").addClass("checkbox_true_full_focus")}}},getData:function(){return F.data},donSelect:function(R){if(F.treeModel=="checkbox"){A(I).find("a[data-id="+R+"]").prev("span.chk").removeClass("checkbox_true_full_focus").addClass("checkbox_false_full")}else{A(I).find("a[data-id="+R+"]").removeClass("curSelectedNode")}}};function Q(S){var T=A(S).parent("li").parent("ul");if(A(T).get(0)){var R=A(T).find(".checkbox_false_full").size();if(R==0){A(T).siblings(".chk").removeClass("checkbox_false_full").addClass("checkbox_true_full_focus")}Q(A(T).siblings(".chk"))}}return N}})(jQuery);
/*
 * 集成表格控件 
 *创建人：qinnailin
 * 创建时间：2014/11/11 尼玛个光棍节！！
 */
(function(A){A.fn.uTable=function(D){var I=A.extend(true,{url:"",data:null,dataformat:{data:"Data",count:"Count"},click:null,dbclick:null,method:"Get",dataType:"json",sortMultiple:true,putJson:true,cache:true,multiple:true,cancel:true,page:{enable:true,click:null,pageSize:30,pageIndex:1,back:"上一页",next:"下一页",reqindex:"pageindex",reqsize:"pagesize"},afterLoad:null,checkbox:{enable:false},buttons:null,heads:[]},D);var F=A(this);A(F).addClass("container-fluid");A(F).addClass("layout-box");B();G();A(F).find(".layout-center").each(function(J,K){findlayout(A(K))});function B(){if(!I.buttons){return false}if(!A(F).find(".utable-tool").get(0)){var J="<div class=\"row-fluid layout-top utable-tool\" style='height:50px;' ></div>";A(F).append(J);A.each(I.buttons,function(K,L){A("<button class='btn UTable-btn2 "+(L.style?L.style:"")+"' >"+L.text+"</button>").appendTo(A(F).find(".utable-tool")).click(function(){L.click()})})}}function G(){var J='<div class="row-fluid layout-center"><div class="layout-box">';J+='<div class="row-fluid layout-top table_th '+(I.buttons?"utable-hasbutton":"")+"\" style='height:30px; background:#f7f7f7; padding-right:17px;' >";J+="<table class='table' ><thead fm-head><tr>";if(I.checkbox.enable&&I.multiple){J+="<th ><input type='checkbox' class='chkAll' /></th>"}else{if(I.checkbox.enable){J+="<th ></th>"}}A.each(I.heads,function(K,L){J+=(L.sort?"<th fm-sort='"+L.key+"' "+(L.width?"width='"+L.width+"'":"")+" >":"<th "+(L.width?"width='"+L.width+"'":"")+">")+L.name+"</th>"});J+="</tr></thead></table>";J+="</div><div class=\"row-fluid layout-center\" style='overflow-y:scroll'>";J+="<table class='table scroll_table table_hover table_ch_c'  ><tbody fm-body><tr>";if(I.checkbox.enable){J+="<td ><input type='checkbox' /></td>"}A.each(I.heads,function(K,L){J+="<td "+(L.conver?"fm-conver='"+L.conver+"'":"")+" "+(L.width?"width='"+L.width+"'":"")+" >{{"+L.key+"}}</td>"});J+="</tr></tbody></table>";J+="</div>";if(I.page.enable){J+='<div class="row-fluid layout-bottom" style=\'height:35px;\' ><div fm-pagerbox class="tfoot"></div></div>'}J+="</div></div>";A(F).append(J)}if(I.page.click){var C=I.page.click;I.page.click=function(){A(F).find(".chkAll").removeAttr("checked");C()}}else{I.page.click=function(){A(F).find(".chkAll").removeAttr("checked")}}A(document).ready(function(){A(F).find("[fm-body]").on("click","tr",function(){var J=A(this);if(J.hasClass("checked_tr")){if(I.cancel){A(J).removeClass("checked_tr");A(J).find("input[type='checkbox']").removeAttr("checked");A(F).find(".chkAll").removeAttr("checked")}}else{if(!I.multiple){A(F).find("[fm-body] input[type='checkbox']").removeAttr("checked");A(F).find("[fm-body]>tr").removeClass("checked_tr")}A(J).addClass("checked_tr");A(J).find("input[type='checkbox']").attr("checked","checked");if(A(F).find("[fm-body] input:checked").size()==A(F).find("[fm-body]>tr").size()){if(I.multiple){A(F).find(".chkAll").attr("checked","checked")}}}});A(F).on("click",".chkAll",function(){if(A(this).attr("checked")=="checked"){A(F).find("[fm-body] input[type='checkbox']").attr("checked","checked");A(F).find("[fm-body]>tr").addClass("checked_tr")}else{A(F).find("[fm-body] input[type='checkbox']").removeAttr("checked").removeClass("checked_tr");A(F).find("[fm-body]>tr").removeClass("checked_tr")}})});var E=A(F).Grid(I);var H={utable:E,getSelectData:function(){var J=new Array();var K=E.getData();A(F).find("[fm-body]>tr.checked_tr").each(function(L,M){J.push(A(M).data("jsondata"))});return J},refresh:function(){E.refresh()},reload:function(){E.reload()},load:function(J){E.load(J)}};return H}})(jQuery);
/*
 * 树控件
 * 创建人：qinnailin
 * 创建时间：2014/10/17
 */
(function(A){A.fn.uTree=function(F){var C=A.extend(true,{treeId:"",treeObj:null,view:{addDiyDom:null,autoCancelSelected:true,dblClickExpand:true,expandSpeed:"fast",fontCss:{},nameIsHTML:false,selectedMulti:true,showIcon:true,showLine:false,showTitle:true,txtSelectedEnable:false,expand:-1},check:{enable:false,chkStyle:"checkbox",chkboxType:{"Y":"ps","N":"ps"}},data:{key:{children:"Child",name:"Name",title:"",url:"url"},simpleData:{enable:false,idKey:"Id",pIdKey:"PId",rootPId:null},keep:{parent:false,leaf:false},Nodes:null},callback:{beforeAsync:null,beforeClick:null,beforeDblClick:null,beforeRightClick:null,beforeMouseDown:null,beforeMouseUp:null,beforeExpand:null,beforeCollapse:null,beforeRemove:null,onAsyncError:null,onAsyncSuccess:null,onNodeCreated:null,onClick:null,onDblClick:null,onRightClick:null,onMouseDown:null,onMouseUp:null,onExpand:null,onCollapse:null,onRemove:null,afterLoad:null}},F);var H=A(this);var J=A(H).attr("id");if(!H.hasClass("ztree")){H.addClass("ztree")}var K;try{if(C.view.expand!=-1){var E;if(C.callback.onNodeCreated!=null){E=C.callback.onNodeCreated}C.callback.onNodeCreated=function(L,M,N){var O=A.fn.zTree.getZTreeObj(J);if(N.level<=C.view.expand){O.expandNode(N,null,null,null,true)}if(E){E(L,M,N)}}}var D=C.callback.onAsyncSuccess;C.callback.onAsyncSuccess=function(N,L,M,P){if(D){D(N,L,M,P)}if(C.callback.afterLoad){C.callback.afterLoad()}var O=[];if(C.check.enable){O=K.getCheckedNodes(true)}else{O=K.getSelectedNodes()}A.each(O,function(Q,R){G(R)})};K=A.fn.zTree.init(H,C,C.data.Nodes);if(C.async==undefined||!C.async.enable){if(C.callback.afterLoad){C.callback.afterLoad()}var I=[];if(C.check.enable){I=K.getCheckedNodes(true)}else{I=K.getSelectedNodes()}A.each(I,function(L,M){G(M)})}}catch(B){alertui("请引入zTree类库!");console.debug(B)}A.extend(true,K,{setSelected:function(M){var O=K.transformToArray(K.getNodes());var N=M.split(",");for(var L=0;L<N.length;L++){for(var Q=0;Q<O.length;Q++){if(O[Q][C.data.simpleData.idKey]==N[L]){if(C.check.enable){K.checkNode(O[Q],true,true)}else{K.selectNode(O[Q],C.view.selectedMulti)}break}}}var P=[];if(C.check.enable){P=K.getCheckedNodes(true)}else{P=K.getSelectedNodes()}A.each(P,function(R,S){G(S)})},donSelect:function(N){if(C.check.enable){var L=K.getCheckedNodes(true);for(var M=0;M<L.length;M++){if(L[M][C.data.simpleData.idKey]==N){K.checkNode(L[M],false,true);break}}}else{var L=K.getSelectedNodes();for(var M=0;M<L.length;M++){if(L[M][C.data.simpleData.idKey]==N){K.cancelSelectedNode(L[M]);break}}}}});function G(M){K.expandNode(M,true,false,false,false);var L=M.getParentNode();if(L){G(L)}}return K}})(jQuery);!(function(B){var A=function(C){this.init(C)};A.prototype={ws:null,init:function(C){var D;this.opstions=D=this.getOpstions(C);if(this.checkBrowser()){this.ws=this.openWS(D.callback,D.error,D.close)}else{this.doAjaxRequest(D.callback,D.error)}},getOpstions:function(C){return B.extend(true,B.webcnm.defaults,C)},doAjaxRequest:function(C,F){var E=this.opstions,D;D=this;B.ajax({type:E.type,url:E.url,dataType:E.dataType,timeout:E.timeout,data:{webComet:true,tim:Math.random()},success:function(H,G){D.doAjaxRequest(C,F)},complete:function(H,G){if(H.readyState=="4"){C(H.responseText)}},error:function(H,G,I){if(G=="timeout"){D.doAjaxRequest(C,F)}else{F("error:"+G)}}})},checkBrowser:function(){if(window.WebSocket){return true}else{return false}},openWS:function(C,E,F){var D;D=new WebSocket(this.opstions.ws);D.onopen=function(){console.info("服务器链接成功！")};D.onmessage=function(G){C(G.data)};D.onerror=function(G){console.info(G.error);if(E){E(G)}};D.onclose=function(){console.info("服务关闭！");if(F){F()}};return D},send:function(E){if(this.ws){this.ws.send(E)}else{var D=this.opstions,C;C=this;B.ajax({type:D.type,url:D.url,dataType:D.dataType,data:E,success:function(G,F){},complete:function(G,F){D.callback(G.responseText)},error:function(G,F,H){D.error("error:"+F)}})}}};B.webcnm=function(D){var C=B("body").data("websocket");if(!C){B("body").data("websocket",C=new A(D))}return C};B.webcnm.defaults={ws:null,type:"post",url:"",dataType:"json",timeout:10000,callback:function(){},error:function(){},close:function(){}}})(jQuery);