From 3afadd10641f644f146c266542cb0758ea557696 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 14 Oct 2020 16:23:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E8=AE=BE=E8=AE=A1=E4=B8=AD?= =?UTF-8?q?=E5=85=81=E8=AE=B8=E4=BD=BF=E7=94=A8=E8=A7=86=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../x_component_query_Query/Statement.js | 495 ++++++++++++++++++ 1 file changed, 495 insertions(+) create mode 100644 o2web/source/x_component_query_Query/Statement.js diff --git a/o2web/source/x_component_query_Query/Statement.js b/o2web/source/x_component_query_Query/Statement.js new file mode 100644 index 0000000000..bd1f71a34f --- /dev/null +++ b/o2web/source/x_component_query_Query/Statement.js @@ -0,0 +1,495 @@ +MWF.xApplication.query = MWF.xApplication.query || {}; +MWF.xApplication.query.Query = MWF.xApplication.query.Query || {}; +MWF.xDesktop.requireApp("query.Query", "Viewer", null, false); +MWF.xApplication.query.Query.Statement = MWF.QStatement = new Class({ + Extends: MWF.QViewer, + options: { + }, + initialize: function(container, json, options, app, parentMacro){ + //本类有三种事件, + //一种是通过 options 传进来的事件,包括 loadView、openDocument、select + //一种是用户配置的 事件, 在this.options.moduleEvents 中定义的作为类事件 + //还有一种也是用户配置的事件,不在this.options.moduleEvents 中定义的作为 this.node 的DOM事件 + + this.setOptions(options); + + this.path = "../x_component_query_Query/$Viewer/"; + this.cssPath = "../x_component_query_Query/$Viewer/"+this.options.style+"/css.wcss"; + this._loadCss(); + this.lp = MWF.xApplication.query.Query.LP; + + this.app = app; + + this.container = $(container); + this.json = json; + + this.parentMacro = parentMacro; + + this.originalJson = Object.clone(json); + + this.viewJson = null; + this.filterItems = []; + this.searchStatus = "none"; //none, custom, default + + + this.items = []; + this.selectedItems = []; + this.hideColumns = []; + this.openColumns = []; + + this.gridJson = null; + + if (this.options.isload){ + this.init(function(){ + this.load(); + }.bind(this)); + } + + }, + init: function(callback){ + if (this.json.view){ + this.viewJson = JSON.decode(this.json.view); + if (callback) callback(); + }else{ + this.getView(callback); + } + }, + loadMacro: function (callback) { + MWF.require("MWF.xScript.Macro", function () { + this.Macro = new MWF.Macro.ViewContext(this); + if (callback) callback(); + }.bind(this)); + }, + createActionbarNode : function(){ + this.actionbarAreaNode.empty(); + if( typeOf(this.json.showActionbar) === "boolean" && this.json.showActionbar !== true )return; + if( typeOf( this.viewJson.actionbarHidden ) === "boolean" ){ + if( this.viewJson.actionbarHidden === true || !this.viewJson.actionbarList || !this.viewJson.actionbarList.length )return; + this.actionbar = new MWF.xApplication.query.Query.Statement.Actionbar(this.actionbarAreaNode, this.viewJson.actionbarList[0], this, {}); + this.actionbar.load(); + } + }, + _loadPageNode : function(){ + this.viewPageAreaNode.empty(); + if( !this.paging ){ + var json; + if( !this.viewJson.pagingList || !this.viewJson.pagingList.length ){ + json = { + "firstPageText": this.lp.firstPage, + "lastPageText": this.lp.lastPage + }; + }else{ + json = this.viewJson.pagingList[0]; + } + this.paging = new MWF.xApplication.query.Query.Statement.Paging(this.viewPageAreaNode, json, this, {}); + this.paging.load(); + }else{ + this.paging.reload(); + } + }, + _initPage: function(){ + this.count = this.bundleItems.length; + + var i = this.count/this.json.pageSize; + this.pages = (i.toInt()1){ + this.viewTable.deleteRow(-1); + } + //this.createLoadding(); + + this.loadViewRes = this.lookupAction.loadView(this.json.name, this.json.application, d, function(json){ + this.viewData = json.data; + + this.fireEvent("postLoadPageData"); + + if (this.viewJson.group.column){ + this.gridJson = json.data.groupGrid; + // this.loadGroupData(); + }else{ + this.gridJson = json.data.grid; + this.loadData(); + } + if (this.gridJson.length) this._loadPageNode(); + if (this.loadingAreaNode){ + this.loadingAreaNode.destroy(); + this.loadingAreaNode = null; + } + + this.pageloading = false; + + this.fireEvent("loadView"); //options 传入的事件 + this.fireEvent("postLoadPage"); + + if(callback)callback(); + }.bind(this), null, async === false ? false : true ); + }, + + + loadData: function(){ + if (this.gridJson.length){ + // if( !this.options.paging ){ + this.gridJson.each(function(line, i){ + this.items.push(new MWF.xApplication.query.Query.Statement.Item(this, line, null, i)); + }.bind(this)); + // }else{ + // this.loadPaging(); + // } + }else{ + if (this.viewPageAreaNode) this.viewPageAreaNode.empty(); + } + }, + loadDataByPaging : function(){ + if( this.isItemsLoading )return; + if( !this.isItemsLoaded ){ + var from = Math.min( this.pageNumber * this.options.perPageCount , this.gridJson.length); + var to = Math.min( ( this.pageNumber + 1 ) * this.options.perPageCount + 1 , this.gridJson.length); + this.isItemsLoading = true; + for( var i = from; i