unknown 5 лет назад
Родитель
Сommit
ee38438bba

+ 98 - 0
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": "<div style='height: 100%;'></div>",
+                        "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){

+ 98 - 0
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": "<div style='height: 100%;'></div>",
+                        "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 : {

+ 98 - 0
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": "<div style='height: 100%;'></div>",
+                        "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

+ 101 - 1
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": "<div style='height: 100%;'></div>",
+                        "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; },

+ 2 - 2
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"
   }
 }

+ 2 - 2
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"
   }
 }

+ 1 - 1
o2web/source/x_component_portal_PageDesigner/$Main/bottom/tools.json

@@ -106,7 +106,7 @@
   },
   "statement": {
     "icon": "statement.png",
-    "text": "嵌入查询",
+    "text": "嵌入查询视图",
     "className": "Statement"
   }
 }

+ 1 - 1
o2web/source/x_component_portal_PageDesigner/$Main/default/tools.json

@@ -126,7 +126,7 @@
   },
   "statement": {
     "icon": "statement.png",
-    "text": "嵌入查询",
+    "text": "嵌入查询视图",
     "className": "Statement"
   }
 }

+ 2 - 2
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"
   }
 }

+ 2 - 2
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"
   }
 }

+ 7 - 1
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({