forked from loafer/jQuery.easyui-extend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jquery.easyui.extend.min.js
10 lines (10 loc) · 60.4 KB
/
jquery.easyui.extend.min.js
1
2
3
4
5
6
7
8
9
10
/**
* Licensed under the GPL licenses
* http://www.gnu.org/licenses/gpl.txt
*
* @author: 爱看书不识字<[email protected]>
* @date: 2013-9-3
*
* https://github.com/loafer/jQuery.easyui-extend
*/
(function(d){function a(g){var h=d.extend(true,{},d.fn.combobox.defaults,d(g).combobox("options"));var f=h.customAttr.slave;if(f.id==null){return}if(/^#/.test(f.id)){f.id=f.id}else{f.id="#"+f.id}if(!h.multiple&&!h.editable){d(g).combobox("addEventListener",[{name:"onSelect",handler:function(j){b(g,f,j,h.valueField)}},{name:"onChange",handler:function(k,j){if(k==null||k==""){d(f.id).combobox("clear").combobox("loadData",[]);d(g).combobox("textbox").trigger("blur")}}}])}}function b(j,k,f,h){if(k.remote){var g=k.url||d(k.id).combobox("options").url;if(g.indexOf("?")>-1){g+="&swd="+f[h]}else{g+="?swd="+f[h]}d(k.id).combobox("clear").combobox("reload",g)}else{d(k.id).combobox("clear").combobox("loadData",f.data)}}function e(g){var h=d(g).combobox("options");var f=d.extend(true,{},d.fn.combobox.defaults,h);if(!f.customAttr.headervalue){return}d(g).combobox("addEventListener",{name:"onLoadSuccess",handler:function(){d(g).combobox("textbox").trigger("blur")}})}function c(k,f,j,h){var g=d(k).combobox("options");var l=g[f];switch(f){case"onBeforeLoad":if(h){g[f]=j}else{g[f]=function(m){l.apply(this,arguments);j.apply(this,arguments)}}break;case"onLoadSuccess":if(h){g[f]=j}else{g[f]=function(){l.apply(this,arguments);j.apply(this,arguments)}}break;case"onLoadError":if(h){g[f]=j}else{g[f]=function(){l.apply(this,arguments);j.apply(this,arguments)}}break;case"onSelect":if(h){g[f]=j}else{g[f]=function(m){l.apply(this,arguments);j.apply(this,arguments)}}break;case"onUnselect":if(h){g[f]=j}else{g[f]=function(m){l.apply(this,arguments);j.apply(this,arguments)}}break;default:d(k).combo("addEventListener",{name:f,override:h,handler:j});break}}d.fn.combobox.defaults.customAttr={slave:{id:null,remote:true,url:null}};d.extend(d.fn.combobox.methods,{followCustomHandle:function(f){return f.each(function(){e(this);a(this);d(this).combo("followCustomHandle")})},addEventListener:function(g,f){return g.each(function(){var h=d.isArray(f)?f:[f];var j=this;d.each(h,function(k,l){c(j,l.name,l.handler||function(){},l.override)})})},getSelected:function(m){var f=m.combobox("options");var h=f.valueField;var l=m.combobox("getValue");var k=m.combobox("getData");for(var g=0;g<k.length;g++){var j=k[g];if(j[h]==l){return j}}return null}})})(jQuery);(function(f){function c(j){var k=f.data(j,"combo").options;var h=f.extend(true,{},f.fn.combo.defaults,k);if(!h.customAttr.headervalue){return}if(k.required){var g=['unequal["'+h.customAttr.headervalue+'"]'];if(k.validType){if(typeof k.validType=="string"){g.push(k.validType);k.validType=g}if(f.isArray(k.validType)){f.merge(k.validType,g)}}else{f.extend(k,{validType:g})}}f(j).combo("addEventListener",{name:"onChange",handler:function(m,l){if(m==null||m==""){f(j).combo("setText",h.customAttr.headervalue)}}}).combo("textbox").val(h.customAttr.headervalue).attr("prompt",h.customAttr.headervalue).focus(function(){if(f(this).val()==h.customAttr.headervalue){f(this).val("")}}).blur(function(){if(f.trim(f(this).val())==""){f(this).val(h.customAttr.headervalue)}f(j).combo("validate")})}function a(j){var h=f(j).combo("getValue");if(!h){return}var g=f.data(j,"combo").options;f(j).combo("setText","");if(g.multiple){f(j).combo("setValues",[])}else{f(j).combo("setValue","")}}function b(h){var g=f(h).combo("getValues");return g.length>0?(g[0]!=""?g[0]:null):null}function e(h){var j=f.extend(true,{},f.fn.combo.defaults,f.data(h,"combo").options);var g=j.customAttr.autocomplete;if(!g.enabled){return}f(h).combo("textbox").keyup(function(k){if(f(this).val().length!=0&&(f(this).val().length%g.minLength==0)&&g.url){f.ajax({type:"POST",url:g.url,data:{wd:f(this).val()},dataType:"json",success:function(n){var l=f(h).combo("panel").empty();for(var m=0;m<n.length;m++){f("<div>").addClass("combobox-item").attr("value",n[m].id).text(n[m].text).click(function(q){var o=f(this).attr("value");var p=f(this).text();f(h).combo("setValue",o).combo("setText",p).combo("hidePanel")}).hover(function(){f(this).addClass("combobox-item-hover")},function(){f(this).removeClass("combobox-item-hover")}).appendTo(l)}},error:function(l,n,m){f.messager.alert("Error",m,"error")}})}})}function d(l,g,k,j){var h=f(l).combo("options");var m=h[g];switch(g){case"onShowPanel":if(j){h[g]=k}else{h[g]=function(){m.apply(this,arguments);k.apply(this,arguments)}}break;case"onHidePanel":if(j){h[g]=k}else{h[g]=function(){m.apply(this,arguments);k.apply(this,arguments)}}break;case"onChange":if(j){h[g]=k}else{h[g]=function(o,n){m.apply(this,arguments);k.apply(this,arguments)}}break;default:break}}f.fn.combo.defaults.customAttr={headervalue:null,autocomplete:{enabled:false,minLength:3,url:undefined}};f.extend(f.fn.combo.methods,{followCustomHandle:function(g){return g.each(function(){c(this);e(this)})},clear:function(g){return g.each(function(){a(this)})},getValue:function(g){return b(g[0])},addEventListener:function(h,g){return h.each(function(){var j=f.isArray(g)?g:[g];var k=this;f.each(j,function(l,m){d(k,m.name,m.handler||function(){},m.override)})})}})})(jQuery);(function(a){a.extend(a.fn.combogrid.methods,{getSelected:function(b){return b.combogrid("grid").datagrid("getSelected")}})})(jQuery);(function(a){a.extend(a.fn.combotree.methods,{followCustomHandle:function(b){return b.each(function(){a(this).combotree("tree").tree("followCustomHandle");a(this).combo("followCustomHandle")})}})})(jQuery);(function(c){function v(A,B,x){var z=h(A,x);var y=c("#"+z);if(y.length==0){y=c("<div>",{id:z}).menu().menu("appendItems",B)}return y}function h(y,x){return c(y).attr("id")+"_"+x}function t(y){var x={};c.each(y,function(){var A=this;if(A.onclick){var z=A.id||A.text;x[z]=A.onclick;delete A.onclick}if(A.submenu&&c.isArray(A.submenu)&&A.submenu.length>0){c.extend(x,t(A.submenu))}});return x}function n(E){var D=h(E,"headerContextMenu");var y=[{text:"显示/隐藏列",iconCls:"icon-columns",submenu:[{id:D+"_showAll",text:"全部显示",iconCls:"icon-columns",onclick:function(G,H,F){c.fn.datagrid.headerContextMenu.defaultEvents.doShowAll(F)}},{id:D+"_restore",text:"还原",iconCls:"icon-columns",onclick:function(G,H,F){c.fn.datagrid.headerContextMenu.defaultEvents.doRestore(F)}},"-"]}];var A=function(F){return F.substr(F.lastIndexOf("_")+1,F.length)};var B=[];var z=c(E).datagrid("getColumnFields",true);var C=c(E).datagrid("getColumnFields");x(C,false);function x(G,F){c.each(G,function(I,J){if(!J||J=="ck"){return true}var H=c(E).datagrid("getColumnOption",J);H._hidden=H.hidden;B.push({id:D+"_"+J,text:H.title,disabled:F,iconCls:H.hidden?"icon-unchecked":"icon-checked",onclick:function(L,K,O){var N=A(L.id);var M=c(O).datagrid("getColumnOption",N).hidden;if(!M){c.fn.datagrid.headerContextMenu.defaultEvents.doHideColumn(O,N,L)}else{c.fn.datagrid.headerContextMenu.defaultEvents.doShowColumn(O,N,L)}}})})}c.merge(y[0].submenu,B);return y}function m(A){var y=c.extend(true,{},c.fn.datagrid.defaults,c(A).datagrid("options"));var C=y.customAttr.headerContextMenu;if(!C.isShow){return}if(y.columns[0][0].checkbox){y.columns[0][0].field="ck"}var B=n(A);if(C.isMerge){c.merge(B,C.items)}if(!C.isMerge&&c.isArray(C.items)&&C.items.length>0){B=C.items}var z=t(B);var x=v(A,B,"headerContextMenu");c(A).datagrid("addEventListener",{name:"onHeaderContextMenu",handler:function(E,D){E.preventDefault();x.menu("addEventListener",[{name:"onClick",override:true,handler:function(G){var F=G.id||G.text;if(z[F]){z[F].call(this,G,D,A)}}},{name:"onShow",override:true,handler:function(){C.onShow&&C.onShow.call(this,D,A)}},{name:"onHide",override:true,handler:function(){C.onHide&&C.onHide.call(this)}}]).menu("show",{left:E.pageX,top:E.pageY})}})}function j(z){var y=h(z,"rowContextMenu");var x=[{id:y+"_delete",text:"删除",iconCls:"icon-remove",onclick:function(B,D,C,A){c.fn.datagrid.rowContextMenu.defaultEvents.doDelete(B,D,C,A)}},"-",{id:y+"_reload",text:"刷新",iconCls:"icon-reload",onclick:function(B,D,C,A){c.fn.datagrid.rowContextMenu.defaultEvents.doReload(B,D,C,A)}},{id:y+"_reload_this_page",text:"刷新当前页",onclick:function(B,D,C,A){c.fn.datagrid.rowContextMenu.defaultEvents.doReloadThisPage(B,D,C,A)}}];return x}function e(B){var y=c.extend(true,{},c.fn.datagrid.defaults,c(B).datagrid("options"));var z=y.customAttr.rowContextMenu;if(!z.isShow){return}var C=j(B);if(z.isMerge){c.merge(C,z.items)}if(!z.isMerge&&c.isArray(z.items)&&z.items.length>0){C=z.items}var A=t(C);var x=v(B,C,"rowContextMenu");c(B).datagrid("addEventListener",{name:"onRowContextMenu",handler:function(E,F,D){E.preventDefault();c(B).datagrid("selectRow",F);x.menu("addEventListener",{name:"onClick",override:true,handler:function(H){var G=H.id||H.text;if(A[G]){A[G].call(this,H,F,D,B)}}}).menu("show",{left:E.pageX,top:E.pageY})}})}function f(D){var F=c.extend(true,{},c.fn.datagrid.defaults,c(D).datagrid("options"));if(!c.isArray(F.customAttr.slaveList)){return}if(F.customAttr.slaveList.length==0){return}var E={slaveList:F.customAttr.slaveList,activeSlave:F.customAttr.activeSlave};var z=c(D);var y=[];for(var C in E.slaveList){var A={id:E.slaveList[C].id,params:{}};var B={},x;if(!E.slaveList[C].relatedfield){x=z.datagrid("options").idField;B[x]="undefined"}else{x=E.slaveList[C].relatedfield;B[E.slaveList[C].relatedfield]="undefined"}c.extend(A.params,B,E.slaveList[C].queryParams);y.push(A)}if(E.activeSlave==c.fn.datagrid.defaults.customAttr.activeSlave){z.datagrid("addEventListener",{name:"onDblClickRow",handler:function(I,H){for(var G in y){y[G].params[x]=H[x];c("#"+y[G].id).datagrid("load",y[G].params)}}})}}function q(C){var y=c.extend(true,{},c.fn.datagrid.defaults,c(C).datagrid("options"));if(!y.customAttr.rowediting){return}var D=function(E){return c(E).attr("id")+"_editor_buttons_panel"};var x=120;var A=function(J){var H=D(J);if(c("#"+H).length>0){return}var F=c(J).datagrid("getPanel");var I=c.data(J,"datagrid");var G=I.dc.body2;G.css("position","relative");var E=c("<div>",{id:H}).addClass("dialog-button").appendTo(G).css({position:"absolute",display:"block","border-bottom":"1px solid #ddd","border-left":"1px solid #ddd","border-right":"1px solid #ddd",left:parseInt(F.width()/2)-x,"z-index":2013,display:"none",padding:"4px 5px"});c('<a href="javascript:void(0)">确定</a>').css("margin-left","0px").linkbutton({iconCls:"icon-ok"}).click(function(){var K=c(J).datagrid("getRowIndex",c(J).datagrid("getEditingRow"));if(!y.customAttr.onConfirmEdit.call(J,K)){return}c(J).datagrid("endEdit",K)}).appendTo(E);c('<a href="javascript:void(0)">取消</a>').css("margin-left","6px").linkbutton({iconCls:"icon-cancel"}).click(function(){var K=c(J).datagrid("getRowIndex",c(J).datagrid("getEditingRow"));c(J).datagrid("cancelEdit",K)}).appendTo(E)};var B=function(L,K){var E=c.data(L,"datagrid").options;var M=E.finder.getTr(L,K,"body",2);var H=M.position();var G="#"+D(L);var F=c.data(L,"datagrid");var I=F.dc.body2;var J=function(){var N=M.height(),O=M.width();var Q=H.top+I.scrollTop(),P=H.left;var R=11;if(O>I.width()){P=I.width()/2-x}else{P=O/2-x}if(H.top+(N*2+R)>I.height()){Q=Q-(N+R)}else{Q=Q+N}return{top:Q,left:P}};c(G).css(J()).show()};var z=function(F){var E="#"+D(F);c(E).hide()};c(C).datagrid("addEventListener",[{name:"onLoadSuccess",handler:function(E){A(this)}},{name:"onBeforeEdit",handler:function(E,F){A(C);B(C,E)}},{name:"onAfterEdit",handler:function(E,G,F){z(C)}},{name:"onCancelEdit",handler:function(E,F){z(C)}}])}function u(z){var y=c.extend(true,{},c.fn.datagrid.defaults,c(z).datagrid("options"));if(!y.customAttr.tooltip.enable){return}var C=function(F,E){var D={position:y.customAttr.tooltip.position,trackMouse:true,onHide:function(){c(F).tooltip("destroy")},onShow:function(){if(c.isPlainObject(E)&&E.css){c(this).tooltip("tip").css(E.css)}}};c.extend(D,c.isPlainObject(E)?E:{content:E});c(F).tooltip(D).tooltip("show")};var B=function(H,E){var I=parseInt(H.attr("datagrid-row-index"));var G=c(z).datagrid("getRows")[I];var D=function(L){var K=[];var J=c.grep(c.merge(c(z).datagrid("getColumnFields",true),c(z).datagrid("getColumnFields")),function(N,M){return c.trim(N).length>0});c.each(J,function(){var M=this;var N=c(z).datagrid("getColumnOption",M).title;K.push(N+": "+L[M])});return K.join("<br>")};var F=E?E(G,I):D(G);H.mouseover(function(){C(this,F)})};var x=function(D,E){D.mouseover(function(){var J=c(this).parent().attr("datagrid-row-index");var H=c(z).datagrid("getRows")[J];var I=c(this).attr("field");var G=H[I];var F=E?E(G,I):G;C(this,F)})};var A=function(){if(y.customAttr.tooltip.target=="row"){y.finder.getTr(z,"","allbody").each(function(){var G=c(this);if(G.hasClass("datagrid-row")){B(G,y.customAttr.tooltip.formatter)}})}else{if(y.customAttr.tooltip.fields&&c.isArray(y.customAttr.tooltip.fields)){var D=c(z).datagrid("getPanel");var F=c.data(z,"datagrid");var E=F.dc.body2;c.each(y.customAttr.tooltip.fields,function(){var G=this;x(c("td[field="+G+"]",E),y.customAttr.tooltip.formatter)})}}};c(z).datagrid("addEventListener",{name:"onLoadSuccess",handler:function(D){A()}})}function b(y){var x=c.extend(true,{},c.fn.datagrid.defaults,c(y).datagrid("options"));if(!x.pagination){return}c(y).datagrid("addEventListener",{name:"onLoadSuccess",handler:function(z){c(y).datagrid("setPagination",x.customAttr.pagination)}})}function r(z){var y=c(z).datagrid("options");var x=function(C){var B=c(z).datagrid("getPanel");if(C.rows.length==0){var D=c("div.datagrid-view2>div.datagrid-header>div.datagrid-header-inner>table",B)[0];var A=c(">div.datagrid-view>div.datagrid-view2>div.datagrid-body",B);c("<div>").html(" ").width(c(D).width()).appendTo(A)}else{c("div.datagrid-view2>div.datagrid-body>div",B).remove()}};c(z).datagrid("addEventListener",[{name:"onLoadSuccess",handler:function(A){x(A)}},{name:"onLoadError",handler:function(){x({rows:[]})}}])}function p(A,z){var x=c(A).datagrid("options");var B=c(A).datagrid("getColumnFields",true);var y=x.columns[0][0];if(B.length==0&&y.checkbox){w(A,"ck",2,1)}s(A,z,true);w(A,z,2,1)}function o(C,B){var x=c(C).datagrid("options");if(!x.frozenColumns[0]){x.frozenColumns=[[]]}var A=c(C).datagrid("getColumnOption",B);x.frozenColumns[0].push(A);z(A);c(C).datagrid(x);var y=c(C).datagrid("getHeaderContextMenu").menu("findItem",A.title);c(C).datagrid("getHeaderContextMenu").menu("disableItem",y.target);function z(F){for(var E=0;E<x.columns.length;E++){for(var D=0;D<x.columns[E].length;D++){if(x.columns[E][D].field==F.field){x.columns[E].splice(D,1);return}}}}}function w(B,C,D,E){var G=c(B).datagrid("options");var F=c.data(B,"datagrid").dc;var x=null;var x=(D==1?F.header1:F.header2).find(">table>tbody>tr.datagrid-header-row>td[field="+C+"]");if(D>E){(E==1?F.header1:F.header2).find(">table>tbody>tr.datagrid-header-row").append(x)}else{(E==1?F.header1:F.header2).find(">table>tbody>tr.datagrid-header-row").children("td[field]").each(function(){if(A(C,c(this).attr("field"))){c(this).before(x);return false}})}var y=(D==1?F.body1:F.body2).find(">table>tbody>tr>td[field="+C+"]");if(D>E){c.each(y,function(H,I){G.finder.getTr(B,H,"body",E).append(I)})}else{c.each(y,function(H,I){G.finder.getTr(B,H,"body",E).children("td[field]").each(function(){if(A(C,c(this).attr("field"))){c(this).before(I);return false}})})}c(B).datagrid("fixColumnSize");function A(H,I){return z(H)<z(I)}function z(H){return c.inArray(H,c(B).datagrid("getColumnFields"))}}function s(D,C,z){var y=E(C);var B=c(D).datagrid("getColumnOption",C);c.extend(B,{index:y});var x=c(D).datagrid("getHeaderContextMenu");var A=x.menu("findItem",B.title);if(!A){return}if(z){x.menu("disableItem",A.target)}else{x.menu("enableItem",A.target)}function E(F){return c.inArray(F,c(D).datagrid("getColumnFields"))}}function g(D,C){var z=c(C).datagrid("getHeaderContextMenu");var B=c(C).datagrid("getColumnOption",D);var y=z.menu("findItem",B.title);if(y){if(!y.disabled){x("冻结此列");A("取消冻结")}else{x("取消冻结");A("冻结此列")}}else{A("冻结此列");A("取消冻结")}function A(F){var E=z.menu("findItem",F);if(E){z.menu("disableItem",E.target)}}function x(F){var E=z.menu("findItem",F);if(E){z.menu("enableItem",E.target)}}}function d(z,y,x){if(x){p(z,y)}else{o(z,y)}}function a(y,x){s(y,x,false);w(y,x,1,2)}function k(B,x,A,z){var y=c(B).datagrid("options");var C=y[x];switch(x){case"onLoadSuccess":if(z){y[x]=A}else{y[x]=function(D){C.apply(this,arguments);A.apply(this,arguments)}}break;case"onLoadError":if(z){y[x]=A}else{y[x]=function(){C.apply(this,arguments);A.apply(this,arguments)}}break;case"onBeforeLoad":if(z){y[x]=A}else{y[x]=function(D){C.apply(this,arguments);A.apply(this,arguments)}}break;case"onClickRow":if(z){y[x]=A}else{y[x]=function(E,D){C.apply(this,arguments);A.apply(this,arguments)}}break;case"onDblClickRow":if(z){y[x]=A}else{y[x]=function(E,D){C.apply(this,arguments);A.apply(this,arguments)}}break;case"onClickCell":if(z){y[x]=A}else{y[x]=function(F,E,D){C.apply(this,arguments);A.apply(this,arguments)}}break;case"onDblClickCell":if(z){y[x]=A}else{y[x]=function(F,E,D){C.apply(this,arguments);A.apply(this,arguments)}}break;case"onSortColumn":if(z){y[x]=A}else{y[x]=function(E,D){C.apply(this,arguments);A.apply(this,arguments)}}break;case"onResizeColumn":if(z){y[x]=A}else{y[x]=function(E,D){C.apply(this,arguments);A.apply(this,arguments)}}break;case"onSelect":if(z){y[x]=A}else{y[x]=function(E,D){C.apply(this,arguments);A.apply(this,arguments)}}break;case"onUnselect":if(z){y[x]=A}else{y[x]=function(E,D){C.apply(this,arguments);A.apply(this,arguments)}}break;case"onSelectAll":if(z){y[x]=A}else{y[x]=function(D){C.apply(this,arguments);A.apply(this,arguments)}}break;case"onUnselectAll":if(z){y[x]=A}else{y[x]=function(D){C.apply(this,arguments);handlerapply(this,arguments)}}break;case"onCheck":if(z){y[x]=A}else{y[x]=function(E,D){C.apply(this,arguments);A.apply(this,arguments)}}break;case"onUncheck":if(z){y[x]=A}else{y[x]=function(E,D){C.apply(this,arguments);A.apply(this,arguments)}}break;case"onCheckAll":if(z){y[x]=A}else{y[x]=function(D){C.apply(this,arguments);A.apply(this,arguments)}}break;case"onUncheckAll":if(z){y[x]=A}else{y[x]=function(D){C.apply(this,arguments);A.apply(this,arguments)}}break;case"onBeforeEdit":if(z){y[x]=A}else{y[x]=function(E,D){C.apply(this,arguments);A.apply(this,arguments)}}break;case"onAfterEdit":if(z){y[x]=A}else{y[x]=function(F,E,D){C.apply(this,arguments);A.apply(this,arguments)}}break;case"onCancelEdit":if(z){y[x]=A}else{y[x]=function(E,D){C.apply(this,arguments);A.apply(this,arguments)}}break;case"onHeaderContextMenu":if(z){y[x]=A}else{y[x]=function(E,D){C.apply(this,arguments);A.apply(this,arguments)}}break;case"onRowContextMenu":if(z){y[x]=A}else{y[x]=function(E,F,D){C.apply(this,arguments);A.apply(this,arguments)}}break;case"onExpandRow":if(z){y[x]=A}else{y[x]=function(D,E){C&&C.apply(this,arguments);A.apply(this,arguments)}}break;case"onCollapseRow":if(z){y[x]=A}else{y[x]=function(D,E){C&&C.apply(this,arguments);A.apply(this,arguments)}}break;default:break}}function l(z){var y=c(z).datagrid("options");var x=[];y.finder.getTr(z,"","allbody",1).each(function(){if(c("span.datagrid-row-collapse",this).length>0){x.push(c(this).attr("datagrid-row-index"))}});return x}c.fn.datagrid.headerContextMenu={};c.fn.datagrid.headerContextMenu.defaultEvents={doHideColumn:function(z,y,x){c(z).datagrid("hideColumn",y);var A=c(z).datagrid("getHeaderContextMenu");A.menu("setIcon",{target:x.target,iconCls:"icon-unchecked"})},doShowColumn:function(z,y,x){c(z).datagrid("showColumn",y);var A=c(z).datagrid("getHeaderContextMenu");A.menu("setIcon",{target:x.target,iconCls:"icon-checked"})},doShowAll:function(A){var x=c(A).datagrid("getColumnFields");var B=c(A).datagrid("getHeaderContextMenu");for(i in x){c(A).datagrid("showColumn",x[i]);var y=c(A).datagrid("getColumnOption",x[i]);var z=B.menu("findItem",y.title);if(z){B.menu("setIcon",{target:z.target,iconCls:"icon-checked"})}}},doRestore:function(A){var x=c(A).datagrid("getColumnFields");var B=c(A).datagrid("getHeaderContextMenu");for(i in x){var y=c(A).datagrid("getColumnOption",x[i]);var z=B.menu("findItem",y.title);if(!y._hidden){c(A).datagrid("showColumn",x[i]);z&&B.menu("setIcon",{target:z.target,iconCls:"icon-checked"})}else{c(A).datagrid("hideColumn",x[i]);z&&B.menu("setIcon",{target:z.target,iconCls:"icon-unchecked"})}}}};c.fn.datagrid.rowContextMenu={};c.fn.datagrid.rowContextMenu.defaultEvents={doAdd:function(x,A,y,z){},doEdit:function(x,A,y,z){},doDelete:function(x,A,y,z){c.messager.confirm("疑问","您确定要删除已选中的行?",function(B){if(B){c(z).datagrid("deleteRows",c(z).datagrid("getSelections"))}})},doReload:function(x,A,y,z){c(z).datagrid("load")},doReloadThisPage:function(x,A,y,z){c(z).datagrid("reload")},doExportThisPage:function(x,A,y,z){},doExprotAll:function(x,A,y,z){}};c.extend(c.fn.datagrid.defaults.editors,{my97:{init:function(x,z){var y=c('<input type="text" class="Wdate">').appendTo(x);z=z||{};z=c.extend({},z,{readOnly:true});return y.focus(function(){WdatePicker()})},getValue:function(x){return c(x).val()},setValue:function(y,x){c(y).val(x)},resize:function(z,y){var x=c(z);if(c.boxModel==true){x.width(y-(x.outerWidth()-x.width()))}else{x.width(y)}}},datetimebox:{init:function(x,z){var y=c('<input type="text" class="easyui-datetimebox">').appendTo(x);z=z||{};z=c.extend({},z,{formatter:function(A){return c.dateFormat(new Date(A),"yyyy-MM-dd hh:mm")}});return y.datetimebox(z)},getValue:function(x){return c(x).datetimebox("getValue")},setValue:function(y,x){c(y).datetimebox("setValue",x)},resize:function(y,x){c(y).datetimebox("resize",x)}},numberspinner:{init:function(x,z){var y=c('<input type="text">').appendTo(x);z=z||{};z=c.extend({},z,{min:0,editable:false});return y.numberspinner(z)},getValue:function(x){return c(x).numberspinner("getValue")},setValue:function(y,x){c(y).numberspinner("setValue",x)},resize:function(y,x){c(y).numberspinner("resize",x)}},timespinner:{init:function(x,z){var y=c('<input type="text">').appendTo(x);z=z||{};return y.timespinner(z)},getValue:function(x){return c(x).timespinner("getValue")},setValue:function(y,x){c(y).timespinner("setValue",x)},resize:function(y,x){c(y).timespinner("resize",x)}},combogrid:{init:function(x,z){var y=c('<input type="text">').appendTo(x);z=z||{};z=c.extend({},z,{panelWidth:400,editable:false});return y.combogrid(z)},getValue:function(x){return c(x).combogrid("getValue")},setValue:function(y,x){c(y).combogrid("setValue",x)},resize:function(y,x){c(y).combogrid("resize",x)}}});c.fn.datagrid.defaults.customAttr={headerContextMenu:{isShow:false,isMerge:true,items:[],onShow:function(y,x){},onHide:function(){}},rowContextMenu:{isShow:false,isMerge:true,items:[]},pagination:{showPageList:false,showRefresh:true,beforePageText:undefined,afterPageText:undefined,displayMsg:undefined},slaveList:undefined,activeSlave:"dblclickrow",rowediting:false,tooltip:{enable:false,target:"row",position:"bottom",fields:undefined,formatter:undefined},onConfirmEdit:function(x){return true}};c.extend(c.fn.datagrid.methods,{followCustomHandle:function(x){return x.each(function(){r(this);m(this);e(this);b(this);f(this);q(this);u(this)})},getHeaderContextMenu:function(x){return c("#"+h(x[0],"headerContextMenu"))},getRowContextMenu:function(x){return c("#"+h(x[0],"rowContextMenu"))},getEditingRow:function(y){var x=y.datagrid("getEditingRows");return x.length?x[0]:null},getEditingRows:function(B){var x=c.data(B[0],"datagrid");var z=x.options;var A=x.data;var y=[];z.finder.getTr(B[0],"","allbody").each(function(){if(c(this).hasClass("datagrid-row-editing")){var C=parseInt(c(this).attr("datagrid-row-index"));y.push(A.rows[C])}});return y},setPagination:function(y,x){return y.each(function(){c(this).datagrid("getPager").pagination(x)})},deleteRows:function(y,x){return y.each(function(){var A=undefined;if(!c.isArray(x)){A=[x]}else{A=x}var z=this;c.each(A,function(C,D){if(c.isPlainObject(D)){var B=c(z).datagrid("getRowIndex",D);c(z).datagrid("deleteRow",B)}else{c(z).datagrid("deleteRow",D)}})})},freezeColumn:function(y,x){return y.each(function(){d(this,x,true)})},unfreezColumn:function(y,x){return y.each(function(){a(this,x)})},addEventListener:function(y,x){return y.each(function(){var z=c.isArray(x)?x:[x];var A=this;c.each(z,function(B,C){k(A,C.name,C.handler||function(){},C.override)})})},fixDetailRowWidth:function(y,x){return y.each(function(){var A=c.data(this,"datagrid");var z=A.dc.header2.children();x.handler&&x.handler.call(this,x.index,z.width())})},getAllExpandRowIndex:function(x){return l(x[0])},getExpandRowIndex:function(y){var x=y.datagrid("getAllExpandRowIndex");return x.length>0?x[0]:-1}})})(jQuery);(function(a){a.extend({dateFormat:function(c,k){if(c==null){return null}if(k==null){var p="yyyy-MM-dd"}else{var p=k}var l=c.getFullYear().toString();var j=(c.getMonth()+1).toString();var m=c.getDate().toString();var n=c.getHours().toString();var e=c.getMinutes().toString();var o=c.getSeconds().toString();var d=p.replace(/[^y]/g,"");var q=p.replace(/[^M]/g,"");var b=p.replace(/[^d]/g,"");var g=p.replace(/[^h]/g,"");var f=p.replace(/[^m]/g,"");var h=p.replace(/[^s]/g,"");if(d.length==2){l=l.substring(2,4)}if(q.length>1&&j.length==1){j="0"+j}if(b.length>1&&m.length==1){m="0"+m}if(g.length>1&&n.length==1){n="0"+n}if(f.length>1&&e.length==1){e="0"+e}if(h.length>1&&o.length==1){o="0"+o}if(d.length>0){p=p.replace(d,l)}if(q.length>0){p=p.replace(q,j)}if(b.length>0){p=p.replace(b,m)}if(g.length>0){p=p.replace(g,n)}if(f.length>0){p=p.replace(f,e)}if(h.length>0){p=p.replace(h,o)}return p},parseDate:function(u,p){var t=new Date();if(u==null){return t}if(p==null){var m="yyyy-MM-dd"}else{var m=p}var w=m.replace(/[^y]/g,"");var l=m.replace(/[^M]/g,"");var h=m.replace(/[^d]/g,"");var x=m.replace(/[^h]/g,"");var d=m.replace(/[^m]/g,"");var f=m.replace(/[^s]/g,"");var j=m.indexOf(w);var q=w.length;var e=parseInt(u.substring(j,j+q));if(isNaN(e)){e=t.getYear()}else{if(q==2){if(e<50){e+=2000}else{e+=1900}}}var y=m.indexOf(l);var v=parseInt(u.substring(y,y+l.length));if(isNaN(v)){v=t.getMonth()}else{v-=1}var b=m.indexOf(h);var n=parseInt(u.substring(b,b+h.length));if(isNaN(n)){n=t.getDate()}var s=m.indexOf(x);var o=parseInt(u.substring(s,s+x.length));if(isNaN(o)){o=0}var c=m.indexOf(d);var k=parseInt(u.substring(c,c+d.length));if(isNaN(k)){k=0}var r=m.indexOf(f);var g=parseInt(u.substring(r,r+f.length));if(isNaN(g)){g=0}return new Date(e,v,n,o,k,g)}})})(jQuery);(function(b){function a(d,c){if(b("#"+d).length>0){return}return b("<style>"+c+"</style>").attr("id",d).attr("type","text/css").appendTo("head")}b.extend({mask:function(f){f=f||{};var d=b.extend({},{target:"body",loadMsg:b.fn.datagrid.defaults.loadMsg},f);this.unmask(d);if(d.target!="body"&&b(d.target).css("position")=="static"){b(d.target).addClass("mask-relative")}var c=b('<div class="datagrid-mask" style="display:block;"></div>').appendTo(d.target);var g=b('<div class="datagrid-mask-msg" style="display:block; left: 50%;"></div>').html(d.loadMsg).appendTo(d.target);setTimeout(function(){g.css("marginLeft",-g.outerWidth()/2)},5);var e=".mask-relative {position: relative !important;}";a("mask_css",e)},unmask:function(c){var d=c.target||"body";b(">div.datagrid-mask-msg",d).remove();b(">div.datagrid-mask",d).remove();b(c.target).removeClass("mask-relative")}})})(jQuery);(function(c){function a(f,e,d){if(e&&c.isArray(e)){c.each(e,function(){var j=this;var h={};if(d){c.extend(h,{parent:d})}if(c.isPlainObject(j)){c(f).menu("appendItem",c.extend(j,h));if(j.submenu){var k=c(f).menu("findItem",j.text);a(f,j.submenu,k.target)}}else{if(j=="-"){var g=c(f).menu("appendItem",c.extend({text:j},h)).menu("findItem",j).target;c(g).removeClass("menu-item").addClass("menu-sep").removeAttr("style").empty()}}})}}function b(h,d,g,f){var e=c(h).menu("options");var j=e[d];switch(d){case"onShow":if(f){e[d]=g}else{e[d]=function(){j.apply(this,arguments);g.apply(this,arguments)}}break;case"onHide":if(f){e[d]=g}else{e[d]=function(){j.apply(this,arguments);g.apply(this,arguments)}}break;case"onClick":if(f){e[d]=g}else{e[d]=function(k){j.apply(this,arguments);g.apply(this,arguments)}}break;default:break}}c.extend(c.fn.menu.methods,{followCustomHandle:function(d){},appendItems:function(e,d){return e.each(function(){a(this,d)})},addEventListener:function(e,d){return e.each(function(){var f=c.isArray(d)?d:[d];var g=this;c.each(f,function(h,j){b(g,j.name,j.handler||function(){},j.override)})})}})})(jQuery);(function(b){function c(h){var f=b.extend(true,{},b.fn.panel.defaults,b(h).panel("options"));var g=f.customAttr.toolbar;if(!g){return}var d=b(h).panel("body");if(typeof g=="string"){b(g).addClass("dialog-toolbar panel-body").insertBefore(d);b(g).show()}else{var e=b("<div></div>").insertBefore(d);e.toolbar(g)}}function a(h,d,g,f){var e=b(h).panel("options");var j=e[d];switch(d){case"onResize":if(f){e[d]=g}else{e[d]=function(l,k){j.apply(this,arguments);g.apply(this,arguments)}}break;case"onMove":if(f){e[d]=g}else{e[d]=function(l,k){j.apply(this,arguments);g.apply(this,arguments)}}break;default:if(f){e[d]=g}else{e[d]=function(){j.apply(this,arguments);g.apply(this,arguments)}}}}b.fn.panel.defaults.customAttr={toolbar:{buttonPosition:"left",data:undefined}};b.extend(b.fn.panel.methods,{followCustomHandle:function(d){return d.each(function(){c(this)})},addEventListener:function(e,d){return e.each(function(){var f=b.isArray(d)?d:[d];var g=this;b.each(f,function(h,j){a(g,j.name,j.handler||function(){},j.override)})})}})})(jQuery);(function(a){var b=function(d,h){var e=d;var n=h;if(e<1){e=1}if(n<1){n=1}var c=parseInt(a(this).parent().css("width"))+14;var k=parseInt(a(this).parent().css("height"))+14;var j=e+c;var g=n+k;var m=a(window).width();var f=a(window).height();if(j>m){e=m-c}if(g>f){n=f-k}a(this).parent().css({left:e,top:n})};a.fn.dialog.defaults.onMove=b;a.fn.window.defaults.onMove=b;a.fn.panel.defaults.onMove=b;a.fn.panel.defaults=jQuery.extend({},a.fn.panel.defaults,{onBeforeDestroy:function(){var c=a("iframe",this);if(c.length>0){c[0].contentWindow.document.write("");c[0].contentWindow.close();c.remove();if(navigator.userAgent.indexOf("MSIE")>0){CollectGarbage()}}}})})(jQuery);(function(f){function g(o){return f(o).attr("id")+"_contextmenu"}function h(q,r){var p=g(q);var o=f("#"+p);if(o.length==0){o=f("<div>",{id:p}).menu();o.menu("appendItems",r)}return o}function m(p){var o={};f.each(p,function(){var r=this;if(r.onclick){var q=r.id||r.text;o[q]=r.onclick;delete r.onclick}if(r.submenu&&f.isArray(r.submenu)&&r.submenu.length>0){f.extend(o,m(r.submenu))}});return o}function n(s){var p=f.extend(true,{},f.fn.tabs.defaults,f.data(s,"tabs").options);var o=p.customAttr.contextMenu;if(!o.isShow){return}var t=l(s);if(o.isMerge&&f.isArray(o.items)&&o.items.length>0){t=f.merge(t,o.items)}if(!o.isMerge&&f.isArray(o.items)&&o.items.length>0){t=o.items}var r=m(t);var q=h(s,t);f(s).tabs("addEventListener",{name:"onContextMenu",handler:function(v,w,u){v.preventDefault();j(s,q,u);q.menu("addEventListener",{name:"onClick",override:true,handler:function(y){var x=y.id||y.text;if(r[x]){r[x].call(this,y,w,u,s)}}}).menu("show",{left:v.pageX,top:v.pageY})}})}function j(s,q,o){var r=g(s);var p=f("#"+r+"_fixed");if(f.inArray(o,f.fn.tabs.defaults.customAttr.fixedtabs)==-1&&!f(s).tabs("getTab",o).panel("options").closable){q.menu("setText",{target:p,text:f.fn.tabs.defaults.contextMenu.itemname.unfixtab})}else{q.menu("setText",{target:p,text:f.fn.tabs.defaults.contextMenu.itemname.fixtab});if(f.inArray(o,f.fn.tabs.defaults.customAttr.fixedtabs)>-1){q.menu("disableItem",p)}else{q.menu("enableItem",p)}}p=f("#"+r+"_close");if(!f(s).tabs("getTab",o).panel("options").closable){q.menu("disableItem",p)}else{q.menu("enableItem",p)}}function l(p){var o=g(p);return[{id:o+"_reload",text:f.fn.tabs.defaults.contextMenu.itemname.reload,onclick:f.fn.tabs.defaults.contextMenu.defaultEventsHandler.reload},{id:o+"_fixed",text:f.fn.tabs.defaults.contextMenu.itemname.fixtab,onclick:function(s,t,q,r){if(s.text==f.fn.tabs.defaults.contextMenu.itemname.fixtab){f.fn.tabs.defaults.contextMenu.defaultEventsHandler.fixtab(s,t,q,r)}else{f.fn.tabs.defaults.contextMenu.defaultEventsHandler.unfixtab(s,t,q,r)}}},"-",{id:o+"_close",text:f.fn.tabs.defaults.contextMenu.itemname.close,onclick:f.fn.tabs.defaults.contextMenu.defaultEventsHandler.closetab},{id:o+"_close_others",text:f.fn.tabs.defaults.contextMenu.itemname.closeothers,onclick:f.fn.tabs.defaults.contextMenu.defaultEventsHandler.closeOthersTab},{id:o+"_close_rightside",text:f.fn.tabs.defaults.contextMenu.itemname.closerightside,onclick:f.fn.tabs.defaults.contextMenu.defaultEventsHandler.closeRightSideTabs},{id:o+"_close_all",text:f.fn.tabs.defaults.contextMenu.itemname.closeall,onclick:f.fn.tabs.defaults.contextMenu.defaultEventsHandler.closeAll}]}function a(p,o){var q=[];o++;f(p).children("div.tabs-header").find("ul li:nth-child("+o+")").each(function(){q.push(this)});return q.length>0?q[0]:null}function b(u,r,o,v){if(typeof o=="number"&&typeof r=="number"){var w=f.data(u,"tabs").tabs;if(o<0||o>w.length){return}if(r<0||r>w.length){return}if(v){var y=w[o];for(var q=o;q>r;q--){w.splice(q,1,w[q-1])}w[r]=y;var x=a(u,r);if(x){var t=a(u,o);f(x).before(t)}}else{var y=w[r];for(var p=r;p<=o;p++){w.splice(p,1,w[p+1])}w[o]=y;var x=a(u,o);if(x){var s=a(u,r);f(x).after(s)}}}}function e(r){var p=f(r).tabs("tabs");var s=[];for(var o=0;o<p.length;o++){var q=p[o];if(q.panel("options").closable==undefined||!q.panel("options").closable){s.push(q)}}return s}function d(v,r,o,w,t){var s=f("<iframe>").attr("height","100%").attr("width","100%").attr("marginheight","0").attr("marginwidth","0").attr("frameborder","0");setTimeout(function(){s.attr("src",o)},1);var q=f(v).tabs("getTab",r);q.panel("body").css({overflow:"hidden"}).empty().append(s);if(w){var t=t||f.fn.datagrid.defaults.loadMsg;var u=q.panel("body");u.css("position","relative");var x=f('<div class="datagrid-mask" style="display:block;"></div>').appendTo(u);var p=f('<div class="datagrid-mask-msg" style="display:block; left: 50%;"></div>').html(t).appendTo(u);setTimeout(function(){p.css("marginLeft",-p.outerWidth()/2)},5)}s.bind("load",function(){if(s[0].contentWindow){q.panel("body").children("div.datagrid-mask-msg").remove();q.panel("body").children("div.datagrid-mask").remove()}})}f.fn.tabs.defaults.contextMenu={};f.fn.tabs.defaults.contextMenu.itemname={};f.fn.tabs.defaults.contextMenu.itemname.reload="重新加载";f.fn.tabs.defaults.contextMenu.itemname.fixtab="固定标签页";f.fn.tabs.defaults.contextMenu.itemname.unfixtab="取消固定标签";f.fn.tabs.defaults.contextMenu.itemname.close="关闭标签页";f.fn.tabs.defaults.contextMenu.itemname.closeothers="关闭其他标签页";f.fn.tabs.defaults.contextMenu.itemname.closerightside="关闭右侧标签页";f.fn.tabs.defaults.contextMenu.itemname.closeall="关闭所有标签页";f.fn.tabs.defaults.contextMenu.defaultEventsHandler={reload:function(r,t,q,s){var o=f(s).tabs("getTab",q);var p=o.panel("options").useiframe;if(p){f("iframe",o.panel("body")).each(function(){this.contentWindow.location.reload()})}else{o.panel("refresh")}},fixtab:function(r,t,p,s){var q=f(s).tabs("getTab",p);f(s).tabs("update",{tab:q,options:{closable:false}});var o=f.fn.tabs.defaults.customAttr.fixedtabs.length;b(s,o,p,true)},unfixtab:function(r,t,o,s){var p=e(s).length-1;var q=f(s).tabs("getTab",o);f(s).tabs("update",{tab:q,options:{closable:true}});b(s,o,p)},closetab:function(q,s,p,r){var o=f(r).tabs("getTab",p).panel("options");if(o.closable){f(r).tabs("close",p)}},closeOthersTab:function(s,r,p,t){var q=f(t).tabs("tabs");var o=f.grep(q,function(v,u){return v.panel("options").closable&&u!=p});f.each(o,function(){f(t).tabs("close",this.panel("options").title)})},closeRightSideTabs:function(r,t,p,s){var q=f(s).tabs("tabs");var o=f.grep(q,function(v,u){return u>p&&v.panel("options").closable});f.each(o,function(){f(s).tabs("close",this.panel("options").title)})},closeAll:function(r,t,p,s){var q=f(s).tabs("tabs");var o=f.grep(q,function(v,u){return v.panel("options").closable});f.each(o,function(){f(s).tabs("close",this.panel("options").title)})}};function c(s,o,r,q){var p=f(s).tabs("options");var t=p[o];switch(o){case"onLoad":if(q){p[o]=r}else{p[o]=function(u){t.apply(this,arguments);r.apply(this,arguments)}}break;case"onContextMenu":if(q){p[o]=r}else{p[o]=function(v,w,u){t.apply(this,arguments);r.apply(this,arguments)}}break;default:if(q){p[o]=r}else{p[o]=function(v,u){t.apply(this,arguments);r.apply(this,arguments)}}break}}f.fn.tabs.defaults.customAttr={fixedtabs:[0],contextMenu:{isShow:false,isMerge:true,items:[]}};var k=f.extend({},f.fn.tabs.methods);f.extend(f.fn.tabs.methods,{followCustomHandle:function(o){return o.each(function(){n(this)})},add:function(p,o){return p.each(function(){var q=null;if(o.href||/^url:/.test(o.content)){q=o.href||o.content.substr(4,o.content.length);delete o.content;delete o.href}if(q){if(o.useiframe){k.add(p,o);d(this,o.title,q,o.showMask,o.loadMsg)}else{k.add(p,f.extend(o,{href:q}))}}else{k.add(p,o)}if(o.css){f(this).tabs("getTab",o.title).css(o.css)}})},addEventListener:function(p,o){return p.each(function(){var q=f.isArray(o)?o:[o];var r=this;f.each(q,function(s,t){c(r,t.name,t.handler||function(){},t.override)})})}})})(jQuery);(function($){function init(target){var options=$(target).toolbar("options");var tb=$(target).addClass("datagrid-toolbar").css({"border-top-width":1});tb.append('<table cellspacing="0" cellpadding="0"><tr></tr></table>');if(options.buttonPosition=="right"){tb.find("table").css("float","right")}if(options.data){addItems(target,options.data)}else{options.loader.call(target,function(data){options.data=data;addItems(target,options.data)},function(){options.onLoadError.apply(target,arguments)})}}function add(target,item){var tr=$(target).find("tr");if(typeof item=="string"&&$.trim(item)=="-"){$('<td><div class="dialog-tool-separator"></div></td>').appendTo(tr)}else{if($.trim(item.text)=="-"){$('<td><div class="dialog-tool-separator"></div></td>').appendTo(tr)}else{var td=$("<td></td>").appendTo(tr);var button=$('<a href="javascript:void(0)"></a>').appendTo(td);button[0].onclick=eval(item.handler||function(){});button.linkbutton($.extend({},item,{plain:true}))}}}function addItems(target,items){if(!$.isArray(items)){return}for(var i=0;i<items.length;i++){add(target,items[i])}}$.fn.toolbar=function(options,param){if(typeof options=="string"){return $.fn.toolbar.methods[options](this,param)}options=options||{};return this.each(function(){var state=$.data(this,"toolbar");if(state){$.extend(state.options,options)}else{$.data(this,"toolbar",{options:$.extend({},$.fn.toolbar.defaults,$.parser.parseOptions(this),options)});init(this)}})};$.fn.toolbar.methods={options:function(jq){return $.data(jq[0],"toolbar").options},add:function(jq,items){return jq.each(function(){addItems(this,items)})}};$.fn.toolbar.defaults={data:null,url:undefined,buttonPosition:"left",loader:function(success,error){var options=$(this).toolbar("options");$.ajax({type:"POST",url:"toolbar_data.json",dataType:"json",success:function(data){success(data)},error:function(){error.apply(this,arguments)}})},onLoadError:function(){}}})(jQuery);(function(f){function k(u){return f(u).attr("id")+"_contextmenu"}function r(w,x){var v=k(w);var u=f("#"+v);if(u.length==0){u=f("<div>",{id:v}).menu();u.menu("appendItems",x)}return u}function q(v){var u={};f.each(v,function(){var x=this;if(x.onclick){var w=x.id||x.text;u[w]=x.onclick;delete x.onclick}if(x.submenu&&f.isArray(x.submenu)&&x.submenu.length>0){f.extend(u,q(x.submenu))}});return u}function d(v){var u=k(v);return[{id:u+"_moveup",text:"位置上移",iconCls:"icon-moveup",onclick:f.fn.tree.contextmenu.defaultEvents.moveup},{id:u+"_movedown",text:"位置下移",iconCls:"icon-movedown",onclick:f.fn.tree.contextmenu.defaultEvents.movedown}]}function s(y){var v=f.extend(true,{},f.fn.tree.defaults,f(y).tree("options"));var u=v.customAttr.contextMenu;if(!u.isShow){return}var z=d(y);if(u.isMerge&&f.isArray(u.items)&&u.items.length>0){z=f.merge(z,u.items)}if(!u.isMerge&&f.isArray(u.items)&&u.items.length>0){z=u.items}var x=q(z);var w=r(y,z);f(y).tree("addEventListener",{name:"onContextMenu",handler:function(B,A){B.preventDefault();f(y).tree("select",A.target);w.menu("addEventListener",{name:"onClick",override:true,handler:function(D){var C=D.id||D.text;if(x[C]){x[C].call(this,D,A,y)}}}).menu("show",{left:B.pageX,top:B.pageY})}})}function l(A,v){var z=v.id||v.text;var B=f(A).tree("getParent",v.target);var u=e(A,B.target,false);var C=-1;for(var w=0,y=u.length;w<y;w++){var x=u[w].id||u[w].text;if(z==x){C=w-1;break}}if(C>-1){return u[C]}return null}function a(A,v){var z=v.id||v.text;var C=f(A).tree("getParent",v.target);var u=e(A,C.target,false);var B=-1;for(var w=0,y=u.length;w<y;w++){var x=u[w].id||u[w].text;if(z==x){B=w+1;break}}if(B>-1&&B<u.length){return u[B]}return null}function e(x,w,u){if(u){return f(x).tree("getChildren",w)}else{var v=[];f(w).next().find(">li>div.tree-node").each(function(){v.push(f(x).tree("getNode",this))});return v}}function b(v){var u=f.extend(true,{},f.fn.tree.defaults,f(v).tree("options"));if(!u.customAttr.expandOnNodeClick&&!u.customAttr.expandOnDblClick){return}if(u.customAttr.expandOnNodeClick){f(v).tree("addEventListener",{name:"onClick",handler:function(w){f(v).tree("toggle",w.target)}});return}if(u.customAttr.expandOnDblClick){f(v).tree("addEventListener",{name:"onDblClick",handler:function(w){f(v).tree("toggle",w.target)}})}}function h(w,v){var x=1;var u=f(w).tree("getParent",v.target);if(!u){return 1}return x+h(w,u)}function o(z,A,y){var u=y?[y]:f(z).tree("getRoots");for(var x=0;x<u.length;x++){var w=e(z,u[x].target,false);for(var v=0;v<w.length;v++){f(z).tree("expandTo",w[v].target)}A--;if(A>0){for(var v=0;v<w.length;v++){o(z,A,w[v])}}}}function p(v){var u=f.extend(true,{},f.fn.tree.defaults,f(v).tree("options"));if(!u.customAttr.onlyNodeExpand){return}f(v).tree("addEventListener",{name:"onBeforeExpand",handler:function(z){var y=f(v).tree("getParent",z.target);if(y){var x=e(v,y.target,false);for(var w=0;w<x.length;w++){if(x[w].state=="open"){f(v).tree("collapseAll",x[w].target)}}}else{f(v).tree("collapseAll")}}})}function m(y,u,x,w){var v=f(y).tree("options");var z=v[u];switch(u){case"onBeforeLoad":if(w){v[u]=x}else{v[u]=function(A,B){z.apply(this,arguments);x.apply(this,arguments)}}break;case"onLoadSuccess":if(w){v[u]=x}else{v[u]=function(A,B){z.apply(this,arguments);x.apply(this,arguments)}}break;case"onLoadError":if(w){v[u]=x}else{v[u]=function(A){z.apply(this,A);x.apply(this,A)}}break;case"onBeforeCheck":if(w){v[u]=x}else{v[u]=function(B,A){z.apply(this,arguments);x.apply(this,arguments)}}break;case"onCheck":if(w){v[u]=x}else{v[u]=function(B,A){z.apply(this,arguments);x.apply(this,arguments)}}break;case"onContextMenu":if(w){v[u]=x}else{v[u]=function(B,A){z.apply(this,arguments);x.apply(this,arguments)}}break;case"onDragEnter":if(w){v[u]=x}else{v[u]=function(B,A){z.apply(this,arguments);x.apply(this,arguments)}}break;case"onDragOver":if(w){v[u]=x}else{v[u]=function(B,A){z.apply(this,arguments);x.apply(this,arguments)}}break;case"onDragLeave":if(w){v[u]=x}else{v[u]=function(B,A){z.apply(this,arguments);x.apply(this,arguments)}}break;case"onBeforeDrop":if(w){v[u]=x}else{v[u]=function(C,B,A){z.apply(this,arguments);x.apply(this,arguments)}}break;case"onDrop":if(w){v[u]=x}else{v[u]=function(C,B,A){z.apply(this,arguments);x.apply(this,arguments)}}break;default:if(w){v[u]=x}else{v[u]=function(A){z.apply(this,arguments);x.apply(this,arguments)}}break}}function n(w,u){if(!w.attributes){w.attributes={}}for(var v=0;v<u.length;v++){w.attributes[u[v]]=w[u[v]]}}function t(v){var u=v.idField||v.textField||v.iconField||v.childrenField||v.attributesField||v.attributes||false;return u?true:false}function g(E,z){if(!t(E)){return z}var u=E.idField||"id",w=E.textField||"text",v=E.iconField||"iconCls",B=E.parentField||"pid",x=E.attributes||[];var C=[],D=[];for(var y=0,A=z.length;y<A;y++){D[z[y][u]]=z[y]}for(var y=0,A=z.length;y<A;y++){if(D[z[y][B]]&&z[y][u]!=z[y][B]){if(!D[z[y][B]]["children"]){D[z[y][B]]["children"]=[]}z[y]["text"]=z[y][w];z[y][v]&&(z[y]["iconCls"]=z[y][v]);n(z[y],x);D[z[y][B]]["children"].push(z[y])}else{z[y]["text"]=z[y][w];z[y][v]&&(z[y]["iconCls"]=z[y][v]);n(z[y],x);C.push(z[y])}}return C}function c(D,A){if(!t(D)){return A}var u=D.idField||"id",x=D.textField||"text",w=D.iconField||"iconCls",C=D.childrenField||"children",B=D.attributesField||"attributes",y=D.attributes||[];var v=function(F){if(!F.id&&F[u]){F.id=F[u]}if(!F.text&&F[x]){F.text=F[x]}if(!F.iconCls&&F[w]){F.iconCls=F[w]}if(!F.children&&F[C]){F.children=F[C]}if(!F.attributes&&F[B]){F.attributes=F[B]}if(y&&f.isArray(y)){n(F,y)}if(F.children){for(var E=0;E<F.children.length;E++){v(F.children[E])}}};for(var z=0;z<A.length;z++){v(A[z])}return A}f.fn.tree.contextmenu={};f.fn.tree.contextmenu.defaultEvents={moveup:function(y,x,z){var v=f.extend(true,{},f.fn.tree.defaults,f(z).tree("options"));var w=l(z,x);if(w){var u=f(z).tree("pop",x.target);f(z).tree("insert",{before:w.target,data:u});v.customAttr.onAfterMove.call(this,w,x)}},movedown:function(y,x,z){var w=f.extend(true,{},f.fn.tree.defaults,f(z).tree("options"));var v=a(z,x);if(v){var u=f(z).tree("pop",x.target);f(z).tree("insert",{after:v.target,data:u});w.customAttr.onAfterMove.call(this,v,x)}}};f.fn.tree.defaults.customAttr={idField:null,textField:null,parentField:null,iconField:null,childrenField:null,attributesField:null,attributes:null,dataModel:null,expandOnNodeClick:false,expandOnDblClick:false,onlyNodeExpand:false,contextMenu:{isShow:false,isMerge:true,items:[]},onAfterMove:function(v,u){}};f.fn.tree.defaults.loadFilter=function(w,v){var u=f(this).tree("options").customAttr;if(u){if(u.dataModel=="simpleData"){return g(u,w)}else{return c(u,w)}}return w};f.fn.combotree.defaults.loadFilter=f.fn.tree.defaults.loadFilter;var j=f.extend({},f.fn.tree.methods);f.extend(f.fn.tree.methods,{followCustomHandle:function(u){return u.each(function(){s(this);b(this);p(this)})},getLevel:function(v,u){return h(v[0],u)},expandTo:function(v,u){return v.each(function(){if(f.type(u)=="number"){var w=u;o(this,w)}else{j.expandTo(v,u)}})},addEventListener:function(v,u){return v.each(function(){var w=f.isArray(u)?u:[u];var x=this;f.each(w,function(y,z){m(x,z.name,z.handler||function(){},z.override)})})}})})(jQuery);(function(d){function e(o,n){return d(o).attr("id")+"_"+n}function g(q,r,n){var p=e(q,n);var o=d("#"+p);if(o.length==0){o=d("<div>",{id:p}).menu();o.menu("appendItems",r)}return o}function l(o){var n={};d.each(o,function(){var q=this;if(q.onclick){var p=q.id||q.text;n[p]=q.onclick;delete q.onclick}if(q.submenu&&d.isArray(q.submenu)&&q.submenu.length>0){d.extend(n,l(q.submenu))}});return n}function j(o){var n=e(o,"rowContextMenu");return[{id:n+"_delete",text:"删除",iconCls:"icon-remove",onclick:d.fn.treegrid.headerContextMenu.defaultEvents.doRemove},"-",{id:n+"_reload",text:"刷新",iconCls:"icon-reload",onclick:d.fn.treegrid.headerContextMenu.defaultEvents.doReload}]}function m(r){var n=d.extend(true,{},d.fn.treegrid.defaults,d(r).treegrid("options"));var o=n.customAttr.contextMenu;if(!o.isShow){return}var s=j(r);if(o.isMerge&&d.isArray(o.items)&&o.items.length>0){d.merge(s,o.items)}if(!o.isMerge&&d.isArray(o.items)&&o.items.length>0){s=o.items}var q=l(s);var p=g(r,s,"rowContextMenu");d(r).treegrid("addEventListener",{name:"onContextMenu",handler:function(u,v){u.preventDefault();d(r).treegrid("select",v[n.idField]);var t=p.menu("options");t.onClickCallback=t.onClickCallback||t.onClick;p.menu("addEventListener",{name:"onClick",override:true,handler:function(x){var w=x.id||x.text;if(q[w]){q[w].call(this,x,v,r)}}}).menu("show",{left:u.pageX,top:u.pageY})}})}function f(t){var s=e(t,"headerContextMenu");var n=[{text:"显示/隐藏列",iconCls:"icon-columns",submenu:[{id:s+"_showAll",text:"全部显示",iconCls:"icon-columns",onclick:function(v,w,u){d.fn.datagrid.headerContextMenu.defaultEvents.doShowAll(u)}},{id:s+"_restore",text:"还原",iconCls:"icon-columns",onclick:function(v,w,u){d.fn.datagrid.headerContextMenu.defaultEvents.doRestore(u)}},"-"]}];var o=function(u){return u.substr(u.lastIndexOf("_")+1,u.length)};var q=[];var r=d(t).treegrid("getColumnFields");var p=d(t).treegrid("options").treeField;d.each(r,function(v,x){if(!x){return true}var w=x==p?true:false;var u=d(t).treegrid("getColumnOption",x);u._hidden=u.hidden;q.push({id:s+"_"+x,text:u.title,iconCls:u.hidden?"icon-unchecked":"icon-checked",disabled:w,onclick:function(z,y,C){var B=o(z.id);var A=d(C).treegrid("getColumnOption",B).hidden;if(!A){d.fn.datagrid.headerContextMenu.defaultEvents.doHideColumn(C,B,z)}else{d.fn.datagrid.headerContextMenu.defaultEvents.doShowColumn(C,B,z)}}})});d.merge(n[0].submenu,q);return n}function k(q){var o=d.extend(true,{},d.fn.treegrid.defaults,d(q).treegrid("options"));var s=o.customAttr.headerContextMenu;if(!s.isShow){return}var r=f(q);if(s.isMerge){d.merge(r,s.items)}if(!s.isMerge&&d.isArray(s.items)&&s.items.length>0){r=s.items}var p=l(r);var n=g(q,r,"headerContextMenu");d(q).treegrid("addEventListener",{name:"onHeaderContextMenu",handler:function(u,t){u.preventDefault();n.menu("addEventListener",{name:"onClick",override:true,handler:function(w){var v=w.id||w.text;if(p[v]){p[v].call(this,w,t,q)}}}).menu("show",{left:u.pageX,top:u.pageY})}})}function a(q){var p=d.extend(true,{},d.fn.treegrid.defaults,d(q).treegrid("options"));if(!p.customAttr.expandOnNodeClick&&!p.customAttr.expandOnDblClick){return}var n=p.treeField;var o=p.idField;if(p.customAttr.expandOnNodeClick){d(q).treegrid("addEventListener",{name:"onClickCell",handler:function(r,s){if(n==r){d(q).treegrid("toggle",s[o])}}});return}if(p.customAttr.expandOnDblClick){d(q).treegrid("addEventListener",{name:"onDblClickCell",handler:function(r,s){if(n==r){d(q).treegrid("toggle",s[o])}}})}}function b(s){var o=d.extend(true,{},d.fn.treegrid.defaults,d(s).treegrid("options"));if(!o.customAttr.rowediting){return}var t=function(u){return d(u).attr("id")+"_editor_buttons_panel"};var n=120;var q=function(y){var x=t(y);if(d("#"+x).length>0){return}var v=d(y).treegrid("getPanel");var w=d(">div.datagrid-view>div.datagrid-view2>div.datagrid-body",v);w.css("position","relative");var u=d("<div>",{id:x}).addClass("dialog-button").appendTo(w).css({position:"absolute",display:"block","border-bottom":"1px solid #ddd","border-left":"1px solid #ddd","border-right":"1px solid #ddd",left:parseInt(v.width()/2)-n,"z-index":2013,display:"none",padding:"4px 5px"});d('<a href="javascript:void(0)">确定</a>').css("margin-left","0px").linkbutton({iconCls:"icon-ok"}).click(function(){var z=o.idField;var A=d(y).treegrid("getEditingRow");if(!o.customAttr.onConfirmEdit.call(y,A)){return}d(y).treegrid("endEdit",A[z])}).appendTo(u);d('<a href="javascript:void(0)">取消</a>').css("margin-left","6px").linkbutton({iconCls:"icon-cancel"}).click(function(){var z=o.idField;var A=d(y).treegrid("getEditingRow");d(y).treegrid("cancelEdit",A[z])}).appendTo(u)};var r=function(A,C){var v=o.idField;var B=o.finder.getTr(A,C[v],"body",2);var x=B.position();var w="#"+t(A);var u=d(A).treegrid("getPanel");var y=d(">div.datagrid-view>div.datagrid-view2>div.datagrid-body",u);var z=function(){var D=B.height(),E=B.width();var G=x.top+y.scrollTop(),F=x.left;var H=11;if(E>y.width()){F=y.width()/2-n}else{F=E/2-n}if(x.top+(D*2+H)>y.height()){G=G-(D+H)}else{G=G+D}return{top:G,left:F}};d(w).css(z()).show()};var p=function(v){var u="#"+t(v);d(u).hide()};d(s).treegrid("addEventListener",[{name:"onLoadSuccess",handler:function(v,u){q(this)}},{name:"onBeforeEdit",handler:function(u){r(s,u)}},{name:"onAfterEdit",handler:function(v,u){p(s)}},{name:"onCancelEdit",handler:function(u){p(s)}}])}function h(p){var o=d.extend(true,{},d.fn.treegrid.defaults,d(p).treegrid("options"));if(!o.customAttr.tooltip.enable){return}var s=function(v,u){var t={position:o.customAttr.tooltip.position,trackMouse:true,onHide:function(){d(v).tooltip("destroy")},onShow:function(){if(d.isPlainObject(u)&&u.css){d(this).tooltip("tip").css(u.css)}}};d.extend(t,d.isPlainObject(u)?u:{content:u});d(v).tooltip(t).tooltip("show")};var r=function(y,u){var x=d(y).attr("node-id");var w=d(p).treegrid("find",x);var t=function(B){var A=[];var z=d.grep(d.merge(d(p).treegrid("getColumnFields",true),d(p).treegrid("getColumnFields")),function(D,C){return d.trim(D).length>0});d.each(z,function(){var C=this;var D=d(p).treegrid("getColumnOption",C).title;A.push(D+": "+B[C])});return A.join("<br>")};var v=u?u(x,w):t(w);d(y).mouseover(function(){s(this,v)})};var n=function(t,u){t.mouseover(function(){var y=d(this).parent().attr("node-id");var w=d(p).treegrid("find",y);var z=d(this).attr("field");var x=w[z];var v=u?u(x,z,y,w):x;s(this,v)})};var q=function(){if(o.customAttr.tooltip.target=="row"){o.finder.getTr(p,"","allbody").each(function(){if(d(this).hasClass("datagrid-row")){r(this,o.customAttr.tooltip.formatter)}})}else{if(o.customAttr.tooltip.fields&&d.isArray(o.customAttr.tooltip.fields)){var t=d(p).treegrid("getPanel");var u=d(">div.datagrid-view>div.datagrid-view2>div.datagrid-body",t);d.each(o.customAttr.tooltip.fields,function(){var v=this;n(d("td[field="+v+"]",u),o.customAttr.tooltip.formatter)})}}};d(p).treegrid("addEventListener",{name:"onLoadSuccess",handler:function(u,t){q()}})}function c(r,n,q,p){var o=d(r).treegrid("options");var s=o[n];switch(n){case"onClickRow":if(p){o[n]=q}else{o[n]=function(t){s.apply(this,arguments);q.apply(this,arguments)}}break;case"onDblClickRow":if(p){o[n]=q}else{o[n]=function(t){s.apply(this,arguments);q.apply(this,arguments)}}break;case"onClickCell":if(p){o[n]=q}else{o[n]=function(t,u){s.apply(this,arguments);q.apply(this,arguments)}}break;case"onDblClickCell":if(p){o[n]=q}else{o[n]=function(t,u){s.apply(this,arguments);q.apply(this,arguments)}}break;case"onBeforeLoad":if(p){o[n]=q}else{o[n]=function(u,t){s.apply(this,arguments);q.apply(this,arguments)}}break;case"onLoadSuccess":if(p){o[n]=q}else{o[n]=function(u,t){s.apply(this,arguments);q.apply(this,arguments)}}break;case"onLoadError":if(p){o[n]=q}else{o[n]=function(t){s.apply(this,t);q.apply(this,t)}}break;case"onBeforeExpand":if(p){o[n]=q}else{o[n]=function(t){s.apply(this,arguments);q.apply(this,arguments)}}break;case"onExpand":if(p){o[n]=q}else{o[n]=function(t){s.apply(this,arguments);q.apply(this,arguments)}}break;case"onBeforeCollapse":if(p){o[n]=q}else{o[n]=function(t){s.apply(this,arguments);q.apply(this,arguments)}}break;case"onCollapse":if(p){o[n]=q}else{o[n]=function(t){s.apply(this,arguments);q.apply(this,arguments)}}break;case"onContextMenu":if(p){o[n]=q}else{o[n]=function(t,u){s.apply(this,arguments);q.apply(this,arguments)}}break;case"onBeforeEdit":if(p){o[n]=q}else{o[n]=function(t){s.apply(this,arguments);q.apply(this,arguments)}}break;case"onAfterEdit":if(p){o[n]=q}else{o[n]=function(u,t){s.apply(this,arguments);q.apply(this,arguments)}}break;case"onCancelEdit":if(p){o[n]=q}else{o[n]=function(t){s.apply(this,arguments);q.apply(this,arguments)}}break;default:d(r).datagrid("addEventListener",{name:n,override:p,handler:q});break}}d.fn.treegrid.headerContextMenu={};d.fn.treegrid.headerContextMenu.defaultEvents={doRemove:function(n,p,o){d.messager.confirm("疑问","您确定要删除已选中的行?",function(s){if(s){var q=d(o).treegrid("options").idField;var t=p[q];d(o).treegrid("remove",t)}})},doReload:function(n,p,o){d(o).treegrid("reload")}};d.fn.treegrid.defaults.customAttr={iconField:null,parentField:null,expandOnNodeClick:false,expandOnDblClick:false,headerContextMenu:{isShow:false,isMerge:true,items:[]},contextMenu:{isShow:false,isMerge:true,items:[]},rowediting:false,tooltip:{enable:false,target:"row",position:"bottom",fields:undefined,formatter:undefined},onConfirmEdit:function(n){return true}};d.fn.treegrid.defaults.loadFilter=function(p,r){var v=d(this).treegrid("options");var u=v.customAttr;if(u&&u.parentField){var n=v.idField,t=u.parentField,o=u.iconField||"icon";for(var q=0,s=p.rows.length;q<s;q++){if(p.rows[q][t]&&p.rows[q][t]!="0"&&p.rows[q][n]!=p.rows[q][t]){p.rows[q]["_parentId"]=p.rows[q][t]}else{delete p.rows[q][t]}p.rows[q]["iconCls"]=p.rows[q][o]}}return p};d.extend(d.fn.treegrid.methods,{followCustomHandle:function(n){return n.each(function(){k(this);m(this);a(this);b(this);h(this)})},getEditingRow:function(o){var n=o.treegrid("getEditingRows");return n.length?n[0]:null},getEditingRows:function(p){var n=p.treegrid("options");var o=[];n.finder.getTr(p[0],"","allbody").each(function(){if(d(this).hasClass("datagrid-row-editing")){var q=d(this).attr("node-id");o.push(p.treegrid("find",q))}});return o},addEventListener:function(o,n){return o.each(function(){var p=d.isArray(n)?n:[n];var q=this;d.each(p,function(r,s){c(q,s.name,s.handler||function(){},s.override)})})}})})(jQuery);(function(d){function e(h){var f=d(h);var g=d.data(h,"validatebox");f.unbind(".validatebox");if(g.options.novalidate){return}f.bind("focus.validatebox",function(){g.validating=true;g.value=undefined;(function(){if(g.validating){if(g.value!=f.val()){g.value=f.val();if(g.timer){clearTimeout(g.timer)}g.timer=setTimeout(function(){d(h).validatebox("validate")},g.options.delay)}else{a(h)}setTimeout(arguments.callee,200)}})()}).bind("blur.validatebox",function(){if(g.timer){clearTimeout(g.timer);g.timer=undefined}g.validating=false;c(h)}).bind("mouseenter.validatebox",function(){if(f.hasClass("validatebox-invalid")){b(h)}}).bind("mouseleave.validatebox",function(){if(!g.validating){c(h)}})}function b(h){var g=d.data(h,"validatebox");var f=g.options;d(h).tooltip(d.extend({},f.tipOptions,{content:g.message,position:f.tipPosition,deltaX:f.deltaX})).tooltip("show");g.tip=true}function a(g){var f=d.data(g,"validatebox");if(f&&f.tip){d(g).tooltip("reposition")}}function c(g){var f=d.data(g,"validatebox");f.tip=false;d(g).tooltip("hide")}d.extend(d.fn.validatebox.defaults.rules,{unequal:{validator:function(f,g){return f!=g},message:d.fn.validatebox.defaults.missingMessage},minLength:{validator:function(f,g){return f.length>=g[0]}},equals:{validator:function(f,g){if(/^#/.test(g)){return f==d(g).val()}else{return f==g}}}});if(d.fn.validatebox){d.fn.validatebox.defaults.rules.minLength.message="请至少输入{0}个字符。";d.fn.validatebox.defaults.rules.equals.message="字段不匹配"}})(jQuery);(function($){function getTop(w,options){var _doc;try{_doc=w.top.document;_doc.getElementsByTagName}catch(e){return w}if(options.locate=="document"||_doc.getElementsByTagName("frameset").length>0){return w}return w.top}function setWindowSize(w,options){var _top=getTop(w,options);var wHeight=$(_top).height(),wWidth=$(_top).width();if(options.locate=="top"||options.locate=="document"){if(options.height=="auto"){options.height=wHeight*0.6}if(options.width=="auto"){options.width=wWidth*0.6}}else{var locate=/^#/.test(options.locate)?options.locate:"#"+options.locate;if(options.height=="auto"){options.height=$(locate).height()*0.6}if(options.width=="auto"){options.width=$(locate).width()*0.6}}}$.extend({showWindow:function(options){options=options||{};var target;var winOpts=$.extend({},{iconCls:"icon-form",useiframe:false,locate:"top",data:undefined,width:"auto",height:"auto",cache:false,minimizable:true,maximizable:true,collapsible:true,resizable:true,loadMsg:$.fn.datagrid.defaults.loadMsg,showMask:false,onClose:function(){target.dialog("destroy")}},options);var iframe=null;if(/^url:/.test(winOpts.content)){var url=winOpts.content.substr(4,winOpts.content.length);if(winOpts.useiframe){iframe=$("<iframe>").attr("height","100%").attr("width","100%").attr("marginheight",0).attr("marginwidth",0).attr("frameborder",0);setTimeout(function(){iframe.attr("src",url)},10)}else{winOpts.href=url}delete winOpts.content}var selfRefrence={getData:function(name){return winOpts.data?winOpts.data[name]:null},close:function(){target.panel("close")}};var _top=getTop(window,winOpts);var warpHandler=function(handler){if(typeof handler=="function"){return function(){handler(selfRefrence)}}if(typeof handler=="string"&&winOpts.useiframe){return function(){iframe[0].contentWindow[handler](selfRefrence)}}if(typeof handler=="string"){return function(){eval(_top[handler])(selfRefrence)}}};setWindowSize(window,winOpts);if(winOpts.toolbar&&$.isArray(winOpts.toolbar)){$.each(winOpts.toolbar,function(i,button){button.handler=warpHandler(button.handler)})}if(winOpts.buttons&&$.isArray(winOpts.buttons)){$.each(winOpts.buttons,function(i,button){button.handler=warpHandler(button.handler)})}var onLoadCallback=winOpts.onLoad;winOpts.onLoad=function(){onLoadCallback&&onLoadCallback.call(this,selfRefrence,_top)};if(winOpts.locate=="top"||winOpts.locate=="document"){if(winOpts.useiframe&&iframe){if(winOpts.showMask){winOpts.onBeforeOpen=function(){var panel=$(this).panel("panel");var header=$(this).panel("header");var body=$(this).panel("body");body.css("position","relative");var mask=$('<div class="datagrid-mask" style="display:block;"></div>').appendTo(body);var msg=$('<div class="datagrid-mask-msg" style="display:block; left: 50%;"></div>').html(winOpts.loadMsg).appendTo(body);setTimeout(function(){msg.css("marginLeft",-msg.outerWidth()/2)},5)}}iframe.bind("load",function(){if(iframe[0].contentWindow){onLoadCallback&&onLoadCallback.call(this,selfRefrence,iframe[0].contentWindow);target.panel("body").children("div.datagrid-mask-msg").remove();target.panel("body").children("div.datagrid-mask").remove()}});target=_top.$("<div>").css({overflow:"hidden"}).append(iframe).dialog(winOpts)}else{target=_top.$("<div>").dialog(winOpts)}}else{var locate=/^#/.test(winOpts.locate)?winOpts.locate:"#"+winOpts.locate;target=$("<div>").appendTo(locate).dialog($.extend({},winOpts,{inline:true}))}return target},showModalDialog:function(options){options=options||{};var opts=$.extend({},options,{modal:true,minimizable:false,maximizable:false,resizable:false,collapsible:false});return $.showWindow(opts)}})})(jQuery);