META-INF.resources.openmonitor.jui.dest.win.win.view.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of easyopen Show documentation
Show all versions of easyopen Show documentation
一个简单易用的接口开放平台,平台封装了常用的参数校验、结果返回等功能,开发者只需实现业务代码即可。https://gitee.com/durcframework/easyopen
(function(){var c=JUIConfig.Win.zIndex;var d=function(){return ++c};var b={normal:0,max:1,min:2};JUI.Class("WinView",{init:function(e){this.winContId="winId_"+e.id;this._super(e);this.hide();this.sizeState=b.normal},afterRender:function(){this.initPanel()},initPanel:function(){this.setSize(this.opt("width"),this.opt("height"));this.initPanelEvent();this.initHeader();this.initBodyContent();this.initButtons();this.initDragable()},initPanelEvent:function(){var e=this;this.getWin().click(function(f){e.panelClick(f)})},initBodyContent:function(){if(this.opt("remote")){this.initRemoteContent()}else{this.initContent()}},initHeader:function(){var e=this;this.getWin().find(".modal-header").find("button").click(function(){e.cmp.hide()})},initRemoteContent:function(){var e=this.opt("url");this.frameId="winFrameId"+this.cmp.id;this.$frame=$('');if(!this.opt("lazyLoad")){this.setUrl(e)}$("#"+this.winContId).append(this.$frame)},setUrl:function(e){this.$frame.attr("src",e);this.resizeFrame()},resizeFrame:function(){var e=this.getSize();if(this.$frame){this.$frame.width(e.width-20).height(e.height-10)}},initContent:function(){this.$targetWin=$("#"+this.opt("contentId"));$("#"+this.winContId).append(this.$targetWin);this.$targetWin.removeClass("hide").show()},initButtons:function(){var k=this;var e=this.getBtnPanel();var j=this.cmp.opts.buttons;for(var h=0,g=j.length;h'+l.text+"");m.click(function(n){k.vBtnClick(l,n)});e.append(m)})(f)}},initDragable:function(){var f=this.getWraper();var e=this.getHeader();if(this.opt("draggable")){a.regist(f,e)}},move:function(f,e){this.getWraper().css({left:f+"px",top:e+"px"})},show:function(){this.showModal();this.addWinZindex();this._super();this.normal();this.center();if(this.opt("remote")&&this.opt("lazyLoad")){this.setUrl(this.opt("url"))}},setTitle:function(e){this.getTitle().html(e)},setSize:function(f,e){var g=this.getVisiable();if(f){g.width(f)}if(e){g.height(e)}},getSize:function(){var e=this.getVisiable();return{width:e.width(),height:e.height()}},hide:function(){this._super();this.hideModal()},normal:function(){this.sizeState=b.normal;var f=this.getWraper();var e=this.normalSize;f.offset(this.normalOffset);if(e){this.setSize(e.width,e.height)}this.resizeFrame()},max:function(){if(!this.canMaxToggle()){return}if(this.sizeState==b.normal){this.saveNormalState();var f=$(window);var e=f.width();var g=f.height();this.move(0,0);this.setSize(e-32,g-153);this.sizeState=b.max;this.resizeFrame()}},canMaxToggle:function(){return this.opt("maximizable")&&this.sizeState!=b.min},saveNormalState:function(){var e=this.getWin();this.normalSize=this.getSize();this.normalOffset=e.offset()},saveBeforeSize:function(){this.beforeSize=this.getSize()},saveBeforePos:function(){var e=this.getWin();this.beforeOffset=e.offset()},saveState:function(){this.beforeState=this.sizeState},isMaxState:function(){return this.sizeState==b.max},isMinState:function(){return this.sizeState==b.min},setSize:function(f,e){var g=this.getVisiable();if(f){g.width(f)}if(e){g.height(e)}},showModal:function(){var g=this.getModal();if(g){var k=$(document);var i=$("body");var f=k.height();var h=k.scrollTop()||i.scrollTop();var e=Math.max(f,h);var j=d();g.height(e).css("z-index",j).show()}},hideModal:function(){var e=this.getModal();if(e){e.hide()}},getModal:function(){if(this.opt("modal")){if(!this.$modal){this.$modal=this.createModal();$("body").append(this.$modal)}return this.$modal}},panelClick:function(g){var f=$(g.target);var h=f.parent(".modal-content")||f.attr("id")==this.opt("contentId");if(h){this.addWinZindex()}},addWinZindex:function(){var e=d();this.setZIndex(e)},createModal:function(){return $('').hide()},center:function(){var f=$(window);var l=$(document);var k=$(document.body);var m=f.height(),o=f.width(),i=l.scrollLeft()||k.scrollLeft(),h=o*0.35+i,n=m*0.25;var e=this.getWin();var g=e.width()||200;var j=e.height()||30;if(g){h=(o*0.5-(parseInt(g))*0.5)-10}if(j){n=(m*0.5-(parseInt(j))*0.5)-50}this.move(h,n)},hideBtn:function(e){this.getBtnPanel().find("button").eq(e).hide()},showBtn:function(e){this.getBtnPanel().find("button").eq(e).show()},getWin:function(){return this.$win},getVisiable:function(){if(!this._$visi){this._$visi=this.getWin().find(".modal-body").eq(0)}return this._$visi},getBtnPanel:function(){if(!this._$btnPanel){this._$btnPanel=this.getWin().find(".modal-footer").eq(0)}return this._$btnPanel},getTitle:function(){if(!this._$title){this._$title=this.getWin().find(".modal-title").eq(0)}return this._$title},getHeader:function(){if(!this._$had){this._$had=this.getWin().find(".modal-header").eq(0)}return this._$had},vBtnClick:function(f,g){f.handler.call(this.cmp,{target:g.target})},getTemplate:function(){var e=['','"];this.$win=$(e.join(""));return this.$win}},JUI.View);var a=(function(){var h=0;var g=0;var f=0;var k=0;var e=0;var j=$(window);var i=$(document);return{regist:function(o,m){m.css({cursor:"move"});m.on("mousedown",function(p){p.preventDefault();clientHeight=j.height();clientWidth=j.width();h=p.clientX;g=p.clientY;var q=o.offset();f=parseInt(q.top);k=parseInt(q.left);i.on("mousemove",l);i.on("mouseup",n)});function l(t){var r=t.clientX-h;var q=t.clientY-g;var s=r+k;var p=q+f;if(s ","0&&p