From aaa3a471c90389f8a0b12a0b3fd643846d96dc4b Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 15 Oct 2020 17:33:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E4=B8=AD=E5=85=81=E8=AE=B8?= =?UTF-8?q?=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 --- .../o2_core/o2/xScript/CMSEnvironment.js | 98 +++++++++++++++++ .../source/o2_core/o2/xScript/Environment.js | 98 +++++++++++++++++ .../o2_core/o2/xScript/PageEnvironment.js | 98 +++++++++++++++++ .../o2_core/o2/xScript/ViewEnvironment.js | 102 +++++++++++++++++- .../$Main/bottom/tools.json | 4 +- .../$Main/default/tools.json | 4 +- .../$Main/bottom/tools.json | 2 +- .../$Main/default/tools.json | 2 +- .../$Main/bottom/tools.json | 4 +- .../$Main/default/tools.json | 4 +- .../x_component_query_Query/Statement.js | 8 +- 11 files changed, 412 insertions(+), 12 deletions(-) diff --git a/o2web/source/o2_core/o2/xScript/CMSEnvironment.js b/o2web/source/o2_core/o2/xScript/CMSEnvironment.js index 83051603c7..3a664b902c 100644 --- a/o2web/source/o2_core/o2/xScript/CMSEnvironment.js +++ b/o2web/source/o2_core/o2/xScript/CMSEnvironment.js @@ -695,6 +695,104 @@ MWF.xScript.CMSEnvironment = function(ev){ } }; + this.statement = { + "execute": function (statement, callback, async) { + var filterList = { "filterList": (statement.filter || null) }; + MWF.Actions.get("x_query_assemble_surface").executeStatement(statement.view, statement.application, filterList, function (json) { + var data = { + "grid": json.data.grid, + }; + if (callback) callback(data); + }, null, async); + }, + "select": function (statement, callback, options) { + if (statement.statement) { + var statementJson = { + "application": statement.application || _form.json.application, + "statementName": statement.statement || "", + "isTitle": (statement.isTitle === false) ? "no" : "yes", + "select": (statement.isMulti === false) ? "single" : "multi", + "filter": statement.filter + }; + if (!options) options = {}; + options.width = statement.width; + options.height = statement.height; + options.title = statement.caption; + + var width = options.width || "700"; + var height = options.height || "400"; + + if (layout.mobile) { + var size = document.body.getSize(); + width = size.x; + height = size.y; + options.style = "viewmobile"; + } + width = width.toInt(); + height = height.toInt(); + + var size = _form.app.content.getSize(); + var x = (size.x - width) / 2; + var y = (size.y - height) / 2; + if (x < 0) x = 0; + if (y < 0) y = 0; + if (layout.mobile) { + x = 20; + y = 0; + } + + var _self = this; + MWF.require("MWF.xDesktop.Dialog", function () { + var dlg = new MWF.xDesktop.Dialog({ + "title": options.title || "select statement view", + "style": options.style || "view", + "top": y, + "left": x - 20, + "fromTop": y, + "fromLeft": x - 20, + "width": width, + "height": height, + "html": "
", + "maskNode": _form.app.content, + "container": _form.app.content, + "buttonList": [ + { + "text": MWF.LP.process.button.ok, + "action": function () { + //if (callback) callback(_self.view.selectedItems); + if (callback) callback(_self.statement.getData()); + this.close(); + } + }, + { + "text": MWF.LP.process.button.cancel, + "action": function () { this.close(); } + } + ] + }); + dlg.show(); + + if (layout.mobile) { + var backAction = dlg.node.getElement(".MWF_dialod_Action_back"); + var okAction = dlg.node.getElement(".MWF_dialod_Action_ok"); + if (backAction) backAction.addEvent("click", function (e) { + dlg.close(); + }.bind(this)); + if (okAction) okAction.addEvent("click", function (e) { + //if (callback) callback(this.view.selectedItems); + if (callback) callback(this.statement.getData()); + dlg.close(); + }.bind(this)); + } + + MWF.xDesktop.requireApp("query.Query", "Statement", function () { + this.statement = new MWF.xApplication.query.Query.Statement(dlg.content.getFirst(), statementJson, { "style": "select" }, _form.app, _form.Macro); + }.bind(this)); + }.bind(this)); + } + } + }; + //var lookupAction = null; //var getLookupAction = function(callback){ diff --git a/o2web/source/o2_core/o2/xScript/Environment.js b/o2web/source/o2_core/o2/xScript/Environment.js index cebb7a9ec8..4e540f3350 100644 --- a/o2web/source/o2_core/o2/xScript/Environment.js +++ b/o2web/source/o2_core/o2/xScript/Environment.js @@ -864,6 +864,104 @@ MWF.xScript.Environment = function(ev){ } }; + this.statement = { + "execute": function (statement, callback, async) { + var filterList = { "filterList": (statement.filter || null) }; + MWF.Actions.get("x_query_assemble_surface").execute(statement.view, statement.application, filterList, function (json) { + var data = { + "grid": json.data.grid, + }; + if (callback) callback(data); + }, null, async); + }, + "select": function (statement, callback, options) { + if (statement.statement) { + var statementJson = { + "application": statement.application || _form.json.application, + "statementName": statement.statement || "", + "isTitle": (statement.isTitle === false) ? "no" : "yes", + "select": (statement.isMulti === false) ? "single" : "multi", + "filter": statement.filter + }; + if (!options) options = {}; + options.width = statement.width; + options.height = statement.height; + options.title = statement.caption; + + var width = options.width || "700"; + var height = options.height || "400"; + + if (layout.mobile) { + var size = document.body.getSize(); + width = size.x; + height = size.y; + options.style = "viewmobile"; + } + width = width.toInt(); + height = height.toInt(); + + var size = _form.app.content.getSize(); + var x = (size.x - width) / 2; + var y = (size.y - height) / 2; + if (x < 0) x = 0; + if (y < 0) y = 0; + if (layout.mobile) { + x = 20; + y = 0; + } + + var _self = this; + MWF.require("MWF.xDesktop.Dialog", function () { + var dlg = new MWF.xDesktop.Dialog({ + "title": options.title || "select statement view", + "style": options.style || "view", + "top": y, + "left": x - 20, + "fromTop": y, + "fromLeft": x - 20, + "width": width, + "height": height, + "html": "
", + "maskNode": _form.app.content, + "container": _form.app.content, + "buttonList": [ + { + "text": MWF.LP.process.button.ok, + "action": function () { + //if (callback) callback(_self.view.selectedItems); + if (callback) callback(_self.statement.getData()); + this.close(); + } + }, + { + "text": MWF.LP.process.button.cancel, + "action": function () { this.close(); } + } + ] + }); + dlg.show(); + + if (layout.mobile) { + var backAction = dlg.node.getElement(".MWF_dialod_Action_back"); + var okAction = dlg.node.getElement(".MWF_dialod_Action_ok"); + if (backAction) backAction.addEvent("click", function (e) { + dlg.close(); + }.bind(this)); + if (okAction) okAction.addEvent("click", function (e) { + //if (callback) callback(this.view.selectedItems); + if (callback) callback(this.statement.getData()); + dlg.close(); + }.bind(this)); + } + + MWF.xDesktop.requireApp("query.Query", "Statement", function () { + this.statement = new MWF.xApplication.query.Query.Statement(dlg.content.getFirst(), statementJson, { "style": "select" }, _form.app, _form.Macro); + }.bind(this)); + }.bind(this)); + } + } + }; + //include 引用脚本 //optionsOrName : { diff --git a/o2web/source/o2_core/o2/xScript/PageEnvironment.js b/o2web/source/o2_core/o2/xScript/PageEnvironment.js index eff873b87b..7761a67a76 100644 --- a/o2web/source/o2_core/o2/xScript/PageEnvironment.js +++ b/o2web/source/o2_core/o2/xScript/PageEnvironment.js @@ -751,6 +751,104 @@ MWF.xScript.PageEnvironment = function (ev) { } }; + this.statement = { + "execute": function (statement, callback, async) { + var filterList = { "filterList": (statement.filter || null) }; + MWF.Actions.get("x_query_assemble_surface").execute(statement.view, statement.application, filterList, function (json) { + var data = { + "grid": json.data.grid, + }; + if (callback) callback(data); + }, null, async); + }, + "select": function (statement, callback, options) { + if (statement.statement) { + var statementJson = { + "application": statement.application || _form.json.application, + "statementName": statement.statement || "", + "isTitle": (statement.isTitle === false) ? "no" : "yes", + "select": (statement.isMulti === false) ? "single" : "multi", + "filter": statement.filter + }; + if (!options) options = {}; + options.width = statement.width; + options.height = statement.height; + options.title = statement.caption; + + var width = options.width || "700"; + var height = options.height || "400"; + + if (layout.mobile) { + var size = document.body.getSize(); + width = size.x; + height = size.y; + options.style = "viewmobile"; + } + width = width.toInt(); + height = height.toInt(); + + var size = _form.app.content.getSize(); + var x = (size.x - width) / 2; + var y = (size.y - height) / 2; + if (x < 0) x = 0; + if (y < 0) y = 0; + if (layout.mobile) { + x = 20; + y = 0; + } + + var _self = this; + MWF.require("MWF.xDesktop.Dialog", function () { + var dlg = new MWF.xDesktop.Dialog({ + "title": options.title || "select statement view", + "style": options.style || "view", + "top": y, + "left": x - 20, + "fromTop": y, + "fromLeft": x - 20, + "width": width, + "height": height, + "html": "
", + "maskNode": _form.app.content, + "container": _form.app.content, + "buttonList": [ + { + "text": MWF.LP.process.button.ok, + "action": function () { + //if (callback) callback(_self.view.selectedItems); + if (callback) callback(_self.statement.getData()); + this.close(); + } + }, + { + "text": MWF.LP.process.button.cancel, + "action": function () { this.close(); } + } + ] + }); + dlg.show(); + + if (layout.mobile) { + var backAction = dlg.node.getElement(".MWF_dialod_Action_back"); + var okAction = dlg.node.getElement(".MWF_dialod_Action_ok"); + if (backAction) backAction.addEvent("click", function (e) { + dlg.close(); + }.bind(this)); + if (okAction) okAction.addEvent("click", function (e) { + //if (callback) callback(this.view.selectedItems); + if (callback) callback(this.statement.getData()); + dlg.close(); + }.bind(this)); + } + + MWF.xDesktop.requireApp("query.Query", "Statement", function () { + this.statement = new MWF.xApplication.query.Query.Statement(dlg.content.getFirst(), statementJson, { "style": "select" }, _form.app, _form.Macro); + }.bind(this)); + }.bind(this)); + } + } + }; + //include 引用脚本 //optionsOrName : { // type : "", 默认为portal, 可以为 portal process cms diff --git a/o2web/source/o2_core/o2/xScript/ViewEnvironment.js b/o2web/source/o2_core/o2/xScript/ViewEnvironment.js index a05d0ae9d4..e4ee6323f5 100644 --- a/o2web/source/o2_core/o2/xScript/ViewEnvironment.js +++ b/o2web/source/o2_core/o2/xScript/ViewEnvironment.js @@ -667,6 +667,104 @@ MWF.xScript.ViewEnvironment = function (ev) { } }; + this.statement = { + "execute": function (statement, callback, async) { + var filterList = { "filterList": (statement.filter || null) }; + MWF.Actions.get("x_query_assemble_surface").execute(statement.view, statement.application, filterList, function (json) { + var data = { + "grid": json.data.grid, + }; + if (callback) callback(data); + }, null, async); + }, + "select": function (statement, callback, options) { + if (statement.statement) { + var statementJson = { + "application": statement.application || _form.json.application, + "statementName": statement.statement || "", + "isTitle": (statement.isTitle === false) ? "no" : "yes", + "select": (statement.isMulti === false) ? "single" : "multi", + "filter": statement.filter + }; + if (!options) options = {}; + options.width = statement.width; + options.height = statement.height; + options.title = statement.caption; + + var width = options.width || "700"; + var height = options.height || "400"; + + if (layout.mobile) { + var size = document.body.getSize(); + width = size.x; + height = size.y; + options.style = "viewmobile"; + } + width = width.toInt(); + height = height.toInt(); + + var size = _form.app.content.getSize(); + var x = (size.x - width) / 2; + var y = (size.y - height) / 2; + if (x < 0) x = 0; + if (y < 0) y = 0; + if (layout.mobile) { + x = 20; + y = 0; + } + + var _self = this; + MWF.require("MWF.xDesktop.Dialog", function () { + var dlg = new MWF.xDesktop.Dialog({ + "title": options.title || "select statement view", + "style": options.style || "view", + "top": y, + "left": x - 20, + "fromTop": y, + "fromLeft": x - 20, + "width": width, + "height": height, + "html": "
", + "maskNode": _form.app.content, + "container": _form.app.content, + "buttonList": [ + { + "text": MWF.LP.process.button.ok, + "action": function () { + //if (callback) callback(_self.view.selectedItems); + if (callback) callback(_self.statement.getData()); + this.close(); + } + }, + { + "text": MWF.LP.process.button.cancel, + "action": function () { this.close(); } + } + ] + }); + dlg.show(); + + if (layout.mobile) { + var backAction = dlg.node.getElement(".MWF_dialod_Action_back"); + var okAction = dlg.node.getElement(".MWF_dialod_Action_ok"); + if (backAction) backAction.addEvent("click", function (e) { + dlg.close(); + }.bind(this)); + if (okAction) okAction.addEvent("click", function (e) { + //if (callback) callback(this.view.selectedItems); + if (callback) callback(this.statement.getData()); + dlg.close(); + }.bind(this)); + } + + MWF.xDesktop.requireApp("query.Query", "Statement", function () { + this.statement = new MWF.xApplication.query.Query.Statement(dlg.content.getFirst(), statementJson, { "style": "select" }, _form.app, _form.Macro); + }.bind(this)); + }.bind(this)); + } + } + }; + //include 引用脚本 //optionsOrName : { // type : "", 默认为portal, 可以为 portal process cms @@ -765,8 +863,9 @@ MWF.xScript.ViewEnvironment = function (ev) { //仅前台对象----------------------------------------- //form - this.page = this.form = this.queryView = { + this.page = this.form = this.queryView = this.queryStatement = { "getParentEnvironment" : function () { return _form.getParentEnvironment(); }, //视图嵌入的表单或页面的上下文 + "getStatementInfor" : function () { return _form.getStatementInfor ? _form.getStatementInfor() : null; }, "getViewInfor" : function () { return _form.getViewInfor(); }, "getPageInfor" : function () { return _form.getPageInfor(); }, "getPageData" : function () { return _form.getPageData(); }, @@ -776,6 +875,7 @@ MWF.xScript.ViewEnvironment = function (ev) { "getSelectedData" : function () { return _form.getSelectedData(); }, "setFilter" : function ( filter ) { return _form.setFilter(filter); }, "switchView" : function ( options ) { return _form.switchView(options); }, + "switchStatement" : function ( options ) { if(_form.switchStatement)_form.switchStatement(options) ; }, "reload" : function () { _form.reload(); }, // "getInfor": function () { return ev.pageInfor; }, diff --git a/o2web/source/x_component_cms_FormDesigner/$Main/bottom/tools.json b/o2web/source/x_component_cms_FormDesigner/$Main/bottom/tools.json index 140d7b24fa..4351ae2fa9 100644 --- a/o2web/source/x_component_cms_FormDesigner/$Main/bottom/tools.json +++ b/o2web/source/x_component_cms_FormDesigner/$Main/bottom/tools.json @@ -197,12 +197,12 @@ }, "statementSelector": { "icon": "statementSelector.png", - "text": "选择查询", + "text": "选择查询视图", "className": "StatementSelector" }, "statement": { "icon": "statement.png", - "text": "嵌入查询", + "text": "嵌入查询视图", "className": "Statement" } } \ No newline at end of file diff --git a/o2web/source/x_component_cms_FormDesigner/$Main/default/tools.json b/o2web/source/x_component_cms_FormDesigner/$Main/default/tools.json index 48fa4ca9a2..3f02ed7b91 100644 --- a/o2web/source/x_component_cms_FormDesigner/$Main/default/tools.json +++ b/o2web/source/x_component_cms_FormDesigner/$Main/default/tools.json @@ -198,12 +198,12 @@ }, "statementSelector": { "icon": "statementSelector.png", - "text": "选择查询", + "text": "选择查询视图", "className": "StatementSelector" }, "statement": { "icon": "statement.png", - "text": "嵌入查询", + "text": "嵌入查询视图", "className": "Statement" } } \ No newline at end of file diff --git a/o2web/source/x_component_portal_PageDesigner/$Main/bottom/tools.json b/o2web/source/x_component_portal_PageDesigner/$Main/bottom/tools.json index fc2f41e674..58a873b0ba 100644 --- a/o2web/source/x_component_portal_PageDesigner/$Main/bottom/tools.json +++ b/o2web/source/x_component_portal_PageDesigner/$Main/bottom/tools.json @@ -106,7 +106,7 @@ }, "statement": { "icon": "statement.png", - "text": "嵌入查询", + "text": "嵌入查询视图", "className": "Statement" } } \ No newline at end of file diff --git a/o2web/source/x_component_portal_PageDesigner/$Main/default/tools.json b/o2web/source/x_component_portal_PageDesigner/$Main/default/tools.json index 7acc45601d..31c68625ed 100644 --- a/o2web/source/x_component_portal_PageDesigner/$Main/default/tools.json +++ b/o2web/source/x_component_portal_PageDesigner/$Main/default/tools.json @@ -126,7 +126,7 @@ }, "statement": { "icon": "statement.png", - "text": "嵌入查询", + "text": "嵌入查询视图", "className": "Statement" } } \ No newline at end of file diff --git a/o2web/source/x_component_process_FormDesigner/$Main/bottom/tools.json b/o2web/source/x_component_process_FormDesigner/$Main/bottom/tools.json index e8149d085b..aa6a8caac3 100644 --- a/o2web/source/x_component_process_FormDesigner/$Main/bottom/tools.json +++ b/o2web/source/x_component_process_FormDesigner/$Main/bottom/tools.json @@ -177,12 +177,12 @@ }, "statementSelector": { "icon": "statementSelector.png", - "text": "选择查询", + "text": "选择查询视图", "className": "StatementSelector" }, "statement": { "icon": "statement.png", - "text": "嵌入查询", + "text": "嵌入查询视图", "className": "Statement" } } \ No newline at end of file diff --git a/o2web/source/x_component_process_FormDesigner/$Main/default/tools.json b/o2web/source/x_component_process_FormDesigner/$Main/default/tools.json index 4d71b8ab06..1c493a34f7 100644 --- a/o2web/source/x_component_process_FormDesigner/$Main/default/tools.json +++ b/o2web/source/x_component_process_FormDesigner/$Main/default/tools.json @@ -194,12 +194,12 @@ }, "statementSelector": { "icon": "statementSelector.png", - "text": "选择查询", + "text": "选择查询视图", "className": "StatementSelector" }, "statement": { "icon": "statement.png", - "text": "嵌入查询", + "text": "嵌入查询视图", "className": "Statement" } } \ No newline at end of file diff --git a/o2web/source/x_component_query_Query/Statement.js b/o2web/source/x_component_query_Query/Statement.js index 6209e736a1..a54a47993d 100644 --- a/o2web/source/x_component_query_Query/Statement.js +++ b/o2web/source/x_component_query_Query/Statement.js @@ -341,8 +341,14 @@ MWF.xApplication.query.Query.Statement = MWF.QStatement = new Class({ this.searchCustomView(); } - } + }, //搜索相关结束 + getStatementInfor : function () { + return this.json; + }, + switchStatement : function (json) { + this.switchView(json); + } }); MWF.xApplication.query.Query.Statement.Item = new Class({ -- GitLab