Просмотр исходного кода

Merge branch 'feature/Query.statement_add_view' into 'wrdp'

Merge of feature/Query.statement_add_view 查询语句中可以使用视图功能 to wrdp

See merge request o2oa/o2oa!1993
蔡祥熠 5 лет назад
Родитель
Сommit
5bfa280556
100 измененных файлов с 6349 добавлено и 1469 удалено
  1. 16 0
      o2web/source/o2_core/o2/widget/JavascriptEditor.js
  2. 28 0
      o2web/source/o2_core/o2/widget/O2Identity.js
  3. 6 2
      o2web/source/o2_core/o2/widget/Tab.js
  4. 98 0
      o2web/source/o2_core/o2/xScript/CMSEnvironment.js
  5. 98 0
      o2web/source/o2_core/o2/xScript/Environment.js
  6. 98 0
      o2web/source/o2_core/o2/xScript/PageEnvironment.js
  7. 101 1
      o2web/source/o2_core/o2/xScript/ViewEnvironment.js
  8. 162 0
      o2web/source/x_component_Selector/QueryStatement.js
  9. 1 0
      o2web/source/x_component_Selector/lp/en.js
  10. 1 0
      o2web/source/x_component_Selector/lp/zh-cn.js
  11. BIN
      o2web/source/x_component_cms_FormDesigner/$Main/bottom/icon/statement.png
  12. BIN
      o2web/source/x_component_cms_FormDesigner/$Main/bottom/icon/statementSelector.png
  13. 10 0
      o2web/source/x_component_cms_FormDesigner/$Main/bottom/tools.json
  14. BIN
      o2web/source/x_component_cms_FormDesigner/$Main/default/icon/statement.png
  15. BIN
      o2web/source/x_component_cms_FormDesigner/$Main/default/icon/statementSelector.png
  16. 10 0
      o2web/source/x_component_cms_FormDesigner/$Main/default/tools.json
  17. 3 1
      o2web/source/x_component_cms_FormDesigner/Module/Package.js
  18. 39 0
      o2web/source/x_component_cms_FormDesigner/Module/Statement.js
  19. 6 0
      o2web/source/x_component_cms_FormDesigner/Module/StatementSelector.js
  20. 4 0
      o2web/source/x_component_cms_FormDesigner/Script.js
  21. 5 0
      o2web/source/x_component_cms_Xform/Statement.js
  22. 4 0
      o2web/source/x_component_cms_Xform/StatementSelector.js
  23. BIN
      o2web/source/x_component_portal_PageDesigner/$Main/bottom/icon/statement.png
  24. 5 0
      o2web/source/x_component_portal_PageDesigner/$Main/bottom/tools.json
  25. BIN
      o2web/source/x_component_portal_PageDesigner/$Main/default/icon/statement.png
  26. 5 0
      o2web/source/x_component_portal_PageDesigner/$Main/default/tools.json
  27. 2 1
      o2web/source/x_component_portal_PageDesigner/Module/Package.js
  28. 3 0
      o2web/source/x_component_portal_PageDesigner/Module/Statement.js
  29. 90 0
      o2web/source/x_component_portal_PageDesigner/Module/Statement/template.json
  30. 12 0
      o2web/source/x_component_portal_PageDesigner/Script.js
  31. BIN
      o2web/source/x_component_process_FormDesigner/$Main/bottom/icon/statement.png
  32. BIN
      o2web/source/x_component_process_FormDesigner/$Main/bottom/icon/statementSelector.png
  33. 10 0
      o2web/source/x_component_process_FormDesigner/$Main/bottom/tools.json
  34. BIN
      o2web/source/x_component_process_FormDesigner/$Main/default/icon/statement.png
  35. BIN
      o2web/source/x_component_process_FormDesigner/$Main/default/icon/statementSelector.png
  36. 10 0
      o2web/source/x_component_process_FormDesigner/$Main/default/tools.json
  37. 2 0
      o2web/source/x_component_process_FormDesigner/Module/Package.js
  38. 161 0
      o2web/source/x_component_process_FormDesigner/Module/Statement.js
  39. 91 0
      o2web/source/x_component_process_FormDesigner/Module/Statement/default/css.wcss
  40. BIN
      o2web/source/x_component_process_FormDesigner/Module/Statement/default/icon/copy.png
  41. BIN
      o2web/source/x_component_process_FormDesigner/Module/Statement/default/icon/copy1.png
  42. BIN
      o2web/source/x_component_process_FormDesigner/Module/Statement/default/icon/delete.png
  43. BIN
      o2web/source/x_component_process_FormDesigner/Module/Statement/default/icon/delete1.png
  44. BIN
      o2web/source/x_component_process_FormDesigner/Module/Statement/default/icon/move.png
  45. BIN
      o2web/source/x_component_process_FormDesigner/Module/Statement/default/icon/move1.png
  46. BIN
      o2web/source/x_component_process_FormDesigner/Module/Statement/default/icon/multi.png
  47. BIN
      o2web/source/x_component_process_FormDesigner/Module/Statement/default/icon/single.png
  48. BIN
      o2web/source/x_component_process_FormDesigner/Module/Statement/default/icon/statement.png
  49. 180 0
      o2web/source/x_component_process_FormDesigner/Module/Statement/statement.html
  50. 90 0
      o2web/source/x_component_process_FormDesigner/Module/Statement/template.json
  51. 35 0
      o2web/source/x_component_process_FormDesigner/Module/StatementSelector.js
  52. 209 0
      o2web/source/x_component_process_FormDesigner/Module/StatementSelector/StatementSelector.html
  53. 55 0
      o2web/source/x_component_process_FormDesigner/Module/StatementSelector/default/css.wcss
  54. BIN
      o2web/source/x_component_process_FormDesigner/Module/StatementSelector/default/icon/buttonIcon.png
  55. BIN
      o2web/source/x_component_process_FormDesigner/Module/StatementSelector/default/icon/copy.png
  56. BIN
      o2web/source/x_component_process_FormDesigner/Module/StatementSelector/default/icon/copy1.png
  57. BIN
      o2web/source/x_component_process_FormDesigner/Module/StatementSelector/default/icon/delete.png
  58. BIN
      o2web/source/x_component_process_FormDesigner/Module/StatementSelector/default/icon/delete1.png
  59. BIN
      o2web/source/x_component_process_FormDesigner/Module/StatementSelector/default/icon/hand2.png
  60. BIN
      o2web/source/x_component_process_FormDesigner/Module/StatementSelector/default/icon/hand3.png
  61. BIN
      o2web/source/x_component_process_FormDesigner/Module/StatementSelector/default/icon/inputtext.png
  62. BIN
      o2web/source/x_component_process_FormDesigner/Module/StatementSelector/default/icon/move.png
  63. BIN
      o2web/source/x_component_process_FormDesigner/Module/StatementSelector/default/icon/move1.png
  64. 85 0
      o2web/source/x_component_process_FormDesigner/Module/StatementSelector/template.json
  65. 30 0
      o2web/source/x_component_process_FormDesigner/Property.js
  66. 1 1
      o2web/source/x_component_process_FormDesigner/widget/ActionsEditor.js
  67. 43 39
      o2web/source/x_component_process_ProcessDesigner/widget/PersonSelector.js
  68. 2 0
      o2web/source/x_component_process_Xform/Package.js
  69. 95 0
      o2web/source/x_component_process_Xform/Statement.js
  70. 163 0
      o2web/source/x_component_process_Xform/StatementSelector.js
  71. 15 0
      o2web/source/x_component_query_Query/$Main/default/css.wcss
  72. BIN
      o2web/source/x_component_query_Query/$Main/default/icon/statement.png
  73. 41 0
      o2web/source/x_component_query_Query/Main.js
  74. 711 0
      o2web/source/x_component_query_Query/Statement.js
  75. 4 2
      o2web/source/x_component_query_Query/Viewer.js
  76. 1 0
      o2web/source/x_component_query_Query/lp/zh-cn.js
  77. BIN
      o2web/source/x_component_query_StatementDesigner/$Main/default/toolbar/preview.png
  78. 1 1
      o2web/source/x_component_query_StatementDesigner/$Main/default/toolbars.html
  79. 42 0
      o2web/source/x_component_query_StatementDesigner/$Statement/actionbar.html
  80. 92 22
      o2web/source/x_component_query_StatementDesigner/$Statement/column.html
  81. 37 0
      o2web/source/x_component_query_StatementDesigner/$Statement/column_bak.html
  82. 1 1
      o2web/source/x_component_query_StatementDesigner/$Statement/default/css.wcss
  83. 24 0
      o2web/source/x_component_query_StatementDesigner/$Statement/default/statement.css
  84. 19 5
      o2web/source/x_component_query_StatementDesigner/$Statement/statement.html
  85. 61 33
      o2web/source/x_component_query_StatementDesigner/$Statement/statementDesigner.html
  86. 1 0
      o2web/source/x_component_query_StatementDesigner/$Statement/toolbars.json
  87. 332 0
      o2web/source/x_component_query_StatementDesigner/$Statement/view.html
  88. 69 0
      o2web/source/x_component_query_StatementDesigner/$Statement/view.json
  89. 45 43
      o2web/source/x_component_query_StatementDesigner/Main.js
  90. 53 646
      o2web/source/x_component_query_StatementDesigner/Property.js
  91. 1508 171
      o2web/source/x_component_query_StatementDesigner/Statement.js
  92. 16 52
      o2web/source/x_component_query_StatementDesigner/lp/zh-cn.js
  93. 0 134
      o2web/source/x_component_query_StatementDesigner/widget/$PersonSelector/default/css.wcss
  94. 60 0
      o2web/source/x_component_query_StatementDesigner/widget/$ViewFilter/default/css.wcss
  95. BIN
      o2web/source/x_component_query_StatementDesigner/widget/$ViewFilter/default/down.png
  96. 0 0
      o2web/source/x_component_query_StatementDesigner/widget/$ViewFilter/default/icon/addPerson.png
  97. BIN
      o2web/source/x_component_query_StatementDesigner/widget/$ViewFilter/default/icon/delete1.png
  98. BIN
      o2web/source/x_component_query_StatementDesigner/widget/$ViewFilter/default/icon/error.png
  99. 0 314
      o2web/source/x_component_query_StatementDesigner/widget/PersonSelector.js
  100. 1147 0
      o2web/source/x_component_query_StatementDesigner/widget/ViewFilter.js

+ 16 - 0
o2web/source/o2_core/o2/widget/JavascriptEditor.js

@@ -371,6 +371,22 @@ o2.widget.JavascriptEditor = new Class({
     setValue: function(v){
         if (this.editor) this.editor.setValue(v);
     },
+    insertValue : function(v){
+        if (this.editor){
+            switch (this.options.type.toLowerCase()) {
+                case "ace":
+                    this.editor.insert(v);
+                    break;
+                case "monaco":
+                    // this.editor.getModel().applyEdits([{
+                    this.editor.executeEdits("", [{
+                        range: monaco.Range.fromPositions(this.editor.getPosition()),
+                        text: v
+                    }]);
+                    break;
+            }
+        }
+    },
     getValue: function(){
         return (this.editor) ? this.editor.getValue() : "";
     },

+ 28 - 0
o2web/source/o2_core/o2/widget/O2Identity.js

@@ -468,6 +468,34 @@ o2.widget.O2QueryView = new Class({
         }
     }
 });
+
+o2.widget.O2QueryStatement = new Class({
+    Extends: o2.widget.O2View,
+    getPersonData: function(){
+        if (!this.data.query){
+            var data = null;
+            o2.Actions.load("x_query_assemble_designer").StatementAction.get(this.data.id, function(json){
+                data = json.data
+            }, null, false);
+            this.data = data;
+            return data;
+        }else{
+            return this.data;
+        }
+    },
+    open : function (e) {
+        if( this.data.id && this.data.query ){
+            var appId = "query.StatementDesigner" + this.data.id;
+            if (layout.desktop.apps[appId]){
+                layout.desktop.apps[appId].setCurrent();
+            }else {
+                var options = {"id": this.data.id, "application": this.data.query, "appId": appId};
+                layout.desktop.openApplication(e, "query.StatementDesigner", options);
+            }
+        }
+    }
+});
+
 o2.widget.O2QueryStat = new Class({
     Extends: o2.widget.O2View,
     getPersonData: function(){

+ 6 - 2
o2web/source/o2_core/o2/widget/Tab.js

@@ -267,9 +267,13 @@ o2.widget.TabPage = new Class({
 			this.fireEvent("hide");
 		}
 	},
-	enableTab : function(){
+	enableTab : function( notShow ){
 		this.disabled = false;
-		this.showTab();
+		if( notShow ){
+			this.tabNode.show();
+		}else{
+			this.showTab();
+		}
 	},
 	disableTab : function( notShowSibling ){
 		this.disabled = true;

+ 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; },

+ 162 - 0
o2web/source/x_component_Selector/QueryStatement.js

@@ -0,0 +1,162 @@
+MWF.xApplication.Selector = MWF.xApplication.Selector || {};
+MWF.xDesktop.requireApp("Selector", "Person", null, false);
+MWF.xApplication.Selector.QueryStatement = new Class({
+	Extends: MWF.xApplication.Selector.Person,
+    options: {
+        "style": "default",
+        "count": 0,
+        "title": MWF.xApplication.Selector.LP.selectStatement,
+        "values": [],
+        "names": [],
+        "expand": false,
+        "forceSearchInItem" : true
+    },
+    _init : function(){
+        this.selectType = "querystatement";
+        this.className = "QueryStatement";
+    },
+    loadSelectItems: function(addToNext){
+        this.queryAction.listApplication(function(json){
+            if (json.data.length){
+                json.data.each(function(data){
+                    if (!data.statementList){
+                        this.queryAction.listStatement(data.id, function(statementsJson){
+                            data.statementList = statementsJson.data;
+                        }.bind(this), null, false);
+                    }
+                    if (data.statementList && data.statementList.length){
+                        var category = this._newItemCategory(data, this, this.itemAreaNode);
+                        data.statementList.each(function(d){
+                            d.applicationName = data.name;
+                            var item = this._newItem(d, this, category.children);
+                            this.items.push(item);
+                        }.bind(this));
+                    }
+                }.bind(this));
+            }
+        }.bind(this));
+    },
+
+    _scrollEvent: function(y){
+        return true;
+    },
+    _getChildrenItemIds: function(data){
+        return data.statementList || [];
+    },
+    _newItemCategory: function(data, selector, item, level){
+        return new MWF.xApplication.Selector.QueryStatement.ItemCategory(data, selector, item, level)
+    },
+
+    _listItemByKey: function(callback, failure, key){
+        return false;
+    },
+    _getItem: function(callback, failure, id, async){
+        this.queryAction.getStatement(function(json){
+            if (callback) callback.apply(this, [json]);
+        }.bind(this), failure, ((typeOf(id)==="string") ? id : id.id), async);
+    },
+    _newItemSelected: function(data, selector, item){
+        return new MWF.xApplication.Selector.QueryStatement.ItemSelected(data, selector, item)
+    },
+    _listItemByPinyin: function(callback, failure, key){
+        return false;
+    },
+    _newItem: function(data, selector, container, level){
+        return new MWF.xApplication.Selector.QueryStatement.Item(data, selector, container, level);
+    }
+});
+MWF.xApplication.Selector.QueryStatement.Item = new Class({
+	Extends: MWF.xApplication.Selector.Person.Item,
+    _getShowName: function(){
+        return this.data.name;
+    },
+    _setIcon: function(){
+        this.iconNode.setStyle("background-image", "url("+"../x_component_Selector/$Selector/default/icon/view.png)");
+    },
+    loadSubItem: function(){
+        return false;
+    },
+    checkSelectedSingle: function(){
+        var selectedItem = this.selector.options.values.filter(function(item, index){
+            if (typeOf(item)==="object"){
+                if( this.data.id && item.id ){
+                    return this.data.id === item.id;
+                }else{
+                    return this.data.name === item.name;
+                }
+                //return (this.data.id === item.id) || (this.data.name === item.name) ;
+            }
+            //if (typeOf(item)==="object") return (this.data.id === item.id) || (this.data.name === item.name) ;
+            if (typeOf(item)==="string") return (this.data.id === item) || (this.data.name === item);
+            return false;
+        }.bind(this));
+        if (selectedItem.length){
+            this.selectedSingle();
+        }
+    },
+    checkSelected: function(){
+
+        var selectedItem = this.selector.selectedItems.filter(function(item, index){
+            if( item.data.id && this.data.id){
+                return item.data.id === this.data.id;
+            }else{
+                return item.data.name === this.data.name;
+            }
+            //return (item.data.id === this.data.id) || (item.data.name === this.data.name);
+        }.bind(this));
+        if (selectedItem.length){
+            //selectedItem[0].item = this;
+            selectedItem[0].addItem(this);
+            this.selectedItem = selectedItem[0];
+            this.setSelected();
+        }
+    }
+});
+
+MWF.xApplication.Selector.QueryStatement.ItemSelected = new Class({
+	Extends: MWF.xApplication.Selector.Person.ItemSelected,
+    _getShowName: function(){
+        return this.data.name;
+    },
+    _setIcon: function(){
+        this.iconNode.setStyle("background-image", "url("+"../x_component_Selector/$Selector/default/icon/view.png)");
+    },
+    check: function(){
+        if (this.selector.items.length){
+            var items = this.selector.items.filter(function(item, index){
+                //return (item.data.id === this.data.id) || (item.data.name === this.data.name);
+                if( item.data.id && this.data.id){
+                    return item.data.id === this.data.id;
+                }else{
+                    return item.data.name === this.data.name;
+                }
+            }.bind(this));
+            this.items = items;
+            if (items.length){
+                items.each(function(item){
+                    item.selectedItem = this;
+                    item.setSelected();
+                }.bind(this));
+            }
+        }
+    }
+});
+
+MWF.xApplication.Selector.QueryStatement.ItemCategory = new Class({
+    Extends: MWF.xApplication.Selector.Person.ItemCategory,
+    _getShowName: function(){
+        return this.data.name;
+    },
+    createNode: function(){
+        this.node = new Element("div", {
+            "styles": this.selector.css.selectorItemCategory_department
+        }).inject(this.container);
+    },
+    _setIcon: function(){
+        this.iconNode.setStyle("background-image", "url("+"../x_component_Selector/$Selector/default/icon/applicationicon.png)");
+    },
+    _hasChild: function(){
+        return (this.data.statementList && this.data.statementList.length);
+    },
+    check: function(){}
+});

+ 1 - 0
o2web/source/x_component_Selector/lp/en.js

@@ -10,6 +10,7 @@ MWF.xApplication.Selector.LP = MWF.SelectorLP = {
     "selectAppliction": "Select Process Appliction",
     "selectProcess": "Select Process",
     "selectView": "Select View",
+    "selectStatement": "Select Statement",
     "selectCMSApplication": "Select CMS Application",
     "selectCMSCategory": "Select CMS Category",
     "searchDescription" : "search",

+ 1 - 0
o2web/source/x_component_Selector/lp/zh-cn.js

@@ -12,6 +12,7 @@ MWF.xApplication.Selector.LP = MWF.SelectorLP = {
     "selectAppliction": "选择流程应用",
     "selectProcess": "选择流程",
     "selectView": "选择视图",
+    "selectStatement" : "选择查询",
     "selectTable": "选择数据表",
     "selectFormStyle" : "选择表单样式",
     "selectCMSApplication": "选择内容管理应用",

BIN
o2web/source/x_component_cms_FormDesigner/$Main/bottom/icon/statement.png


BIN
o2web/source/x_component_cms_FormDesigner/$Main/bottom/icon/statementSelector.png


+ 10 - 0
o2web/source/x_component_cms_FormDesigner/$Main/bottom/tools.json

@@ -194,5 +194,15 @@
     "icon": "comment.png",
     "text": "评论",
     "className": "Comment"
+  },
+  "statementSelector": {
+    "icon": "statementSelector.png",
+    "text": "选择查询视图",
+    "className": "StatementSelector"
+  },
+  "statement": {
+    "icon": "statement.png",
+    "text": "嵌入查询视图",
+    "className": "Statement"
   }
 }

BIN
o2web/source/x_component_cms_FormDesigner/$Main/default/icon/statement.png


BIN
o2web/source/x_component_cms_FormDesigner/$Main/default/icon/statementSelector.png


+ 10 - 0
o2web/source/x_component_cms_FormDesigner/$Main/default/tools.json

@@ -195,5 +195,15 @@
     "icon": "comment.png",
     "text": "评论",
     "className": "Comment"
+  },
+  "statementSelector": {
+    "icon": "statementSelector.png",
+    "text": "选择查询视图",
+    "className": "StatementSelector"
+  },
+  "statement": {
+    "icon": "statement.png",
+    "text": "嵌入查询视图",
+    "className": "Statement"
   }
 }

+ 3 - 1
o2web/source/x_component_cms_FormDesigner/Module/Package.js

@@ -41,4 +41,6 @@ MWF.xDesktop.requireApp("cms.FormDesigner", "Module.Office", null, false);
 MWF.xDesktop.requireApp("cms.FormDesigner", "Module.Attachment", null, false);
 MWF.xDesktop.requireApp("cms.FormDesigner", "Module.Log", null, false);
 MWF.xDesktop.requireApp("cms.FormDesigner", "Module.Office", null, false);
-MWF.xDesktop.requireApp("cms.FormDesigner", "Module.Comment", null, false);
+MWF.xDesktop.requireApp("cms.FormDesigner", "Module.Comment", null, false);
+MWF.xDesktop.requireApp("cms.FormDesigner", "Module.Statement", null, false);
+MWF.xDesktop.requireApp("cms.FormDesigner", "Module.StatementSelector", null, false);

+ 39 - 0
o2web/source/x_component_cms_FormDesigner/Module/Statement.js

@@ -0,0 +1,39 @@
+MWF.xApplication.cms.FormDesigner.Module = MWF.xApplication.cms.FormDesigner.Module || {};
+MWF.xDesktop.requireApp("process.FormDesigner", "Module.Statement", null, false);
+MWF.xApplication.cms.FormDesigner.Module.Statement = MWF.CMSFCStatement = new Class({
+	Extends: MWF.FCStatement,
+	Implements : [MWF.CMSFCMI]//,
+	//_createViewNode: function(callback){
+	//	if (!this.viewNode) this.viewNode = new Element("div", {"styles": this.css.viewNode}).inject(this.node);
+	//	this.node.setStyle("background", "transparent");
+    //
+	//	this.viewTable = new Element("table", {
+	//		"styles": this.css.viewTitleTableNode,
+	//		"border": "0px",
+	//		"cellPadding": "0",
+	//		"cellSpacing": "0"
+	//	}).inject(this.viewNode);
+	//	this.viewLine = new Element("tr", {"styles": this.css.viewTitleLineNode}).inject(this.viewTable);
+    //
+	//	if (this.json.select!="no"){
+	//		this.viewSelectCell = new Element("td", {
+	//			"styles": this.css.viewTitleCellNode
+	//		}).inject(this.viewLine);
+	//		this.viewSelectCell.setStyle("width", "10px");
+	//	}
+	//	this.form.designer.actions.getQueryView(this.json["view"], function(json){
+	//		var viewData = JSON.decode(json.data.data);
+	//		viewData.selectEntryList.each(function(column){
+	//			//    if (column.export){
+	//			var viewCell = new Element("td", {
+	//				"styles": this.css.viewTitleCellNode,
+	//				"text": column.displayName
+	//			}).inject(this.viewLine);
+	//			//    }
+	//		}.bind(this));
+    //
+	//		if (callback) callback();
+	//	}.bind(this));
+	//	this._setViewNodeTitle();
+	//}
+});

+ 6 - 0
o2web/source/x_component_cms_FormDesigner/Module/StatementSelector.js

@@ -0,0 +1,6 @@
+MWF.xApplication.cms.FormDesigner.Module = MWF.xApplication.cms.FormDesigner.Module || {};
+MWF.xDesktop.requireApp("process.FormDesigner", "Module.StatementSelector", null, false);
+MWF.xApplication.cms.FormDesigner.Module.StatementSelector = MWF.CMSFCStatementSelector = new Class({
+	Extends: MWF.FCStatementSelector,
+	Implements : [MWF.CMSFCMI]
+});

+ 4 - 0
o2web/source/x_component_cms_FormDesigner/Script.js

@@ -102,6 +102,10 @@ MWF.xApplication.cms.FormDesigner.Script = new Class({
                 this.loadAuthorScript(v); break;
             case "Reader":
                 this.loadReaderScript(v); break;
+            case "Statement":
+                this.loadStatementScript(v); break;
+            case "StatementSelector":
+                this.loadStatementSelectorScript(v); break;
         }
         this.bindDataId(v);
     },

+ 5 - 0
o2web/source/x_component_cms_Xform/Statement.js

@@ -0,0 +1,5 @@
+MWF.xDesktop.requireApp("process.Xform", "Statement", null, false);
+//MWF.xDesktop.requireApp("cms.Xform", "widget.View", null, false);
+MWF.xApplication.cms.Xform.Statement = MWF.CMSStatement =  new Class({
+	Extends: MWF.APPStatement
+});

+ 4 - 0
o2web/source/x_component_cms_Xform/StatementSelector.js

@@ -0,0 +1,4 @@
+MWF.xDesktop.requireApp("process.Xform", "StatementSelector", null, false);
+MWF.xApplication.cms.Xform.StatementSelector = MWF.CMSStatementSelector =  new Class({
+	Extends: MWF.APPStatementSelector
+}); 

BIN
o2web/source/x_component_portal_PageDesigner/$Main/bottom/icon/statement.png


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

@@ -103,5 +103,10 @@
     "icon": "subpage.png",
     "text": "部件元素",
     "className": "Widgetmodules"
+  },
+  "statement": {
+    "icon": "statement.png",
+    "text": "嵌入查询视图",
+    "className": "Statement"
   }
 }

BIN
o2web/source/x_component_portal_PageDesigner/$Main/default/icon/statement.png


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

@@ -123,5 +123,10 @@
     "icon": "subpage.png",
     "text": "部件元素",
     "className": "Widgetmodules"
+  },
+  "statement": {
+    "icon": "statement.png",
+    "text": "嵌入查询视图",
+    "className": "Statement"
   }
 }

+ 2 - 1
o2web/source/x_component_portal_PageDesigner/Module/Package.js

@@ -27,4 +27,5 @@ MWF.xDesktop.requireApp("portal.PageDesigner", "Module.Source", null, false);
 MWF.xDesktop.requireApp("portal.PageDesigner", "Module.SourceText", null, false);
 MWF.xDesktop.requireApp("portal.PageDesigner", "Module.SubSource", null, false);
 MWF.xDesktop.requireApp("portal.PageDesigner", "Module.Widget", null, false);
-MWF.xDesktop.requireApp("portal.PageDesigner", "Module.Widgetmodules", null, false);
+MWF.xDesktop.requireApp("portal.PageDesigner", "Module.Widgetmodules", null, false);
+MWF.xDesktop.requireApp("portal.PageDesigner", "Module.Statement", null, false);

+ 3 - 0
o2web/source/x_component_portal_PageDesigner/Module/Statement.js

@@ -0,0 +1,3 @@
+MWF.xApplication.portal.PageDesigner.Module.Statement = MWF.PCStatement = new Class({
+    Extends: MWF.FCStatement
+});

+ 90 - 0
o2web/source/x_component_portal_PageDesigner/Module/Statement/template.json

@@ -0,0 +1,90 @@
+{
+	"id": "",
+	"name": "",
+	"type": "Statement",
+	"description": "",
+    "view": "",
+    "isTitle": "yes",
+    "select": "no",  //single, multi
+    "isOpen": "yes",
+	"events": {
+		"queryLoad": {
+		  "code": "",
+		  "html": ""
+		},
+		"postLoad": {
+		  "code": "",
+		  "html": ""
+		},
+		"load": {
+		  "code": "",
+		  "html": ""
+		},
+	  	"loadView" : {
+		  "code": "",
+		  "html": ""
+		},
+		"select": {
+		  "code": "",
+		  "html": ""
+		},
+		"openDocument": {
+		  "code": "",
+		  "html": ""
+		},
+		"click": {
+			"code": "",
+			"html": ""
+		},
+		"dblclick": {
+			"code": "",
+			"html": ""
+		},
+		"keydown": {
+			"code": "",
+			"html": ""
+		},
+		"keypress": {
+			"code": "",
+			"html": ""
+		},
+		"keyup": {
+			"code": "",
+			"html": ""
+		},
+		"mousedown": {
+			"code": "",
+			"html": ""
+		},
+		"mousemove": {
+			"code": "",
+			"html": ""
+		},
+		"mouseout": {
+			"code": "",
+			"html": ""
+		},
+		"mouseover": {
+			"code": "",
+			"html": ""
+		},
+		"mouseup": {
+			"code": "",
+			"html": ""
+		},
+		"focus": {
+			"code": "",
+			"html": ""
+		},
+		"blur": {
+			"code": "",
+			"html": ""
+		}
+	},
+	"properties": {},
+	"class": "",
+	"styles": {},
+    "titleStyles":{},
+    "itemStyles": {},
+	"container": ""
+}

+ 12 - 0
o2web/source/x_component_portal_PageDesigner/Script.js

@@ -158,6 +158,10 @@ MWF.xApplication.portal.PageDesigner.Script = new Class({
                 this.loadSubformScript(v); break;
             case "ViewSelector":
                 this.loadViewSelectorScript(v); break;
+            case "Statement":
+                this.loadStatementScript(v); break;
+            case "StatementSelector":
+                this.loadStatementSelectorScript(v); break;
         }
         this.bindDataId(v);
     },
@@ -421,6 +425,14 @@ MWF.xApplication.portal.PageDesigner.Script = new Class({
         this.loadEventsScript(data);
     },
 
+    loadStatementScript: function(data){
+        this.loadEventsScript(data);
+    },
+    loadStatementSelectorScript: function(data){
+        this.addScriptItem(data.selectedScript, "code", data, "selectedScript");
+        this.loadEventsScript(data);
+    },
+
 
     loadEventsScript: function(data){
         Object.each(data.events, function(event, key){

BIN
o2web/source/x_component_process_FormDesigner/$Main/bottom/icon/statement.png


BIN
o2web/source/x_component_process_FormDesigner/$Main/bottom/icon/statementSelector.png


+ 10 - 0
o2web/source/x_component_process_FormDesigner/$Main/bottom/tools.json

@@ -174,5 +174,15 @@
     "icon": "office.png",
     "text": "Office控件",
     "className": "Office"
+  },
+  "statementSelector": {
+    "icon": "statementSelector.png",
+    "text": "选择查询视图",
+    "className": "StatementSelector"
+  },
+  "statement": {
+    "icon": "statement.png",
+    "text": "嵌入查询视图",
+    "className": "Statement"
   }
 }

BIN
o2web/source/x_component_process_FormDesigner/$Main/default/icon/statement.png


BIN
o2web/source/x_component_process_FormDesigner/$Main/default/icon/statementSelector.png


+ 10 - 0
o2web/source/x_component_process_FormDesigner/$Main/default/tools.json

@@ -191,5 +191,15 @@
     "icon": "office.png",
     "text": "Office控件",
     "className": "Office"
+  },
+  "statementSelector": {
+    "icon": "statementSelector.png",
+    "text": "选择查询视图",
+    "className": "StatementSelector"
+  },
+  "statement": {
+    "icon": "statement.png",
+    "text": "嵌入查询视图",
+    "className": "Statement"
   }
 }

+ 2 - 0
o2web/source/x_component_process_FormDesigner/Module/Package.js

@@ -41,3 +41,5 @@ MWF.xDesktop.requireApp("process.FormDesigner", "Module.Attachment", null, false
 MWF.xDesktop.requireApp("process.FormDesigner", "Module.Orgfield", null, false);
 MWF.xDesktop.requireApp("process.FormDesigner", "Module.Org", null, false);
 MWF.xDesktop.requireApp("process.FormDesigner", "Module.Opinion", null, false);
+MWF.xDesktop.requireApp("process.FormDesigner", "Module.Statement", null, false);
+MWF.xDesktop.requireApp("process.FormDesigner", "Module.StatementSelector", null, false);

+ 161 - 0
o2web/source/x_component_process_FormDesigner/Module/Statement.js

@@ -0,0 +1,161 @@
+MWF.xApplication.process.FormDesigner.Module = MWF.xApplication.process.FormDesigner.Module || {};
+MWF.xDesktop.requireApp("process.FormDesigner", "Module.View", null, false);
+MWF.xApplication.process.FormDesigner.Module.Statement = MWF.FCStatement = new Class({
+	Extends: MWF.FCView,
+	options: {
+		"style": "default",
+		"propertyPath": "../x_component_process_FormDesigner/Module/Statement/statement.html"
+	},
+	
+	initialize: function(form, options){
+		this.setOptions(options);
+		
+		this.path = "../x_component_process_FormDesigner/Module/Statement/";
+		this.cssPath = "../x_component_process_FormDesigner/Module/Statement/"+this.options.style+"/css.wcss";
+
+        this.imagePath_default = "../x_component_query_ViewDesigner/$Statement/";
+        this.imagePath_custom = "../x_component_process_FormDesigner/Module/Actionbar/";
+
+		this._loadCss();
+		this.moduleType = "element";
+		this.moduleName = "statement";
+
+		this.form = form;
+		this.container = null;
+		this.containerNode = null;
+	},
+	_createMoveNode: function(){
+		this.moveNode = new Element("div", {
+			"MWFType": "statement",
+			"id": this.json.id,
+			"styles": this.css.moduleNodeMove,
+			"events": {
+				"selectstart": function(){
+					return false;
+				}
+			}
+		}).inject(this.form.container);
+	},
+	_createNode: function(){
+		this.node = this.moveNode.clone(true, true);
+		this.node.setStyles(this.css.moduleNode);
+		this.node.set("id", this.json.id);
+		this.node.addEvent("selectstart", function(){
+			return false;
+		});
+
+		this.iconNode = new Element("div", {
+			"styles": this.css.iconNode
+		}).inject(this.node);
+		new Element("div", {
+			"styles": this.css.iconNodeIcon
+		}).inject(this.iconNode);
+		new Element("div", {
+			"styles": this.css.iconNodeText,
+			"text": "Statement"
+		}).inject(this.iconNode);
+
+		this.iconNode.addEvent("click", function(){
+            this._checkView();
+        }.bind(this));
+	},
+    _createViewNode: function(callback){
+
+        if (!this.viewNode) this.viewNode = new Element("div", {"styles": this.css.viewNode}).inject(this.node);
+        if( !this.actionbarNode)this.actionbarNode = new Element("div.actionbarNode",{}).inject( this.viewNode, "top" );
+
+        this.node.setStyle("background", "transparent");
+
+
+        this.viewTable = new Element("table", {
+            "styles": this.css.viewTitleTableNode,
+            "border": "0px",
+            "cellPadding": "0",
+            "cellSpacing": "0"
+        }).inject(this.viewNode);
+        this.viewLine = new Element("tr", {"styles": this.css.viewTitleLineNode}).inject(this.viewTable);
+
+        if (this.json.select!="no"){
+            this.viewSelectCell = new Element("td", {
+                "styles": this.css.viewTitleCellNode
+            }).inject(this.viewLine);
+            this.viewSelectCell.setStyle("width", "10px");
+        }
+
+        MWF.Actions.get("x_query_assemble_designer").getStatement(this.json["queryStatement"].id, function(json){
+
+            var viewData = JSON.decode(json.data.view || "");
+            if( !viewData || !viewData.data ){
+                return;
+            }
+
+            this.viewData = viewData;
+            if( this.json.actionbar === "show" ){
+                this.actionbarList = [];
+                this._showActionbar();
+            }
+
+            var columnList = viewData.data ? (viewData.data.selectEntryList || viewData.data.selectList) : [];
+            columnList.each(function(column){
+                if (!column.hideColumn){
+                    var viewCell = new Element("td", {
+                        "styles": this.css.viewTitleCellNode,
+                        "text": column.displayName
+                    }).inject(this.viewLine);
+                }
+            }.bind(this));
+
+            if (callback) callback();
+        }.bind(this));
+        this._setViewNodeTitle();
+    },
+    _checkView: function(callback){
+        if (this.json["queryStatement"] && this.json["queryStatement"]!="none"){
+            this.iconNode.setStyle("display", "none");
+            if (this.viewNode) this.viewNode.destroy();
+            this.viewNode = null;
+            this._createViewNode(function(){
+                if (callback) callback();
+            }.bind(this));
+            if( this.property && this.property.viewFilter ){
+                this.property.viewFilter.resetStatementData( this.json["queryStatement"].id );
+            }
+        }else{
+            this.iconNode.setStyle("display", "block");
+            if (this.viewNode) this.viewNode.destroy();
+            this.node.setStyles(this.css.moduleNode);
+            if (callback) callback();
+            if( this.property && this.property.viewFilter ){
+                this.property.viewFilter.resetStatementData();
+            }
+        }
+    },
+    _setEditStyle: function(name, input, oldValue){
+        if (name=="queryStatement"){
+            if (this.json[name]!=oldValue) this._checkView();
+        }
+        if (name=="select") this._checkSelect();
+        if (name=="isTitle") this._checkTitle();
+        if (name=="titleStyles") this._setTitleStyles();
+
+        if (name=="name"){
+            var title = this.json.name || this.json.id;
+            var text = this.json.type.substr(this.json.type.lastIndexOf("$")+1, this.json.type.length);
+            this.treeNode.setText("<"+text+"> "+title);
+        }
+        if (name=="id"){
+            if (!this.json.name){
+                var text = this.json.type.substr(this.json.type.lastIndexOf("$")+1, this.json.type.length);
+                this.treeNode.setText("<"+text+"> "+this.json.id);
+            }
+            this.treeNode.setTitle(this.json.id);
+            this.node.set("id", this.json.id);
+        }
+        if(name=="actionbar"){
+            this.json.actionbar === "show" ? this._showActionbar() : this._hideActionbar();
+        }
+
+        this._setEditStyle_custom(name, input, oldValue);
+
+    }
+});

+ 91 - 0
o2web/source/x_component_process_FormDesigner/Module/Statement/default/css.wcss

@@ -0,0 +1,91 @@
+{
+	"moduleNodeMove": {
+		"border": "2px dashed #ffa200",
+		"height": "22px",
+		"line-height": "22px",
+		"overflow": "hidden",
+		"margin": "3px",
+		"display": "block",
+		"-webkit-user-select": "none",
+		"-moz-user-select": "none",
+		"position": "absolute",
+		"z-index": 10002,
+		"opacity": 0.7,
+		"width": "100px",
+		"cursor": "move",
+		"background-color": "#EEE"
+	},
+	"moduleNodeShow": {
+		"border": "1px dashed #333",
+		"height": "2px",
+		"cursor": "pointer",
+		"line-height": "22px",
+		"overflow": "hidden",
+		"margin": "3px",
+		"-webkit-user-select": "none",
+		"-moz-user-select": "none",
+		"position": "static",
+		"display": "block",
+		"top": "auto",
+		"left": "auto",
+		"width": "auto",
+		"opacity": 0.5,
+		"background": "#ffa200"
+	},
+	"moduleNode": {
+		"border": "1px dashed #333",
+		"height": "100px",
+		"cursor": "pointer",
+		"line-height": "22px",
+		"overflow": "hidden",
+		"margin": "3px",
+		"-webkit-user-select": "none",
+		"-moz-user-select": "none",
+		"position": "static",
+		"display": "block",
+		"top": "auto",
+		"left": "auto",
+		"width": "auto",
+		"opacity": 1,
+		"background": "transparent"
+	},
+	"iconNode": {
+		"width": "70px",
+		"height": "24px",
+		"color": "#999",
+		"font-size": "12px",
+		"position": "static",
+		"margin": "10px auto"
+	},
+	"iconNodeIcon":{
+		"width": "24px",
+		"height": "24px",
+		"background": "url("+"../x_component_process_FormDesigner/Module/Statement/default/icon/statement.png) 5px center no-repeat",
+		"float": "left"
+	},
+	"iconNodeText":{
+		"line-height": "24px",
+		"height": "24px",
+		"width": "44px",
+		"float": "right"
+	},
+	"viewNode": {
+	    "overflow": "hidden",
+        "height": "100%"
+	},
+	"viewTitleTableNode": {
+	    "width": "100%",
+	    "height": "30px",
+	    "background-color": "#EEE",
+	    "border": "1px solid #999"
+	},
+	"viewTitleLineNode": {
+	    "line-height": "30px"
+	},
+	"viewTitleCellNode": {
+	    "border-left": "1px solid #FFF",
+	    "border-right": "1px solid #999",
+	    "padding": "0px 10px"
+	}
+	
+}

BIN
o2web/source/x_component_process_FormDesigner/Module/Statement/default/icon/copy.png


BIN
o2web/source/x_component_process_FormDesigner/Module/Statement/default/icon/copy1.png


BIN
o2web/source/x_component_process_FormDesigner/Module/Statement/default/icon/delete.png


BIN
o2web/source/x_component_process_FormDesigner/Module/Statement/default/icon/delete1.png


BIN
o2web/source/x_component_process_FormDesigner/Module/Statement/default/icon/move.png


BIN
o2web/source/x_component_process_FormDesigner/Module/Statement/default/icon/move1.png


BIN
o2web/source/x_component_process_FormDesigner/Module/Statement/default/icon/multi.png


BIN
o2web/source/x_component_process_FormDesigner/Module/Statement/default/icon/single.png


BIN
o2web/source/x_component_process_FormDesigner/Module/Statement/default/icon/statement.png


+ 180 - 0
o2web/source/x_component_process_FormDesigner/Module/Statement/statement.html

@@ -0,0 +1,180 @@
+<div style="background-color: #FFF; overflow: hidden">
+	<div title="基本" class="MWFTab">
+		<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
+		  <tr>
+		    <td class="editTableTitle">标识:</td>
+		    <td class="editTableValue"><input type="text" name="id" value="text{$.id}" class="editTableInput"/></td>
+		  </tr>
+		  <tr>
+		    <td class="editTableTitle">名称:</td>
+		    <td class="editTableValue"><input type="text" name="name" value="text{$.name}" class="editTableInput"/></td>
+		  </tr>
+		  <tr>
+		    <td class="editTableTitle">描述:</td>
+		    <td class="editTableValue"><input type="text" name="description" value="text{$.description}" class="editTableInput"/></td>
+		  </tr>
+		  <tr>
+		    <td class="editTableTitle">Class:</td>
+		    <td class="editTableValue"><input type="text" name="description" value="text{$.description}" class="editTableInput"/></td>
+		  </tr>
+		</table>
+		
+		<div class="MWFMaplist" name="styles" title="样式"></div>
+		<div class="MWFMaplist" name="properties" title="属性"></div>
+
+        <div class="MWFMaplist" name="titleStyles" title="标题样式"></div>
+        <div class="MWFMaplist" name="itemStyles" title="数据样式"></div>
+
+	</div>
+
+	<div title="查询"  class="MWFTab">
+		<div>
+			<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
+				<tr>
+					<td class="editTableTitle">查询:</td>
+					<td class="editTableValue"><div class="MWFQueryStatementSelect" name="queryStatement"></div></td>
+				</tr>
+			</table>
+			<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
+				<tr>
+					<td class="editTableTitle">立即载入:</td>
+					<td class="editTableValue">
+						<input type="radio" name="loadView" value="yes" text{($.loadView!='no')?'checked':''}/>是
+						<input type="radio" name="loadView" value="no" text{($.loadView=='no')?'checked':''}/>否
+					</td>
+				</tr>
+			</table>
+		</div>
+
+
+		<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
+			<!--<tr>-->
+			<!--<td class="editTableTitle">视图:</td>-->
+			<!--<td class="editTableValue">-->
+			<!--<div class="MWFViewSelect" name="view"></div>-->
+			<!--</td>-->
+			<!--</tr>-->
+			<tr>
+				<td class="editTableTitle">显示标题</td>
+				<td class="editTableValue">
+					<input class="editTableRadio" name="isTitle" text{($.isTitle!='no')?'checked':''} type="radio" value="yes"/>显示
+					<input class="editTableRadio" name="isTitle" text{($.isTitle=='no')?'checked':''} type="radio" value="no"/>不显示
+				</td>
+			</tr>
+			<tr>
+				<td class="editTableTitle">选择文件</td>
+				<td class="editTableValue">
+					<select name="select">
+						<option text{($.select!='single' && $.select!='multi')?'selected':''} value="no">不允许</option>
+						<option text{($.select=='single')?'selected':''} value="single">单选</option>
+						<option text{($.select=='multi')?'selected':''} value="multi">多选</option>
+					</select>
+				</td>
+			</tr>
+			<tr>
+				<td class="editTableTitle">操作条</td>
+				<td class="editTableValue">
+					<input class="editTableRadio" name="actionbar" text{($.actionbar=='show')?'checked':''} type="radio" value="show"/>显示
+					<input class="editTableRadio" name="actionbar" text{($.actionbar!='show')?'checked':''} type="radio" value="hidden"/>不显示
+				</td>
+			</tr>
+		</table>
+
+		<div style="background-color: #eeeeee; border-top:1px solid #999999; height: 24px; line-height: 24px; text-align: center; cursor:pointer">过滤</div>
+		<div class="MWFStatementFilter">
+			<div class="inputAreaNode_vf">
+				<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable restrictViewFilterTable_vf" style="table-layout: fixed;">
+					<tr id="text{$.id}pathInputSelectTr">
+						<td class="editTableTitle">选择:</td>
+						<td class="editTableValue">
+							<select class="pathInputSelect_vf"></select>
+							<!--                            <div style="line-height: 20px;color:#999;">注:选择路径后,需在选择的值前面加上"表别名.",如:o.</div>-->
+						</td>
+					</tr>
+					<tr style="display:none">
+						<td class="editTableTitle">标题:</td>
+						<td class="editTableValue"><input type="text" class="editTableInput titleInput_vf"/></td>
+					</tr>
+					<tr>
+						<td class="editTableTitle">路径:</td>
+						<td class="editTableValue">
+							<input type="text" class="editTableInput pathInput_vf"/>
+							<div style="color: #999">注:路径的写法是"表别名.字段名",如:o.title</div>
+						</td>
+					</tr>
+					<tr>
+						<td class="editTableTitle">数据类型:</td>
+						<td class="editTableValue"><select class="datatypeInput_vf">
+							<option value="textValue" selected>文本</option>
+							<option value="numberValue">数字</option>
+							<option value="dateTimeValue">日期时间</option>
+							<option value="booleanValue">布尔</option>
+						</select></td>
+					</tr>
+					<tr style="display:none">
+						<td class="editTableTitle"></td>
+						<td class="editTableValue">
+							<input type="radio" class="restrictFilterInput_vf" value="restrict" name="text{$.id}viewFilterType" checked/>作为默认过滤条件<br>
+							<input type="radio" class="customFilterInput_vf" value="custom" name="text{$.id}viewFilterType"/>作为自定义过滤数据
+						</td>
+					</tr>
+				</table>
+				<table id="text{$.pid}viewFilterRestrict" width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
+					<tr style="display:none;">
+						<td class="editTableTitle">逻辑:</td>
+						<td class="editTableValue"><select class="logicInput_vf">
+							<option selected value="and">并且(and)</option>
+							<option value="or">或者(or)</option>
+						</select></td>
+					</tr>
+
+					<tr>
+						<td class="editTableTitle">比较:</td>
+						<td class="editTableValue"><select class="comparisonInput_vf">
+							<option value="equals" selected>等于(==)</option>
+							<option value="notEquals">不等于(!=)</option>
+							<option value="greaterThan">大于(>)</option>
+							<option value="greaterThanOrEqualTo">大于等于(>=)</option>
+							<option value="lessThan">小于(<)</option>
+							<option value="lessThanOrEqualTo">小于等于(<=)</option>
+							<option value="like">匹配(like)</option>
+							<option value="notLike">不匹配(not-like)</option>
+							<option value="range">范围(range)</option>
+						</select></td>
+					</tr>
+					<tr style="display:none">
+						<td class="editTableTitle">值:</td>
+						<td class="editTableValue">
+							<input type="text" class="editTableInput valueTextInput_vf" style="display: block"/>
+							<input type="number" class="editTableInput valueNumberInput_vf" style="display: none"/>
+							<input type="text" class="editTableInput valueDatetimeInput_vf" style="display: none" readonly/>
+							<input type="text" class="editTableInput valueDateInput_vf" style="display: none" readonly/>
+							<input type="text" class="editTableInput valueTimeInput_vf" style="display: none" readonly/>
+							<select class="valueBooleanInput_vf" style="display: none">
+								<option value="true" selected>是(True)</option>
+								<option value="false">否(False)</option>
+							</select>
+						</td>
+					</tr>
+				</table>
+				<div title="值" class="MWFFilterFormulaArea"></div>
+			</div>
+			<div class="actionAreaNode_vf"></div>
+			<div style="height: 20px; line-height: 20px; text-align:center; background-color: #eeeeee">默认过滤条件</div>
+			<div class="listAreaNode_vf" style="min-height: 56px; border-bottom:1px solid #CCCCCC; overflow: hidden;"></div>
+			<div style="display:none; height: 20px; line-height: 20px; text-align:center; background-color: #eeeeee">自定义过滤数据</div>
+			<div class="fieldListAreaNode_vf" style="display:none; min-height: 56px; border-bottom:1px solid #CCCCCC; overflow: hidden;"></div>
+		</div>
+		<div class="MWFScriptArea" name="defaultSelectedScript" title="默认选中行脚本"></div>
+	</div>
+
+	<div title="事件"  class="MWFTab">
+		<div class="MWFEventsArea" name="events"></div>
+	</div>
+	<div title="HTML"  class="MWFTab">
+		<div class="MWFHTMLArea" style="font-family: Verdana, Geneva, sans-serif; font-size:14px"></div>
+	</div>
+	<div title="JSON"  class="MWFTab">
+		<div class="MWFJSONArea" style="font-family: Verdana, Geneva, sans-serif; font-size:14px"></div>
+	</div>
+</div>

+ 90 - 0
o2web/source/x_component_process_FormDesigner/Module/Statement/template.json

@@ -0,0 +1,90 @@
+{
+	"id": "",
+	"name": "",
+	"type": "Statement",
+	"description": "",
+    "view": "",
+    "isTitle": "yes",
+    "select": "no",  //single, multi
+    "isOpen": "yes",
+	"events": {
+		"queryLoad": {
+		  "code": "",
+		  "html": ""
+		},
+		"postLoad": {
+		  "code": "",
+		  "html": ""
+		},
+		"load": {
+		  "code": "",
+		  "html": ""
+		},
+	  	"loadView" : {
+		  "code": "",
+		  "html": ""
+		},
+		"select": {
+		  "code": "",
+		  "html": ""
+		},
+		"openDocument": {
+		  "code": "",
+		  "html": ""
+		},
+		"click": {
+			"code": "",
+			"html": ""
+		},
+		"dblclick": {
+			"code": "",
+			"html": ""
+		},
+		"keydown": {
+			"code": "",
+			"html": ""
+		},
+		"keypress": {
+			"code": "",
+			"html": ""
+		},
+		"keyup": {
+			"code": "",
+			"html": ""
+		},
+		"mousedown": {
+			"code": "",
+			"html": ""
+		},
+		"mousemove": {
+			"code": "",
+			"html": ""
+		},
+		"mouseout": {
+			"code": "",
+			"html": ""
+		},
+		"mouseover": {
+			"code": "",
+			"html": ""
+		},
+		"mouseup": {
+			"code": "",
+			"html": ""
+		},
+		"focus": {
+			"code": "",
+			"html": ""
+		},
+		"blur": {
+			"code": "",
+			"html": ""
+		}
+	},
+	"properties": {},
+	"class": "",
+	"styles": {},
+    "titleStyles":{},
+    "itemStyles": {},
+	"container": ""
+}

+ 35 - 0
o2web/source/x_component_process_FormDesigner/Module/StatementSelector.js

@@ -0,0 +1,35 @@
+MWF.xApplication.process.FormDesigner.Module = MWF.xApplication.process.FormDesigner.Module || {};
+MWF.xDesktop.requireApp("process.FormDesigner", "Module.$Element", null, false);
+MWF.xApplication.process.FormDesigner.Module.StatementSelector = MWF.FCStatementSelector = new Class({
+	Extends: MWF.xApplication.process.FormDesigner.Module.Button,
+	Implements: [Options, Events],
+	options: {
+		"style": "default",
+		"propertyPath": "../x_component_process_FormDesigner/Module/StatementSelector/StatementSelector.html"
+	},
+	
+	initialize: function(form, options){
+		this.setOptions(options);
+		
+		this.path = "../x_component_process_FormDesigner/Module/StatementSelector/";
+		this.cssPath = "../x_component_process_FormDesigner/Module/StatementSelector/"+this.options.style+"/css.wcss";
+
+		this._loadCss();
+		this.moduleType = "element";
+		this.moduleName = "statementSelector";
+
+		this.form = form;
+		this.container = null;
+		this.containerNode = null;
+	},
+	_checkView: function(callback){
+		if( this.property && this.property.viewFilter ){
+			if (this.json["queryStatement"] && this.json["queryStatement"]!="none"){
+				this.property.viewFilter.resetStatementData( this.json["queryStatement"].id );
+			}else{
+				this.property.viewFilter.resetStatementData();
+			}
+		}
+	}
+
+});

+ 209 - 0
o2web/source/x_component_process_FormDesigner/Module/StatementSelector/StatementSelector.html

@@ -0,0 +1,209 @@
+<div style="background-color: #FFF; overflow: hidden">
+	<div title="基本" class="MWFTab">
+		<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
+		  <tr>
+		    <td class="editTableTitle">标识:</td>
+		    <td class="editTableValue"><input type="text" name="id" value="text{$.id}" class="editTableInput"/></td>
+		  </tr>
+		  <tr>
+		    <td class="editTableTitle">名称:</td>
+		    <td class="editTableValue"><input type="text" name="name" value="text{$.name}" class="editTableInput"/></td>
+		  </tr>
+		  <tr>
+		    <td class="editTableTitle">描述:</td>
+		    <td class="editTableValue"><input type="text" name="description" value="text{$.description}" class="editTableInput"/></td>
+		  </tr>
+		</table>
+		
+		<div class="MWFMaplist" name="styles" title="样式"></div>
+		<div class="MWFMaplist" name="properties" title="属性"></div>
+
+        <div style="background-color: #eeeeee; height: 24px; line-height: 24px; text-align: center;">查询选择框</div>
+        <div>
+            <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
+                <tr>
+                    <td class="editTableTitle">选择框标题:</td>
+                    <td class="editTableValue"><input type="text" name="title" value="text{$.title}" class="editTableInput"/></td>
+                </tr>
+                <tr>
+                    <td class="editTableTitle">列标题:</td>
+                    <td class="editTableValue">
+                        <input type="radio" name="isTitle" value="true" text{($.isTitle)?'checked':''}/>显示
+                        <input type="radio" name="isTitle" value="false" text{(!$.isTitle)?'checked':''}/>隐藏
+                    </td>
+                </tr>
+                <tr>
+                    <td class="editTableTitle">默认展开</td>
+                    <td class="editTableValue">
+                        <input class="editTableRadio" name="isExpand" text{($.isExpand=='yes')?'checked':''} type="radio" value="yes"/>展开
+                        <input class="editTableRadio" name="isExpand" text{($.isExpand!='yes')?'checked':''} type="radio" value="no"/>不展开
+                    </td>
+                </tr>
+                <tr>
+                    <td class="editTableTitle">选择:</td>
+                    <td class="editTableValue">
+                        <input type="radio" name="select" value="single" text{($.select!='multi')?'checked':''}/>单选
+                        <input type="radio" name="select" value="multi" text{($.select=='multi')?'checked':''}/>多选
+                    </td>
+                </tr>
+                <tr>
+                    <td class="editTableTitle">操作条</td>
+                    <td class="editTableValue">
+                        <input class="editTableRadio" name="actionbar" text{($.actionbar=='show')?'checked':''} type="radio" value="show"/>显示
+                        <input class="editTableRadio" name="actionbar" text{($.actionbar!='show')?'checked':''} type="radio" value="hidden"/>不显示
+                    </td>
+                </tr>
+                <!--<tr>-->
+                    <!--<td class="editTableTitle"></td>-->
+                    <!--<td class="editTableValue">-->
+                        <!--<input type="radio" onclick="if (this.checked) {$('text{$.id}processViewArea').setStyle('display', 'block'); $('text{$.id}cmsViewArea').setStyle('display', 'none');}" name="selectViewType" value="process" text{($.selectViewType!='cms')?'checked':''}/>流程视图-->
+                        <!--<input type="radio" onclick="if (this.checked) {$('text{$.id}processViewArea').setStyle('display', 'none'); $('text{$.id}cmsViewArea').setStyle('display', 'block');}" name="selectViewType" value="cms" text{($.selectViewType=='cms')?'checked':''}/>内容管理视图-->
+                    <!--</td>-->
+                <!--</tr>-->
+            </table>
+        </div>
+        <!--<div id="text{$.id}processViewArea" style="display: text{($.selectViewType!='cms')?'block':'none'};">-->
+            <!--<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">-->
+                <!--<tr>-->
+                    <!--<td class="editTableTitle">视图:</td>-->
+                    <!--<td class="editTableValue"><div class="MWFViewSelect" name="processViewName"></div></td>-->
+                <!--</tr>-->
+            <!--</table>-->
+        <!--</div>-->
+        <!--<div id="text{$.id}cmsViewArea" style="display: text{($.selectViewType=='cms')?'block':'none'};">-->
+            <!--<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">-->
+                <!--<tr>-->
+                    <!--<td class="editTableTitle">视图:</td>-->
+                    <!--<td class="editTableValue"><div class="MWFCMSViewSelect" name="cmsViewName"></div></td>-->
+                <!--</tr>-->
+            <!--</table>-->
+        <!--</div>-->
+        <div>
+            <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
+                <tr>
+                    <td class="editTableTitle">查询:</td>
+                    <td class="editTableValue"><div class="MWFQueryStatementSelect" name="queryStatement"></div></td>
+                </tr>
+            </table>
+        </div>
+
+        <div class="MWFMaplist" name="titleStyles" title="选择框标题样式"></div>
+        <div class="MWFMaplist" name="itemStyles" title="选择框条目样式"></div>
+
+        <div style="background-color: #eeeeee; height: 24px; line-height: 24px; text-align: center;">选择结果处理</div>
+        <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
+            <tr>
+                <td class="editTableTitle">处理方式:</td>
+                <td class="editTableValue">
+                    <input type="radio" onclick="if (this.checked){ $('text{$.pid}selectedSetValueArea').setStyle('display', 'block'); $('text{$.pid}selectedScriptArea').setStyle('display', 'none')}" name="result" value="setValue" text{($.result!='script')?'checked':''}/>赋值
+                    <input type="radio" onclick="if (this.checked){ $('text{$.pid}selectedSetValueArea').setStyle('display', 'none'); $('text{$.pid}selectedScriptArea').setStyle('display', 'block')}" name="result" value="script" text{($.result=='script')?'checked':''}/>脚本
+                </td>
+            </tr>
+        </table>
+
+        <div id="text{$.pid}selectedSetValueArea" style="display: text{($.result!='script')?'block':'none'};">
+            <div class="MWFMaplist" name="selectedSetValues" title="选择结果赋值"></div>
+        </div>
+        <div id="text{$.pid}selectedScriptArea" style="display: text{($.result=='script')?'block':'none'};">
+            <div class="MWFScriptArea" name="selectedScript" title="选择结果 (S)"></div>
+        </div>
+        <div class="MWFScriptArea" name="defaultSelectedScript" title="默认选中行脚本"></div>
+	</div>
+    <div title="过滤"  class="MWFTab">
+        <div class="MWFStatementFilter">
+            <div class="inputAreaNode_vf">
+                <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable restrictViewFilterTable_vf" style="table-layout: fixed;">
+                    <tr id="text{$.id}pathInputSelectTr">
+						<td class="editTableTitle">选择:</td>
+						<td class="editTableValue">
+							<select class="pathInputSelect_vf"></select>
+							<!--                            <div style="line-height: 20px;color:#999;">注:选择路径后,需在选择的值前面加上"表别名.",如:o.</div>-->
+						</td>
+					</tr>
+                    <tr style="display:none">
+                        <td class="editTableTitle">标题:</td>
+                        <td class="editTableValue"><input type="text" class="editTableInput titleInput_vf"/></td>
+                    </tr>
+                    <tr>
+                        <td class="editTableTitle">路径:</td>
+                        <td class="editTableValue">
+                            <input type="text" class="editTableInput pathInput_vf"/>
+							<div style="color: #999">注:路径的写法是"表别名.字段名",如:o.title</div>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class="editTableTitle">数据类型:</td>
+                        <td class="editTableValue"><select class="datatypeInput_vf">
+                            <option value="textValue" selected>文本</option>
+                            <option value="numberValue">数字</option>
+                            <option value="dateTimeValue">日期时间</option>
+                            <option value="booleanValue">布尔</option>
+                        </select></td>
+                    </tr>
+                    <tr style="display:none">
+                        <td class="editTableTitle"></td>
+                        <td class="editTableValue">
+                            <input type="radio" class="restrictFilterInput_vf" value="restrict" name="text{$.id}viewFilterType" checked/>作为默认过滤条件<br>
+                            <input type="radio" class="customFilterInput_vf" value="custom" name="text{$.id}viewFilterType"/>作为自定义过滤数据
+                        </td>
+                    </tr>
+                </table>
+                <table id="text{$.pid}viewFilterRestrict" width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
+                    <tr style="display:none;">
+                        <td class="editTableTitle">逻辑:</td>
+                        <td class="editTableValue"><select class="logicInput_vf">
+                            <option selected value="and">并且(and)</option>
+                            <option value="or">或者(or)</option>
+                        </select></td>
+                    </tr>
+
+                    <tr>
+                        <td class="editTableTitle">比较:</td>
+                        <td class="editTableValue"><select class="comparisonInput_vf">
+                            <option value="equals" selected>等于(==)</option>
+                            <option value="notEquals">不等于(!=)</option>
+                            <option value="greaterThan">大于(>)</option>
+                            <option value="greaterThanOrEqualTo">大于等于(>=)</option>
+                            <option value="lessThan">小于(<)</option>
+                            <option value="lessThanOrEqualTo">小于等于(<=)</option>
+                            <option value="like">匹配(like)</option>
+                            <option value="notLike">不匹配(not-like)</option>
+                            <option value="range">范围(range)</option>
+                        </select></td>
+                    </tr>
+                    <tr style="display:none">
+                        <td class="editTableTitle">值:</td>
+                        <td class="editTableValue">
+                            <input type="text" class="editTableInput valueTextInput_vf" style="display: block"/>
+                            <input type="number" class="editTableInput valueNumberInput_vf" style="display: none"/>
+                            <input type="text" class="editTableInput valueDatetimeInput_vf" style="display: none" readonly/>
+							<input type="text" class="editTableInput valueDateInput_vf" style="display: none" readonly/>
+							<input type="text" class="editTableInput valueTimeInput_vf" style="display: none" readonly/>
+                            <select class="valueBooleanInput_vf" style="display: none">
+                                <option value="true" selected>是(True)</option>
+                                <option value="false">否(False)</option>
+                            </select>
+                        </td>
+                    </tr>
+                </table>
+                <div title="值" class="MWFFilterFormulaArea"></div>
+            </div>
+            <div class="actionAreaNode_vf"></div>
+            <div style="height: 20px; line-height: 20px; text-align:center; background-color: #eeeeee">默认过滤条件</div>
+            <div class="listAreaNode_vf" style="min-height: 56px; border-bottom:1px solid #CCCCCC; overflow: hidden;"></div>
+            <div style="display:none; height: 20px; line-height: 20px; text-align:center; background-color: #eeeeee">自定义过滤数据</div>
+            <div class="fieldListAreaNode_vf" style="display:none; min-height: 56px; border-bottom:1px solid #CCCCCC; overflow: hidden;"></div>
+        </div>
+		<div class="MWFScriptArea" name="defaultSelectedScript" title="默认选中行脚本"></div>
+    </div>
+
+	<div title="事件"  class="MWFTab">
+		<div class="MWFEventsArea" name="events"></div>
+	</div>
+	<div title="HTML"  class="MWFTab">
+        <div class="MWFHTMLArea" style="font-family: Verdana, Geneva, sans-serif; font-size:14px"></div>
+	</div>
+    <div title="JSON"  class="MWFTab">
+        <div class="MWFJSONArea" style="font-family: Verdana, Geneva, sans-serif; font-size:14px"></div>
+    </div>
+</div>

+ 55 - 0
o2web/source/x_component_process_FormDesigner/Module/StatementSelector/default/css.wcss

@@ -0,0 +1,55 @@
+{
+	"moduleNodeMove": {
+		"border-radius": "5px",
+		"border": "1px solid #ffa200",
+		"overflow": "hidden",
+		"margin": "3px",
+		"-webkit-user-select": "none",
+		"-moz-user-select": "none",
+		"position": "absolute",
+		"z-index": 10002,
+		"opacity": 0.7,
+		"cursor": "move",
+		"height": "26px",
+		"display": "inline-block"
+	},
+	"moduleNodeShow": {
+		"border": "1px solid #333",
+		"margin": "3px",
+		"-webkit-user-select": "none",
+		"-moz-user-select": "none",
+		"position": "static",
+		"top": "auto",
+		"left": "auto",
+		"width": "18px",
+		"height": "2px",
+		"opacity": 0.5,
+		"display": "inline-block",
+		"background": "#ffa200"
+	},
+	"moduleNode": {
+		"border-radius": "5px",
+		"border-top": "1px solid #999",
+		"border-left": "1px solid #999",
+		"border-right": "1px solid #333",
+		"border-bottom": "1px solid #333",
+		"overflow": "hidden",
+		"cursor": "pointer",
+		"margin": "3px",
+		"-webkit-user-select": "none",
+		"-moz-user-select": "none",
+		"position": "static",
+		"top": "auto",
+		"left": "auto",
+		"opacity": 1,
+		"height": "26px",
+		"display": "inline-block"
+	},
+	"buttonIcon": {
+		"height": "26px",
+		"cursor": "pointer",
+		"border": "0px",
+		"margin": "0px"
+	}
+	
+}

BIN
o2web/source/x_component_process_FormDesigner/Module/StatementSelector/default/icon/buttonIcon.png


BIN
o2web/source/x_component_process_FormDesigner/Module/StatementSelector/default/icon/copy.png


BIN
o2web/source/x_component_process_FormDesigner/Module/StatementSelector/default/icon/copy1.png


BIN
o2web/source/x_component_process_FormDesigner/Module/StatementSelector/default/icon/delete.png


BIN
o2web/source/x_component_process_FormDesigner/Module/StatementSelector/default/icon/delete1.png


BIN
o2web/source/x_component_process_FormDesigner/Module/StatementSelector/default/icon/hand2.png


BIN
o2web/source/x_component_process_FormDesigner/Module/StatementSelector/default/icon/hand3.png


BIN
o2web/source/x_component_process_FormDesigner/Module/StatementSelector/default/icon/inputtext.png


BIN
o2web/source/x_component_process_FormDesigner/Module/StatementSelector/default/icon/move.png


BIN
o2web/source/x_component_process_FormDesigner/Module/StatementSelector/default/icon/move1.png


+ 85 - 0
o2web/source/x_component_process_FormDesigner/Module/StatementSelector/template.json

@@ -0,0 +1,85 @@
+{
+	"id": "",
+	"name": "",
+	"type": "StatementSelector",
+	"description": "",
+    "titleStyles": {},
+    "itemStyles": {},
+    "title": "选择",
+    "isTitle": true,
+    "select": "single", //"single", "multi"
+    "application": "",
+    "statementName": "",
+    "result": "setValue", //setValue., script
+    "selectedSetValues": {},
+    "selectedScript": {
+      "code": "",
+      "html": ""
+    },
+	"events": {
+		"queryLoad": {
+		  "code": "",
+		  "html": ""
+		},
+		"postLoad": {
+		  "code": "",
+		  "html": ""
+		},
+		"load": {
+		  "code": "",
+		  "html": ""
+		},
+		"click": {
+			"code": "",
+			"html": ""
+		},
+		"dblclick": {
+			"code": "",
+			"html": ""
+		},
+		"keydown": {
+			"code": "",
+			"html": ""
+		},
+		"keypress": {
+			"code": "",
+			"html": ""
+		},
+		"keyup": {
+			"code": "",
+			"html": ""
+		},
+		"mousedown": {
+			"code": "",
+			"html": ""
+		},
+		"mousemove": {
+			"code": "",
+			"html": ""
+		},
+		"mouseout": {
+			"code": "",
+			"html": ""
+		},
+		"mouseover": {
+			"code": "",
+			"html": ""
+		},
+		"mouseup": {
+			"code": "",
+			"html": ""
+		},
+		"focus": {
+			"code": "",
+			"html": ""
+		},
+		"blur": {
+			"code": "",
+			"html": ""
+		}
+	},
+	"properties": {},
+	"class": "",
+	"styles": {},
+	"container": ""
+}

+ 30 - 0
o2web/source/x_component_process_FormDesigner/Property.js

@@ -84,6 +84,7 @@ MWF.xApplication.process.FormDesigner.Property = MWF.FCProperty = new Class({
                     this.loadSourceTestRestful();
                     this.loadSidebarPosition();
                     this.loadViewFilter();
+                    this.loadStatementFilter();
                     this.loadDocumentTempleteSelect();
                     // this.loadScriptIncluder();
                     // this.loadDictionaryIncluder();
@@ -517,6 +518,25 @@ MWF.xApplication.process.FormDesigner.Property = MWF.FCProperty = new Class({
             }.bind(this));
         }
     },
+    loadStatementFilter: function(){
+	    debugger;
+        var nodes = this.propertyContent.getElements(".MWFStatementFilter");
+        var filtrData = this.data.filterList;
+        nodes.each(function(node){
+            MWF.xDesktop.requireApp("query.StatementDesigner", "widget.ViewFilter", function(){
+                var _slef = this;
+                this.viewFilter = new MWF.xApplication.query.StatementDesigner.widget.ViewFilter(node, this.form.designer, {"filtrData": filtrData, "customData": null}, {
+                    "statementId" : this.data.queryStatement ? this.data.queryStatement.id : "",
+                    "withForm" : true,
+                    "onChange": function(ids){
+                        var data = this.getData();
+                        _slef.changeJsonDate(["filterList"], data.data);
+                        //_slef.changeJsonDate(["data", "customFilterEntryList"], data.customData);
+                    }
+                });
+            }.bind(this));
+        }.bind(this));
+    },
     loadViewFilter: function(){
         var nodes = this.propertyContent.getElements(".MWFViewFilter");
         var filtrData = this.data.filterList;
@@ -1241,6 +1261,7 @@ debugger;
         var viewNodes = this.propertyContent.getElements(".MWFViewSelect");
         var cmsviewNodes = this.propertyContent.getElements(".MWFCMSViewSelect");
         var queryviewNodes = this.propertyContent.getElements(".MWFQueryViewSelect");
+        var queryStatementNodes = this.propertyContent.getElements(".MWFQueryStatementSelect");
         var querystatNodes = this.propertyContent.getElements(".MWFQueryStatSelect");
         var fileNodes = this.propertyContent.getElements(".MWFImageFileSelect");
         var processFileNodes = this.propertyContent.getElements(".MWFProcessImageFileSelect");
@@ -1307,6 +1328,15 @@ debugger;
                 });
             }.bind(this));
 
+            queryStatementNodes.each(function(node){
+                new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.form.designer, {
+                    "type": "QueryStatement",
+                    "count": 1,
+                    "names": [this.data[node.get("name")]],
+                    "onChange": function(ids){this.saveViewItem(node, ids);}.bind(this)
+                });
+            }.bind(this));
+
             querystatNodes.each(function(node){
                 new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.form.designer, {
                     "type": "QueryStat",

+ 1 - 1
o2web/source/x_component_process_FormDesigner/widget/ActionsEditor.js

@@ -197,7 +197,7 @@ MWF.xApplication.process.FormDesigner.widget.ActionsEditor.ButtonAction = new Cl
         this.loadNode();
 
         var form = this.editor.designer.form || this.editor.designer.page || this.editor.designer.view;
-        if (form.scriptDesigner){
+        if (form && form.scriptDesigner){
             this.scriptItem = form.scriptDesigner.addScriptItem(this.data, "actionScript", this.editor.module, "action.tools", this.data.text);
         }
 

+ 43 - 39
o2web/source/x_component_process_ProcessDesigner/widget/PersonSelector.js

@@ -76,28 +76,30 @@ MWF.xApplication.process.ProcessDesigner.widget.PersonSelector = new Class({
                     if (name){
                         var data = (typeOf(name)==="string") ? {"name": name, "id": name}: name;
                         MWF.require("MWF.widget.O2Identity", function(){
-                            if (this.options.type.toLowerCase()==="identity") this.identitys.push(new MWF.widget.O2Identity(data, this.node));
-                            if (this.options.type.toLowerCase()==="unit") this.identitys.push(new MWF.widget.O2Unit(data, this.node));
-                            if (this.options.type.toLowerCase()==="group") this.identitys.push(new MWF.widget.O2Group(data, this.node));
-                            if (this.options.type.toLowerCase()==="person") this.identitys.push(new MWF.widget.O2Person(data, this.node));
+                            var type = this.options.type.toLowerCase();
+                            if (type==="identity") this.identitys.push(new MWF.widget.O2Identity(data, this.node));
+                            if (type==="unit") this.identitys.push(new MWF.widget.O2Unit(data, this.node));
+                            if (type==="group") this.identitys.push(new MWF.widget.O2Group(data, this.node));
+                            if (type==="person") this.identitys.push(new MWF.widget.O2Person(data, this.node));
 
-                            if (this.options.type.toLowerCase()==="application") this.identitys.push(new MWF.widget.O2Application(data, this.node));
-                            if (this.options.type.toLowerCase()==="process") this.identitys.push(new MWF.widget.O2Process(data, this.node));
-                            if (this.options.type.toLowerCase()==="formfield") this.identitys.push(new MWF.widget.O2FormField(data, this.node));
-                            if (this.options.type.toLowerCase()==="view") this.identitys.push(new MWF.widget.O2View(data, this.node));
-                            if (this.options.type.toLowerCase()==="cmsview") this.identitys.push(new MWF.widget.O2CMSView(data, this.node));
-                            if (this.options.type.toLowerCase()==="queryview") this.identitys.push(new MWF.widget.O2QueryView(data, this.node));
-                            if (this.options.type.toLowerCase()==="querystat") this.identitys.push(new MWF.widget.O2QueryStat(data, this.node));
-                            if (this.options.type.toLowerCase()==="dutyname") this.identitys.push(new MWF.widget.O2Duty(data, this.node));
-                            if (this.options.type.toLowerCase()==="cmsapplication") this.identitys.push(new MWF.widget.O2CMSApplication(data, this.node));
-                            if (this.options.type.toLowerCase()==="cmscategory") this.identitys.push(new MWF.widget.O2CMSCategory(data, this.node));
+                            if (type==="application") this.identitys.push(new MWF.widget.O2Application(data, this.node));
+                            if (type==="process") this.identitys.push(new MWF.widget.O2Process(data, this.node));
+                            if (type==="formfield") this.identitys.push(new MWF.widget.O2FormField(data, this.node));
+                            if (type==="view") this.identitys.push(new MWF.widget.O2View(data, this.node));
+                            if (type==="cmsview") this.identitys.push(new MWF.widget.O2CMSView(data, this.node));
+                            if (type==="queryview") this.identitys.push(new MWF.widget.O2QueryView(data, this.node));
+                            if (type==="querystatement") this.identitys.push(new MWF.widget.O2QueryStatement(data, this.node));
+                            if (type==="querystat") this.identitys.push(new MWF.widget.O2QueryStat(data, this.node));
+                            if (type==="dutyname") this.identitys.push(new MWF.widget.O2Duty(data, this.node));
+                            if (type==="cmsapplication") this.identitys.push(new MWF.widget.O2CMSApplication(data, this.node));
+                            if (type==="cmscategory") this.identitys.push(new MWF.widget.O2CMSCategory(data, this.node));
 
-                            if (this.options.type.toLowerCase()==="portalfile") this.identitys.push(new MWF.widget.O2File(data, this.node));
-                            if (this.options.type.toLowerCase()==="processfile") this.identitys.push(new MWF.widget.O2File(data, this.node));
+                            if (type==="portalfile") this.identitys.push(new MWF.widget.O2File(data, this.node));
+                            if (type==="processfile") this.identitys.push(new MWF.widget.O2File(data, this.node));
 
-                            if (this.options.type.toLowerCase()==="dictionary") this.identitys.push(new MWF.widget.O2Dictionary(data, this.node));
-                            if (this.options.type.toLowerCase()==="script") this.identitys.push(new MWF.widget.O2Script(data, this.node));
-                            if (this.options.type.toLowerCase()==="formstyle") this.identitys.push(new MWF.widget.O2FormStyle(data, this.node));
+                            if (type==="dictionary") this.identitys.push(new MWF.widget.O2Dictionary(data, this.node));
+                            if (type==="script") this.identitys.push(new MWF.widget.O2Script(data, this.node));
+                            if (type==="formstyle") this.identitys.push(new MWF.widget.O2FormStyle(data, this.node));
                         }.bind(this));
                     }
                 }.bind(this));
@@ -141,32 +143,34 @@ MWF.xApplication.process.ProcessDesigner.widget.PersonSelector = new Class({
                     }
                     this.identitys = [];
                     if (this.options.type.toLowerCase()!=="duty") this.node.empty();
+                    var type = this.options.type.toLowerCase();
                     MWF.require("MWF.widget.O2Identity", function(){
                         items.each(function(item){
-                            if (this.options.type.toLowerCase()==="identity") this.identitys.push(new MWF.widget.O2Identity(item.data, this.node));
-                            if (this.options.type.toLowerCase()==="person") this.identitys.push(new MWF.widget.O2Person(item.data, this.node));
-                            if (this.options.type.toLowerCase()==="unit") this.identitys.push(new MWF.widget.O2Unit(item.data, this.node));
-                            if (this.options.type.toLowerCase()==="group") this.identitys.push(new MWF.widget.O2Group(item.data, this.node));
+                            if (type==="identity") this.identitys.push(new MWF.widget.O2Identity(item.data, this.node));
+                            if (type==="person") this.identitys.push(new MWF.widget.O2Person(item.data, this.node));
+                            if (type==="unit") this.identitys.push(new MWF.widget.O2Unit(item.data, this.node));
+                            if (type==="group") this.identitys.push(new MWF.widget.O2Group(item.data, this.node));
 
-                            if (this.options.type.toLowerCase()==="application") this.identitys.push(new MWF.widget.O2Application(item.data, this.node));
-                            if (this.options.type.toLowerCase()==="process") this.identitys.push(new MWF.widget.O2Process(item.data, this.node));
-                            if (this.options.type.toLowerCase()==="cmsapplication") this.identitys.push(new MWF.widget.O2CMSApplication(item.data, this.node));
-                            if (this.options.type.toLowerCase()==="cmscategory") this.identitys.push(new MWF.widget.O2CMSCategory(item.data, this.node));
+                            if (type==="application") this.identitys.push(new MWF.widget.O2Application(item.data, this.node));
+                            if (type==="process") this.identitys.push(new MWF.widget.O2Process(item.data, this.node));
+                            if (type==="cmsapplication") this.identitys.push(new MWF.widget.O2CMSApplication(item.data, this.node));
+                            if (type==="cmscategory") this.identitys.push(new MWF.widget.O2CMSCategory(item.data, this.node));
 
-                            if (this.options.type.toLowerCase()==="formfield") this.identitys.push(new MWF.widget.O2FormField(item.data, this.node));
-                            if (this.options.type.toLowerCase()==="view") this.identitys.push(new MWF.widget.O2View(item.data, this.node));
-                            if (this.options.type.toLowerCase()==="cmsview") this.identitys.push(new MWF.widget.O2CMSView(item.data, this.node));
-                            if (this.options.type.toLowerCase()==="queryview") this.identitys.push(new MWF.widget.O2QueryView(item.data, this.node));
-                            if (this.options.type.toLowerCase()==="querystat") this.identitys.push(new MWF.widget.O2QueryStat(item.data, this.node));
-                            if (this.options.type.toLowerCase()==="dutyname") this.identitys.push(new MWF.widget.O2Duty(item.data, this.node));
-                            if (this.options.type.toLowerCase()==="portalfile") this.identitys.push(new MWF.widget.O2File(item.data, this.node));
-                            if (this.options.type.toLowerCase()==="processfile") this.identitys.push(new MWF.widget.O2File(item.data, this.node));
+                            if (type==="formfield") this.identitys.push(new MWF.widget.O2FormField(item.data, this.node));
+                            if (type==="view") this.identitys.push(new MWF.widget.O2View(item.data, this.node));
+                            if (type==="cmsview") this.identitys.push(new MWF.widget.O2CMSView(item.data, this.node));
+                            if (type==="queryview") this.identitys.push(new MWF.widget.O2QueryView(item.data, this.node));
+                            if (type==="querystatement") this.identitys.push(new MWF.widget.O2QueryStatement(item.data, this.node));
+                            if (type==="querystat") this.identitys.push(new MWF.widget.O2QueryStat(item.data, this.node));
+                            if (type==="dutyname") this.identitys.push(new MWF.widget.O2Duty(item.data, this.node));
+                            if (type==="portalfile") this.identitys.push(new MWF.widget.O2File(item.data, this.node));
+                            if (type==="processfile") this.identitys.push(new MWF.widget.O2File(item.data, this.node));
 
-                            if (this.options.type.toLowerCase()==="dictionary") this.identitys.push(new MWF.widget.O2Dictionary(item.data, this.node));
-                            if (this.options.type.toLowerCase()==="script") this.identitys.push(new MWF.widget.O2Script(item.data, this.node));
-                            if (this.options.type.toLowerCase()==="formstyle") this.identitys.push(new MWF.widget.O2FormStyle(item.data, this.node));
+                            if (type==="dictionary") this.identitys.push(new MWF.widget.O2Dictionary(item.data, this.node));
+                            if (type==="script") this.identitys.push(new MWF.widget.O2Script(item.data, this.node));
+                            if (type==="formstyle") this.identitys.push(new MWF.widget.O2FormStyle(item.data, this.node));
                         }.bind(this));
-                        if (this.options.type.toLowerCase()==="duty") {
+                        if (type==="duty") {
                             items.each(function(item){
                                 new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector.DutyInput(this, item.data, this.node, 20000);
                             }.bind(this));

+ 2 - 0
o2web/source/x_component_process_Xform/Package.js

@@ -46,6 +46,8 @@ MWF.xApplication.process.Xform.require = function(callback){
         ["process.Xform", "Common"],
         ["process.Xform", "Image"],
         ["process.Xform", "Html"],
+        ["process.Xform", "Statement"],
+        ["process.Xform", "StatementSelector"],
     ];
     MWF.xDesktop.requireApp(modules, null, function(){
         if (callback) callback();

+ 95 - 0
o2web/source/x_component_process_Xform/Statement.js

@@ -0,0 +1,95 @@
+MWF.xDesktop.requireApp("process.Xform", "$Module", null, false);
+//MWF.xDesktop.requireApp("process.Xform", "widget.View", null, false);
+MWF.xApplication.process.Xform.Statement = MWF.APPStatement =  new Class({
+	Extends: MWF.APP$Module,
+    options: {
+        "moduleEvents": ["load", "loadView", "queryLoad", "postLoad", "select", "openDocument"]
+    },
+
+    _loadUserInterface: function(){
+        MWF.xDesktop.requireApp("query.Query", "Statement", null, false);
+        this.node.empty();
+    },
+    _afterLoaded: function(){
+        if (this.json.queryStatement){
+            this.loadView();
+        }
+    },
+    reload: function(){
+        if (this.view){
+            if (this.view.loadViewRes) if (this.view.loadViewRes.isRunning()) this.view.loadViewRes.cancel();
+            if (this.view.getViewRes) if (this.view.getViewRes.isRunning()) this.view.getViewRes.cancel();
+        }
+        this.node.empty();
+        this.loadView();
+    },
+    active: function(){
+        if (this.view){
+            if (!this.view.loadingAreaNode) this.view.loadView();
+        }else{
+            this.loadView();
+        }
+    },
+    loadView: function(){
+        if (!this.json.queryStatement) return "";
+        var filter = null;
+        if (this.json.filterList && this.json.filterList.length){
+            filter = [];
+            this.json.filterList.each(function(entry){
+                entry.value = this.form.Macro.exec(entry.code.code, this);
+                //delete entry.code;
+                filter.push(entry);
+            }.bind(this));
+        }
+
+        debugger;
+
+        //var data = JSON.parse(this.json.data);
+        var viewJson = {
+            "application": (this.json.queryStatement) ? this.json.queryStatement.appName : this.json.application,
+            "statementName": (this.json.queryStatement) ? this.json.queryStatement.name : this.json.statementName,
+            "statementId": (this.json.queryStatement) ? this.json.queryStatement.id : this.json.statementId,
+            "isTitle": this.json.isTitle || "yes",
+            "select": this.json.select || "none",
+            "titleStyles": this.json.titleStyles,
+            "itemStyles": this.json.itemStyles,
+            "isExpand": this.json.isExpand || "no",
+            "showActionbar" : this.json.actionbar === "show",
+            "filter": filter,
+            "defaultSelectedScript" : this.json.defaultSelectedScript ? this.json.defaultSelectedScript.code : null
+        };
+
+        //MWF.xDesktop.requireApp("query.Query", "Viewer", function(){
+            this.view = new MWF.xApplication.query.Query.Statement(this.node, viewJson, {
+                "isload": (this.json.loadView!=="no"),
+                "resizeNode": (this.node.getStyle("height").toString().toLowerCase()!=="auto" && this.node.getStyle("height").toInt()>0),
+                "onLoadView": function(){
+                    this.fireEvent("loadView");
+                }.bind(this),
+                "onSelect": function(){
+                    this.fireEvent("select");
+                }.bind(this),
+                "onOpenDocument": function(options, item){
+                    this.openOptions = {
+                        "options": options,
+                        "item": item
+                    };
+                    this.fireEvent("openDocument");
+                    this.openOptions = null;
+                }.bind(this)
+            }, this.form.app, this.form.Macro);
+        //}.bind(this));
+    },
+
+    getData: function(){
+        if (this.view.selectedItems.length){
+            var arr = [];
+            this.view.selectedItems.each(function(item){
+                arr.push(item.data);
+            });
+            return arr;
+        }else{
+            return [];
+        }
+    }
+});

+ 163 - 0
o2web/source/x_component_process_Xform/StatementSelector.js

@@ -0,0 +1,163 @@
+MWF.xDesktop.requireApp("process.Xform", "$Module", null, false);
+MWF.xDesktop.requireApp("process.Xform", "ViewSelector", null, false);
+MWF.xApplication.process.Xform.StatementSelector = MWF.APPStatementSelector =  new Class({
+	Implements: [Events],
+	Extends: MWF.xApplication.process.Xform.ViewSelector,
+    selectView: function(callback){
+        var viewData = this.json.queryStatement;
+
+        if (viewData){
+            var filter = null;
+            if (this.json.filterList && this.json.filterList.length){
+                filter = [];
+                this.json.filterList.each(function(entry){
+                    entry.value = this.form.Macro.exec(entry.code.code, this);
+                    //delete entry.code;
+                    filter.push(entry);
+                }.bind(this));
+            }
+
+            var viewJson = {
+                "application": viewData.appName,
+                "statementName": viewData.name,
+                "statementId": viewData.id,
+                "isTitle": this.json.isTitle || "yes",
+                "select": this.json.select || "single",
+                "titleStyles": this.json.titleStyles,
+                "itemStyles": this.json.itemStyles,
+                "isExpand": this.json.isExpand || "no",
+                "showActionbar" : this.json.actionbar === "show",
+                "filter": filter,
+                "defaultSelectedScript" : this.json.defaultSelectedScript ? this.json.defaultSelectedScript.code : null
+            };
+            var options = {};
+            var width = options.width || "850";
+            var height = options.height || "700";
+
+            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 = this.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": this.json.title || "select view",
+                    "style": options.style || "view",
+                    "top": y,
+                    "left": x-20,
+                    "fromTop":y,
+                    "fromLeft": x-20,
+                    "width": width,
+                    "height": height,
+                    "html": "",
+                    "maskNode": layout.mobile?$(document.body) : this.form.app.content,
+                    "container": layout.mobile?$(document.body) : this.form.app.content,
+                    "buttonList": [
+                        {
+                            "text": MWF.LP.process.button.ok,
+                            "action": function(){
+                                //if (callback) callback(_self.view.selectedItems);
+                                debugger;
+                                if (callback) callback(_self.view.getData());
+                                this.close();
+                            }
+                        },
+                        {
+                            "text": MWF.LP.process.button.cancel,
+                            "action": function(){this.close();}
+                        }
+                    ],
+                    "onPostShow": function(){
+                        if(layout.mobile){
+                            dlg.node.setStyle("z-index",200);
+                        }
+                        MWF.xDesktop.requireApp("query.Query", "Statement", function(){
+                            this.view = new MWF.xApplication.query.Query.Statement(dlg.content, viewJson, {"style": "select"}, this.form.app, this.form.Macro );
+                        }.bind(this));
+                    }.bind(this)
+                });
+                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.view.getData());
+                        dlg.close();
+                    }.bind(this));
+                }
+
+                // MWF.xDesktop.requireApp("process.Xform", "widget.View", function(){
+                //     this.view = new MWF.xApplication.process.Xform.widget.View(dlg.content.getFirst(), viewJson, {"style": "select"});
+                // }.bind(this));
+                // MWF.xDesktop.requireApp("query.Query", "Viewer", function(){
+                //     this.view = new MWF.xApplication.query.Query.Viewer(dlg.content, viewJson, {"style": "select"});
+                // }.bind(this));
+            }.bind(this));
+        }
+    },
+    doResult: function(data){
+        if (this.json.result === "script"){
+            this.selectedData = data;
+            return (this.json.selectedScript.code) ? this.form.Macro.exec(this.json.selectedScript.code, this) : "";
+        }else{
+            Object.each(this.json.selectedSetValues, function(v, k){
+                var value = "";
+                data.each(function(d, idx){
+                    // Object.each(d, function(dv, dk){
+                    //     if (dk===v) value = (value) ? (value+", "+dv) : dv;
+                    // }.bind(this));
+
+                    var pathList = v.split(".");
+                    for( var i=0; i<pathList.length; i++ ){
+                        var p = pathList[i];
+                        if( (/(^[1-9]\d*$)/.test(p)) )p = p.toInt();
+                        if( d[ p ] ){
+                            d = d[ p ];
+                        }else{
+                            d = "";
+                            break;
+                        }
+                    }
+
+                    if( typeOf(d) === "array" || typeOf(d) === "object" ) {
+                        d = JSON.stringify(d);
+                    }
+
+                    value = (value) ? (value+", "+d) : d;
+
+                }.bind(this));
+
+                var field = this.form.all[k];
+                if (field){
+                    field.setData(value);
+                    if (value){
+                        if (field.descriptionNode) field.descriptionNode.setStyle("display", "none");
+                    }else{
+                        if (field.descriptionNode) field.descriptionNode.setStyle("display", "block");
+                    }
+                }
+            }.bind(this));
+        }
+    },
+	
+}); 

+ 15 - 0
o2web/source/x_component_query_Query/$Main/default/css.wcss

@@ -52,6 +52,21 @@
         "color": "#333333",
         "line-height": "40px"
     },
+    "naviStatementTitleNode": {
+        "height": "40px",
+        "line-height": "40px",
+        "padding-left": "65px",
+        "font-size": "16px",
+        "color": "#333333",
+        "background": "url('../x_component_query_Query/$Main/default/icon/statement.png') 38px center no-repeat"
+    },
+    "naviStatementContentNode": {
+        "min-height": "40px",
+        "overflow": "hidden",
+        "font-size": "14px",
+        "color": "#333333",
+        "line-height": "40px"
+    },
     "naviIconTitleNode": {
         "width": "82px",
         "height": "100px",

BIN
o2web/source/x_component_query_Query/$Main/default/icon/statement.png


+ 41 - 0
o2web/source/x_component_query_Query/Main.js

@@ -79,6 +79,10 @@ MWF.xApplication.query.Query.Main = new Class({
         this.naviViewContentNode = new Element("div", {"styles": this.css.naviViewContentNode}).inject(this.naviContentNode);
         this.naviStatTitleNode = new Element("div", {"styles": this.css.naviStatTitleNode, "text": this.lp.stat}).inject(this.naviContentNode);
         this.naviStatContentNode = new Element("div", {"styles": this.css.naviStatContentNode}).inject(this.naviContentNode);
+
+        this.naviStatementTitleNode = new Element("div", {"styles": this.css.naviStatementTitleNode, "text": this.lp.statement}).inject(this.naviContentNode);
+        this.naviStatementContentNode = new Element("div", {"styles": this.css.naviStatementContentNode}).inject(this.naviContentNode);
+
         this.setContentHeightFun = this.setContentHeight.bind(this);
         this.addEvent("resize", this.setContentHeightFun);
         this.setContentHeightFun();
@@ -127,6 +131,21 @@ MWF.xApplication.query.Query.Main = new Class({
                 }.bind(this));
             }
         }.bind(this));
+        MWF.Actions.load("x_query_assemble_surface").StatementAction.listWithQuery(this.options.id, {
+            "justSelect" : true,
+            "hasView" : true
+        }, function(json){
+            //this.action.listStat(this.options.id, function(json){
+            if (json.data){
+                json.data.each(function(statement){
+                    debugger;
+                    var item = this.createStatementNaviItem(statement);
+                    if( statement.id === this.options.statementId ){
+                        item.selected()
+                    }
+                }.bind(this));
+            }
+        }.bind(this));
     },
     createViewNaviItem: function(view){
         var item = new MWF.xApplication.query.Query.ViewItem(view, this);
@@ -136,6 +155,10 @@ MWF.xApplication.query.Query.Main = new Class({
         var item = new MWF.xApplication.query.Query.StatItem(stat, this);
         return item;
     },
+    createStatementNaviItem: function(statement){
+        var item = new MWF.xApplication.query.Query.StatementItem(statement, this);
+        return item;
+    },
 
 
     recordStatus: function(){
@@ -219,4 +242,22 @@ MWF.xApplication.query.Query.StatItem = new Class({
             });
         }.bind(this));
     }
+});
+
+MWF.xApplication.query.Query.StatementItem = new Class({
+    Extends: MWF.xApplication.query.Query.ViewItem,
+    getContentNode: function(){
+        return this.app.naviStatementContentNode;
+    },
+    loadView: function(){
+        MWF.xDesktop.requireApp("query.Query", "Statement",function(){
+            this.viewContent.empty();
+            debugger;
+            this.viewer = new MWF.QStatement( this.viewContent, {
+                "application": this.view.query,
+                "statementName": this.view.name,
+                "statementId" : this.view.id
+            },{}, this.app);
+        }.bind(this));
+    }
 });

+ 711 - 0
o2web/source/x_component_query_Query/Statement.js

@@ -0,0 +1,711 @@
+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);
+
+        debugger;
+        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.parameter = {};
+
+        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);
+            this.statementJson = this.json;
+            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(){
+    //     var i = this.count/this.json.pageSize;
+    //     this.pages = (i.toInt()<i) ? i.toInt()+1 : i;
+    //     this.currentPage = this.options.defaultPage || 1;
+    //     this.options.defaultPage = null;
+    // },
+    lookup: function(data, callback){
+        if( this.lookuping )return;
+        this.lookuping = true;
+        // this.getLookupAction(function(){
+        //     if (this.json.application){
+
+        var d = data || {};
+        // d.count = this.json.count;
+        // this.lookupAction.bundleView(this.json.id, d, function(json){
+        //     this.bundleItems = json.data.valueList;
+
+        // this._initPage();
+
+        debugger;
+        this.loadParameter( d );
+        this.loadFilter( d );
+
+        this.currentPage = this.options.defaultPage || 1;
+        this.options.defaultPage = null;
+
+        if( this.noDataTextNode )this.noDataTextNode.destroy();
+        this.loadCurrentPageData( function (json) {
+            if(this.count){
+                this.fireEvent("postLoad"); //用户配置的事件
+                this.lookuping = false;
+                if(callback)callback(this);
+            }else{
+                this.viewPageAreaNode.empty();
+                if( this.viewJson.noDataText ){
+                    var noDataTextNodeStyle = this.css.noDataTextNode;
+                    if( this.viewJson.viewStyles && this.viewJson.viewStyles["noDataTextNode"] ){
+                        noDataTextNodeStyle = this.viewJson.viewStyles["noDataTextNode"];
+                    }
+                    this.noDataTextNode = new Element( "div", {
+                        "styles": noDataTextNodeStyle,
+                        "text" : this.viewJson.noDataText
+                    }).inject( this.contentAreaNode );
+                }
+                // if (this.loadingAreaNode){
+                //     this.loadingAreaNode.destroy();
+                //     this.loadingAreaNode = null;
+                // }
+                this.fireEvent("postLoad"); //用户配置的事件
+                this.lookuping = false;
+                if(callback)callback(this);
+            }
+
+
+        }.bind(this), true,"all");
+
+        // }.bind(this));
+        // }
+        // }.bind(this));
+    },
+    loadFilter : function( data ){
+        debugger;
+        this.filterList = [];
+        ( data.filterList || [] ).each( function (d) {
+            var parameterName = d.path.replace(/\./g, "_");
+            var value = d.value;
+            if( d.code && d.code.code ){
+                value = this.Macro.exec( d.code.code, this);
+            }
+            if( d.comparison === "like" || d.comparison === "notLike" ){
+                this.parameter[ parameterName ] = "%"+value+"%";
+            }else{
+                if( d.formatType === "dateTimeValue" || d.formatType === "datetimeValue"){
+                    value = "{ts '"+value+"'}"
+                }else if( d.formatType === "dateValue" ){
+                    value = "{d '"+value+"'}"
+                }else if( d.formatType === "timeValue" ){
+                    value = "{t '"+value+"'}"
+                }
+                this.parameter[ parameterName ] = value;
+            }
+            d.value = parameterName;
+
+            this.filterList.push( d );
+        }.bind(this))
+    },
+    loadParameter : function( data ){
+        this.parameter = {};
+        //系统默认的参数
+        ( this.viewJson.filterList || [] ).each( function (f) {
+            var value = f.value;
+            if( data.parameter && data.parameter[ f.parameter ] ){
+                value = data.parameter[ f.parameter ];
+                delete data.parameter[ f.parameter ];
+            }
+            debugger;
+            if( typeOf( value ) === "date" ){
+                value = value.format("db");
+            }
+            if( f.valueType === "script" ){
+                value = this.Macro.exec( f.valueScript ? f.valueScript.code : "", this);
+            }else if( f.value.indexOf( "@" ) > -1 ){
+                var user = layout.user;
+                switch ( f.value ) {
+                    case "@person":
+                        value = user.distinguishedName;
+                        break;
+                    case "@identityList":
+                        value =  user.identityList.map( function (d) {
+                            return d.distinguishedName;
+                        });
+                        break;
+                    case "@unitList":
+                        o2.Actions.load("x_organization_assemble_express").UnitAction.listWithPerson({ "personList" : [user.distinguishedName] }, function (json) {
+                            value = json.unitList;
+                        }, null, false);
+                        break;
+                    case "@unitAllList":
+                        o2.Actions.load("x_organization_assemble_express").UnitAction.listWithIdentitySupNested({ "personList" : [user.distinguishedName] }, function (json) {
+                            value = json.unitList;
+                        }, null, false);
+                        break;
+                    case "@year":
+                        value = (new Date().getFullYear()).toString();
+                        break;
+                    case "@season":
+                        var m = new Date().format("%m");
+                        if( ["01","02","03"].contains(m) ){
+                            value = "1"
+                        }else if( ["04","05","06"].contains(m) ){
+                            value = "2"
+                        }else if( ["07","08","09"].contains(m) ){
+                            value = "3"
+                        }else{
+                            value = "4"
+                        }
+                        break;
+                    case "@month":
+                        value = new Date().format("%Y-%m");
+                        break;
+                    case "@time":
+                        value = new Date().format("db");
+                        break;
+                    case "@date":
+                        value = new Date().format("%Y-%m-%d");
+                        break;
+                    default:
+                }
+            }
+            if( f.formatType === "dateTimeValue" || f.formatType === "datetimeValue"){
+                value = "{ts '"+value+"'}"
+            }else if( f.formatType === "dateValue" ){
+                value = "{d '"+value+"'}"
+            }else if( f.formatType === "timeValue" ){
+                value = "{t '"+value+"'}"
+            }
+            this.parameter[ f.parameter ] = value;
+        }.bind(this));
+        //传入的参数
+        if( data.parameter ){
+            for( var p in data.parameter ){
+                var value = data.parameter[p];
+                if( typeOf( value ) === "date" ){
+                    value = "{ts '"+value+"'}"
+                }
+                this.parameter[ p ] = value;
+            }
+        }
+    },
+    loadCurrentPageData: function( callback, async, type ){
+        //是否需要在翻页的时候清空之前的items ?
+
+        debugger;
+
+        if( this.pageloading )return;
+        this.pageloading = true;
+
+        this.items = [];
+
+        var p = this.currentPage;
+        var d = {
+            "filterList" : this.filterList,
+            "parameter" : this.parameter
+        };
+
+        while (this.viewTable.rows.length>1){
+            this.viewTable.deleteRow(-1);
+        }
+        //this.createLoadding();
+
+        this.loadViewRes = o2.Actions.load("x_query_assemble_surface").StatementAction.executeV2(
+            this.options.statementId || this.options.statementName || this.json.statementId || this.json.statementName,
+            type || "data", p, this.json.pageSize, d, function(json){
+
+                if( type === "all" || type === "count" ){
+                    if( typeOf(json.count) === "number" ){
+                        this.count = json.count;
+                        var i = this.count/this.json.pageSize;
+                        this.pages = (i.toInt()<i) ? i.toInt()+1 : i;
+                    }
+                }
+
+                this.gridJson = json.data;
+
+                this.fireEvent("postLoadPageData");
+
+                // if (this.viewJson.group.column){
+                //     this.gridJson = json.data.groupGrid;
+                // }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( json );
+            }.bind(this), null, async === false ? false : true );
+    },
+    getView: function(callback){
+        this.getViewRes = o2.Actions.load("x_query_assemble_surface").StatementAction.get(this.json.statementId || this.json.statementName, function(json){
+            debugger;
+            var viewData = JSON.decode(json.data.view);
+            if( !this.json.pageSize )this.json.pageSize = viewData.pageSize || "20";
+            this.viewJson = viewData.data;
+            this.json.application = json.data.query;
+            //this.json = Object.merge(this.json, json.data);
+            this.statementJson = json.data;
+            if (callback) callback();
+        }.bind(this));
+    },
+
+    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<to; i++ ){
+                this.items.push(new MWF.xApplication.query.Query.Statement.Item(this, this.gridJson[i], null, i));
+            }
+            this.isItemsLoading = false;
+            this.pageNumber ++;
+            if( to == this.gridJson.length )this.isItemsLoaded = true;
+        }
+    },
+    getFilter: function(){
+        var filterData = [];
+        if (this.searchStatus==="custom"){
+            if (this.filterItems.length){
+                this.filterItems.each(function(filter){
+                    filterData.push(filter.data);
+                }.bind(this));
+            }
+        }
+        if (this.searchStatus==="default"){
+            var key = this.viewSearchInputNode.get("value");
+            if (key && key!==this.lp.searchKeywork){
+                this.viewJson.customFilterList.each(function(entry){
+                    if (entry.formatType==="textValue"){
+                        var d = {
+                            "path": entry.path,
+                            "value": key,
+                            "formatType": entry.formatType,
+                            "logic": "and",
+                            "comparison": "like"
+                        };
+                        filterData.push(d);
+                    }
+                    if (entry.formatType==="numberValue"){
+                        var v = key.toFloat();
+                        if (!isNaN(v)){
+                            var d = {
+                                "path": entry.path,
+                                "value": v,
+                                "formatType": entry.formatType,
+                                "logic": "and",
+                                "comparison": "like"
+                            };
+                            filterData.push(d);
+                        }
+                    }
+                }.bind(this));
+            }
+        }
+        return (filterData.length) ? filterData : null;
+    },
+    viewSearchCustomAddToFilter: function(){
+        var pathIdx = this.viewSearchCustomPathListNode.selectedIndex;
+        var comparisonIdx = this.viewSearchCustomComparisonListNode.selectedIndex;
+        if (pathIdx===-1){
+            MWF.xDesktop.notice("error", {"x": "left", "y": "top"}, this.lp.filterErrorTitle, this.viewSearchCustomPathListNode, {"x": 0, "y": 85});
+            return false;
+        }
+        if (comparisonIdx===-1){
+            MWF.xDesktop.notice("error", {"x": "left", "y": "top"}, this.lp.filterErrorComparison, this.viewSearchCustomComparisonListNode, {"x": 0, "y": 85});
+            return false;
+        }
+        var pathOption = this.viewSearchCustomPathListNode.options[pathIdx];
+        var entry = pathOption.retrieve("entry");
+        if (entry){
+            var pathTitle = entry.title;
+            var path = entry.path;
+            var comparison = this.viewSearchCustomComparisonListNode.options[comparisonIdx].get("value");
+            var comparisonTitle = this.viewSearchCustomComparisonListNode.options[comparisonIdx].get("text");
+            var value = "";
+
+            if( entry.valueType === "script" && entry.valueScript && entry.valueScript.code  ){
+                var idx = this.viewSearchCustomValueNode.selectedIndex;
+                if (idx!==-1){
+                    var v = this.viewSearchCustomValueNode.options[idx].get("value");
+                    value = entry.formatType === "booleanValue" ? (v==="true") : v;
+                }
+            }else{
+                switch (entry.formatType){
+                    case "numberValue":
+                        value = this.viewSearchCustomValueNode.get("value");
+                        break;
+                    case "dateTimeValue":
+                        value = this.viewSearchCustomValueNode.get("value");
+                        break;
+                    case "booleanValue":
+                        var idx = this.viewSearchCustomValueNode.selectedIndex;
+                        if (idx!==-1){
+                            var v = this.viewSearchCustomValueNode.options[idx].get("value");
+                            value = (v==="true");
+                        }
+                        break;
+                    default:
+                        value = this.viewSearchCustomValueNode.get("value");
+                }
+            }
+
+            if (value===""){
+                MWF.xDesktop.notice("error", {"x": "left", "y": "top"}, this.lp.filterErrorValue, this.viewSearchCustomValueContentNode, {"x": 0, "y": 85});
+                return false;
+            }
+
+            this.filterItems.push(new MWF.xApplication.query.Query.Statement.Filter(this, {
+                "logic": "and",
+                "path": path,
+                "title": pathTitle,
+                "comparison": comparison,
+                "comparisonTitle": comparisonTitle,
+                "value": value,
+                "formatType": (entry.formatType=="datetimeValue") ? "dateTimeValue": entry.formatType
+            }, this.viewSearchCustomFilterContentNode));
+
+            this.searchCustomView();
+        }
+    },
+    //搜索相关结束
+    getStatementInfor : function () {
+        return this.json;
+    },
+    switchStatement : function (json) {
+        this.switchView(json);
+    },
+    setFilter : function( filter, callback ){
+        if( this.lookuping || this.pageloading )return;
+        if( !filter )filter = {"filterList": [], "paramter" : {} };
+        if( typeOf( filter ) === "object" )return;
+        this.json.filter = filter.filterList || [];
+        this.json.paramter = filter.paramter || {};
+        if( this.viewAreaNode ){
+            this.createViewNode({"filterList": this.json.filter.clone(), "paramter" : Object.clone(this.json.paramter) }, callback);
+        }
+    }
+});
+
+MWF.xApplication.query.Query.Statement.Item = new Class({
+    Extends : MWF.xApplication.query.Query.Viewer.Item,
+    initialize: function(view, data, prev, i){
+        this.view = view;
+        this.data = data;
+        this.css = this.view.css;
+        this.isSelected = false;
+        this.prev = prev;
+        this.idx = i;
+        this.clazzType = "item";
+
+        this.load();
+    },
+    load: function(){
+        this.view.fireEvent("queryLoadItemRow", [null, this]);
+
+        var viewStyles = this.view.viewJson.viewStyles;
+        var viewContentTdNode = ( viewStyles && viewStyles["contentTd"] ) ? viewStyles["contentTd"] : this.css.viewContentTdNode;
+
+        this.node = new Element("tr", {
+            "styles": ( viewStyles && viewStyles["contentTr"] ) ? viewStyles["contentTr"] : this.css.viewContentTrNode
+        });
+        if (this.prev){
+            this.node.inject(this.prev.node, "after");
+        }else{
+            this.node.inject(this.view.viewTable);
+        }
+
+        //if (this.view.json.select==="single" || this.view.json.select==="multi"){
+        this.selectTd = new Element("td", { "styles": viewContentTdNode }).inject(this.node);
+        this.selectTd.setStyles({"cursor": "pointer"});
+        if (this.view.json.itemStyles) this.selectTd.setStyles(this.view.json.itemStyles);
+        if( this.view.isSelectTdHidden() ){
+            this.selectTd.hide();
+        }
+        //}
+
+        //序号
+        if (this.view.viewJson.isSequence==="yes"){
+            this.sequenceTd = new Element("td", {"styles": viewContentTdNode}).inject(this.node);
+            this.sequenceTd.setStyle("width", "10px");
+            var s= 1+this.view.json.pageSize*(this.view.currentPage-1)+this.idx;
+            this.sequenceTd.set("text", s);
+        }
+
+        debugger;
+
+        Object.each(this.view.entries, function(c, k){
+            //if (cell){
+            if (this.view.hideColumns.indexOf(k)===-1){
+                var td = new Element("td", {"styles": viewContentTdNode}).inject(this.node);
+
+                var cell =  this.getText( c, k, td ); //this.data[k];
+                if (cell === undefined || cell === null) cell = "";
+
+                // if (k!== this.view.viewJson.group.column){
+                var v = cell;
+                if (c.isHtml){
+                    td.set("html", v);
+                }else{
+                    td.set("text", v);
+                }
+
+                if( typeOf(c.contentProperties) === "object" )td.setProperties(c.contentProperties);
+                if (this.view.json.itemStyles) td.setStyles(this.view.json.itemStyles);
+                if( typeOf(c.contentStyles) === "object" )td.setStyles(c.contentStyles);
+                // }else{
+                //     if (this.view.json.itemStyles) td.setStyles(this.view.json.itemStyles);
+                // }
+
+                if (this.view.openColumns.indexOf(k)!==-1){
+                    this.setOpenWork(td, c)
+                }
+
+                // if (k!== this.view.viewJson.group.column){
+                Object.each( c.events || {}, function (e , key) {
+                    if(e.code){
+                        if( key === "loadContent" ){
+                            this.view.Macro.fire( e.code,
+                                {"node" : td, "json" : c, "data" : v, "view": this.view, "row" : this});
+                        }else if( key !== "loadTitle" ){
+                            td.addEvent(key, function(event){
+                                return this.view.Macro.fire(
+                                    e.code,
+                                    {"node" : td, "json" : c, "data" : v, "view": this.view, "row" : this},
+                                    event
+                                );
+                            }.bind(this));
+                        }
+                    }
+                }.bind(this));
+                // }
+            }
+            //}
+        }.bind(this));
+
+        //默认选中
+        var defaultSelectedScript = this.view.json.defaultSelectedScript || this.view.viewJson.defaultSelectedScript;
+        if( !this.isSelected && defaultSelectedScript ){
+            // var flag = this.view.json.select || this.view.viewJson.select ||  "none";
+            // if ( flag ==="single" || flag==="multi"){
+            //
+            // }
+            var flag = this.view.Macro.exec( defaultSelectedScript,
+                {"node" : this.node, "data" : this.data, "view": this.view, "row" : this});
+            if( flag ){
+                if( flag === "multi" || flag === "single" ){
+                    this.select( flag );
+                }else if( flag.toString() === "true" ){
+                    var f = this.view.json.select || this.view.viewJson.select ||  "none";
+                    if ( f ==="single" || f==="multi"){
+                        this.select();
+                    }
+                }
+            }
+        }
+
+        this.setEvent();
+
+        this.view.fireEvent("postLoadItemRow", [null, this]);
+    },
+    getDataByPath : function( obj, path ){
+        var pathList = path.split(".");
+        for (var i = 0; i < pathList.length; i++) {
+            var p = pathList[i];
+            if ((/(^[1-9]\d*$)/.test(p))) p = p.toInt();
+            if (obj[p]) {
+                obj = obj[p];
+            } else {
+                obj = "";
+                break;
+            }
+        }
+        return obj
+    },
+    getText : function(c, k, td){
+        var path = c.path, code = c.code, obj = this.data;
+        if( !path ){
+            return ""
+        }else if( path === "$all" ){
+        }else{
+            obj = this.getDataByPath(obj, path);
+        }
+
+        if( code && code.trim())obj = this.view.Macro.exec( code, {"value": obj,  "data": this.data, "entry": c, "node" : td, "json" : c, "row" : this});
+
+        var toName = function (value) {
+            if(typeOf(value) === "array"){
+                Array.each( value, function (v, idx) {
+                    value[idx] = toName(v)
+                })
+            }else if( typeOf(value) === "object" ){
+                Object.each( value, function (v, key) {
+                    value[key] = toName(v);
+                })
+            }else if( typeOf( value ) === "string" ){
+                value = o2.name.cn( value )
+            }
+            return value;
+        };
+
+        var d;
+        if( obj!= undefined && obj!= null ){
+            if( typeOf(obj) === "array" ) {
+                d = c.isName ? JSON.stringify(toName(Array.clone(obj))) : JSON.stringify(obj);
+            }else if( typeOf(obj) === "object" ){
+                d = c.isName ? JSON.stringify(toName(Object.clone(obj))) : JSON.stringify(obj);
+            }else{
+                d = c.isName ? o2.name.cn( obj.toString() ) : obj;
+            }
+        }
+
+        return d;
+    },
+    setOpenWork: function(td, column){
+        td.setStyle("cursor", "pointer");
+        if( column.clickCode ){
+            if( !this.view.Macro ){
+                MWF.require("MWF.xScript.Macro", function () {
+                    this.view.businessData = {};
+                    this.view.Macro = new MWF.Macro.PageContext(this.view);
+                }.bind(this), false);
+            }
+            td.addEvent("click", function( ev ){
+                var result = this.view.Macro.fire(column.clickCode, this, ev);
+                ev.stopPropagation();
+                return result;
+            }.bind(this));
+        }else if( this.view.statementJson.entityCategory==="official" && column.idPath ){
+            var id = this.getDataByPath(this.data, column.idPath );
+            if( id ){
+                if (this.view.statementJson.entityClassName==="com.x.cms.core.entity.Document"){
+                    td.addEvent("click", function(ev){
+                        this.openCms(ev, id);
+                        ev.stopPropagation();
+                    }.bind(this));
+                }else{
+                    td.addEvent("click", function(ev){
+                        this.openWork(ev, id);
+                        ev.stopPropagation();
+                    }.bind(this));
+                }
+            }
+        }
+    },
+    openCms: function(e, id){
+        var options = {"documentId": id};
+        this.view.fireEvent("openDocument", [options, this]); //options 传入的事件
+        layout.desktop.openApplication(e, "cms.Document", options);
+    },
+    openWork: function(e, id){
+        var options = {"workId": id};
+        this.view.fireEvent("openDocument", [options, this]); //options 传入的事件
+        layout.desktop.openApplication(e, "process.Work", options);
+    }
+});
+
+MWF.xApplication.query.Query.Statement.Filter = new Class({
+    Extends : MWF.xApplication.query.Query.Viewer.Filter
+});
+
+MWF.xApplication.query.Query.Statement.Actionbar = new Class({
+    Extends : MWF.xApplication.query.Query.Viewer.Actionbar
+});
+
+MWF.xApplication.query.Query.Statement.Paging = new Class({
+    Extends : MWF.xApplication.query.Query.Viewer.Paging
+});

+ 4 - 2
o2web/source/x_component_query_Query/Viewer.js

@@ -902,10 +902,11 @@ MWF.xApplication.query.Query.Viewer = MWF.QViewer = new Class({
         });
     },
     searchView: function(){
+        debugger;
         if (this.viewJson.customFilterList) {
             var key = this.viewSearchInputNode.get("value");
             if (key && key !== this.lp.searchKeywork) {
-                var filterData = this.json.filter ? this.json.filter : [];
+                var filterData = this.json.filter ? this.json.filter.clone() : [];
                 this.filterItems = [];
                 this.viewJson.customFilterList.each(function (entry) {
                     if (entry.formatType === "textValue") {
@@ -938,7 +939,8 @@ MWF.xApplication.query.Query.Viewer = MWF.QViewer = new Class({
                 this.createViewNode({"filterList": filterData});
             }else{
                 this.filterItems = [];
-                this.createViewNode();
+                var filterData = this.json.filter ? this.json.filter.clone() : [];
+                this.createViewNode( {"filterList": filterData} );
             }
         }
     },

+ 1 - 0
o2web/source/x_component_query_Query/lp/zh-cn.js

@@ -10,6 +10,7 @@ MWF.xApplication.query.Query.LP = {
     "noDescription": "未定义描述",
     "view": "视图",
     "stat": "统计",
+    "statement" : "查询",
     "customSearch": "高级搜索",
     "searchKeywork": "输入关键字搜索视图",
     "yes": "是",

BIN
o2web/source/x_component_query_StatementDesigner/$Main/default/toolbar/preview.png


+ 1 - 1
o2web/source/x_component_query_StatementDesigner/$Main/default/toolbars.html

@@ -1,7 +1,7 @@
 <div id="MWFFormToolbar">
 	<span MWFnodetype="MWFToolBarSeparator"></span>
 	<span MWFnodetype="MWFToolBarButton" MWFButtonImage="save.gif" title="保存数据表" MWFButtonAction="saveStatement" MWFButtonText=""></span>
-
+    <span MWFnodetype="MWFToolBarButton" MWFButtonImage="preview.png" title="预览" MWFButtonAction="preview" MWFButtonText=""></span>
     <span MWFnodetype="MWFToolBarSeparator"></span>
 	
 	<span MWFnodetype="MWFToolBarButton" MWFButtonImage="help.png" title="帮助" MWFButtonAction="statementHelp" MWFButtonText=""></span>

+ 42 - 0
o2web/source/x_component_query_StatementDesigner/$Statement/actionbar.html

@@ -0,0 +1,42 @@
+<div style="background-color: #FFF; overflow: hidden">
+	<div title="基本" class="MWFTab">
+		<table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
+		  <tr>
+		    <td class="editTableTitle">标识:</td>
+		    <td class="editTableValue"><input type="text" name="id" value="text{$.id}" class="editTableInput"/></td>
+		  </tr>
+		  <tr>
+		    <td class="editTableTitle">名称:</td>
+		    <td class="editTableValue"><input type="text" name="name" value="text{$.name}" class="editTableInput"/></td>
+		  </tr>
+		  <tr>
+		    <td class="editTableTitle">描述:</td>
+		    <td class="editTableValue"><input type="text" name="description" value="text{$.description}" class="editTableInput"/></td>
+		  </tr>
+<!--          <tr>-->
+<!--            <td class="editTableTitle">系统操作:</td>-->
+<!--            <td class="editTableValue">-->
+<!--                <input type="radio" name="hideSystemTools" value="false" text{(!$.hideSystemTools)?'checked':''}/>显示-->
+<!--                <input type="radio" name="hideSystemTools" value="true" text{($.hideSystemTools)?'checked':''}/>不显示-->
+<!--            </td>-->
+<!--          </tr>-->
+
+		</table>
+	</div>
+    <div title="操作"  class="MWFTab" style="overflow: hidden">
+<!--		<div class="MWFDefaultActionArea" name="defaultTools"></div>-->
+        <div class="MWFActionArea" name="tools"></div>
+    </div>
+    <div title="样式"  class="MWFTab">
+        <div class="MWFActionStylesArea" name="actionStyles"></div>
+    </div>
+	<div title="事件"  class="MWFTab">
+		<div class="MWFEventsArea" name="events"></div>
+	</div>
+	<!--<div title="HTML"  class="MWFTab">-->
+		<!--<div class="MWFHTMLArea" style="font-family: Verdana, Geneva, sans-serif; font-size:14px"></div>-->
+	<!--</div>-->
+	<div title="JSON"  class="MWFTab">
+		<div class="MWFJSONArea" style="font-family: Verdana, Geneva, sans-serif; font-size:14px"></div>
+	</div>
+</div>

+ 92 - 22
o2web/source/x_component_query_StatementDesigner/$Statement/column.html

@@ -2,35 +2,105 @@
 	<div title="基本" class="MWFTab">
         <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
             <tr>
-                <td class="editTableTitle">名称:</td>
-                <td class="editTableValue"><input type="text" name="name" value="text{$.name}" class="editTableInput"/></td>
+                <td class="editTableTitle">列标题:</td>
+                <td class="editTableValue"><input type="text" name="displayName" value="text{$.displayName}" class="editTableInput"/></td>
             </tr>
             <tr>
-                <td class="editTableTitle">描述:</td>
-                <td class="editTableValue"><input type="text" name="description" value="text{$.description}" class="editTableInput"/></td>
+                <td class="editTableTitle">列名:</td>
+                <td class="editTableValue"><input type="text" name="column" value="text{$.column}" class="editTableInput"/></td>
             </tr>
             <tr>
-                <td class="editTableTitle">类型:</td>
-                <td class="editTableValue"><select class="type" name="column">
-                    <option value="string">string</option>
-                    <option value="integer">integer</option>
-                    <option value="long">long</option>
-                    <option value="double">double</option>
-                    <option value="boolean">boolean</option>
-                    <option value="date">date</option>
-                    <option value="time">time</option>
-                    <option value="dateTime">dateTime</option>
-                    <option value="stringList">stringList</option>
-                    <option value="integerList">integerList</option>
-                    <option value="longList">longList</option>
-                    <option value="doubleList">doubleList</option>
-                    <option value="booleanList">booleanList</option>
-                    <option value="stringLob">stringLob</option>
-                    <option value="stringMap">stringMap</option>
-                </select></td>
+                <td class="editTableTitle">默认值:</td>
+                <td class="editTableValue"><input type="text" name="defaultValue" value="text{$.defaultValue}" class="editTableInput"/></td>
+            </tr>
+            <tr>
+                <td class="editTableTitle">打开文档:</td>
+                <td class="editTableValue">
+                    <input class="editTableRadio" name="allowOpen" text{($.allowOpen===true)?'checked':''} type="radio" value="true"
+                           onclick="if(this.checked){
+                               $('text{$.pid}clickCodeTr').setStyle('display', '');
+                               $('text{$.pid}idPathTr').setStyle('display', '');
+                           }"/>是
+                    <input class="editTableRadio" name="allowOpen" text{($.allowOpen!==true)?'checked':''} type="radio" value="false"
+                           onclick="if(this.checked){
+                               $('text{$.pid}clickCodeTr').setStyle('display', 'none');
+                               $('text{$.pid}idPathTr').setStyle('display', 'none');
+                           }"/>否
+                </td>
+            </tr>
+            <tr id="text{$.pid}clickCodeTr" style="display:text{($.allowOpen===true)?'':'none'}">
+                <td class="editTableValue" colspan="2">
+                    <div class="MWFFormulaArea" name="clickCode" title="打开文档脚本(S)"></div>
+                </td>
+            </tr>
+            <tr id="text{$.pid}idPathTr" style="display:text{($.allowOpen===true)?'':'none'}">
+                <td class="editTableTitle">id路径:</td>
+                <td class="editTableValue">
+                    <input type="text" name="idPath" value="text{$.idPath}" class="editTableInput"/>
+                    <div style="line-height: 20px;color:#999;">注:指Id(cms文档id/流程work id)相对单条数据的路径,用于打开文档。</div>
+                </td>
             </tr>
         </table>
+
+        <div style="border-top: 1px solid #999; margin-top:10px">
+            <div style="background-color: #EEE; height:24px; line-height: 24px; text-align: center; font-weight: bold">数据</div>
+            <div class="MWFDataData" id="text{$.pid}dataDataEditor">
+                <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable" style="table-layout: fixed;">
+                    <tr>
+                        <td class="editTableTitle">选择路径:</td>
+                        <td class="editTableValue">
+                            <select class="MWFDataPathSelect" id="text{$.pid}dataPathSelected" onchange=" var v=this.options[this.selectedIndex].value; if (true){var n = $('text{$.pid}viewColumnPathInput'); n.set('value', v); n.focus();} ">
+                            </select>
+                            <div style="line-height: 20px;color:#999;">注:正确填写了查询语句,再测试语句或刷新视图数据可显示(刷新)选择路径。</div>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class="editTableTitle">数据路径:</td>
+                        <td class="editTableValue">
+                            <input id="text{$.pid}viewColumnPathInput" type="text" name="path" value="text{$.path}" class="editTableInput"/>
+                            <div style="line-height: 20px;color:#999;">注:指该列相对单条数据的路径。比如 0,title,或 0.title</div>
+                        </td>
+                    </tr>
+                </table>
+            </div>
+        </div>
+
+        <div style="border-top: 1px solid #999; margin-top:10px">
+            <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
+                <tr class="MWFColumnExportHide">
+                    <td class="editTableTitle">隐藏:</td>
+                    <td class="editTableValue">
+                        <input class="MWFWorkDataCheck" name="hideColumn" type="radio" value="true" text{($.hideColumn)===true?'checked':''}/>是
+                        <input class="MWFWorkDataCheck" name="hideColumn" type="radio" value="false" text{($.hideColumn)!==true?'checked':''}/>否
+                    </td>
+                </tr>
+                <tr class="MWFColumnExportGroup">
+                    <td class="editTableTitle">组织对象:</td>
+                    <td class="editTableValue">
+                        <input class="MWFWorkDataCheck" name="isName" type="radio" value="true" text{($.isName)===true?'checked':''}/>是
+                        <input class="MWFWorkDataCheck" name="isName" type="radio" value="false" text{($.isName)!==true?'checked':''}/>否
+                    </td>
+                </tr>
+                <tr class="MWFColumnExportGroup">
+                    <td class="editTableTitle">HTML值:</td>
+                    <td class="editTableValue">
+                        <input class="MWFWorkDataCheck" name="isHtml" type="radio" value="true" text{($.isHtml)===true?'checked':''}/>是
+                        <input class="MWFWorkDataCheck" name="isHtml" type="radio" value="false" text{($.isHtml)!==true?'checked':''}/>否
+                    </td>
+                </tr>
+            </table>
+        </div>
+        <div class="MWFFormulaArea" name="code" title="显示脚本 (S)"></div>
 	</div>
+    <div title="样式" class="MWFTab">
+        <div class="MWFMaplist" name="titleStyles" title="标题单元格样式"></div>
+        <div class="MWFMaplist" name="titleProperties" title="标题单元格属性"></div>
+        <div class="MWFMaplist" name="contentStyles" title="内容单元格样式"></div>
+        <div class="MWFMaplist" name="contentProperties" title="内容单元格属性"></div>
+    </div>
+    <div title="事件"  class="MWFTab">
+        <div class="MWFEventsArea" name="events"></div>
+    </div>
 	<div title="JSON"  class="MWFTab">
 		<div class="MWFJSONArea" style="font-family: Verdana, Geneva, sans-serif; font-size:14px"></div>
 	</div>

+ 37 - 0
o2web/source/x_component_query_StatementDesigner/$Statement/column_bak.html

@@ -0,0 +1,37 @@
+<div style="background-color: #FFF; overflow: hidden">
+	<div title="基本" class="MWFTab">
+        <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
+            <tr>
+                <td class="editTableTitle">名称:</td>
+                <td class="editTableValue"><input type="text" name="name" value="text{$.name}" class="editTableInput"/></td>
+            </tr>
+            <tr>
+                <td class="editTableTitle">描述:</td>
+                <td class="editTableValue"><input type="text" name="description" value="text{$.description}" class="editTableInput"/></td>
+            </tr>
+            <tr>
+                <td class="editTableTitle">类型:</td>
+                <td class="editTableValue"><select class="type" name="column">
+                    <option value="string">string</option>
+                    <option value="integer">integer</option>
+                    <option value="long">long</option>
+                    <option value="double">double</option>
+                    <option value="boolean">boolean</option>
+                    <option value="date">date</option>
+                    <option value="time">time</option>
+                    <option value="dateTime">dateTime</option>
+                    <option value="stringList">stringList</option>
+                    <option value="integerList">integerList</option>
+                    <option value="longList">longList</option>
+                    <option value="doubleList">doubleList</option>
+                    <option value="booleanList">booleanList</option>
+                    <option value="stringLob">stringLob</option>
+                    <option value="stringMap">stringMap</option>
+                </select></td>
+            </tr>
+        </table>
+	</div>
+	<div title="JSON"  class="MWFTab">
+		<div class="MWFJSONArea" style="font-family: Verdana, Geneva, sans-serif; font-size:14px"></div>
+	</div>
+</div>

+ 1 - 1
o2web/source/x_component_query_StatementDesigner/$Statement/default/css.wcss

@@ -336,7 +336,7 @@
         "margin-right": "8px",
         "top": "-38px"
     },
-    propertyRefreshFormNode: {
+    "propertyRefreshFormNode": {
         "width": "24px",
         "height": "24px",
         "float": "right",

+ 24 - 0
o2web/source/x_component_query_StatementDesigner/$Statement/default/statement.css

@@ -1,4 +1,5 @@
 .o2_statement_statementDesignerNode {
+    height : 360px;
     overflow: hidden;
     padding: 20px;
     box-shadow: 0 0 10px #999999;
@@ -49,7 +50,19 @@
     border: 1px solid #cccccc;
     background: #ffffff;
 }
+.o2_statement_statementDesignerCountJpqlLine {
+    height: 260px;
+    margin-top: 10px;
+    border: 1px solid #cccccc;
+    background: #ffffff;
+}
 .o2_statement_statementDesignerScript {
+     height: 260px;
+     margin-top: 10px;
+     border: 1px solid #cccccc;
+     background: #ffffff;
+ }
+.o2_statement_statementDesignerCountScript {
     height: 260px;
     margin-top: 10px;
     border: 1px solid #cccccc;
@@ -103,4 +116,15 @@
     top:45%;
     margin: auto;
     cursor: pointer;
+}
+.o2_statement_tabNode{
+    height: 32px;
+}
+.o2_statement_statementJpqlTabNode{
+    height: 32px;
+}
+.o2_statement_resizeNode{
+    height: 3px;
+    background-color: #505050;
+    cursor: row-resize;
 }

+ 19 - 5
o2web/source/x_component_query_StatementDesigner/$Statement/statement.html

@@ -21,12 +21,27 @@
         <div style="height:24px; text-align: center; line-height: 24px; background-color: #EEE; border-top: 1px solid #999; font-weight: bold">执行权限</div>
         <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable" id="processEditStarter">
             <tr>
+                <td class="editTableTitle">匿名访问:</td>
+                <td class="editTableValue">
+                    <input class="editTableRadio" name="anonymousAccessible" text{($.anonymousAccessible===true)?'checked':''} type="radio" value="true"
+                           onclick="if(this.checked){
+                               $('text{$.pid}executePersonListTr').setStyle('display', 'none');
+                               $('text{$.pid}executeUnitListTr').setStyle('display', 'none');
+                            }"/>允许
+                    <input class="editTableRadio" name="anonymousAccessible" text{($.anonymousAccessible!==true)?'checked':''} type="radio" value="false"
+                           onclick="if(this.checked){
+                               $('text{$.pid}executePersonListTr').setStyle('display', '');
+                               $('text{$.pid}executeUnitListTr').setStyle('display', '');
+                            }"/>不允许
+                </td>
+            </tr>
+            <tr id="text{$.pid}executePersonListTr" style="display:text{($.anonymousAccessible==true)?'none':''}">
                 <td class="editTableTitle">执行人:</td>
                 <td class="editTableValue">
                     <div class="MWFPersonIdentity" name="executePersonList"></div>
                 </td>
             </tr>
-            <tr>
+            <tr id="text{$.pid}executeUnitListTr" style="display:text{($.anonymousAccessible==true)?'none':''}">
                 <td class="editTableTitle">执行组织:</td>
                 <td class="editTableValue">
                     <div class="MWFPersonUnit" name="executeUnitList"></div>
@@ -34,9 +49,8 @@
             </tr>
         </table>
     </div>
-</div>
 
-<div title="JSON"  class="MWFTab">
-    <div class="MWFJSONArea" style="font-family: Verdana, Geneva, sans-serif; font-size:14px"></div>
-</div>
+    <div title="JSON"  class="MWFTab">
+        <div class="MWFJSONArea" style="font-family: Verdana, Geneva, sans-serif; font-size:14px"></div>
+    </div>
 </div>

+ 61 - 33
o2web/source/x_component_query_StatementDesigner/$Statement/statementDesigner.html

@@ -1,6 +1,6 @@
 <div class="o2_statement_statementDesignerNode">
     <div class="o2_statement_statementDesignerFormatLine">
-        <div class="o2_statement_statementDesignerFormatTitle">{{$.lp.statementFormat}}: </div>
+        <div class="o2_statement_statementDesignerFormatTitle">{{$.lp.statementFormat}} </div>
         <div class="o2_statement_statementDesignerFormatContent" style="float: left; margin-right: 20px">
             <input name="format" type="radio" value="jpql" {{if $.data.format!=='script'}} checked {{end if}}/>{{$.lp.statementJpql}}
             <input name="format" type="radio" value="script" {{if $.data.format=='script'}} checked {{end if}}/>{{$.lp.statementScript}}
@@ -11,7 +11,7 @@
             <select>
                 <option value="official" {{if $.data.entityCategory!=='dynamic' && $.data.entityCategory!=='custom'}} selected {{end if}}>系统表</option>
                 <option value="dynamic" {{if $.data.entityCategory=='dynamic'}} selected {{end if}}>自建数据表</option>
-                <option value="custom" {{if $.data.entityCategory=='custom'}} selected {{end if}}>自定义应用</option>
+<!--                <option value="custom" {{if $.data.entityCategory=='custom'}} selected {{end if}}>自定义应用</option>-->
             </select>
         </div>
     </div>
@@ -39,6 +39,7 @@
             <div style="margin-left: 30px;" class="o2_statement_statementDesignerTitle">{{$.lp.statementTable}}: </div>
             <div class="o2_statement_statementDesignerOfficialTable">
                 <select>
+                    <option value=""></option>
                     <option value="com.x.processplatform.core.entity.content.Task" {{if $.data.entityClassName =='com.x.processplatform.core.entity.content.Task'}} selected {{end if}}>待办(Task)</option>
                     <option value="com.x.processplatform.core.entity.content.TaskCompleted" {{if $.data.entityClassName =='com.x.processplatform.core.entity.content.TaskCompleted'}} selected {{end if}}>已办(TaskCompleted)</option>
                     <option value="com.x.processplatform.core.entity.content.Read" {{if $.data.entityClassName =='com.x.processplatform.core.entity.content.Read'}} selected {{end if}}>待阅(Read)</option>
@@ -46,6 +47,7 @@
                     <option value="com.x.processplatform.core.entity.content.Work" {{if $.data.entityClassName =='com.x.processplatform.core.entity.content.Work'}} selected {{end if}}>流程实例(Work)</option>
                     <option value="com.x.processplatform.core.entity.content.WorkCompleted" {{if $.data.entityClassName =='com.x.processplatform.core.entity.content.WorkCompleted'}} selected {{end if}}>已完成流程实例(WorkCompleted)</option>
                     <option value="com.x.processplatform.core.entity.content.Review" {{if $.data.entityClassName =='com.x.processplatform.core.entity.content.Review'}} selected {{end if}}>可阅读(Review)</option>
+                    <option value="com.x.cms.core.entity.Document" {{if $.data.entityClassName =='com.x.cms.core.entity.Document'}} selected {{end if}}>内容管理文档(Document)</option>
                 </select>
             </div>
         </div>
@@ -54,45 +56,69 @@
 
         </div>
 
+        <div class="o2_statement_statementDesignerTableArea_field">
+            <div style="margin-left: 30px;" class="o2_statement_statementDesignerTitle">{{$.lp.field}}: </div>
+            <select>
+            </select>
+        </div>
+
     </div>
 
-    <div class="o2_statement_statementDesignerJpql" style="{{if $.data.format=='script'}} display: none {{end if}}">
-
-        <div class="o2_statement_statementDesignerJpqlLine">
-
-<!--            <div class="o2_statement_statementDesignerJpql_select" style="{{if $.data.type=='update' || $.data.type=='delete'}} display: none {{end if}}">-->
-<!--&lt;!&ndash;                <div class="o2_statement_statementDesignerJpql_jpql_select">SELECT</div>&ndash;&gt;-->
-<!--&lt;!&ndash;                <div class="o2_statement_statementDesignerJpql_jpql_selectContent"></div>&ndash;&gt;-->
-<!--&lt;!&ndash;                <div class="o2_statement_statementDesignerJpql_jpql_from">FROM</div>&ndash;&gt;-->
-<!--&lt;!&ndash;                <div class="o2_statement_statementDesignerJpql_jpql_fromContent"></div>&ndash;&gt;-->
-<!--&lt;!&ndash;                <div class="o2_statement_statementDesignerJpql_jpql_where">WHERE</div>&ndash;&gt;-->
-<!--&lt;!&ndash;                <div class="o2_statement_statementDesignerJpql_jpql_whereContent"></div>&ndash;&gt;-->
-<!--            </div>-->
-
-<!--            <div class="o2_statement_statementDesignerJpql_update" style="{{if $.data.type!=='update'}} display: none {{end if}}">-->
-<!--&lt;!&ndash;                <div class="o2_statement_statementDesignerJpql_jpql_update">UPDATE</div>&ndash;&gt;-->
-<!--&lt;!&ndash;                <div class="o2_statement_statementDesignerJpql_jpql_updateContent"></div>&ndash;&gt;-->
-<!--&lt;!&ndash;                <div class="o2_statement_statementDesignerJpql_jpql_set">SET</div>&ndash;&gt;-->
-<!--&lt;!&ndash;                <div class="o2_statement_statementDesignerJpql_jpql_setContent"></div>&ndash;&gt;-->
-<!--&lt;!&ndash;                <div class="o2_statement_statementDesignerJpql_jpql_where">WHERE</div>&ndash;&gt;-->
-<!--&lt;!&ndash;                <div class="o2_statement_statementDesignerJpql_jpql_whereContent"></div>&ndash;&gt;-->
-<!--            </div>-->
-
-<!--            <div class="o2_statement_statementDesignerJpql_sdelete" style="{{if $.data.type!=='delete'}} display: none {{end if}}">-->
-<!--&lt;!&ndash;                <div class="o2_statement_statementDesignerJpql_jpql_delete">DELETE</div>&ndash;&gt;-->
-<!--&lt;!&ndash;                <div class="o2_statement_statementDesignerJpql_jpql_deleteContent"></div>&ndash;&gt;-->
-<!--&lt;!&ndash;                <div class="o2_statement_statementDesignerJpql_jpql_where">WHERE</div>&ndash;&gt;-->
-<!--&lt;!&ndash;                <div class="o2_statement_statementDesignerJpql_jpql_whereContent"></div>&ndash;&gt;-->
-<!--            </div>-->
+<!--    <div class="o2_statement_statementJpqlTabNode" style="{{if $.data.type!='select'}} display: none {{end if}}"></div>-->
+    <div class="o2_statement_statementJpqlTabNode"></div>
+
+    <div class="o2_statement_statementJpqlTabPageNode">
+        <div class="o2_statement_statementDesignerJpql" style="{{if $.data.format=='script'}} display: none {{end if}}">
+
+            <div class="o2_statement_statementDesignerJpqlLine">
+
+                <!--            <div class="o2_statement_statementDesignerJpql_select" style="{{if $.data.type=='update' || $.data.type=='delete'}} display: none {{end if}}">-->
+                <!--&lt;!&ndash;                <div class="o2_statement_statementDesignerJpql_jpql_select">SELECT</div>&ndash;&gt;-->
+                <!--&lt;!&ndash;                <div class="o2_statement_statementDesignerJpql_jpql_selectContent"></div>&ndash;&gt;-->
+                <!--&lt;!&ndash;                <div class="o2_statement_statementDesignerJpql_jpql_from">FROM</div>&ndash;&gt;-->
+                <!--&lt;!&ndash;                <div class="o2_statement_statementDesignerJpql_jpql_fromContent"></div>&ndash;&gt;-->
+                <!--&lt;!&ndash;                <div class="o2_statement_statementDesignerJpql_jpql_where">WHERE</div>&ndash;&gt;-->
+                <!--&lt;!&ndash;                <div class="o2_statement_statementDesignerJpql_jpql_whereContent"></div>&ndash;&gt;-->
+                <!--            </div>-->
+
+                <!--            <div class="o2_statement_statementDesignerJpql_update" style="{{if $.data.type!=='update'}} display: none {{end if}}">-->
+                <!--&lt;!&ndash;                <div class="o2_statement_statementDesignerJpql_jpql_update">UPDATE</div>&ndash;&gt;-->
+                <!--&lt;!&ndash;                <div class="o2_statement_statementDesignerJpql_jpql_updateContent"></div>&ndash;&gt;-->
+                <!--&lt;!&ndash;                <div class="o2_statement_statementDesignerJpql_jpql_set">SET</div>&ndash;&gt;-->
+                <!--&lt;!&ndash;                <div class="o2_statement_statementDesignerJpql_jpql_setContent"></div>&ndash;&gt;-->
+                <!--&lt;!&ndash;                <div class="o2_statement_statementDesignerJpql_jpql_where">WHERE</div>&ndash;&gt;-->
+                <!--&lt;!&ndash;                <div class="o2_statement_statementDesignerJpql_jpql_whereContent"></div>&ndash;&gt;-->
+                <!--            </div>-->
+
+                <!--            <div class="o2_statement_statementDesignerJpql_sdelete" style="{{if $.data.type!=='delete'}} display: none {{end if}}">-->
+                <!--&lt;!&ndash;                <div class="o2_statement_statementDesignerJpql_jpql_delete">DELETE</div>&ndash;&gt;-->
+                <!--&lt;!&ndash;                <div class="o2_statement_statementDesignerJpql_jpql_deleteContent"></div>&ndash;&gt;-->
+                <!--&lt;!&ndash;                <div class="o2_statement_statementDesignerJpql_jpql_where">WHERE</div>&ndash;&gt;-->
+                <!--&lt;!&ndash;                <div class="o2_statement_statementDesignerJpql_jpql_whereContent"></div>&ndash;&gt;-->
+                <!--            </div>-->
+            </div>
+        </div>
+        <div class="o2_statement_statementDesignerScript" style="{{if $.data.format!=='script'}} display: none {{end if}}">
+
         </div>
     </div>
-    <div class="o2_statement_statementDesignerScript" style="{{if $.data.format!=='script'}} display: none {{end if}}">
 
+
+    <div class="o2_statement_statementCountJpqlTabPageNode">
+        <div class="o2_statement_statementDesignerCountJpql" style="{{if $.data.format=='script'}} display: none {{end if}}">
+            <div class="o2_statement_statementDesignerCountJpqlLine"></div>
+        </div>
+        <div class="o2_statement_statementDesignerCountScript" style="{{if $.data.format!=='script'}} display: none {{end if}}">
+        </div>
     </div>
 </div>
 
+<div class="o2_statement_resizeNode"></div>
+
+<div class="o2_statement_tabNode"></div>
+
 <div class="o2_statement_statementRunNode">
-    <div class="o2_statement_statementRunTitleNode">{{$.lp.runTest}}</div>
+<!--    <div class="o2_statement_statementRunTitleNode">{{$.lp.runTest}}</div>-->
     <div class="o2_statement_statementRunContentNode">
         <div class="o2_statement_statementRunJsonNode">
 <!--            <div class="o2_statement_statementRunJsonContent"></div>-->
@@ -105,4 +131,6 @@
         </div>
     </div>
 
-</div>
+</div>
+
+<div class="o2_statement_viewNode"></div>

+ 1 - 0
o2web/source/x_component_query_StatementDesigner/$Statement/toolbars.json

@@ -0,0 +1 @@
+[]

+ 332 - 0
o2web/source/x_component_query_StatementDesigner/$Statement/view.html

@@ -0,0 +1,332 @@
+<div style="background-color: #FFF; overflow: hidden">
+    <div title="基本" class="MWFTab">
+        <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
+            <tr>
+                <td class="editTableTitle">标识:</td>
+                <td class="editTableValue">text{$.id}</td>
+            </tr>
+            <tr>
+                <td class="editTableTitle">名称:</td>
+                <td class="editTableValue"><input type="text" name="name" value="text{$.name}" class="editTableInput"/></td>
+            </tr>
+            <tr>
+                <td class="editTableTitle">描述:</td>
+                <td class="editTableValue"><input type="text" name="description" value="text{$.description}" class="editTableInput"/></td>
+            </tr>
+<!--            <tr>-->
+<!--                <td class="editTableTitle">隐藏:</td>-->
+<!--                <td class="editTableValue">-->
+<!--                    <input class="editTableRadio" name="display" text{($.display===false)?'checked':''} type="radio" value="false"/>是-->
+<!--                    <input class="editTableRadio" name="display" text{($.display!==false)?'checked':''} type="radio" value="true"/>否-->
+<!--                </td>-->
+<!--            </tr>-->
+            <tr>
+                <td class="editTableTitle">视图样式:</td>
+                <td class="editTableValue">
+                    <select class="MWFViewStyle" name="data.viewStyleType"></select>
+                </td>
+            </tr>
+<!--            <tr>-->
+<!--                <td class="editTableTitle">展开分类:</td>-->
+<!--                <td class="editTableValue">-->
+<!--                    <input class="editTableRadio" name="data.isExpand" text{($.data.isExpand==='yes')?'checked':''} type="radio" value="yes"/>是-->
+<!--                    <input class="editTableRadio" name="data.isExpand" text{($.data.isExpand!=='yes')?'checked':''} type="radio" value="no"/>否-->
+<!--                </td>-->
+<!--            </tr>-->
+            <tr>
+                <td class="editTableTitle">显示序号:</td>
+                <td class="editTableValue">
+                    <input class="editTableRadio" name="data.isSequence" text{($.data.isSequence==='yes')?'checked':''} type="radio" value="yes"/>是
+                    <input class="editTableRadio" name="data.isSequence" text{($.data.isSequence!=='yes')?'checked':''} type="radio" value="no"/>否
+                </td>
+            </tr>
+<!--            <tr>-->
+<!--                <td class="editTableTitleNoWidth">最大行数:</td>-->
+<!--                <td class="editTableValue"><input type="number" name="count" value="text{$.count || 600}" class="editTableInput"/></td>-->
+<!--            </tr>-->
+            <tr>
+                <td class="editTableTitleNoWidth">每页行数:</td>
+                <td class="editTableValue">
+                    <input type="number" name="pageSize" value="text{$.pageSize || 20}" class="editTableInput"/>
+                </td>
+            </tr>
+            <tr>
+                <td class="editTableTitle">隐藏操作条:</td>
+                <td class="editTableValue">
+                    <input class="editTableRadio" name="data.actionbarHidden" text{($.data.actionbarHidden!==false)?'checked':''} type="radio" value="true"/>是
+                    <input class="editTableRadio" name="data.actionbarHidden" text{($.data.actionbarHidden===false)?'checked':''} type="radio" value="false"/>否
+                </td>
+            </tr>
+            <tr>
+                <td class="editTableTitle">选择:</td>
+                <td class="editTableValue">
+                    <input class="editTableRadio" name="data.select" text{($.data.select!=='single' || $.data.select!=='multi' )?'checked':''} type="radio" value="none"/>无
+                    <input class="editTableRadio" name="data.select" text{($.data.select==='single')?'checked':''} type="radio" value="single"/>单选
+                    <input class="editTableRadio" name="data.select" text{($.data.select==='multi')?'checked':''} type="radio" value="multi"/>多选
+                </td>
+            </tr>
+            <tr>
+                <td class="editTableTitle">无选择隐藏首列</td>
+                <td class="editTableValue">
+                    <input class="editTableRadio" name="data.firstTdHidden" text{($.data.firstTdHidden===true)?'checked':''} type="radio" value="single"/>是
+                    <input class="editTableRadio" name="data.firstTdHidden" text{($.data.firstTdHidden!==true)?'checked':''} type="radio" value="multi"/>否
+                </td>
+            </tr>
+            <tr>
+                <td class="editTableTitle">无数据显示:</td>
+                <td class="editTableValue">
+                    <input type="text" name="data.noDataText" value="text{$.data.noDataText}" class="editTableInput"/>
+                </td>
+            </tr>
+            <!--<tr>-->
+            <!--<td class="editTableTitle">最大行数:</td>-->
+            <!--<td class="editTableValue"><input type="text" name="max" value="text{$.max}" class="editTableInput"/></td>-->
+            <!--</tr>-->
+        </table>
+
+        <div class="MWFFormulaArea" name="data.defaultSelectedScript" title="默认选中行脚本"></div>
+
+
+
+        <!--<div class="MWFApplicationSelect" title="选择应用"></div>-->
+        <!--<div class="MWFProcessSelect" title="选择流程"></div>-->
+        <!--<div class="MWFCompanySelect" title="选择公司"></div>-->
+        <!--<div class="MWFDepartmentSelect" title="选择部门"></div>-->
+        <!--<div class="MWFPersonSelect" title="选择人员"></div>-->
+        <!--<div class="MWFIdentitySelect" title="选择身份"></div>-->
+    </div>
+
+    <div title="过滤"  class="MWFTab">
+        <div class="MWFViewFilter">
+            <div class="inputAreaNode_vf">
+                <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable restrictViewFilterTable_vf" style="table-layout: fixed;">
+                    <tr id="text{$.id}pathInputSelectTr">
+                        <td class="editTableTitle">选择:</td>
+                        <td class="editTableValue">
+                            <select class="pathInputSelect_vf"></select>
+                            <!--                            <div style="line-height: 20px;color:#999;">注:选择路径后,需在选择的值前面加上"表别名.",如:o.</div>-->
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class="editTableTitle">标题:</td>
+                        <td class="editTableValue"><input type="text" class="editTableInput titleInput_vf"/></td>
+                    </tr>
+<!--                    <tr id="text{$.id}parameterInputSelectTr" style="display: none">-->
+<!--                        <td class="editTableTitle">选择参数:</td>-->
+<!--                        <td class="editTableValue">-->
+<!--                            <select class="parameterInputSelect_vf"></select>-->
+<!--                        </td>-->
+<!--                    </tr>-->
+                    <tr id="text{$.id}parameterInputTr" style="display: none">
+                        <td class="editTableTitle">参数:</td>
+                        <td class="editTableValue">
+                            <input type="text" class="editTableInput parameterInput_vf"/>
+                            <div style="line-height: 20px;color:#999;">注:参数对应查询语句和总数语句中形如":field"的where条件,填写"field"。</div>
+                        </td>
+                    </tr>
+                    <tr id="text{$.id}pathInputTr">
+                        <td class="editTableTitle">路径:</td>
+                        <td class="editTableValue">
+                            <input type="text" class="editTableInput pathInput_vf"/>
+                            <div style="line-height: 20px;color:#999;">注:路径的写法是"表别名.字段名",如:o.title</div>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class="editTableTitle">数据类型:</td>
+                        <td class="editTableValue"><select class="datatypeInput_vf">
+<!--                                 onchange="if (this.selectedIndex==2){-->
+<!--                                    $('text{$.id}viewFilterDateFormulaSelector').setStyle('display', 'block');-->
+<!--                                    $('text{$.id}viewFilterDateOnlyFormulaSelector').setStyle('display', 'none');-->
+<!--                                    $('text{$.id}viewFilterTimeOnlyFormulaSelector').setStyle('display', 'none');-->
+<!--                                   }else if (this.selectedIndex==3){-->
+<!--                                    $('text{$.id}viewFilterDateFormulaSelector').setStyle('display', 'none');-->
+<!--                                    $('text{$.id}viewFilterDateOnlyFormulaSelector').setStyle('display', 'block');-->
+<!--                                    $('text{$.id}viewFilterTimeOnlyFormulaSelector').setStyle('display', 'none');-->
+
+<!--                                }else if (this.selectedIndex==4){-->
+<!--                                    $('text{$.id}viewFilterDateFormulaSelector').setStyle('display', 'none');-->
+<!--                                    $('text{$.id}viewFilterDateOnlyFormulaSelector').setStyle('display', 'none');-->
+<!--                                    $('text{$.id}viewFilterTimeOnlyFormulaSelector').setStyle('display', 'block');-->
+<!--                                }else{-->
+<!--                                    $('text{$.id}viewFilterDateFormulaSelector').setStyle('display', 'none');-->
+<!--                                    $('text{$.id}viewFilterDateOnlyFormulaSelector').setStyle('display', 'none');-->
+<!--                                    $('text{$.id}viewFilterTimeOnlyFormulaSelector').setStyle('display', 'none');-->
+<!--                                }-->
+
+<!--                                if (this.selectedIndex==0){-->
+<!--                                    $('text{$.id}viewFilterTextFormulaSelector').setStyle('display', 'block');-->
+<!--                                }else{-->
+<!--                                    $('text{$.id}viewFilterTextFormulaSelector').setStyle('display', 'none');-->
+<!--                                }">-->
+
+                            <option value="textValue" selected>文本</option>
+                            <option value="numberValue">数字</option>
+                            <option value="dateTimeValue">日期时间</option>
+                            <option value="dateValue">日期</option>
+                            <option value="timeValue">时间</option>
+                            <option value="booleanValue">布尔</option>
+                        </select></td>
+                    </tr>
+                    <tr>
+                        <td class="editTableTitle"></td>
+                        <td class="editTableValue">
+                            <input type="radio" class="restrictFilterInput_vf" value="restrict" name="text{$.id}viewFilterType" onclick="if (this.checked){
+                                debugger;
+                                $('text{$.id}viewFilterRestrict').setStyle('display', 'block');
+                                $('text{$.id}parameterInputTr').setStyle('display', 'table-row');
+                                // $('text{$.id}parameterInputSelectTr').setStyle('display', 'table-row');
+                                $('text{$.id}viewCustomFilterRestrict').setStyle('display', 'none');
+                                $('text{$.id}pathInputTr').setStyle('display', 'none');
+                                $('text{$.id}pathInputSelectTr').setStyle('display', 'none');
+                            }"/>作为默认过滤条件<br>
+                            <input type="radio" class="customFilterInput_vf" value="custom" name="text{$.id}viewFilterType" onclick="if (this.checked){
+                                $('text{$.id}viewFilterRestrict').setStyle('display', 'none');
+                                $('text{$.id}parameterInputTr').setStyle('display', 'none');
+                                // $('text{$.id}parameterInputSelectTr').setStyle('display', 'none');
+                                $('text{$.id}viewCustomFilterRestrict').setStyle('display', 'block');
+                                $('text{$.id}pathInputTr').setStyle('display', 'table-row');
+                                $('text{$.id}pathInputSelectTr').setStyle('display', 'table-row');
+                            }" checked/>作为自定义过滤数据
+                        </td>
+                    </tr>
+                </table>
+                 <div id="text{$.id}viewFilterRestrict"  style="display: none">
+                    <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
+                        <tr>
+                            <td class="editTableTitle" id="text{$.id}viewFilterValueTitleArea">值:</td>
+
+                            <td class="editTableValue">
+                                <input class="editTableRadio"  name="viewFilterValueType" type="radio" value="input" checked onclick="
+                                    if (this.checked){
+                                        $('text{$.id}viewFilterValueScriptDiv').setStyle('display', 'none');
+                                        $('text{$.id}viewFilterValueArea').setStyle('display', 'table-row');
+                                        $('text{$.id}viewFilterFormulaSelector').setStyle('display', 'block');
+                                    }
+                                "/>输入
+                                <input class="editTableRadio" name="viewFilterValueType" type="radio" value="script" onclick="
+                                    if (this.checked){
+                                        $('text{$.id}viewFilterValueScriptDiv').setStyle('display', 'block');
+                                        $('text{$.id}viewFilterValueArea').setStyle('display', 'none');
+                                        $('text{$.id}viewFilterFormulaSelector').setStyle('display', 'none');
+                                    }
+                                "/>脚本
+                            </td>
+                        </tr>
+                        <tr id="text{$.id}viewFilterValueArea">
+                            <td class="editTableTitle"></td>
+                            <td class="editTableValue">
+                                <input type="text" class="editTableInput valueTextInput_vf" style="display: block" onkeypress="$('text{$.id}viewFilterTextFormulaSelector').getElements('input').set('checked', false)"/>
+                                <input type="number" class="editTableInput valueNumberInput_vf" style="display: none"/>
+                                <input type="text" class="editTableInput valueDatetimeInput_vf" style="display: none" readonly/>
+                                <input type="text" class="editTableInput valueDateInput_vf" style="display: none" readonly/>
+                                <input type="text" class="editTableInput valueTimeInput_vf" style="display: none" readonly/>
+                                <select class="valueBooleanInput_vf" style="display: none">
+                                    <option value="true" selected>是(True)</option>
+                                    <option value="false">否(False)</option>
+                                </select>
+                            </td>
+                        </tr>
+
+                    </table>
+                     <div id="text{$.id}viewFilterFormulaSelector">
+                        <div style="display: none" id="text{$.id}viewFilterDateFormulaSelector">
+                            <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
+                                <tr>
+                                    <td class="editTableTitle"></td>
+                                    <td class="editTableValue">
+                                        <input onclick="$('text{$.id}viewFilterValueArea').getElement('.valueDatetimeInput_vf').set('value', this.value)" name="text{$.id}viewFilterDateFormula" type="radio" value="@year" />当前年度
+                                        <input onclick="$('text{$.id}viewFilterValueArea').getElement('.valueDatetimeInput_vf').set('value', this.value)" name="text{$.id}viewFilterDateFormula" type="radio" value="@season" />当前季度
+                                        <input onclick="$('text{$.id}viewFilterValueArea').getElement('.valueDatetimeInput_vf').set('value', this.value)" name="text{$.id}viewFilterDateFormula" type="radio" value="@month" />当前月份<br/>
+                                        <input onclick="$('text{$.id}viewFilterValueArea').getElement('.valueDatetimeInput_vf').set('value', this.value)" name="text{$.id}viewFilterDateFormula" type="radio" value="@time" />当前时间
+                                        <input onclick="$('text{$.id}viewFilterValueArea').getElement('.valueDatetimeInput_vf').set('value', this.value)" name="text{$.id}viewFilterDateFormula" type="radio" value="@date" />当天
+
+                                    </td>
+                                </tr>
+                            </table>
+                        </div>
+                        <div style="display: none" id="text{$.id}viewFilterDateOnlyFormulaSelector">
+                            <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
+                                <tr>
+                                    <td class="editTableTitle"></td>
+                                    <td class="editTableValue">
+                                        <input onclick="$('text{$.id}viewFilterValueArea').getElement('.valueDateInput_vf').set('value', this.value)" name="text{$.id}viewFilterDateFormula" type="radio" value="@year" />当前年度
+                                        <input onclick="$('text{$.id}viewFilterValueArea').getElement('.valueDateInput_vf').set('value', this.value)" name="text{$.id}viewFilterDateFormula" type="radio" value="@season" />当前季度
+                                        <input onclick="$('text{$.id}viewFilterValueArea').getElement('.valueDateInput_vf').set('value', this.value)" name="text{$.id}viewFilterDateFormula" type="radio" value="@month" />当前月份<br/>
+                                        <input onclick="$('text{$.id}viewFilterValueArea').getElement('.valueDateInput_vf').set('value', this.value)" name="text{$.id}viewFilterDateFormula" type="radio" value="@date" />当天
+
+                                    </td>
+                                </tr>
+                            </table>
+                        </div>
+                        <div style="display: none" id="text{$.id}viewFilterTimeOnlyFormulaSelector">
+                            <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
+                                <tr>
+                                    <td class="editTableTitle"></td>
+                                    <td class="editTableValue">
+                                        <input onclick="$('text{$.id}viewFilterValueArea').getElement('.valueTimeInput_vf').set('value', this.value)" name="text{$.id}viewFilterDateFormula" type="radio" value="@time" />当前时间
+                                    </td>
+                                </tr>
+                            </table>
+                        </div>
+                        <div style="display: block" id="text{$.id}viewFilterTextFormulaSelector">
+                            <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
+                                <tr>
+                                    <td class="editTableTitle"></td>
+                                    <td class="editTableValue">
+                                        <input onclick="$('text{$.id}viewFilterValueArea').getElement('.valueTextInput_vf').set('value', this.value)" name="text{$.id}viewFilterTextFormula" onclick="" type="radio" value="@person" />当前人
+                                        <input onclick="$('text{$.id}viewFilterValueArea').getElement('.valueTextInput_vf').set('value', this.value)" name="text{$.id}viewFilterTextFormula" type="radio" value="@identityList" />当前身份<br/>
+                                        <input onclick="$('text{$.id}viewFilterValueArea').getElement('.valueTextInput_vf').set('value', this.value)" name="text{$.id}viewFilterTextFormula" type="radio" value="@unitList" />当前人所在直接组织<br/>
+                                        <input onclick="$('text{$.id}viewFilterValueArea').getElement('.valueTextInput_vf').set('value', this.value)" name="text{$.id}viewFilterTextFormula" type="radio" value="@unitAllList" />当前人所在所有组织
+                                    </td>
+                                </tr>
+                            </table>
+                        </div>
+                     </div>
+                     <div style="display:none" id="text{$.id}viewFilterValueScriptDiv">
+                         <div name="text{$.id}viewFilterValueScript" title="脚本"></div>
+                     </div>
+                </div>
+
+
+                <div id="text{$.id}viewCustomFilterRestrict"  style="display: block">
+                    <table width="100%" border="0" cellpadding="5" cellspacing="0" class="editTable">
+                        <tr>
+                            <td class="editTableTitle">值:</td>
+                            <td class="editTableValue">
+                                <input class="editTableRadio" onclick="
+                                if (this.checked){
+                                    $('text{$.id}viewCustomFilterValueScriptDiv').setStyle('display', 'none');
+                                }" name="viewCustomFilterValueType" checked type="radio" value="input"/>用户输入
+                                <input class="editTableRadio" onclick="
+                                if (this.checked){
+                                    $('text{$.id}viewCustomFilterValueScriptDiv').setStyle('display', 'block');
+                                }" name="viewCustomFilterValueType" type="radio" value="script"/>可选
+                            </td>
+                        </tr>
+                    </table>
+                    <div style="display:none" id="text{$.id}viewCustomFilterValueScriptDiv">
+                        <div style="padding: 5px">return ["选项文本|选项值"]</div>
+                        <div name="text{$.id}viewCustomFilterValueScript" title="选项脚本"></div>
+                    </div>
+                </div>
+            </div>
+            <div class="actionAreaNode_vf"></div>
+            <div style="height: 20px; line-height: 20px; text-align:center; background-color: #eeeeee">默认过滤条件</div>
+            <div class="listAreaNode_vf" style="min-height: 56px; border-bottom:1px solid #CCCCCC; overflow: hidden;"></div>
+            <div style="height: 20px; line-height: 20px; text-align:center; background-color: #eeeeee">自定义过滤数据</div>
+            <div class="fieldListAreaNode_vf" style="min-height: 56px; border-bottom:1px solid #CCCCCC; overflow: hidden;"></div>
+        </div>
+    </div>
+
+    <div title="样式"  class="MWFTab">
+        <div class="MWFViewStylesArea" name="data.viewStyles"></div>
+    </div>
+
+    <div title="事件"  class="MWFTab">
+        <div class="MWFEventsArea" name="data.events"></div>
+    </div>
+
+    <div title="JSON"  class="MWFTab">
+        <div class="MWFJSONArea" style="font-family: Verdana, Geneva, sans-serif; font-size:14px"></div>
+    </div>
+</div>

+ 69 - 0
o2web/source/x_component_query_StatementDesigner/$Statement/view.json

@@ -0,0 +1,69 @@
+{
+  "name": "",
+  "id": "",
+  "query": "",
+  "alias": "",
+  "description": "",
+  "display": true,
+  "type": "View",
+  "pageSize" : "20",
+  "data": {
+//    "exportGrid": true,
+//    "exportGoupGrid": true,
+    "noDataText" : "未找到数据",
+    "selectList": [],
+    "filterList": [],
+    "orderList": [],
+    "group": {},
+    "columnList": [],
+//    "calculate": {},
+//    "afterGridScriptText": "",
+//    "afterGroupGridScriptText": "",
+//    "afterCalculateGridScriptText": "",
+    "actionbarHidden" : true,
+    "events": {
+      "queryLoad" : {
+        "code": "",
+        "html": ""
+      },
+      "postLoad": {
+        "code": "",
+        "html": ""
+      },
+      "postLoadPageData" : {
+        "code": "",
+        "html": ""
+      },
+      "postLoadPage": {
+        "code": "",
+        "html": ""
+      },
+      "queryLoadItemRow": {
+        "code": "",
+        "html": ""
+      },
+      "postLoadItemRow": {
+        "code": "",
+        "html": ""
+      },
+//      "queryLoadCategoryRow": {
+//        "code": "",
+//        "html": ""
+//      },
+//      "postLoadCategoryRow": {
+//        "code": "",
+//        "html": ""
+//      },
+      "selectRow" : {
+        "code": "",
+        "html": ""
+      },
+      "unselectRow" : {
+        "code": "",
+        "html": ""
+      }
+    }
+  }
+//  "availableIdentityList": [],
+//  "availableUnitList": []
+}

+ 45 - 43
o2web/source/x_component_query_StatementDesigner/Main.js

@@ -299,20 +299,22 @@ MWF.xApplication.query.StatementDesigner.Main = new Class({
             "styles": this.css.designerContentNode
         }).inject(this.designerNode);
 
-        // this.designerStatementArea = new Element("div", {
-        //     "styles": this.css.designerStatementArea
-        // }).inject(this.designerContentNode);
-        //
-        // this.designerStatementPercent = 0.6;
-        // this.designerContentResizeNode = new Element("div", {
-        //     "styles": this.css.designerContentResizeNode
-        // }).inject(this.designerContentNode);
+        this.designerStatementArea = new Element("div", {
+            "styles": this.css.designerStatementArea
+        }).inject(this.designerContentNode);
+        this.propertyDomArea = this.designerStatementArea;
+
+        this.designerStatementPercent = 0.6;
+        this.designerContentResizeNode = new Element("div", {
+            "styles": this.css.designerContentResizeNode
+        }).inject(this.designerContentNode);
 
         this.designerContentArea = new Element("div", {
             "styles": this.css.designerContentArea
         }).inject(this.designerContentNode);
+        this.propertyContentArea = this.designerContentArea;
 
-        //this.loadDesignerStatementResize();
+        this.loadDesignerStatementResize();
         //this.setPropertyContent();
         this.designerNode.addEvent("keydown", function(e){e.stopPropagation();});
     },
@@ -348,37 +350,37 @@ MWF.xApplication.query.StatementDesigner.Main = new Class({
             }.bind(this)
         });
     },
-    // loadDesignerStatementResize: function(){
-    //     this.designerContentResize = new Drag(this.designerContentResizeNode, {
-    //         "snap": 1,
-    //         "onStart": function(el, e){
-    //             var x = (Browser.name=="firefox") ? e.event.clientX : e.event.x;
-    //             var y = (Browser.name=="firefox") ? e.event.clientY : e.event.y;
-    //             el.store("position", {"x": x, "y": y});
-    //
-    //             var size = this.designerStatementArea.getSize();
-    //             el.store("initialHeight", size.y);
-    //         }.bind(this),
-    //         "onDrag": function(el, e){
-    //             var size = this.designerContentNode.getSize();
-    //
-    //             //			var x = e.event.x;
-    //             var y = (Browser.name=="firefox") ? e.event.clientY : e.event.y;
-    //             var position = el.retrieve("position");
-    //             var dy = y.toFloat()-position.y.toFloat();
-    //
-    //             var initialHeight = el.retrieve("initialHeight").toFloat();
-    //             var height = initialHeight+dy;
-    //             if (height<40) height = 40;
-    //             if (height> size.y-40) height = size.y-40;
-    //
-    //             this.designerStatementPercent = height/size.y;
-    //
-    //             this.setDesignerStatementResize();
-    //
-    //         }.bind(this)
-    //     });
-    // },
+    loadDesignerStatementResize: function(){
+        this.designerContentResize = new Drag(this.designerContentResizeNode, {
+            "snap": 1,
+            "onStart": function(el, e){
+                var x = (Browser.name=="firefox") ? e.event.clientX : e.event.x;
+                var y = (Browser.name=="firefox") ? e.event.clientY : e.event.y;
+                el.store("position", {"x": x, "y": y});
+
+                var size = this.designerStatementArea.getSize();
+                el.store("initialHeight", size.y);
+            }.bind(this),
+            "onDrag": function(el, e){
+                var size = this.designerContentNode.getSize();
+
+                //			var x = e.event.x;
+                var y = (Browser.name=="firefox") ? e.event.clientY : e.event.y;
+                var position = el.retrieve("position");
+                var dy = y.toFloat()-position.y.toFloat();
+
+                var initialHeight = el.retrieve("initialHeight").toFloat();
+                var height = initialHeight+dy;
+                if (height<40) height = 40;
+                if (height> size.y-40) height = size.y-40;
+
+                this.designerStatementPercent = height/size.y;
+
+                this.setDesignerStatementResize();
+
+            }.bind(this)
+        });
+    },
     setDesignerStatementResize: function(){
         var size = this.designerContentNode.getSize();
         //var resizeNodeSize = this.designerContentResizeNode.getSize();
@@ -495,9 +497,9 @@ MWF.xApplication.query.StatementDesigner.Main = new Class({
 		}.bind(this));
 	},
 
-
-
-
+    preview : function(){
+        this.statement.preview();
+    },
 
     saveStatement: function(){
         this.statement.save(function(){

+ 53 - 646
o2web/source/x_component_query_StatementDesigner/Property.js

@@ -1,48 +1,17 @@
 MWF.require("MWF.widget.Common", null, false);
 MWF.require("MWF.widget.JsonTemplate", null, false);
-MWF.xApplication.query.TableDesigner.Property = MWF.FTProperty = new Class({
-	Extends: MWF.widget.Common,
-	Implements: [Options, Events],
-	options: {
-		"style": "default",
-		"path": "../x_component_query_FormDesigner/property/property.html"
-	},
-	
-	initialize: function(module, propertyNode, designer, options){
-		this.setOptions(options);
-		this.module = module;
-		this.view = module.view;
-		this.data = module.json;
-		this.htmlPath = this.options.path;
-		this.designer = designer;
-		
-		this.propertyNode = propertyNode;
-	},
-	load: function(){
-		if (this.fireEvent("queryLoad")){
-			MWF.getRequestText(this.htmlPath, function(responseText, responseXML){
-				this.htmlString = responseText;
-                this.fireEvent("postLoad");
-			}.bind(this));
-		}
-        this.propertyNode.addEvent("keydown", function(e){e.stopPropagation();});
-	},
-	editProperty: function(td){
-	},
-    getHtmlString: function(callback){
-        if (!this.htmlString){
-            MWF.getRequestText(this.htmlPath, function(responseText, responseXML){
-                this.htmlString = responseText;
-                if (callback) callback();
-            }.bind(this));
-        }else{
-            if (callback) callback();
-        }
+
+MWF.xDesktop.requireApp("query.ViewDesigner", "Property", null, false);
+MWF.xApplication.query.StatementDesigner.Property = MWF.SDProperty = new Class({
+    Extends: MWF.xApplication.query.ViewDesigner.Property,
+    Implements: [Options, Events],
+    options: {
+        "style": "default"
     },
-	show: function(){
-        if (!this.propertyContent){
-            this.getHtmlString(function(){
-                if (this.htmlString){
+    show: function () {
+        if (!this.propertyContent) {
+            this.getHtmlString(function () {
+                if (this.htmlString) {
                     this.JsonTemplate = new MWF.widget.JsonTemplate(this.data, this.htmlString);
                     this.propertyContent = new Element("div", {"styles": {"overflow": "hidden"}}).inject(this.propertyNode);
                     this.propertyContent.set("html", this.JsonTemplate.load());
@@ -52,621 +21,59 @@ MWF.xApplication.query.TableDesigner.Property = MWF.FTProperty = new Class({
                     this.loadPropertyTab();
                     this.loadPersonInput();
                     this.loadPersonSelectInput();
-                    // this.loadViewSelect();
-                    // this.loadStatColumnSelect();
-                    this.loadArrayList();
+                    this.loadViewFilter();
                     this.loadScriptArea();
-                    this.loadJSONArea();
-
-                    //this.view.changeViewSelected();
-                    //this.module.changeViewSelected();
-                }
-            }.bind(this));
-        }else{
-            this.propertyContent.setStyle("display", "block");
-        }
-	},
-	hide: function(){
-		//this.JsonTemplate = null;
-		//this.propertyNode.set("html", "");
-        if (this.propertyContent) this.propertyContent.setStyle("display", "none");
-	},
-
-	loadJSONArea: function(){
-		var jsonNode = this.propertyContent.getElement(".MWFJSONArea");
-
-        if (jsonNode){
-            this.propertyTab.pages.each(function(page){
-                if (page.contentNode == jsonNode.parentElement){
-                    page.setOptions({
-                        "onShow": function(){
-                            jsonNode.empty();
-                            MWF.require("MWF.widget.JsonParse", function(){
-                                this.json = new MWF.widget.JsonParse(this.module.json, jsonNode, null);
-                                this.json.load();
-                            }.bind(this));
-                        }.bind(this)
-                    });
-                }
-            }.bind(this));
-        }
-	},
-	loadPropertyTab: function(){
-		var tabNodes = this.propertyContent.getElements(".MWFTab");
-		if (tabNodes.length){
-			var tmpNode = this.propertyContent.getFirst();
-			var tabAreaNode = new Element("div", {
-				"styles": this.view.css.propertyTabNode
-			}).inject(tmpNode, "before");
-			
-			MWF.require("MWF.widget.Tab", function(){
-				var tab = new MWF.widget.Tab(tabAreaNode, {"style": "formPropertyList"});
-				tab.load();
-				var tabPages = [];
-				tabNodes.each(function(node){
-					var page = tab.addTab(node, node.get("title"), false);
-					tabPages.push(page);
-					this.setScrollBar(page.contentNodeArea, "small", null, null);
-				}.bind(this));
-				tabPages[0].showTab();
-				
-				this.propertyTab = tab;
-				
-				this.designer.resizeNode();
-			}.bind(this), false);
-		}
-	},
-	
-	setEditNodeEvent: function(){
-		var property = this;
-	//	var inputs = this.process.propertyListNode.getElements(".editTableInput");
-		var inputs = this.propertyContent.getElements("input");
-		inputs.each(function(input){
-			var jsondata = input.get("name");
-            if (jsondata && jsondata.substr(0,1)!="_"){
-                if (this.module){
-                    var id = this.module.json.id;
-                    input.set("name", id+jsondata);
-                }
-
-                if (jsondata){
-                    var inputType = input.get("type").toLowerCase();
-                    switch (inputType){
-                        case "radio":
-                            input.addEvent("change", function(e){
-                                property.setRadioValue(jsondata, this);
-                            });
-                            //input.addEvent("blur", function(e){
-                            //    property.setRadioValue(jsondata, this);
-                            //});
-                            input.addEvent("keydown", function(e){
-                                e.stopPropagation();
-                            });
-                            property.setRadioValue(jsondata, input);
-                            break;
-                        case "checkbox":
-
-                            input.addEvent("change", function(e){
-                                property.setCheckboxValue(jsondata, this);
-                            });
-                            input.addEvent("click", function(e){
-                                property.setCheckboxValue(jsondata, this);
-                            });
-                            input.addEvent("keydown", function(e){
-                                e.stopPropagation();
-                            });
-                            break;
-                        default:
-                            input.addEvent("change", function(e){
-                                property.setValue(jsondata, this.value, this);
-                            });
-                            input.addEvent("blur", function(e){
-                                property.setValue(jsondata, this.value, this);
-                            });
-                            input.addEvent("keydown", function(e){
-                                if (e.code==13){
-                                    property.setValue(jsondata, this.value, this);
-                                }
-                                e.stopPropagation();
-                            });
-                            if (input.hasClass("editTableInputDate")){
-                                this.loadCalendar(input);
-                            }
-                    }
-                }
-            }
-		}.bind(this));
-		
-		var selects = this.propertyContent.getElements("select");
-		selects.each(function(select){
-			var jsondata = select.get("name");
-			if (jsondata){
-				select.addEvent("change", function(e){
-					property.setSelectValue(jsondata, this);
-				});
-                //property.setSelectValue(jsondata, select);
-			}
-		});
-		
-		var textareas = this.propertyContent.getElements("textarea");
-		textareas.each(function(input){
-			var jsondata = input.get("name");
-			if (jsondata){
-				input.addEvent("change", function(e){
-					property.setValue(jsondata, this.value);
-				});
-				input.addEvent("blur", function(e){
-					property.setValue(jsondata, this.value);
-				});
-                input.addEvent("keydown", function(e){
-                    e.stopPropagation();
-                });
-			}
-		}.bind(this));
-		
-	},
-    loadCalendar: function(node){
-        MWF.require("MWF.widget.Calendar", function(){
-            this.calendar = new MWF.widget.Calendar(node, {
-                "style": "xform",
-                "isTime": false,
-                "target": this.module.designer.content,
-                "format": "%Y-%m-%d",
-                "onComplate": function(){
-                    //this.validationMode();
-                    //this.validation();
-                    //this.fireEvent("complete");
-                }.bind(this)
-            });
-            //this.calendar.show();
-        }.bind(this));
-    },
-    changeStyle: function(name){
-        this.module.setPropertiesOrStyles(name);
-    },
-    changeData: function(name, input, oldValue){
-        this.module._setEditStyle(name, input, oldValue);
-    },
-    changeJsonDate: function(key, value){
-        if (typeOf(key)!="array") key = [key];
-        var o = this.data;
-        var len = key.length-1;
-        key.each(function(n, i){
-            if (!o[n]) o[n] = {};
-            if (i<len) o = o[n];
-        }.bind(this));
-        o[key[len]] = value;
-    },
-	setRadioValue: function(name, input){
-
-		if (input.checked){
-            var i = name.indexOf("*");
-            var names = (i==-1) ? name.split(".") : name.substr(i+1, name.length).split(".");
 
-			var value = input.value;
-			if (value=="false") value = false;
-			if (value=="true") value = true;
-
-            var oldValue = this.data;
-            for (var idx = 0; idx<names.length; idx++){
-                if (!oldValue[names[idx]]){
-                    oldValue = null;
-                    break;
-                }else{
-                    oldValue = oldValue[names[idx]];
-                }
-            }
+                    this.loadColumnExportEditor();
 
-			//var oldValue = this.data[name];
-			this.changeJsonDate(names, value);
-            this.changeData(name, input, oldValue);
-		}
-	},
-	setCheckboxValue: function(name, input){
-        var i = name.indexOf("*");
-        var names = (i==-1) ? name.split(".") : name.substr(i+1, name.length).split(".");
-
-        var id = this.module.json.id;
-        var checkboxList = $$("input[name='"+id+name+"']");
-		var values = [];
-		checkboxList.each(function(checkbox){
-			if (checkbox.get("checked")){
-				values.push(checkbox.value);
-			}
-		});
-        var o = this.data;
-        names.each(function(k){ o = o[k]; }.bind(this));
-		var oldValue = o;
-
-        this.changeJsonDate(names, values);
-        this.changeData(name, input, oldValue);
-	},
-	setSelectValue: function(name, select){
-		var idx = select.selectedIndex;
-		var options = select.getElements("option");
-		var value = "";
-		if (options[idx]){
-			value = options[idx].get("value");
-		}
-		var oldValue = this.data[name];
-		//this.data[name] = value;
-        var names = name.split(".");
-        this.changeJsonDate(names, value);
-        this.changeData(name, select, oldValue);
-	},
-	
-	setValue: function(name, value, obj){
-        var names = name.split(".");
-        var oldValue = this.data;
-        for (var idx = 0; idx<names.length; idx++){
-            if (!oldValue[names[idx]]){
-                oldValue = null;
-                break;
-            }else{
-                oldValue = oldValue[names[idx]];
-            }
-        }
-
-		//var oldValue = this.data[name];
-		//this.data[name] = value;
-        this.changeJsonDate(names, value);
-        this.changeData(name, obj, oldValue);
-	},
-	setEditNodeStyles: function(node){
-		var nodes = node.getChildren();
-		if (nodes.length){
-			nodes.each(function(el){
-				var cName = el.get("class");
-				if (cName){
-					if (this.view.css[cName]) el.setStyles(this.view.css[cName]);
-				}
-				this.setEditNodeStyles(el);
-			}.bind(this));
-		}
-	},
-    loadPersonInput: function(){
-        var personIdentityNodes = this.propertyContent.getElements(".MWFPersonIdentity");
-        var personUnitNodes = this.propertyContent.getElements(".MWFPersonUnit");
-        var dutyNodes = this.propertyContent.getElements(".MWFDutySelector");
-        var dutyNameNodes = this.propertyContent.getElements(".MWFPersonDuty");
-        var viewNodes = this.propertyContent.getElements(".MWFViewSelect");
-        var cmsviewNodes = this.propertyContent.getElements(".MWFCMSViewSelect");
-        var queryviewNodes = this.propertyContent.getElements(".MWFQueryViewSelect");
-        var querystatNodes = this.propertyContent.getElements(".MWFQueryStatSelect");
-        MWF.xDesktop.requireApp("process.ProcessDesigner", "widget.PersonSelector", function(){
-            personIdentityNodes.each(function(node){
-                new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.view.designer, {
-                    "type": "identity",
-                    "names": this.data[node.get("name")],
-                    "onChange": function(ids){this.savePersonItem(node, ids);}.bind(this)
-                });
-            }.bind(this));
-
-            personUnitNodes.each(function(node){
-                new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.view.designer, {
-                    "type": "unit",
-                    "names": this.data[node.get("name")],
-                    "onChange": function(ids){this.savePersonItem(node, ids);}.bind(this)
-                });
-            }.bind(this));
-            dutyNodes.each(function(node){
-                new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.view.designer, {
-                    "type": "duty",
-                    "names": this.data[node.get("name")],
-                    "onChange": function(ids){this.addDutyItem(node, ids);}.bind(this),
-                    "onRemoveDuty": function(item){this.removeDutyItem(node, item);}.bind(this)
-                });
-            }.bind(this));
-
-            dutyNameNodes.each(function(node){
-                new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.view.designer, {
-                    "type": "dutyName",
-                    "names": this.data[node.get("name")],
-                    "onChange": function(ids){this.savePersonItem(node, ids);}.bind(this)
-                });
-            }.bind(this));
-
-            viewNodes.each(function(node){
-                new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.view.designer, {
-                    "type": "View",
-                    "count": 1,
-                    "names": [this.data[node.get("name")]],
-                    "onChange": function(ids){this.saveViewItem(node, ids);}.bind(this)
-                });
-            }.bind(this));
-            cmsviewNodes.each(function(node){
-                new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.view.designer, {
-                    "type": "CMSView",
-                    "count": 1,
-                    "names": [this.data[node.get("name")]],
-                    "onChange": function(ids){this.saveViewItem(node, ids);}.bind(this)
-                });
-            }.bind(this));
-            queryviewNodes.each(function(node){
-                new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.view.designer, {
-                    "type": "QueryView",
-                    "count": 1,
-                    "names": [this.data[node.get("name")]],
-                    "onChange": function(ids){this.saveViewItem(node, ids);}.bind(this)
-                });
-            }.bind(this));
-
-            querystatNodes.each(function(node){
-                new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.view.designer, {
-                    "type": "QueryStat",
-                    "count": 1,
-                    "names": [this.data[node.get("name")]],
-                    "onChange": function(ids){this.saveViewItem(node, ids);}.bind(this)
-                });
-            }.bind(this));
-        }.bind(this));
-        // var identityNodes = this.propertyContent.getElements(".MWFPersonIdentity");
-        // var personUnitNodes = this.propertyContent.getElements(".MWFPersonUnit");
-        //
-        // MWF.xDesktop.requireApp("process.ProcessDesigner", "widget.PersonSelector", function(){
-        //     identityNodes.each(function(node){
-        //         new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.view.designer, {
-        //             "type": "identity",
-        //             "names": this.data[node.get("name")],
-        //             "onChange": function(ids){this.savePersonItem(node, ids);}.bind(this)
-        //         });
-        //     }.bind(this));
-        //
-        //     personUnitNodes.each(function(node){
-        //         new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.view.designer, {
-        //             "type": "unit",
-        //             "names": this.data[node.get("name")],
-        //             "onChange": function(ids){this.savePersonItem(node, ids);}.bind(this)
-        //         });
-        //     }.bind(this));
-        // }.bind(this));
-    },
-    saveViewItem: function(node, ids){
-        var oldValue = this.data[node.get("name")];
-        if (ids[0]){
-            var view = ids[0].data;
-            var data = {
-                "name": view.name,
-                "alias": view.alias,
-                "id": view.id,
-                "appName" : view.appName || view.applicationName,
-                "appId": view.appId,
-                "application": view.application
-            };
-            this.data[node.get("name")] = view.id;
-        }else{
-            this.data[node.get("name")] = null;
-        }
-        this.changeData(node.get("name"), node, oldValue);
-        //if (this.module._checkView) this.module._checkView();
-    },
-    removeViewItem: function(node, item){
-
-    },
-    savePersonItem: function(node, ids){
-        var values = [];
-        ids.each(function(id){
-            //values.push({"name": (id.data.distinguishedName || id.data.name), "id": id.data.id});
-            values.push((id.data.distinguishedName || id.data.id || id.data.name));
-        }.bind(this));
-        var name = node.get("name");
-
-        key = name.split(".");
-        var o = this.data;
-        var len = key.length-1;
-        key.each(function(n, i){
-            if (!o[n]) o[n] = {};
-            if (i<len) o = o[n];
-        }.bind(this));
-        o[key[len]] = values;
-
-        //this.data.data.restrictWhereEntry[node.get("name")] = values;
-    },
-
-    loadPersonSelectInput: function(){
-        var applicationNodes = this.propertyContent.getElements(".MWFSelectApplication");
-        var processNodes = this.propertyContent.getElements(".MWFSelectProcess");
-        // var companyNodes = this.propertyContent.getElements(".MWFSelectCompany");
-        // var departmentNodes = this.propertyContent.getElements(".MWFSelectDepartment");
-        var personNodes = this.propertyContent.getElements(".MWFSelectPerson");
-        var identityNodes = this.propertyContent.getElements(".MWFSelectIdentity");
-        var personUnitNodes = this.propertyContent.getElements(".MWFSelectUnit");
-
-        MWF.xDesktop.requireApp("process.ProcessDesigner", "widget.PersonSelector", function(){
-            applicationNodes.each(function(node){
-                new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.view.designer, {
-                    "type": "application",
-                    "names": (this.data.data.restrictWhereEntry) ? this.data.data.restrictWhereEntry.applicationList : [],
-                    "onChange": function(ids){this.savePersonSelectItem(node, ids);}.bind(this)
-                });
-            }.bind(this));
-            processNodes.each(function(node){
-                new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.view.designer, {
-                    "type": "process",
-                    "names": (this.data.data.restrictWhereEntry) ? this.data.data.restrictWhereEntry.processList : [],
-                    "onChange": function(ids){this.savePersonSelectItem(node, ids);}.bind(this)
-                });
-            }.bind(this));
-            personUnitNodes.each(function(node){
-                new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.view.designer, {
-                    "type": "unit",
-                    "names": (this.data.data.restrictWhereEntry) ? this.data.data.restrictWhereEntry.unitList : [],
-                    "onChange": function(ids){this.savePersonSelectItem(node, ids);}.bind(this)
-                });
-            }.bind(this));
-
-            personNodes.each(function(node){
-                new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.view.designer, {
-                    "type": "person",
-                    "names": (this.data.data.restrictWhereEntry) ? this.data.data.restrictWhereEntry.personList : [],
-                    "onChange": function(ids){this.savePersonSelectItem(node, ids);}.bind(this)
-                });
-            }.bind(this));
-
-            identityNodes.each(function(node){
-                new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.view.designer, {
-                    "type": "identity",
-                    "names": (this.data.data.restrictWhereEntry) ? this.data.data.restrictWhereEntry.identityList : [],
-                    "onChange": function(ids){this.savePersonSelectItem(node, ids);}.bind(this)
-                });
-            }.bind(this));
-        }.bind(this));
-    },
-    savePersonSelectItem: function(node, ids){
-        //this.initWhereEntryData();
-
-        var values = [];
-        ids.each(function(id){
-            values.push({"name": id.data.name, "id": id.data.id});
-        }.bind(this));
-        var name = node.get("name");
-
-        key = name.split(".");
-        var o = this.data;
-        var len = key.length-1;
-        key.each(function(n, i){
-            if (!o[n]) o[n] = {};
-            if (i<len) o = o[n];
-        }.bind(this));
-        o[key[len]] = values;
-
-        //this.data.data.restrictWhereEntry[node.get("name")] = values;
-    },
-
-    loadArrayList: function(){
-        var arrays = this.propertyContent.getElements(".MWFArraylist");
-        arrays.each(function(node){
-            var title = node.get("title");
-            var name = node.get("name");
+                    this.loadJSONArea();
 
-            var names = name.split(".");
-            var arr = this.data;
-            for (var idx = 0; idx<names.length; idx++){
-                if (!arr[names[idx]]){
-                    arr = null;
-                    break;
-                }else{
-                    arr = arr[names[idx]];
+                    this.loadEventsEditor();
+                    this.loadViewStylesArea();
+                    this.loadPagingStylesArea();
+                    this.loadActionStylesArea();
+                    this.loadActionArea();
+                    this.loadStylesList();
+                    this.loadMaplist();
+                    this.loadDataPathSelect();
                 }
-            }
-            //var arr = this.data[name];
-            if (!arr) arr = [];
-            MWF.require("MWF.widget.Arraylist", function(){
-                var arraylist = new MWF.widget.Arraylist(node, {
-                    "title": title,
-                    "onChange": function(){
-                        this.setValue(name, arraylist.toArray(), node);
-
-                        //this.data[name] = arraylist.toArray();
-                    }.bind(this)
-                });
-                arraylist.load(arr);
-            }.bind(this));
-            node.addEvent("keydown", function(e){e.stopPropagation();});
-        }.bind(this));
-    },
-
-    loadStatColumnSelect: function(){
-        var columnNodes = this.propertyContent.getElements(".MWFStatSelectColumn");
-        if (columnNodes.length){
-            columnNodes.each(function(node){
-                var key = node.get("name");
-                var v = this.data[key];
-                node.empty();
-                new Element("option", {
-                    "value": "",
-                    "selected": true,
-                    "text": this.module.designer.lp.category
-                }).inject(node);
-                this.module.items.each(function(item){
-                    new Element("option", {
-                        "value": item.json.id,
-                        "selected": (v===item.json.id),
-                        "text": item.json.displayName
-                    }).inject(node);
-                }.bind(this));
             }.bind(this));
+        } else {
+            this.propertyContent.setStyle("display", "block");
         }
     },
-    // loadViewSelect: function(){
-    //     var viewNodes = this.propertyContent.getElements(".MWFViewSelect");
-    //     if (viewNodes.length){
-    //         this.getViewList(function(){
-    //             viewNodes.each(function(node){
-    //                 var select = new Element("select").inject(node);
-    //                 select.addEvent("change", function(e){
-    //                     var viewId = e.target.options[e.target.selectedIndex].value;
-    //                     var viewName = e.target.options[e.target.selectedIndex].get("text");
-    //                     this.setValue(e.target.getParent("div").get("name"), viewId);
-    //                     this.setValue(e.target.getParent("div").get("name")+"Name", viewName);
-    //                 }.bind(this));
-    //                 this.setViewSelectOptions(node, select);
-    //
-    //                 var refreshNode = new Element("div", {"styles": this.view.css.propertyRefreshFormNode}).inject(node);
-    //                 refreshNode.addEvent("click", function(e){
-    //                     this.getViewList(function(){
-    //                         this.setViewSelectOptions(node, select);
-    //                     }.bind(this), true);
-    //                 }.bind(this));
-    //                 //select.addEvent("click", function(e){
-    //                 //    this.setFormSelectOptions(node, select);
-    //                 //}.bind(this));
-    //             }.bind(this));
-    //         }.bind(this));
-    //     }
-    // },
-    // setViewSelectOptions: function(node, select){
-    //     var name = node.get("name");
-    //     select.empty();
-    //     var option = new Element("option", {"text": "(none)"}).inject(select);
-    //     this.views.each(function(view){
-    //         var option = new Element("option", {
-    //             "text": view.name,
-    //             "value": view.id,
-    //             "selected": (this.data[name]==view.id)
-    //         }).inject(select);
-    //     }.bind(this));
-    // },
-    // getViewList: function(callback, refresh){
-    //     if (!this.views || refresh){
-    //         this.view.designer.actions.listView(this.view.designer.application.id, function(json){
-    //             this.views = json.data;
-    //             if (callback) callback();
-    //         }.bind(this));
-    //     }else{
-    //         if (callback) callback();
-    //     }
-    // },
-    loadScriptArea: function(){
-
-        var scriptAreas = this.propertyContent.getElements(".MWFScriptArea");
-        var formulaAreas = this.propertyContent.getElements(".MWFFormulaArea");
-        this.loadScriptEditor(scriptAreas);
-        this.loadScriptEditor(formulaAreas, "formula");
+    loadDataPathSelect : function(){
+        var nodes = this.propertyContent.getElements(".MWFDataPathSelect");
+        nodes.each( function (select) {
+            select.empty();
+            var option = new Element("option", {"text": "none", "value" : ""}).inject(select);
+            this.module.getColumnDataPath().each(function(model){
+                var option = new Element("option", {
+                    "text": model,
+                    "value": model,
+                    "selected": (this.data[name]==model)
+                }).inject(select);
+            }.bind(this));
+        }.bind(this))
     },
-    loadScriptEditor: function(scriptAreas, style){
-        scriptAreas.each(function(node){
-            var title = node.get("title");
-            var name = node.get("name");
-            var scriptContent = this.data[name];
-
-            MWF.require("MWF.widget.ScriptArea", function(){
-                var scriptArea = new MWF.widget.ScriptArea(node, {
-                    "title": title,
-                    //"maxObj": this.propertyNode.parentElement.parentElement.parentElement,
-                    "maxObj": this.designer.editContentNode,
-                    "onChange": function(){
-                        this.data[name] = scriptArea.toJson().code;
-                    }.bind(this),
-                    "onSave": function(){
-                        this.designer.saveView();
-                    }.bind(this),
-                    "style": style || "default",
-                    "runtime": "server"
+    loadViewFilter: function () {
+        var nodes = this.propertyContent.getElements(".MWFViewFilter");
+        var filtrData = this.view.data.data.filterList;
+        var customData = this.view.data.data.customFilterList;
+        nodes.each(function (node) {
+            MWF.xDesktop.requireApp("query.StatementDesigner", "widget.ViewFilter", function () {
+                var _slef = this;
+                this.viewFilter = new MWF.xApplication.query.StatementDesigner.widget.ViewFilter(node, this.view.designer, {
+                    "filtrData": filtrData,
+                    "customData": customData
+                }, {
+                    "onChange": function (ids) {
+                        var data = this.getData();
+                        _slef.changeJsonDate(["data", "filterList"], data.data);
+                        _slef.changeJsonDate(["data", "customFilterList"], data.customData);
+                    }
                 });
-                scriptArea.load({"code": scriptContent});
             }.bind(this));
-
         }.bind(this));
     }
 });

+ 1508 - 171
o2web/source/x_component_query_StatementDesigner/Statement.js

@@ -3,10 +3,11 @@ MWF.xApplication.query = MWF.xApplication.query || {};
 MWF.xApplication.query.StatementDesigner = MWF.xApplication.query.StatementDesigner || {};
 MWF.APPDSMD = MWF.xApplication.query.StatementDesigner;
 
-MWF.xDesktop.requireApp("query.StatementDesigner", "lp."+MWF.language, null, false);
-//MWF.xDesktop.requireApp("query.StatementDesigner", "Property", null, false);
-MWF.xDesktop.requireApp("query.TableDesigner", "Property", null, false);
+MWF.xDesktop.requireApp("query.StatementDesigner", "lp." + MWF.language, null, false);
+MWF.xDesktop.requireApp("query.StatementDesigner", "Property", null, false);
+MWF.xDesktop.requireApp("query.ViewDesigner", "View", null, false);
 o2.require("o2.widget.JavascriptEditor", null, false);
+o2.require("o2.widget.UUID", null, false);
 
 MWF.xApplication.query.StatementDesigner.Statement = new Class({
     Extends: MWF.widget.Common,
@@ -18,11 +19,11 @@ MWF.xApplication.query.StatementDesigner.Statement = new Class({
         "propertyPath": "../x_component_query_StatementDesigner/$Statement/statement.html"
     },
 
-    initialize: function(designer, data, options){
+    initialize: function (designer, data, options) {
         this.setOptions(options);
 
         this.path = "../x_component_query_StatementDesigner/$Statement/";
-        this.cssPath = "../x_component_query_StatementDesigner/$Statement/"+this.options.style+"/css.wcss";
+        this.cssPath = "../x_component_query_StatementDesigner/$Statement/" + this.options.style + "/css.wcss";
 
         this._loadCss();
 
@@ -35,47 +36,47 @@ MWF.xApplication.query.StatementDesigner.Statement = new Class({
 
         //this.statementRunNode = this.designer.designerStatementArea;
 
-        if(this.designer.application) this.data.applicationName = this.designer.application.name;
-        if(this.designer.application) this.data.application = this.designer.application.id;
+        if (this.designer.application) this.data.applicationName = this.designer.application.name;
+        if (this.designer.application) this.data.application = this.designer.application.id;
 
         this.isNewStatement = (this.data.id) ? false : true;
 
         this.view = this;
 
         this.autoSave();
-        this.designer.addEvent("queryClose", function(){
+        this.designer.addEvent("queryClose", function () {
             if (this.autoSaveTimerID) window.clearInterval(this.autoSaveTimerID);
         }.bind(this));
     },
-    parseData: function(){
+    parseData: function () {
         this.json = this.data;
         if (!this.json.type) this.json.type = "select";
         if (!this.json.format) this.json.format = "jpql";
         if (!this.json.entityCategory) this.json.entityCategory = "official";
-        if (!this.json.entityClassName) this.json.entityClassName = "com.x.processplatform.core.entity.content.Task";
+        if (!this.json.entityClassName) this.json.entityClassName = ""; //"com.x.processplatform.core.entity.content.Task";
     },
-    autoSave: function(){
-        this.autoSaveTimerID = window.setInterval(function(){
+    autoSave: function () {
+        this.autoSaveTimerID = window.setInterval(function () {
             if (!this.autoSaveCheckNode) this.autoSaveCheckNode = this.designer.contentToolbarNode.getElement("#MWFAutoSaveCheck");
-            if (this.autoSaveCheckNode){
-                if (this.autoSaveCheckNode.get("checked")){
+            if (this.autoSaveCheckNode) {
+                if (this.autoSaveCheckNode.get("checked")) {
                     this.save();
                 }
             }
         }.bind(this), 60000);
     },
 
-    load : function(){
+    load: function () {
 
 
         // this.setAreaNodeSize();
         // this.designer.addEvent("resize", this.setAreaNodeSize.bind(this));
         this.areaNode.inject(this.node);
 
-        this.designer.statementListAreaNode.getChildren().each(function(node){
+        this.designer.statementListAreaNode.getChildren().each(function (node) {
             var statement = node.retrieve("statement");
-            if (statement.id==this.data.id){
-                if (this.designer.currentListStatementItem){
+            if (statement.id == this.data.id) {
+                if (this.designer.currentListStatementItem) {
                     this.designer.currentListStatementItem.setStyles(this.designer.css.listStatementItem);
                 }
                 node.setStyles(this.designer.css.listStatementItem_current);
@@ -85,25 +86,116 @@ MWF.xApplication.query.StatementDesigner.Statement = new Class({
         }.bind(this));
 
         this.loadStatement();
+        // this.showProperty();
+        this.selected();
+    },
+    selected: function () {
+        if (this.currentSelectedModule) {
+            if (this.currentSelectedModule == this) {
+                return true;
+            } else {
+                this.currentSelectedModule.unSelected();
+            }
+        }
+        if (this.view && this.view.domListNode) {
+            this.view.domListNode.hide();
+        }
+
+        this.currentSelectedModule = this;
+        this.isSelected = true;
         this.showProperty();
     },
-    showProperty: function(){
-        if (!this.property){
-            this.property = new MWF.xApplication.query.TableDesigner.Property(this, this.designer.designerContentArea, this.designer, {
+    unSelected: function () {
+        this.currentSelectedModule = null;
+        this.isSelected = false;
+        this.hideProperty();
+    },
+    showProperty: function () {
+        if (!this.property) {
+            this.property = new MWF.xApplication.query.StatementDesigner.Property(this, this.designer.designerContentArea, this.designer, {
                 "path": this.options.propertyPath,
-                "onPostLoad": function(){
+                "onPostLoad": function () {
                     this.property.show();
                 }.bind(this)
             });
             this.property.load();
-        }else{
+        } else {
             this.property.show();
         }
     },
-    loadStatement: function(){
+    hideProperty: function () {
+        if (this.property) this.property.hide();
+    },
+    loadJpqlTab: function (callback) {
+        var _self = this;
+        MWF.require("MWF.widget.Tab", null, false);
+
+        this.jpqlTab = new MWF.widget.Tab(this.jpqlTabNode, {"style": "script"});
+        this.jpqlTab.load();
+
+        this.tabJpqlNode = Element("div");
+        this.jpqlTabPageNode.inject(this.tabJpqlNode);
+
+        this.tabCountJpqlNode = Element("div");
+        this.countJpqlTabPageNode.inject(this.tabCountJpqlNode);
+
+        this.jpqlPage = this.jpqlTab.addTab(this.tabJpqlNode, this.designer.lp.queryStatement);
+        this.countJpqlPage = this.jpqlTab.addTab(this.tabCountJpqlNode, this.designer.lp.countStatement);
+
+        this.jpqlPage.showTabIm();
+
+        // this.jpqlPage.addEvent("postShow", function(){
+        //     if( this.view ){
+        //         this.view.setContentHeight();
+        //         this.view.selected();
+        //     }
+        // }.bind(this));
+        // this.countJpqlPage.addEvent("postShow", function(){
+        //     this.selected();
+        // }.bind(this));
+    },
+    loadTab: function (callback) {
+        var _self = this;
+        MWF.require("MWF.widget.Tab", null, false);
+
+        this.tab = new MWF.widget.Tab(this.tabNode, {"style": "script"});
+        this.tab.load();
+
+        this.tabRunNode = Element("div");
+        this.pageRunNode = new Element("div", {
+            "styles": {
+                "overflow": "auto",
+                "background-color": "#fff"
+            }
+        }).inject(this.tabRunNode);
+        this.runArea.inject(this.pageRunNode);
+
+        this.tabViewNode = Element("div", {"styles": {"height": "100%"}});
+        this.pageViewNode = new Element("div.pageViewNode").inject(this.tabViewNode);
+        this.viewArea.inject(this.pageViewNode);
+
+        this.runPage = this.tab.addTab(this.tabRunNode, this.designer.lp.runTest);
+        this.viewPage = this.tab.addTab(this.tabViewNode, this.designer.lp.view);
+
+        this.runPage.showTabIm();
+
+        this.viewPage.addEvent("postShow", function () {
+            if (this.view) {
+                this.view.setContentHeight();
+                this.view.selected();
+            }
+        }.bind(this));
+        this.runPage.addEvent("postShow", function () {
+            this.selected();
+        }.bind(this));
+    },
+    loadStatement: function () {
         //this.statementDesignerNode = new Element("div", {"styles": this.css.statementDesignerNode}).inject(this.areaNode);
-        this.loadStatementHtml(function(){
+        this.loadStatementHtml(function () {
             this.designerArea = this.areaNode.getElement(".o2_statement_statementDesignerNode");
+
+            this.jpqlTabPageNode = this.areaNode.getElement(".o2_statement_statementJpqlTabPageNode");
+
             this.jpqlArea = this.areaNode.getElement(".o2_statement_statementDesignerJpql");
             this.scriptArea = this.areaNode.getElement(".o2_statement_statementDesignerScript");
 
@@ -117,13 +209,16 @@ MWF.xApplication.query.StatementDesigner.Statement = new Class({
             this.dynamicTableSelect = this.areaNode.getElement(".o2_statement_statementDesignerSelectTable");
             this.officialTableSelect = this.officialTableArea.getElement("select");
 
+            this.fieldSelect = this.areaNode.getElement(".o2_statement_statementDesignerTableArea_field").getElement("select");
+            this.loadFieldSelect();
+
             this.dynamicTableContent = this.areaNode.getElement(".o2_statement_statementDesignerTableContent");
 
+            this.jpqlTabNode = this.areaNode.getElement(".o2_statement_statementJpqlTabNode");
 
             this.jpqlTypeSelect = this.areaNode.getElement(".o2_statement_statementDesignerTypeContent").getElement("select");
 
 
-
             // this.jpqlSelectEditor = this.areaNode.getElement(".o2_statement_statementDesignerJpql_select");
             // this.jpqlUpdateEditor = this.areaNode.getElement(".o2_statement_statementDesignerJpql_update");
             // this.jpqlDeleteEditor = this.areaNode.getElement(".o2_statement_statementDesignerJpql_sdelete");
@@ -135,35 +230,147 @@ MWF.xApplication.query.StatementDesigner.Statement = new Class({
             this.jpqlEditorNode = this.areaNode.getElement(".o2_statement_statementDesignerJpqlLine");
 
 
+            this.countJpqlTabPageNode = this.areaNode.getElement(".o2_statement_statementCountJpqlTabPageNode");
+            this.countJpqlArea = this.areaNode.getElement(".o2_statement_statementDesignerCountJpql");
+            this.countScriptArea = this.areaNode.getElement(".o2_statement_statementDesignerCountScript");
+            this.countJpqlEditorNode = this.areaNode.getElement(".o2_statement_statementDesignerCountJpqlLine");
+            this.loadJpqlTab();
+
+            this.resizeNode = this.areaNode.getElement(".o2_statement_resizeNode");
+
+            this.tabNode = this.areaNode.getElement(".o2_statement_tabNode");
+
             this.runArea = this.areaNode.getElement(".o2_statement_statementRunNode");
-            this.runTitleNode = this.areaNode.getElement(".o2_statement_statementRunTitleNode");
+            // this.runTitleNode = this.areaNode.getElement(".o2_statement_statementRunTitleNode");
             this.runContentNode = this.areaNode.getElement(".o2_statement_statementRunContentNode");
             this.runJsonNode = this.runContentNode.getFirst();
             this.runActionNode = this.runJsonNode.getNext();
             this.runResultNode = this.runContentNode.getLast();
-
             this.setRunnerSize();
             this.designer.addEvent("resize", this.setRunnerSize.bind(this));
-
-            if (this.json.format=="script"){
+            if (this.json.format == "script") {
                 this.loadStatementScriptEditor();
-            }else{
+                this.loadStatementCountScriptEditor();
+            } else {
                 this.loadStatementEditor();
+                this.loadStatementCountEditor();
             }
-
             this.loadStatementRunner();
+
+            this.viewArea = this.areaNode.getElement(".o2_statement_viewNode");
+            this.loadView();
+
+            this.loadTab();
+
             this.setEvent();
+            this.loadVerticalResize();
         }.bind(this));
     },
-    loadStatementScriptEditor: function(){
-        if (! this.scriptEditor){
+    loadFieldSelect : function(){
+        this.fieldSelect.empty();
+        var d = this.data;
+        var className = d.entityCategory === "dynamic" ? d.table : d.entityClassName;
+        if( !className )return;
+        o2.Actions.load("x_query_assemble_designer").QueryAction.getEntityProperties(
+            className,
+            d.entityCategory,
+            function(json){
+                var option = new Element("option", { "text": this.designer.lp.fileldSelectNote, "value": "" }).inject(this.fieldSelect);
+                option.store("type", d.entityCategory);
+                option.store("tableName", className );
+                (json.data||[]).each( function ( field ) {
+                    var option = new Element("option", {
+                        "text": field.name + ( field.description ? ("-" + field.description) : "" ),
+                        "value": field.name
+                    }).inject(this.fieldSelect);
+                    option.store("field", field);
+                    option.store("type", d.entityCategory );
+                    option.store("tableName", className );
+                }.bind(this))
+            }.bind(this)
+        )
+    },
+    loadVerticalResize: function(){
+        this.verticalResize = new Drag(this.resizeNode, {
+            "snap": 10,
+            "onStart": function(el, e){
+                var x = (Browser.name=="firefox") ? e.event.clientX : e.event.x;
+                var y = (Browser.name=="firefox") ? e.event.clientY : e.event.y;
+                el.store("position", {"x": x, "y": y});
+
+                var size = this.designerArea.getSize(); //designerArea
+                el.store("initialHeight", size.y);
+
+                var allSize = this.areaNode.getSize();
+                el.store("initialAllHeight", allSize.y);
+            }.bind(this),
+            "onDrag": function(el, e){
+
+                var allHeight = el.retrieve("initialAllHeight").toFloat(); //this.areaNode.getSize();
+
+                //			var x = e.event.x;
+                var y = (Browser.name=="firefox") ? e.event.clientY : e.event.y;
+                var position = el.retrieve("position");
+                var dy = y.toFloat()-position.y.toFloat();
+
+                var initialHeight = el.retrieve("initialHeight").toFloat();
+                var height = initialHeight+dy;
+                if (height < 180) height = 180;
+                if (height > allHeight-180) height = allHeight-180;
+
+                this.designerAreaPercent = height/allHeight;
+
+                this.setVerticalResize();
+
+            }.bind(this)
+        });
+    },
+    setVerticalResize: function(){
+        var size = this.areaNode.getSize();
+
+        var height = size.y;
+
+        var designAreaHeight = this.designerAreaPercent*height - 52;
+        // var runAreaHeight = height-designAreaHeight;
+
+        this.designerArea.setStyle("height", ""+designAreaHeight+"px");
+
+        debugger;
+
+        var editorHeight = designAreaHeight - 98;
+
+        if(this.jpqlEditorNode)this.jpqlEditorNode.setStyle( "height", ""+editorHeight+"px" );
+        if(this.countJpqlEditorNode)this.countJpqlEditorNode.setStyle( "height", ""+editorHeight+"px" );
+        if(this.scriptArea)this.scriptArea.setStyle( "height", ""+editorHeight+"px" );
+        if(this.countScriptArea)this.countScriptArea.setStyle( "height", ""+editorHeight+"px" );
+
+        if( this.editor )this.editor.resize();
+        if( this.countEditor )this.countEditor.resize();
+        if( this.scriptEditor ){
+            this.scriptEditor.container.setStyle("height", ""+editorHeight+"px");
+            this.scriptEditor.resizeContentNodeSize();
+        }
+        if( this.countScriptEditor ){
+            this.countScriptEditor.container.setStyle("height", ""+editorHeight+"px");
+            this.countScriptEditor.resizeContentNodeSize();
+        }
+
+        // this.tabNode.setStyle("height", ""+runAreaHeight+"px");
+        this.setRunnerSize();
+        if( this.view ){
+            this.setViewSize();
+            this.view.setContentHeight()
+        }
+    },
+    loadStatementScriptEditor: function () {
+        if (!this.scriptEditor) {
             debugger;
-            o2.require("o2.widget.ScriptArea", function(){
+            o2.require("o2.widget.ScriptArea", function () {
                 this.scriptEditor = new o2.widget.ScriptArea(this.scriptArea, {
                     "isbind": false,
                     "maxObj": this.designer.designNode,
                     "title": this.designer.lp.scriptTitle,
-                    "onChange": function(){
+                    "onChange": function () {
                         this.json.scriptText = this.scriptEditor.toJson().code;
                     }.bind(this)
                 });
@@ -171,46 +378,71 @@ MWF.xApplication.query.StatementDesigner.Statement = new Class({
             }.bind(this), false);
         }
     },
-    setRunnerSize: function(){
+    loadStatementCountScriptEditor: function () {
+        if (!this.countScriptEditor) {
+            debugger;
+            o2.require("o2.widget.ScriptArea", function () {
+                this.countScriptEditor = new o2.widget.ScriptArea(this.countScriptArea, {
+                    "isbind": false,
+                    "maxObj": this.designer.designNode,
+                    "title": this.designer.lp.scriptTitle,
+                    "onChange": function () {
+                        this.json.countScriptText = this.countScriptEditor.toJson().code;
+                    }.bind(this)
+                });
+                this.countScriptEditor.load({"code": this.json.countScriptText})
+            }.bind(this), false);
+        }
+    },
+    setRunnerSize: function () {
         debugger;
         var size = this.areaNode.getSize();
         var designerSize = this.designerArea.getComputedSize();
-        var y = size.y-designerSize.totalHeight;
+        var reizeNodeSize = this.resizeNode.getComputedSize();
+
+        var y = size.y - designerSize.totalHeight - reizeNodeSize.totalHeight;
         var mTop = this.runArea.getStyle("margin-top").toInt();
         var mBottom = this.runArea.getStyle("margin-bottom").toInt();
         var pTop = this.runArea.getStyle("padding-top").toInt();
         var pBottom = this.runArea.getStyle("padding-bottom").toInt();
-        y = y-mTop-mBottom-pTop-pBottom-1;
+        y = y - mTop - mBottom - pTop - pBottom - 5;
+
+        var tabSize = this.tabNode.getComputedSize();
+        y = y - tabSize.totalHeight;
 
-        this.runArea.setStyle("height", ""+y+"px");
+        this.runArea.setStyle("height", "" + y + "px");
 
-        var titleSize = this.runTitleNode.getComputedSize();
-        y = y - titleSize.totalHeight;
-        this.runContentNode.setStyle("height", ""+y+"px");
+        // var titleSize = this.runTitleNode.getComputedSize();
+        // y = y - titleSize.totalHeight;
+
+        this.runContentNode.setStyle("height", "" + y + "px");
     },
-    loadStatementEditor: function(){
-        if (!this.editor){
-            o2.require("o2.widget.JavascriptEditor", function(){
-                this.editor = new o2.widget.JavascriptEditor(this.jpqlEditorNode, {"title": "JPQL", "option": {"mode": "sql"}});
-                this.editor.load(function(){
-                    if (this.json.data){
+    loadStatementEditor: function () {
+        if (!this.editor) {
+            o2.require("o2.widget.JavascriptEditor", function () {
+                this.editor = new o2.widget.JavascriptEditor(this.jpqlEditorNode, {
+                    "title": "JPQL",
+                    "option": {"mode": "sql"}
+                });
+                this.editor.load(function () {
+                    if (this.json.data) {
                         this.editor.editor.setValue(this.json.data);
-                    }else{
+                    } else {
                         var table = "table";
                         switch (this.json.type) {
                             case "update":
-                                this.editor.editor.setValue("UPDATE "+table+" o SET ");
+                                this.editor.editor.setValue("UPDATE " + table + " o SET ");
                                 break;
                             case "delete":
-                                this.editor.editor.setValue("DELETE "+table+" o WHERE ");
+                                this.editor.editor.setValue("DELETE " + table + " o WHERE ");
                                 break;
                             default:
-                                this.editor.editor.setValue("SELECT * FROM "+table+" o");
+                                this.editor.editor.setValue("SELECT o FROM " + table + " o");
                         }
                     }
                     this.json.data = this.editor.editor.getValue();
 
-                    this.editor.addEditorEvent("change", function(){
+                    this.editor.addEditorEvent("change", function () {
                         debugger;
                         this.data.data = this.editor.getValue();
                         this.checkJpqlType();
@@ -225,27 +457,57 @@ MWF.xApplication.query.StatementDesigner.Statement = new Class({
         }
 
     },
-    setSatementTable: function(){
+    loadStatementCountEditor: function () {
+        if (!this.countEditor) {
+            o2.require("o2.widget.JavascriptEditor", function () {
+                this.countEditor = new o2.widget.JavascriptEditor(this.countJpqlEditorNode, {
+                    "title": "JPQL",
+                    "option": {"mode": "sql"}
+                });
+                this.countEditor.load(function () {
+                    if (this.json.countData) {
+                        this.countEditor.editor.setValue(this.json.countData);
+                    } else {
+                        var table = "table";
+                        this.countEditor.editor.setValue("SELECT count(o.id) FROM " + table + " o");
+                    }
+                    this.json.countData = this.countEditor.editor.getValue();
+
+                    this.countEditor.addEditorEvent("change", function () {
+                        debugger;
+                        this.data.countData = this.countEditor.getValue();
+                    }.bind(this));
+
+                    // this.editor.editor.on("change", function(){
+                    //     this.data.data = this.editor.getValue();
+                    //     this.checkJpqlType();
+                    // }.bind(this));
+                }.bind(this));
+            }.bind(this), false);
+        }
+
+    },
+    setSatementTable: function () {
         if (!this.json.type) this.json.type = "select";
         this.changeType(this.json.type, true);
-        if (this.json.data){
+        if (this.json.data) {
             this.editor.editor.setValue(this.json.data);
-        }else{
+        } else {
             var table = (this.json.tableObj) ? this.json.tableObj.name : "table";
             switch (this.json.type) {
                 case "update":
-                    this.editor.editor.setValue("UPDATE "+table+" o SET ");
+                    this.editor.editor.setValue("UPDATE " + table + " o SET ");
                     break;
                 case "delete":
-                    this.editor.editor.setValue("DELETE "+table+" o WHERE ");
+                    this.editor.editor.setValue("DELETE " + table + " o WHERE ");
                     break;
                 default:
-                    this.editor.editor.setValue("SELECT * FROM "+table+" o");
+                    this.editor.editor.setValue("SELECT o FROM " + table + " o");
             }
         }
     },
 
-    checkJpqlType: function(){
+    checkJpqlType: function () {
         var str = this.json.data;
         this.json.data = str;
         var jpql_select = /^select/i;
@@ -255,52 +517,67 @@ MWF.xApplication.query.StatementDesigner.Statement = new Class({
         if (jpql_update.test(str)) return this.changeType("update");
         if (jpql_delete.test(str)) return this.changeType("delete");
     },
-    changeType: function(type, force){
-        if (this.json.type!=type) this.json.type=type;
-        if (type != this.jpqlTypeSelect.options[this.jpqlTypeSelect.selectedIndex].value || force){
-            for (var i=0; i<this.jpqlTypeSelect.options.length; i++){
-                if (this.jpqlTypeSelect.options[i].value==type){
+    changeType: function (type, force) {
+        if (this.json.type != type) this.json.type = type;
+        if (type != this.jpqlTypeSelect.options[this.jpqlTypeSelect.selectedIndex].value || force) {
+            for (var i = 0; i < this.jpqlTypeSelect.options.length; i++) {
+                if (this.jpqlTypeSelect.options[i].value == type) {
                     this.jpqlTypeSelect.options[i].set("selected", true);
                     break;
                 }
             }
         }
     },
-    loadStatementHtml: function(callback){
+    loadStatementHtml: function (callback) {
         this.areaNode.loadAll({
-            "css": this.path+this.options.style+"/statement.css",
-            "html": this.path+"statementDesigner.html"
+            "css": this.path + this.options.style + "/statement.css",
+            "html": this.path + "statementDesigner.html"
         }, {
             "bind": {"lp": this.designer.lp, "data": this.data}
-        },function(){
+        }, function () {
             if (callback) callback();
         }.bind(this));
     },
-    loadStatementRunner: function(){
-        o2.require("o2.widget.JavascriptEditor", function(){
-            this.jsonEditor = new o2.widget.JavascriptEditor(this.runJsonNode, {"title": "JPQL", "option": {"mode": "json"}});
-            this.jsonEditor.load(function(){
-                this.jsonEditor.editor.setValue("{}");
+    loadStatementRunner: function () {
+        o2.require("o2.widget.JavascriptEditor", function () {
+            this.jsonEditor = new o2.widget.JavascriptEditor(this.runJsonNode, {
+                "title": "JPQL",
+                "option": {"mode": "json"}
+            });
+            this.jsonEditor.load(function () {
+                this.jsonEditor.editor.setValue(this.data.testParameters || "{}");
             }.bind(this));
         }.bind(this), false);
     },
-    setEvent: function(){
-        this.formatTypeArea.getElements("input").addEvent("click", function(e){
-            if (e.target.checked){
+    setEvent: function () {
+        this.designerArea.addEvent("click", function (e) {
+            this.selected();
+            e.stopPropagation();
+        }.bind(this));
+        this.formatTypeArea.getElements("input").addEvent("click", function (e) {
+            if (e.target.checked) {
                 var v = e.target.get("value");
-                if (v==="script"){
+                if (v === "script") {
                     this.scriptArea.show();
                     this.jpqlArea.hide();
                     this.loadStatementScriptEditor();
-                }else{
+
+                    this.countScriptArea.show();
+                    this.countJpqlArea.hide();
+                    this.loadStatementCountScriptEditor();
+                } else {
                     this.scriptArea.hide();
                     this.jpqlArea.show();
                     this.loadStatementEditor();
+
+                    this.countScriptArea.hide();
+                    this.countJpqlArea.show();
+                    this.loadStatementCountEditor();
                 }
                 this.json.format = v;
             }
         }.bind(this));
-        this.entityCategorySelect.addEvent("change", function(e){
+        this.entityCategorySelect.addEvent("change", function (e) {
             var entityCategory = e.target.options[e.target.selectedIndex].value;
             switch (entityCategory) {
                 case "dynamic":
@@ -319,174 +596,1234 @@ MWF.xApplication.query.StatementDesigner.Statement = new Class({
                     this.customTableArea.hide();
                     break;
             }
-            this.json.entityCategory = entityCategory
+            this.json.entityCategory = entityCategory;
+            this.loadFieldSelect();
+            if(this.view && this.view.property && this.view.property.viewFilter)this.view.property.viewFilter.setPathInputSelectOptions();
         }.bind(this));
         //@todo change table
-        this.officialTableSelect.addEvent("change", function(e){
+        this.officialTableSelect.addEvent("change", function (e) {
             debugger;
             var entityClassName = e.target.options[e.target.selectedIndex].value;
             this.json.entityClassName = entityClassName;
-            if (this.json.format=="jpql"){
-                if (this.editor){
-                    var re = /(.*from\s*)/ig;
-                    if (this.json.type=="update") re = /(.*update\s*)/ig;
-
-                    //if (this.json.type=="select" && this.editor){
-                        var v = this.json.data;
-
-                        var re2 = /(\s+)/ig;
-                        var arr = re.exec(v);
-                        if (arr && arr[0]){
-                            var left = arr[0]
-                            v = v.substring(left.length, v.length);
-                            //var ar = re2.exec(v);
-                            var right = v.substring(v.indexOf(" "),v.length);
-                            this.json.data = left+entityClassName+right;
-                            this.editor.editor.setValue(this.json.data);
-                        }
-                    //}
-                }
-
+            if( entityClassName ){
+                this.changeEditorEntityClassName( entityClassName.split(".").getLast() );
             }
+            this.loadFieldSelect();
 
+            this.json.table = "";
+            this.json.tableObj = null;
 
-        //     var className = e.target.options[e.target.selectedIndex].value;
-        //     if (this.json.type=="select"){
-        //         this.json.data
-        //         /(select)*(where|)/g
-        //     }
-        // }.bind(this));
+            if(this.view && this.view.property && this.view.property.viewFilter)this.view.property.viewFilter.setPathInputSelectOptions();
 
-        // this.jpqlTypeSelect.addEvent("change", function(){
-        //     var type = e.target.options[e.target.selectedIndex].value;
-        //     switch (entityCategory) {
-        //         case "update":
-        //             this.jpqlSelectEditor.hide();
-        //             this.jpqlUpdateEditor.show();
-        //             this.jpqlDeleteEditor.hide();
-        //             this.loadJpqlUpdateEditor();
-        //             break;
-        //         case "delete":
-        //             this.jpqlSelectEditor.hide();
-        //             this.jpqlUpdateEditor.hide();
-        //             this.jpqlDeleteEditor.show();
-        //             break;
-        //         default:
-        //             this.jpqlSelectEditor.show();
-        //             this.jpqlUpdateEditor.hide();
-        //             this.jpqlDeleteEditor.hide();
-        //             break;
-        //     }
+            //     var className = e.target.options[e.target.selectedIndex].value;
+            //     if (this.json.type=="select"){
+            //         this.json.data
+            //         /(select)*(where|)/g
+            //     }
+            // }.bind(this));
+
+            // this.jpqlTypeSelect.addEvent("change", function(){
+            //     var type = e.target.options[e.target.selectedIndex].value;
+            //     switch (entityCategory) {
+            //         case "update":
+            //             this.jpqlSelectEditor.hide();
+            //             this.jpqlUpdateEditor.show();
+            //             this.jpqlDeleteEditor.hide();
+            //             this.loadJpqlUpdateEditor();
+            //             break;
+            //         case "delete":
+            //             this.jpqlSelectEditor.hide();
+            //             this.jpqlUpdateEditor.hide();
+            //             this.jpqlDeleteEditor.show();
+            //             break;
+            //         default:
+            //             this.jpqlSelectEditor.show();
+            //             this.jpqlUpdateEditor.hide();
+            //             this.jpqlDeleteEditor.hide();
+            //             break;
+            //     }
         }.bind(this));
 
         this.runActionNode.getFirst().addEvent("click", this.runStatement.bind(this));
+
         this.dynamicTableSelect.addEvent("click", this.selectTable.bind(this));
-        this.jpqlTypeSelect.addEvent("change", function(){
+        this.jpqlTypeSelect.addEvent("change", function () {
             var t = this.jpqlTypeSelect.options[this.jpqlTypeSelect.selectedIndex].value;
-            if (t!=this.json.type) this.json.type=t;
+            if (t != this.json.type) {
+                this.json.type = t;
+            }
+            if (t != "select") {
+                this.jpqlPage.showTabIm();
+                this.countJpqlPage.disableTab();
+
+                this.runPage.showTabIm();
+                this.viewPage.disableTab();
+            } else {
+                this.countJpqlPage.enableTab(true);
+                this.viewPage.enableTab(true);
+            }
         }.bind(this));
+
+        this.fieldSelect.addEvent("change", function (ev) {
+            var option = ev.target.options[ev.target.selectedIndex];
+            var type = option.retrieve("type");
+            var field = option.retrieve("field");
+            if( !field )return;
+            var text = field.name;
+            if( this.countJpqlPage && this.countJpqlPage.isShow && !this.countJpqlPage.disabled ){
+                if( this.data.format === "script" && this.countScriptEditor.jsEditor ){
+                    this.countScriptEditor.jsEditor.insertValue( text );
+                }else{
+                    this.countEditor.insertValue( text );
+                }
+            }else{
+                if( this.data.format === "script" && this.scriptEditor.jsEditor ){
+                    this.scriptEditor.jsEditor.insertValue( text );
+                }else{
+                    this.editor.insertValue( text );
+                }
+            }
+        }.bind(this))
     },
+    changeEditorEntityClassName : function( entityClassName ){
+        if (this.json.format == "jpql") {
+            if (this.editor) {
+                var re = /(.*from\s*)/ig;
+                if (this.json.type == "update") re = /(.*update\s*)/ig;
+
+                //if (this.json.type=="select" && this.editor){
+                var v = this.json.data;
 
-    selectTable: function(){
+                var re2 = /(\s+)/ig;
+                var arr = re.exec(v);
+                if (arr && arr[0]) {
+                    var left = arr[0]
+                    v = v.substring(left.length, v.length);
+                    //var ar = re2.exec(v);
+                    var right = v.substring(v.indexOf(" "), v.length);
+                    this.json.data = left + entityClassName + right;
+                    this.editor.editor.setValue(this.json.data);
+                }
+
+                //}
+            }
+
+            if( this.countEditor ){
+                var re = /(.*from\s*)/ig;
+                var v = this.json.countData;
+
+                var re2 = /(\s+)/ig;
+                var arr = re.exec(v);
+                if (arr && arr[0]) {
+                    var left = arr[0]
+                    v = v.substring(left.length, v.length);
+                    //var ar = re2.exec(v);
+                    var right = v.substring(v.indexOf(" "), v.length);
+                    this.json.countData = left + entityClassName + right;
+                    this.countEditor.editor.setValue(this.json.countData);
+                }
+            }
+
+        }
+    },
+
+    selectTable: function () {
         new MWF.O2Selector(this.designer.content, {
             "type": "queryTable",
             "count": 1,
             "values": (this.json.table) ? [this.json.table] : [],
             "title": this.designer.lp.selectTable,
-            "onComplete": function(items){
-                if (items.length){
+            "onComplete": function (items) {
+                if (items.length) {
                     var id = items[0].data.id;
                     var name = items[0].data.name;
                     this.dynamicTableContent.set("text", name);
                     this.json.table = name;
                     this.json.tableObj = items[0].data;
-                }else{
+
+                    this.officialTableSelect.options[0].set("selected", true);
+                    this.json.entityClassName = "";
+
+                    this.changeEditorEntityClassName( name );
+                    this.loadFieldSelect();
+                    if(this.view && this.view.property && this.view.property.viewFilter)this.view.property.viewFilter.setPathInputSelectOptions();
+                } else {
                     this.dynamicTableContent.set("text", "");
                     this.json.table = "";
+                    this.loadFieldSelect();
+                    if(this.view && this.view.property && this.view.property.viewFilter)this.view.property.viewFilter.setPathInputSelectOptions();
                 }
             }.bind(this)
         });
     },
 
-    runStatement:function(){
+    runStatement: function () {
         debugger;
         // if (!this.json.data){
         //     this.designer.notice(this.designer.lp.inputStatementData, "error");
         //     return false;
         // }
-        o2.require("o2.widget.Mask", null, false);
-        this.runMask = new o2.widget.Mask();
-        this.runMask.loadNode(this.node);
-
-        this.saveSilence(function(){
-            var json = this.jsonEditor.editor.getValue();
-            var o = JSON.parse(json);
-            o2.Actions.get("x_query_assemble_designer").executeStatement(this.json.id, 1, 50 , o, function(json){
-                o2.require("o2.widget.JsonParse", function(){
+        // o2.require("o2.widget.Mask", null, false);
+        // this.runMask = new o2.widget.Mask();
+        // this.runMask.loadNode(this.node);
+
+        this.saveSilence(function () {
+            debugger;
+            this.execute(function (json) {
+                this.executeData = json;
+                o2.require("o2.widget.JsonParse", function () {
                     this.runResultNode.empty();
-                    var jsonResult = new o2.widget.JsonParse(json.data, this.runResultNode);
+                    var jsonResult = new o2.widget.JsonParse(json, this.runResultNode);
                     jsonResult.load();
                 }.bind(this));
-                this.runMask.hide();
-            }.bind(this), function(xhr, text, error){
-                debugger;
-                if (this.runMask) this.runMask.hide();
-                var errorText = error;
-                if (xhr){
-                    var json = JSON.decode(xhr.responseText);
-                    if (json){
-                        errorText = json.message.trim() || "request json error";
-                    }else{
-                        errorText = "request json error: "+xhr.responseText;
-                    }
+                if (this.view) {
+                    var flag = true;
+                    if (this.data.type !== "select") flag = false;
+                    if (this.data.format === "script" && !this.data.scriptText) flag = false;
+                    if (this.data.format !== "script" && !this.data.data) flag = false;
+                    if (flag) this.view.loadViewData();
                 }
-                errorText = errorText.replace(/\</g, "&lt;");
-                errorText = errorText.replace(/\</g, "&gt;");
-                MWF.xDesktop.notice("error", {x: "right", y:"top"}, errorText);
+                this.setColumnDataPath(json);
+                // this.runMask.hide();
+            }.bind(this), function () {
+                // if (this.runMask) this.runMask.hide();
             }.bind(this))
+
+            // var json = this.jsonEditor.editor.getValue();
+            // var o = JSON.parse(json);
+            //
+            // var mode = "data";
+            // if( this.data.type === "select" ){
+            //     if( this.data.format === "script" ){
+            //         if( this.data.scriptText && this.data.countScriptText ){
+            //             mode = "all"
+            //         }else if( this.data.scriptText && !this.data.countScriptText ){
+            //             mode = "data"
+            //         }else if( !this.data.scriptText && this.data.countScriptText ){
+            //             mode = "count"
+            //         }else{
+            //             this.designer.notice(this.designer.lp.inputStatementData, "error");
+            //             return false;
+            //         }
+            //     }else{
+            //         if( this.data.data && this.data.countData ){
+            //             mode = "all"
+            //         }else if( this.data.data && !this.data.countData ){
+            //             mode = "data"
+            //         }else if( !this.data.data && this.data.countData ){
+            //             mode = "count"
+            //         }else{
+            //             this.designer.notice(this.designer.lp.inputStatementData, "error");
+            //             return false;
+            //         }
+            //     }
+            // }
+            // o2.Actions.load("x_query_assemble_designer").StatementAction.executeV2(this.json.id, mode, 1, 50 , o, function(json){
+            //     o2.require("o2.widget.JsonParse", function(){
+            //         this.runResultNode.empty();
+            //         var jsonResult = new o2.widget.JsonParse(json, this.runResultNode);
+            //         jsonResult.load();
+            //     }.bind(this));
+            //     this.runMask.hide();
+            // }.bind(this), function(xhr, text, error){
+            //     debugger;
+            //     if (this.runMask) this.runMask.hide();
+            //     var errorText = error;
+            //     if (xhr){
+            //         var json = JSON.decode(xhr.responseText);
+            //         if (json){
+            //             errorText = json.message.trim() || "request json error";
+            //         }else{
+            //             errorText = "request json error: "+xhr.responseText;
+            //         }
+            //     }
+            //     errorText = errorText.replace(/\</g, "&lt;");
+            //     errorText = errorText.replace(/\</g, "&gt;");
+            //     MWF.xDesktop.notice("error", {x: "right", y:"top"}, errorText);
+            // }.bind(this))
         }.bind(this));
     },
+    setColumnDataPath: function (json) {
+        if (this.data.type !== "select") return;
+        if (this.data.format === "script" && !this.data.scriptText) return;
+        if (this.data.format !== "script" && !this.data.data) return;
+        this.columnDataPathList = [];
+        debugger;
+        var addPath = function (value, key) {
+            if (typeOf(value) === "array") {
+                Array.each(value, function (v, idx) {
+                    var path = (key || typeOf(key) === "number") ? (key + "." + idx) : idx.toString();
+                    if (!this.columnDataPathList.contains(path)) this.columnDataPathList.push(path);
+                    if (typeOf(v) === "array" || typeOf(v) === "object") addPath(v, path);
+                }.bind(this))
+            } else if (typeOf(value) === "object") {
+                Object.each(value, function (v, k) {
+                    var path = (key || typeOf(key) === "number") ? (key + "." + k) : k;
+                    if (!this.columnDataPathList.contains(path)) this.columnDataPathList.push(path);
+                    if (typeOf(v) === "array" || typeOf(v) === "object") addPath(v, path);
+                    addPath(v, path);
+                }.bind(this))
+            } else {
+                // if( key && !this.columnDataPathList.indexOf(key) )this.columnDataPathList.push(key);
+            }
+        }.bind(this);
+        for (var i = 0; i < json.data.length && i < 10; i++) {
+            var d = json.data[i];
+            addPath(d);
+        }
+        this.columnDataPathList.sort();
+        if (this.view && this.view.items) {
+            this.view.items.each(function (column) {
+                column.refreshColumnPathData()
+            })
+        }
+    },
+    getColumnDataPath: function () {
+        return this.columnDataPathList || [];
+    },
+    execute: function (success, failure) {
+        var json = this.jsonEditor.editor.getValue();
+        var o = JSON.parse(json);
+
+        var mode = "data";
+        if (this.data.type === "select") {
+            if (this.data.format === "script") {
+                if (this.data.scriptText && this.data.countScriptText) {
+                    mode = "all"
+                } else if (this.data.scriptText && !this.data.countScriptText) {
+                    mode = "data"
+                } else if (!this.data.scriptText && this.data.countScriptText) {
+                    mode = "count"
+                } else {
+                    this.designer.notice(this.designer.lp.inputStatementData, "error");
+                    return false;
+                }
+            } else {
+                if (this.data.data && this.data.countData) {
+                    mode = "all"
+                } else if (this.data.data && !this.data.countData) {
+                    mode = "data"
+                } else if (!this.data.data && this.data.countData) {
+                    mode = "count"
+                } else {
+                    this.designer.notice(this.designer.lp.inputStatementData, "error");
+                    return false;
+                }
+            }
+        }
+        o2.Actions.load("x_query_assemble_designer").StatementAction.executeV2(this.json.id, mode, 1, 50, o, function (json) {
+            if (success) success(json)
+        }.bind(this), function (xhr, text, error) {
+            debugger;
+            if (failure) failure();
+            var errorText = error;
+            if (xhr) {
+                var json = JSON.decode(xhr.responseText);
+                if (json) {
+                    errorText = json.message.trim() || "request json error";
+                } else {
+                    errorText = "request json error: " + xhr.responseText;
+                }
+            }
+            errorText = errorText.replace(/\</g, "&lt;");
+            errorText = errorText.replace(/\</g, "&gt;");
+            MWF.xDesktop.notice("error", {x: "right", y: "top"}, errorText);
+        }.bind(this))
+    },
 
-    save: function(callback){
+    save: function (callback) {
         debugger;
-        if (!this.data.name){
+        if (!this.data.name) {
             this.designer.notice(this.designer.lp.inputStatementName, "error");
             return false;
         }
+
+        if (typeOf(this.viewJson) === "object") {
+            if(!this.viewJson.group)this.viewJson.group = {};
+            if(!this.viewJson.pageSize)this.viewJson.pageSize = "20";
+            this.data.view = JSON.stringify(this.viewJson);
+        }
         //if( !this.data.tableType ){
         //    this.data.tableType = "dynamic";
         //}
         if (this.editor) this.data.data = this.editor.editor.getValue();
         if (this.scriptEditor) this.data.scriptText = this.scriptEditor.toJson().code;
+        if (this.jsonEditor) this.data.testParameters = this.jsonEditor.editor.getValue();
 
-        this.designer.actions.saveStatement(this.data, function(json){
+        this.designer.actions.saveStatement(this.data, function (json) {
             this.designer.notice(this.designer.lp.save_success, "success", this.node, {"x": "left", "y": "bottom"});
 
             this.data.id = json.data.id;
             if (this.lisNode) {
-                this.lisNode.getLast().set("text", this.data.name+"("+this.data.alias+")");
+                this.lisNode.getLast().set("text", this.data.name + "(" + this.data.alias + ")");
             }
             if (callback) callback();
         }.bind(this));
     },
-    _setEditStyle: function(){},
+    _setEditStyle: function () {
+    },
 
-    saveSilence: function(callback){
-        if (!this.data.name){
+    saveSilence: function (callback) {
+        if (!this.data.name) {
             this.designer.notice(this.designer.lp.inputStatementName, "error");
             return false;
         }
+
+        if (typeOf(this.viewJson) === "object") {
+            if( !this.viewJson.pageSize )this.viewJson.pageSize = "20";
+            this.data.view = JSON.stringify(this.viewJson);
+        }
+
         if (this.editor) this.data.data = this.editor.editor.getValue();
         if (this.scriptEditor) this.data.scriptText = this.scriptEditor.toJson().code;
+        if (this.jsonEditor) this.data.testParameters = this.jsonEditor.editor.getValue();
 
-        this.designer.actions.saveStatement(this.data, function(json){
+        this.designer.actions.saveStatement(this.data, function (json) {
             //this.designer.notice(this.designer.lp.save_success, "success", this.node, {"x": "left", "y": "bottom"});
 
             this.data.id = json.data.id;
             if (this.lisNode) {
-                this.lisNode.getLast().set("text", this.data.name+"("+this.data.alias+")");
+                this.lisNode.getLast().set("text", this.data.name + "(" + this.data.alias + ")");
             }
             if (callback) callback();
         }.bind(this));
+    },
+
+    loadView: function (callback) {
+        this.setViewSize();
+        this.designer.addEvent("resize", this.setViewSize.bind(this));
+
+        if (!this.data.view) {
+            this.viewJson = {};
+        } else {
+            this.viewJson = JSON.parse(this.data.view)
+        }
+        this.view = new MWF.xApplication.query.StatementDesigner.View(this.designer, this, this.viewJson, {});
+        this.view.load(function () {
+            this.view.setContentHeight();
+        }.bind(this));
+    },
+    setViewSize: function () {
+        debugger;
+        var size = this.areaNode.getSize();
+        var designerSize = this.designerArea.getComputedSize();
+        var reizeNodeSize = this.resizeNode.getComputedSize();
+
+        var y = size.y - designerSize.totalHeight - reizeNodeSize.totalHeight;
+        var mTop = this.viewArea.getStyle("margin-top").toInt();
+        var mBottom = this.viewArea.getStyle("margin-bottom").toInt();
+        var pTop = this.viewArea.getStyle("padding-top").toInt();
+        var pBottom = this.viewArea.getStyle("padding-bottom").toInt();
+        y = y - mTop - mBottom - pTop - pBottom - 1;
+
+        var tabSize = this.tabNode.getComputedSize();
+        y = y - tabSize.totalHeight;
+
+        this.viewArea.setStyle("height", "" + y + "px");
+
+        // var titleSize = this.runTitleNode.getComputedSize();
+        // y = y - titleSize.totalHeight;
+        // this.runContentNode.setStyle("height", ""+y+"px");
+    },
+    preview: function () {
+        if (this.isNewStatement) {
+            this.designer.notice(this.designer.lp.saveStatementNotice, "error");
+            return;
+        }
+        if (this.data.type !== "select") {
+            this.designer.notice(this.designer.lp.previewNotSelectStatementNotice, "error");
+            return;
+        }
+        if (!this.data.view) {
+            this.designer.notice(this.designer.lp.noViewNotice, "error");
+
+        }
+        this.saveSilence(function () {
+            var url = "../x_desktop/app.html?app=query.Query&status=";
+            url += JSON.stringify({
+                id: this.data.application,
+                statementId: this.data.id
+            });
+            window.open(o2.filterUrl(url), "_blank");
+        }.bind(this));
+    }
+});
+
+MWF.xApplication.query.StatementDesigner.View = new Class({
+    Extends: MWF.xApplication.query.ViewDesigner.View,
+    Implements: [Options, Events],
+    options: {
+        "style": "default",
+        "isView": false,
+        "showTab": true,
+        "propertyPath": "../x_component_query_StatementDesigner/$Statement/view.html"
+    },
+
+    initialize: function (designer, statement, data, options) {
+        this.setOptions(options);
+
+        this.path = "../x_component_query_ViewDesigner/$View/";
+        this.cssPath = "../x_component_query_ViewDesigner/$View/" + this.options.style + "/css.wcss";
+
+        this._loadCss();
+
+        this.statement = statement;
+        this.designer = designer;
+        this.data = data;
+
+        // if (!this.data.data) this.data.data = {};
+        this.parseData();
+
+        this.node = this.statement.viewArea;
+        //this.tab = this.designer.tab;
+
+        this.areaNode = new Element("div", {"styles": {"height": "calc(100% - 2px)", "overflow": "auto"}});
+        this.areaNode.setStyles(this.css.areaNode);
+
+        //MWF.require("MWF.widget.ScrollBar", function(){
+        //    new MWF.widget.ScrollBar(this.areaNode, {"distance": 100});
+        //}.bind(this));
+
+
+        // this.propertyListNode = this.designer.propertyDomArea;
+        //this.propertyNode = this.designer.propertyContentArea;
+
+        // if(this.designer.application) this.data.applicationName = this.designer.application.name;
+        // if(this.designer.application) this.data.application = this.designer.application.id;
+
+        // this.isNewView = (this.data.name) ? false : true;
+
+        this.items = [];
+        this.view = this;
+
+        // this.autoSave();
+        // this.designer.addEvent("queryClose", function(){
+        //     if (this.autoSaveTimerID) window.clearInterval(this.autoSaveTimerID);
+        // }.bind(this));
+    },
+    load: function (callback) {
+        this.setAreaNodeSize();
+        this.designer.addEvent("resize", this.setAreaNodeSize.bind(this));
+        this.areaNode.inject(this.node);
+
+        this.domListNode = new Element("div", {"styles": {"overflow": "hidden"}}).inject(this.designer.propertyDomArea);
+
+        this.loadTemplateStyle(function () {
+
+            this.loadActionbar();
+
+            this.loadView();
+
+            this.loadPaging();
+
+            // this.selected();
+            this.setEvent();
+
+            //if (this.options.showTab) this.page.showTabIm();
+            this.setViewWidth();
+
+            this.designer.addEvent("resize", this.setViewWidth.bind(this));
+
+            if (callback) callback();
+        }.bind(this))
+    },
+    parseData: function () {
+        this.json = this.data;
+        if (!this.json.id) {
+            this.json.id = (new o2.widget.UUID).id;
+        }
+        if (!this.json.data || !this.json.data.events) {
+            var url = "../x_component_query_StatementDesigner/$Statement/view.json";
+            MWF.getJSON(url, {
+                "onSuccess": function (obj) {
+                    if (!this.json.data) this.json.data = obj.data;
+                    if (!this.json.data.events) this.json.data.events = obj.data.events;
+                }.bind(this),
+                "onerror": function (text) {
+                    this.notice(text, "error");
+                }.bind(this),
+                "onRequestFailure": function (xhr) {
+                    this.notice(xhr.responseText, "error");
+                }.bind(this)
+            }, false);
+        }
+    },
+    setEvent: function () {
+        this.areaNode.addEvents({
+            "click": function (e) {
+                this.selected();
+                e.stopPropagation();
+            }.bind(this),
+            "mouseover": function () {
+                if (!this.isSelected) this.areaNode.setStyles(this.css.areaNode_over)
+            }.bind(this),
+            "mouseout": function () {
+                if (!this.isSelected) this.areaNode.setStyles(this.css.areaNode)
+            }.bind(this)
+        });
+        this.refreshNode.addEvent("click", function (e) {
+            this.statement.runStatement();
+            e.stopPropagation();
+        }.bind(this));
+        this.addColumnNode.addEvent("click", function (e) {
+            this.addColumn();
+            e.stopPropagation();
+        }.bind(this));
+    },
+    selected: function () {
+        debugger;
+        if (this.statement.currentSelectedModule) {
+            if (this.statement.currentSelectedModule == this) {
+                return true;
+            } else {
+                this.statement.currentSelectedModule.unSelected();
+            }
+        }
+        this.areaNode.setStyles(this.css.areaNode_selected);
+        this.statement.currentSelectedModule = this;
+        this.domListNode.show();
+        this.isSelected = true;
+        this.showProperty();
+    },
+    unSelected: function () {
+        this.statement.currentSelectedModule = null;
+        this.isSelected = false;
+        this.areaNode.setStyles(this.css.areaNode);
+        this.hideProperty();
+    },
+
+    showProperty: function () {
+        if (!this.property) {
+            this.property = new MWF.xApplication.query.StatementDesigner.Property(this, this.designer.propertyContentArea, this.designer, {
+                "path": this.options.propertyPath,
+                "onPostLoad": function () {
+                    this.property.show();
+                }.bind(this)
+            });
+            this.property.load();
+        } else {
+            this.property.show();
+        }
+    },
+    hideProperty: function () {
+        if (this.property) this.property.hide();
+    },
+
+    loadViewData: function () {
+        debugger;
+        if (this.data.id) {
+            // this.statement.saveSilence(function () {
+            this.viewContentBodyNode.empty();
+            this.viewContentTableNode = new Element("table", {
+                "styles": this.css.viewContentTableNode,
+                "border": "0px",
+                "cellPadding": "0",
+                "cellSpacing": "0"
+            }).inject(this.viewContentBodyNode);
+
+            // this.statement.execute( function (json) {
+
+            // this.statement.setColumnDataPath( json );
+
+            var entries = {};
+
+            this.json.data.selectList.each(function (entry) {
+                entries[entry.column] = entry;
+            }.bind(this));
+
+            if (this.statement.executeData && this.statement.executeData.data && this.statement.executeData.data.length) {
+                this.statement.executeData.data.each(function (line, idx) {
+                    var tr = new Element("tr", {
+                        "styles": this.json.data.viewStyles ? this.json.data.viewStyles["contentTr"] : this.css.viewContentTrNode
+                    }).inject(this.viewContentTableNode);
+
+                    //this.createViewCheckboxTd( tr );
+
+                    Object.each(entries, function (c, k) {
+                        debugger;
+
+                        var path = c.path, code = c.code, obj = line;
+                        if( path ){
+                            var pathList = path.split(".");
+                            for( var i=0; i<pathList.length; i++ ){
+                                var p = pathList[i];
+                                if( (/(^[1-9]\d*$)/.test(p)) )p = p.toInt();
+                                if( obj[ p ] ){
+                                    obj = obj[ p ];
+                                }else{
+                                    obj = "";
+                                    break;
+                                }
+                            }
+                        }
+
+                        if( code && code.trim())obj = MWF.Macro.exec( code, { "target" : {"value": obj,  "data": line, "entry": c} });
+
+                        var toName = function (value) {
+                            if(typeOf(value) === "array"){
+                                Array.each( value, function (v, idx) {
+                                    value[idx] = toName(v)
+                                })
+                            }else if( typeOf(value) === "object" ){
+                                Object.each( value, function (v, key) {
+                                    value[key] = toName(v);
+                                })
+                            }else if( typeOf( value ) === "string" ){
+                                value = o2.name.cn( value )
+                            }
+                            return value;
+                        };
+
+                        var d;
+                        if( obj!= undefined && obj!= null ){
+                            if( typeOf(obj) === "array" ) {
+                                d = c.isName ? JSON.stringify(toName(Array.clone(obj))) : JSON.stringify(obj);
+                            }else if( typeOf(obj) === "object" ){
+                                d = c.isName ? JSON.stringify(toName(Object.clone(obj))) : JSON.stringify(obj);
+                            }else{
+                                d = c.isName ? o2.name.cn( obj.toString() ) : obj;
+                            }
+                        }
+
+
+                        if (d != undefined && d != null ) {
+                            var td = new Element("td", {
+                                "styles": this.json.data.viewStyles ? this.json.data.viewStyles["contentTd"] : this.css.viewContentTdNode
+                            }).inject(tr);
+                            if (c.isHtml) {
+                                td.set("html", d);
+                            } else {
+                                td.set("text", d);
+                            }
+                        }
+                    }.bind(this));
+                }.bind(this));
+                this.setContentColumnWidth();
+                this.setContentHeight();
+            } else if (this.json.data.noDataText) {
+                var noDataTextNodeStyle = this.css.noDataTextNode;
+                if (this.json.data.viewStyles) {
+                    if (this.json.data.viewStyles["noDataTextNode"]) {
+                        noDataTextNodeStyle = this.json.data.viewStyles["noDataTextNode"]
+                    } else {
+                        this.json.data.viewStyles["noDataTextNode"] = this.css.noDataTextNode
+                    }
+                }
+                this.noDataTextNode = new Element("div", {
+                    "styles": noDataTextNodeStyle,
+                    "text": this.json.data.noDataText
+                }).inject(this.viewContentBodyNode);
+            }
+            // }.bind(this));
+            // }.bind(this));
+        }
+    },
+    addColumn: function () {
+
+        debugger;
+
+        MWF.require("MWF.widget.UUID", function () {
+            var id = (new MWF.widget.UUID).id;
+            var json = {
+                "id": id,
+                "column": id,
+                "displayName": this.designer.lp.unnamed,
+                "orderType": "original"
+            };
+            if (!this.json.data.selectList) this.json.data.selectList = [];
+            this.json.data.selectList.push(json);
+            var column = new MWF.xApplication.query.StatementDesigner.View.Column(json, this);
+            this.items.push(column);
+            column.selected();
+
+            if (this.viewContentTableNode) {
+                var trs = this.viewContentTableNode.getElements("tr");
+                trs.each(function (tr) {
+                    new Element("td", {"styles": this.css.viewContentTdNode}).inject(tr)
+                }.bind(this));
+                //this.setContentColumnWidth();
+            }
+            this.setViewWidth();
+            this.addColumnNode.scrollIntoView(true);
+
+        }.bind(this));
+        //new Fx.Scroll(this.view.areaNode, {"wheelStops": false, "duration": 0}).toRight();
+    },
+    setContentHeight: function () {
+        var size = this.areaNode.getSize();
+        var titleSize = this.viewTitleNode.getSize();
+        var actionbarSize = this.actionbarNode ? this.actionbarNode.getSize() : {x: 0, y: 0};
+        var pagingSize = this.pagingNode ? this.pagingNode.getSize() : {x: 0, y: 0};
+        var height = size.y - titleSize.y - actionbarSize.y - pagingSize.y - 4;
+
+        this.viewContentScrollNode.setStyle("height", height);
+
+        var contentSize = this.viewContentBodyNode.getSize();
+        if (height < contentSize.y) height = contentSize.y + 10;
+
+        this.viewContentNode.setStyle("height", height);
+        this.contentLeftNode.setStyle("height", height);
+        this.contentRightNode.setStyle("height", height);
+        //this.viewContentBodyNode.setStyle("min-height", height);
+    },
+    loadViewColumns: function () {
+        //    for (var i=0; i<10; i++){
+        if (this.json.data.selectList) {
+            this.json.data.selectList.each(function (json) {
+                this.items.push(new MWF.xApplication.query.StatementDesigner.View.Column(json, this));
+
+            }.bind(this));
+        }
+        //    }
+    },
+    showActionbar: function (noSetHeight) {
+        this.actionbarNode.show();
+        if (!this.json.data.actionbarList) this.json.data.actionbarList = [];
+        if (!this.actionbarList || this.actionbarList.length == 0) {
+            if (this.json.data.actionbarList.length) {
+                this.json.data.actionbarList.each(function (json) {
+                    this.actionbarList.push(new MWF.xApplication.query.StatementDesigner.View.Actionbar(json, this.json.data.actionbarList, this))
+                }.bind(this));
+            } else {
+                this.actionbarList.push(new MWF.xApplication.query.StatementDesigner.View.Actionbar(null, this.json.data.actionbarList, this))
+            }
+        }
+        if (!noSetHeight) this.setContentHeight();
+    },
+    loadPaging: function (noSetHeight) {
+        this.pagingNode = new Element("div#pagingNode", {"styles": this.css.pagingNode}).inject(this.areaNode);
+        this.pagingList = [];
+        if (!this.json.data.pagingList) this.json.data.pagingList = [];
+        if (!this.pagingList || this.pagingList.length == 0) {
+            if (this.json.data.pagingList.length) {
+                this.json.data.pagingList.each(function (json) {
+                    this.pagingList.push(new MWF.xApplication.query.StatementDesigner.View.Paging(json, this.json.data.pagingList, this))
+                }.bind(this));
+            } else {
+                this.pagingList.push(new MWF.xApplication.query.StatementDesigner.View.Paging(null, this.json.data.pagingList, this))
+            }
+        }
+        // if( !noSetHeight )this.setContentHeight();
+    },
+    setViewWidth: function () {
+        if (!this.viewAreaNode) return;
+        this.viewAreaNode.setStyle("width", "auto");
+        this.viewTitleNode.setStyle("width", "auto");
+
+        var s1 = this.viewTitleTableNode.getSize();
+        var s2 = this.refreshNode.getSize();
+        var s3 = this.addColumnNode.getSize();
+        var width = s1.x + s2.x + s2.x;
+        var size = this.areaNode.getSize();
+
+        if (width > size.x) {
+            this.viewTitleNode.setStyle("width", "" + (width - 2) + "px");
+            this.viewAreaNode.setStyle("width", "" + (width - 2) + "px");
+        } else {
+            this.viewTitleNode.setStyle("width", "" + (size.x - 2) + "px");
+            this.viewAreaNode.setStyle("width", "" + (size.x - 2) + "px");
+        }
+        this.setContentColumnWidth();
+        this.setContentHeight();
+    },
+
+    _setEditStyle: function (name, input, oldValue) {
+        if (name == "data.actionbarHidden") {
+            if (this.json.data.actionbarHidden) {
+                this.hideActionbar()
+            } else {
+                this.showActionbar()
+            }
+        }
+        if (name == "data.selectAllEnable") {
+            if (this.json.data.selectAllEnable) {
+                this.viewTitleTrNode.getElement(".viewTitleCheckboxTd").setStyle("display", "table-cell");
+                this.viewContentTableNode.getElements(".viewContentCheckboxTd").setStyle("display", "table-cell");
+            } else {
+                this.viewTitleTrNode.getElement(".viewTitleCheckboxTd").setStyle("display", "none");
+                this.viewContentTableNode.getElements(".viewContentCheckboxTd").setStyle("display", "none");
+            }
+        }
+        if (name == "data.viewStyleType") {
+
+            var file = (this.stylesList && this.json.data.viewStyleType) ? this.stylesList[this.json.data.viewStyleType].file : null;
+            var extendFile = (this.stylesList && this.json.data.viewStyleType) ? this.stylesList[this.json.data.viewStyleType].extendFile : null;
+            this.loadTemplateStyles(file, extendFile, function (templateStyles) {
+                this.templateStyles = templateStyles;
+
+                var oldFile, oldExtendFile;
+                if (oldValue && this.stylesList[oldValue]) {
+                    oldFile = this.stylesList[oldValue].file;
+                    oldExtendFile = this.stylesList[oldValue].extendFile;
+                }
+                this.loadTemplateStyles(oldFile, oldExtendFile, function (oldTemplateStyles) {
+
+                    this.json.data.styleConfig = (this.stylesList && this.json.data.viewStyleType) ? this.stylesList[this.json.data.viewStyleType] : null;
+
+                    if (oldTemplateStyles["view"]) this.clearTemplateStyles(oldTemplateStyles["view"]);
+                    if (this.templateStyles["view"]) this.setTemplateStyles(this.templateStyles["view"]);
+                    this.setAllStyles();
+
+                    this.actionbarList.each(function (module) {
+                        if (oldTemplateStyles["actionbar"]) {
+                            module.clearTemplateStyles(oldTemplateStyles["actionbar"]);
+                        }
+                        module.setStyleTemplate();
+                        module.setAllStyles();
+                    })
+
+                    this.pagingList.each(function (module) {
+                        if (oldTemplateStyles["paging"]) {
+                            module.clearTemplateStyles(oldTemplateStyles["paging"]);
+                        }
+                        module.setStyleTemplate();
+                        module.setAllStyles();
+                    });
+
+                    // this.moduleList.each(function(module){
+                    //     if (oldTemplateStyles[module.moduleName]){
+                    //         module.clearTemplateStyles(oldTemplateStyles[module.moduleName]);
+                    //     }
+                    //     module.setStyleTemplate();
+                    //     module.setAllStyles();
+                    // }.bind(this));
+                }.bind(this))
+
+            }.bind(this))
+        }
+        if (name == "data.viewStyles") {
+            this.setCustomStyles();
+        }
+    },
+
+    loadTemplateStyle: function (callback) {
+        this.loadStylesList(function () {
+            var oldStyleValue = "";
+            if ((!this.json.data.viewStyleType) || !this.stylesList[this.json.data.viewStyleType]) this.json.data.viewStyleType = "default";
+            this.loadTemplateStyles(this.stylesList[this.json.data.viewStyleType].file, this.stylesList[this.json.data.viewStyleType].extendFile,
+                function (templateStyles) {
+                    this.templateStyles = templateStyles;
+                    if (!this.json.data.viewStyleType) this.json.data.viewStyleType = "default";
+
+                    if (this.templateStyles && this.templateStyles["view"]) {
+                        var viewStyles = Object.clone(this.templateStyles["view"]);
+                        if (viewStyles.contentGroupTd) delete viewStyles.contentGroupTd;
+                        if (viewStyles.groupCollapseNode) delete viewStyles.groupCollapseNode;
+                        if (viewStyles.groupExpandNode) delete viewStyles.groupExpandNode;
+                        if (!this.json.data.viewStyles) {
+                            this.json.data.viewStyles = viewStyles;
+                        } else {
+                            this.setTemplateStyles(viewStyles);
+                        }
+                    }
+
+                    this.setCustomStyles();
+
+                    if (callback) callback();
+                }.bind(this)
+            );
+        }.bind(this));
+    },
+    clearTemplateStyles: function (styles) {
+        if (styles) {
+            if (styles.container) this.removeStyles(styles.container, "container");
+            if (styles.table) this.removeStyles(styles.table, "table");
+            if (styles.titleTr) this.removeStyles(styles.titleTr, "titleTr");
+            if (styles.titleTd) this.removeStyles(styles.titleTd, "titleTd");
+            if (styles.contentTr) this.removeStyles(styles.contentTr, "contentTr");
+            if (styles.contentSelectedTr) this.removeStyles(styles.contentSelectedTr, "contentSelectedTr");
+            if (styles.contentTd) this.removeStyles(styles.contentTd, "contentTd");
+            // if (styles.contentGroupTd) this.removeStyles(styles.contentGroupTd, "contentGroupTd");
+            // if (styles.groupCollapseNode) this.removeStyles(styles.groupCollapseNode, "groupCollapseNode");
+            // if (styles.groupExpandNode) this.removeStyles(styles.groupExpandNode, "groupExpandNode");
+            if (styles.checkboxNode) this.removeStyles(styles.checkboxNode, "checkboxNode");
+            if (styles.checkedCheckboxNode) this.removeStyles(styles.checkedCheckboxNode, "checkedCheckboxNode");
+            if (styles.radioNode) this.removeStyles(styles.radioNode, "radioNode");
+            if (styles.checkedRadioNode) this.removeStyles(styles.checkedRadioNode, "checkedRadioNode");
+            if (styles.tableProperties) this.removeStyles(styles.tableProperties, "tableProperties");
+        }
+    },
+
+    setTemplateStyles: function (styles) {
+        if (styles.container) this.copyStyles(styles.container, "container");
+        if (styles.table) this.copyStyles(styles.table, "table");
+        if (styles.titleTr) this.copyStyles(styles.titleTr, "titleTr");
+        if (styles.titleTd) this.copyStyles(styles.titleTd, "titleTd");
+        if (styles.contentTr) this.copyStyles(styles.contentTr, "contentTr");
+        if (styles.contentSelectedTr) this.copyStyles(styles.contentSelectedTr, "contentSelectedTr");
+        if (styles.contentTd) this.copyStyles(styles.contentTd, "contentTd");
+        // if (styles.contentGroupTd) this.copyStyles(styles.contentGroupTd, "contentGroupTd");
+        // if (styles.groupCollapseNode) this.copyStyles(styles.groupCollapseNode, "groupCollapseNode");
+        // if (styles.groupExpandNode) this.copyStyles(styles.groupExpandNode, "groupExpandNode");
+        if (styles.checkboxNode) this.copyStyles(styles.checkboxNode, "checkboxNode");
+        if (styles.checkedCheckboxNode) this.copyStyles(styles.checkedCheckboxNode, "checkedCheckboxNode");
+        if (styles.radioNode) this.copyStyles(styles.radioNode, "radioNode");
+        if (styles.checkedRadioNode) this.copyStyles(styles.checkedRadioNode, "checkedRadioNode");
+        if (styles.tableProperties) this.copyStyles(styles.tableProperties, "tableProperties");
+    },
+    removeStyles: function (from, to) {
+        if (this.json.data.viewStyles[to]) {
+            Object.each(from, function (style, key) {
+                if (this.json.data.viewStyles[to][key] && this.json.data.viewStyles[to][key] == style) {
+                    delete this.json.data.viewStyles[to][key];
+                }
+            }.bind(this));
+        }
+    },
+    copyStyles: function (from, to) {
+        if (!this.json.data.viewStyles[to]) this.json.data.viewStyles[to] = {};
+        Object.each(from, function (style, key) {
+            if (!this.json.data.viewStyles[to][key]) this.json.data.viewStyles[to][key] = style;
+        }.bind(this));
+    }
+    // preview: function(){
+    //     if( this.isNewView ){
+    //         this.designer.notice( this.designer.lp.saveViewNotice, "error" );
+    //         return;
+    //     }
+    //     this.saveSilence( function () {
+    //         var url = "../x_desktop/app.html?app=query.Query&status=";
+    //         url += JSON.stringify({
+    //             id : this.data.application,
+    //             viewId : this.data.id
+    //         });
+    //         window.open(o2.filterUrl(url),"_blank");
+    //     }.bind(this));
+    // },
+    // saveSilence: function(callback){
+    //     if (!this.data.name){
+    //         this.designer.notice(this.designer.lp.notice.inputName, "error");
+    //         return false;
+    //     }
+    //
+    //     this.designer.actions.saveView(this.data, function(json){
+    //         this.data.id = json.data.id;
+    //         this.isNewView = false;
+    //         //this.page.textNode.set("text", this.data.name);
+    //         if (this.lisNode) {
+    //             this.lisNode.getLast().set("text", this.data.name+"("+this.data.alias+")");
+    //         }
+    //         if (callback) callback();
+    //     }.bind(this));
+    // },
+    // save: function(callback){
+    //     //if (this.designer.tab.showPage==this.page){
+    //     if (!this.data.name){
+    //         this.designer.notice(this.designer.lp.notice.inputName, "error");
+    //         return false;
+    //     }
+    //     //}
+    //     this.designer.actions.saveView(this.data, function(json){
+    //         this.designer.notice(this.designer.lp.notice.save_success, "success", this.node, {"x": "left", "y": "bottom"});
+    //         this.isNewView = false;
+    //         this.data.id = json.data.id;
+    //         //this.page.textNode.set("text", this.data.name);
+    //         if (this.lisNode) {
+    //             this.lisNode.getLast().set("text", this.data.name+"("+this.data.alias+")");
+    //         }
+    //         if (callback) callback();
+    //     }.bind(this));
+    // },
+    // saveAs: function(){
+    //     var form = new MWF.xApplication.query.StatementDesigner.View.NewNameForm(this, {
+    //         name : this.data.name + "_" + MWF.xApplication.query.StatementDesigner.LP.copy,
+    //         query : this.data.query || this.data.application,
+    //         queryName :	this.data.queryName || this.data.applicationName
+    //     }, {
+    //         onSave : function( data, callback ){
+    //             this._saveAs( data, callback );
+    //         }.bind(this)
+    //     }, {
+    //         app: this.designer
+    //     });
+    //     form.edit()
+    // },
+    // _saveAs : function( data , callback){
+    //     var _self = this;
+    //
+    //     var d = this.cloneObject( this.data );
+    //
+    //     d.isNewView = true;
+    //     d.id = this.designer.actions.getUUID();
+    //     d.name = data.name;
+    //     d.alias = "";
+    //     d.query = data.query;
+    //     d.queryName = data.queryName;
+    //     d.application = data.query;
+    //     d.applicationName = data.queryName;
+    //     d.pid = d.id + d.id;
+    //
+    //     delete d[this.data.id+"viewFilterType"];
+    //     d[d.id+"viewFilterType"]="custom";
+    //
+    //     d.data.selectList.each( function( entry ){
+    //         entry.id = (new MWF.widget.UUID).id;
+    //     }.bind(this));
+    //
+    //     this.designer.actions.saveView(d, function(json){
+    //         this.designer.notice(this.designer.lp.notice.saveAs_success, "success", this.node, {"x": "left", "y": "bottom"});
+    //         if (callback) callback();
+    //     }.bind(this));
+    // }
+
+});
+
+MWF.xApplication.query.StatementDesigner.View.Column = new Class({
+    Extends: MWF.xApplication.query.ViewDesigner.View.Column,
+    initialize: function (json, view, next) {
+        this.propertyPath = "../x_component_query_StatementDesigner/$Statement/column.html";
+        this.view = view;
+        this.json = json;
+        this.next = next;
+        this.css = this.view.css;
+        this.content = this.view.viewTitleTrNode;
+        this.domListNode = this.view.domListNode;
+        this.load();
+    },
+    refreshColumnPathData: function () {
+        if (this.property) {
+            this.property.loadDataPathSelect();
+        }
+    },
+    getColumnDataPath: function () {
+        return this.view.statement.getColumnDataPath();
+    },
+    showProperty: function () {
+        if (!this.property) {
+            this.property = new MWF.xApplication.query.StatementDesigner.Property(this, this.view.designer.propertyContentArea, this.view.designer, {
+                "path": this.propertyPath,
+                "onPostLoad": function () {
+                    this.property.show();
+
+                    var processDiv = this.property.propertyContent.getElements("#" + this.json.id + "dataPathSelectedProcessArea");
+                    var cmsDiv = this.property.propertyContent.getElements("#" + this.json.id + "dataPathSelectedCMSArea");
+
+                    if (this.view.json.type == "cms") {
+                        processDiv.setStyle("display", "none");
+                        cmsDiv.setStyle("display", "block");
+                    } else {
+                        processDiv.setStyle("display", "block");
+                        cmsDiv.setStyle("display", "none");
+                    }
+                }.bind(this)
+            });
+            this.property.load();
+        } else {
+            this.property.show();
+        }
+    },
+    selected: function () {
+        if (this.view.statement.currentSelectedModule) {
+            if (this.view.statement.currentSelectedModule == this) {
+                return true;
+            } else {
+                this.view.statement.currentSelectedModule.unSelected();
+            }
+        }
+        this.view.domListNode.show();
+        this.node.setStyles(this.css.viewTitleColumnNode_selected);
+        this.listNode.setStyles(this.css.cloumnListNode_selected);
+        new Fx.Scroll(this.view.areaNode, {"wheelStops": false, "duration": 100}).toElementEdge(this.node);
+        new Fx.Scroll(this.view.designer.propertyDomArea, {
+            "wheelStops": false,
+            "duration": 100
+        }).toElement(this.listNode);
+
+        this.view.statement.currentSelectedModule = this;
+        this.isSelected = true;
+        this._showActions();
+        this.showProperty();
+    },
+    unSelected: function () {
+        this.view.statement.currentSelectedModule = null;
+        //this.node.setStyles(this.css.viewTitleColumnNode);
+        if (this.isError) {
+            this.node.setStyles(this.css.viewTitleColumnNode_error)
+        } else {
+            this.node.setStyles(this.css.viewTitleColumnNode)
+        }
+
+        this.listNode.setStyles(this.css.cloumnListNode);
+        this.isSelected = false;
+        this._hideActions();
+        this.hideProperty();
+    }
+});
+
+MWF.xApplication.query.StatementDesigner.View.Actionbar = new Class({
+    Extends: MWF.xApplication.query.ViewDesigner.View.Actionbar,
+    initialize: function (json, jsonList, view, options) {
+        this.setOptions(options);
+        this.propertyPath = "../x_component_query_StatementDesigner/$Statement/actionbar.html";
+        this.path = "../x_component_query_ViewDesigner/$View/";
+        this.imagePath_default = "../x_component_query_ViewDesigner/$View/";
+        this.imagePath_custom = "../x_component_process_FormDesigner/Module/Actionbar/";
+        this.cssPath = "../x_component_query_ViewDesigner/$View/" + this.options.style + "/actionbar.wcss";
+
+        this.view = view;
+        this.json = json;
+        this.jsonList = jsonList;
+        this.css = this.view.css;
+        this.container = this.view.actionbarNode;
+        this.moduleName = "actionbar";
+        this.load();
+    },
+    getJsonPath: function () {
+        return "../x_component_query_StatementDesigner/$Statement/toolbars.json";
+    },
+    selected: function () {
+        if (this.view.statement.currentSelectedModule) {
+            if (this.view.statement.currentSelectedModule == this) {
+                return true;
+            } else {
+                this.view.statement.currentSelectedModule.unSelected();
+            }
+        }
+        this.view.domListNode.show();
+        this.node.setStyles(this.css.toolbarWarpNode_selected);
+        //this.listNode.setStyles(this.css.cloumnListNode_selected);
+        new Fx.Scroll(this.view.areaNode, {"wheelStops": false, "duration": 100}).toElementEdge(this.node);
+        //new Fx.Scroll(this.view.designer.propertyDomArea, {"wheelStops": false, "duration": 100}).toElement(this.listNode);
+
+        this.view.statement.currentSelectedModule = this;
+        this.isSelected = true;
+        //this._showActions();
+        this.showProperty();
+    },
+    unSelected: function () {
+        this.view.statement.currentSelectedModule = null;
+        this.node.setStyles(this.css.toolbarWarpNode);
+
+        //this.listNode.setStyles(this.css.cloumnListNode);
+        this.isSelected = false;
+        //this._hideActions();
+        this.hideProperty();
+    },
+});
+
+MWF.xApplication.query.StatementDesigner.View.Paging = new Class({
+    Extends: MWF.xApplication.query.ViewDesigner.View.Paging,
+    selected: function () {
+        if (this.view.statement.currentSelectedModule) {
+            if (this.view.statement.currentSelectedModule == this) {
+                return true;
+            } else {
+                this.view.statement.currentSelectedModule.unSelected();
+            }
+        }
+        this.view.domListNode.show();
+        this.node.setStyles(this.css.pagingWarpNode_selected);
+        new Fx.Scroll(this.view.areaNode, {"wheelStops": false, "duration": 100}).toElementEdge(this.node);
+
+        this.view.statement.currentSelectedModule = this;
+        this.isSelected = true;
+        this.showProperty();
+    },
+    unSelected: function () {
+        this.view.statement.currentSelectedModule = null;
+        this.node.setStyles(this.css.pagingWarpNode);
+
+        this.isSelected = false;
+        this.hideProperty();
     }
 });

+ 16 - 52
o2web/source/x_component_query_StatementDesigner/lp/zh-cn.js

@@ -1,4 +1,9 @@
-MWF.xApplication.query.StatementDesigner.LP = {
+MWF.xApplication.query = MWF.xApplication.query || {};
+MWF.xApplication.query.StatementDesigner = MWF.xApplication.query.StatementDesigner || {};
+if(!MWF.APPDSMD)MWF.APPDSMD = MWF.xApplication.query.StatementDesigner;
+MWF.xApplication.query.ViewDesigner = MWF.xApplication.query.ViewDesigner || {};
+MWF.xDesktop.requireApp("query.ViewDesigner", "lp."+MWF.language, null, false);
+MWF.xApplication.query.StatementDesigner.LP = Object.merge( MWF.xApplication.query.ViewDesigner.LP, {
     "title": "查询设计",
     "newStatement": "新建查询配置",
     "unCategory": "未分类",
@@ -12,6 +17,11 @@ MWF.xApplication.query.StatementDesigner.LP = {
     "save_success": "查询配置保存成功!",
     "inputStatementName": "请输入查询配置名称",
     "inputStatementData": "请先编辑JPQL查询语句",
+    "saveStatementNotice" : "请先保存!",
+    "noViewNotice" : "未创建视图,请先创建视图!",
+    "previewNotSelectStatementNotice" : "只有语句类型为‘Select’才可以预览",
+    "field" : "字段",
+    "fileldSelectNote" : "-选择后在语句中插入字段-",
 
     "statementFormat": "如何创建语句:",
     "statementJpql": "直接编写JPQL创建语句",
@@ -20,32 +30,6 @@ MWF.xApplication.query.StatementDesigner.LP = {
     "statementCategory": "访问对象类型",
     "scriptTitle": "通过脚本创建JPQL",
 
-
-    "item": "项目",
-    "type": "类型",
-    "value": "值",
-    "stat": "统计",
-    "unnamed": "无标题列",
-    "newColumn": "新建列",
-
-    "close": "关闭",
-
-    "id": "标识",
-    "name": "名称",
-    "alias": "别名",
-    "description": "描述",
-
-    "application" : "数据应用",
-    "copyStat" : "拷贝统计",
-    "newStatName" : "新统计名称",
-    "copy" : "副本",
-    "ok" : "确定",
-    "cancel" : "取消",
-    "view" : "视图",
-
-    "clumn": "列",
-    "addLine": "添加数据",
-
     "jpqlType": "JPQL类型",
     "jpqlFromResult": "查询开始条目",
     "jpqlMaxResult": "最大返回结果",
@@ -54,29 +38,9 @@ MWF.xApplication.query.StatementDesigner.LP = {
     "jpqlRunSuccess": "JPQL执行成功",
     "newLineSuccess": "插入数据成功",
     "newLineJsonError": "插入数据错误,数据格式有误",
+    "queryStatement": "查询语句",
+    "countStatement": "总数语句",
 
-    "action": {
-        "move": "移动",
-        "delete": "删除",
-        "add": "添加"
-    },
-    "errorName": "列名只允许使用字母数字和下划线组合,并且不能以数字开头。",
-    "errorFieldList": "请先创建数据列。",
-    "duplicateName": "同名的列已存在",
-    "inputName": "请输入列名称",
-    "inputTableName": "请输入数据表名称",
-
-    "deleteColumnTitle": "删除列确认",
-    "deleteColumn": "是否确定删除当前列?",
-    "statusBuildTitle": "发布数据表",
-    "statusBuildInfor": "当前数据表将会发布到编译环境,如果您删除了列或修改了列的类型,您可能需要手工删除数据库表。您确定要执行此操作吗?",
-    "statusDraftTitle": "取消编译数据表",
-    "statusDraftInfor": "<span style='color: #FF0000;'>注意:您正在将此数据表从编译环境中删除,下次编译会删除数据库表。</span><br><br>您确定要执行此操作吗?",
-    "statusDraftInforAgain": "<span style='color: #FF0000;'>注意:您正在将此数据表从编译环境中删除,您将无法使用当前数据表,这可能会影响到已使用此数据表的相关应用。</span><br><br>请再次确认要执行此操作吗?",
-    "statusBuild_success": "当前数据表已经发布到编译环境,您需要运行“全部编译”使其生效",
-    "statusDraft_success": "当前数据表已从编译环境取消,下次“全部编译”时会删除从数据库中删除表",
-    "buildAllViewTitle": "编译所有数据表",
-    "buildAllViewInfor": "即将编译所有数据表,包括所有数据应用中的数据表,编译后您可能需要重启服务器后才能使用此数据表。您确定要执行此操作吗?",
-    "buildAllView_success": "已编译所有数据表,新的更改需要您重启服务器后生效",
-    "tableHelp": "数据表能够在系统数据库中自动创建真实表,并生成java实体对象,您可以使用JPQL操作数据表。创建数据表需要以下步骤:<br><br>1、创建数据表,并创建每一列;<br>2、点击工具栏按钮,将数据表发布到编译状态;<br>3、点击工具栏按钮,执行“编译所有数据表”操作<br>4、重启服务器,数据表就可以使用了。"
-};
+    "mastInputParameter" : "请输入参数",
+    "pathExecption" : "路径的写法是\"表别名.字段名\",格式不正确"
+});

+ 0 - 134
o2web/source/x_component_query_StatementDesigner/widget/$PersonSelector/default/css.wcss

@@ -1,134 +0,0 @@
-{
-	"node": {
-	    "min-height": "24px",
-	    "overflow": "hidden",
-	    "margin-right": "26px"
-	},
-	"addPersonNode": {
-        "float": "right",
-        "height": "24px",
-        "width": "24px",
-        "cursor": "pointer",
-        "background": "url("+"../x_component_process_ProcessDesigner/widget/$PersonSelector/default/icon/addPerson.png)  center center no-repeat"
-    },
-
-    "dutyMaskNode": {
-        "background-color": "#666",
-        "opacity": 0.6,
-        "z-index":1000
-    },
-    "dutyInputArea": {
-        "height": "510px",
-        "width": "355px",
-        "background-color": "#FFF",
-        "overflow": "hidden",
-        "border": "3px solid #666",
-        "border-radius": "10px",
-        "box-shadow": "0px 0px 15px #666",
-        "position": "absolute",
-        "z-index":1001
-    },
-    "dutyTitleNode": {
-        "height": "30px",
-        "background-color": "#EEE",
-        "border-bottom": "1px solid #CCC"
-    },
-
-    "dutyTitleTextNode": {
-        "margin-right": "30px",
-        "height": "30px",
-        "padding": "0px 10px",
-        "color": "#666",
-        "font-weight": "bold",
-        "font-size": "14px",
-        "line-height": "30px"
-    },
-    "dutyTitleActionNode": {
-        "width": "30px",
-        "height": "30px",
-        "float": "right",
-        "background": "url("+"../x_component_Organization/Selector/$Selector/default/icon/close.png) no-repeat center center",
-        "cursor": "pointer"
-    },
-
-    "dutyContentNode": {
-        "overflow": "hidden",
-        "height": "410px",
-        "padding": "12px"
-    },
-    "dutyContentAreaNode": {
-        "height": "410px"
-    },
-    "dutyActionNode": {
-        "height": "40px",
-        "width": "310px",
-        "margin": "auto"
-    },
-    "dutyOkActionNode": {
-        "width": "150px",
-        "height": "30px",
-        "background": "url("+"../x_component_Organization/Selector/$Selector/default/icon/editOk_bg.png) no-repeat center center",
-        "border": "0px",
-        "color": "#FFF",
-        "font-size": "18px",
-        "padding-left": "35px",
-        "border-radius": "4px",
-        "cursor": "pointer"
-    },
-    "dutyCancelActionNode": {
-        "width": "100px",
-        "height": "30px",
-        "background": "url("+"../x_component_Organization/Selector/$Selector/default/icon/editCancel_bg.png) no-repeat center center",
-        "border": "0px",
-        "color": "#FFF",
-        "font-size": "18px",
-        "padding-left": "20px",
-        "border-radius": "4px",
-        "margin-left": "10px",
-        "cursor": "pointer"
-    },
-    "dutyTextNode": {
-        "color": "#444",
-        "font-size": "14px",
-        "font-weight": "bold",
-        "height": "26px",
-        "margin-bottom": "6px",
-        "line-height": "26px"
-    },
-    "dutyReferenceAreaNode": {
-        "height": "28px",
-        "padding": "4px 0px 0px 0px",
-        "overflow": "hidden"
-    },
-    "dutyReferenceItemNode":{
-        "margin": "0px 4px 4px 0px",
-        "height": "24px",
-        "line-height": "24px",
-        "border": "1px solid #CCC",
-        "border-radius": "4px",
-        "background": "#f3f4ff",
-        "color": "#666",
-        "float": "left",
-        "cursor": "pointer",
-        "font-size": "14px",
-        "padding": "0px 10px"
-    },
-    "dutyReferenceItemNode_over": {
-        "background": "#e7eaff",
-        "border": "1px solid #999",
-        "color": "#666",
-    },
-    "dutyReferenceItemNode_down": {
-        "background": "#626ca6",
-        "border": "1px solid #FFF",
-        "color": "#FFF",
-    },
-    "dutyScriptAreaNode": {
-        "height": "316px",
-        "padding": "10px 0px"
-    },
-    "dutyScriptNode": {
-        "height": "316px",
-        "border": "1px solid #EEE"
-    }
-}

+ 60 - 0
o2web/source/x_component_query_StatementDesigner/widget/$ViewFilter/default/css.wcss

@@ -0,0 +1,60 @@
+{
+	"inputAreaNode": {
+	    "overflow": "hidden",
+	    "margin": "5px"
+	},
+	"actionAreaNode": {
+	    "height": "20px",
+	    "background": "#EEE",
+	    "border-top": "1px solid #CCC",
+	    "border-bottom": "1px solid #CCC",
+	    "cursor": "pointer"
+	},
+	"actionNode": {
+	    "height": "20px",
+	    "background": "url("+"../x_component_process_ViewDesigner/widget/$ViewFilter/default/down.png) no-repeat center -2px"
+	},
+	"verificationNode": {
+	    "background-color": "#fbe8e8",
+	    "color": "#ff0000",
+	    "height": "24px",
+	    "line-height": "24px"
+	},
+	"verificationTextNode": {
+	    "background": "url("+"../x_component_process_ViewDesigner/widget/$ViewFilter/default/icon/error.png) no-repeat 5px center",
+	    "padding-left": "26px"
+	},
+
+	"itemNode": {
+        "cursor": "pointer",
+        "height": "24px",
+        "margin": "2px 4px",
+        "background-color": "#f4f7fe",
+        "border": "1px solid #999999"
+    },
+    "itemNode_current": {
+        "cursor": "pointer",
+        "height": "24px",
+        "margin": "2px 4px",
+        "background-color": "#e1e9ff",
+        "border": "1px solid #999999"
+    },
+    "itemDeleteNode": {
+        "width": "20px",
+        "height": "24px",
+        "float": "right",
+        "background": "url("+"../x_component_process_ViewDesigner/widget/$ViewFilter/default/icon/delete1.png) no-repeat center center",
+        "cursor": "pointer"
+    },
+    "itemContentNode": {
+        "padding-left": "5px",
+        "padding-right": "3px",
+        "margin-right": "20px",
+        "height": "24px",
+        "line-height": "24px",
+        "overflow": "hidden",
+        "text-overflow": "ellipsis",
+        "white-space": "nowrap"
+    }
+
+}

BIN
o2web/source/x_component_query_StatementDesigner/widget/$ViewFilter/default/down.png


+ 0 - 0
o2web/source/x_component_query_StatementDesigner/widget/$PersonSelector/default/icon/addPerson.png → o2web/source/x_component_query_StatementDesigner/widget/$ViewFilter/default/icon/addPerson.png


BIN
o2web/source/x_component_query_StatementDesigner/widget/$ViewFilter/default/icon/delete1.png


BIN
o2web/source/x_component_query_StatementDesigner/widget/$ViewFilter/default/icon/error.png


+ 0 - 314
o2web/source/x_component_query_StatementDesigner/widget/PersonSelector.js

@@ -1,314 +0,0 @@
-MWF.xApplication.query.StatDesigner = MWF.xApplication.query.StatDesigner || {};
-MWF.xApplication.query.StatDesigner.widget = MWF.xApplication.query.StatDesigner.widget || {};
-MWF.require("MWF.xAction.org.express.RestActions", null,false);
-MWF.require("MWF.widget.Identity", null, false);
-
-MWF.xApplication.query.StatDesigner.widget.PersonSelector = new Class({
-    Implements: [Options, Events],
-    Extends: MWF.widget.Common,
-    options: {
-        "style": "default",
-        "type": "identity",
-        "names": []
-    },
-    initialize: function(node, app, options){
-
-        this.setOptions(options);
-        this.node = $(node);
-        this.app = app;
-
-        this.path = "../x_component_query_ViewDesigner/widget/$PersonSelector/";
-        this.cssPath = "../x_component_query_ViewDesigner/widget/$PersonSelector/"+this.options.style+"/css.wcss";
-        this._loadCss();
-
-        this.identitys = [];
-        this.restActions = new MWF.xAction.org.express.RestActions();
-
-        this.name = this.node.get("name");
-        this.load();
-
-    },
-    load: function(data){
-        this.node.setStyles(this.css.node);
-        this.createAddNode();
-        this.loadIdentitys();
-    },
-    loadIdentitys: function(){
-        var explorer = {
-            "actions": this.restActions,
-            "app": {
-                "lp": this.app.lp
-            }
-        };
-        if (this.options.names){
-            if (this.options.type.toLowerCase()=="duty"){
-                var dutys = JSON.decode(this.options.names);
-                dutys.each(function(d){
-                    var dutyItem = new MWF.widget.Duty(d, this.node, explorer, true, function(e){
-                        var _self = this;
-                        var text = this.selector.app.lp.deleteDutyText.replace(/{duty}/g, this.data.name);
-                        this.selector.app.confirm("warm", e, this.selector.app.lp.deleteDutyTitle, text, 300, 120, function(){
-                            _self.selector.fireEvent("removeDuty", [_self]);
-                            this.close();
-                        }, function(){
-                            this.close();
-                        });
-                        e.stopPropagation();
-                    });
-                    dutyItem.selector = this;
-                    dutyItem.explorer = explorer;
-                    this.identitys.push(dutyItem);
-                }.bind(this));
-            }else{
-                this.options.names.each(function(name){
-                    MWF.require("MWF.widget.Identity", function(){
-                        if (this.options.type.toLowerCase()=="identity") this.identitys.push(new MWF.widget.Identity({"name": name.name, "id": name.id}, this.node, explorer));
-                        if (this.options.type.toLowerCase()=="department") this.identitys.push(new MWF.widget.Department({"name": name.name, "id": name.id}, this.node, explorer));
-                        if (this.options.type.toLowerCase()=="company") this.identitys.push(new MWF.widget.Company({"name": name.name, "id": name.id}, this.node, explorer));
-                        if (this.options.type.toLowerCase()=="person") this.identitys.push(new MWF.widget.Person({"name": name.name, "id": name.id}, this.node, explorer));
-
-                        if (this.options.type.toLowerCase()=="application") this.identitys.push(new MWF.widget.Application({"name": name.name, "id": name.id}, this.node, explorer));
-                        if (this.options.type.toLowerCase()=="process") this.identitys.push(new MWF.widget.Process({"name": name.name, "id": name.id}, this.node, explorer));
-                    }.bind(this));
-                }.bind(this));
-            }
-        }
-
-    },
-    createAddNode: function(){
-        this.addNode = new Element("div", {"styles": this.css.addPersonNode}).inject(this.node, "before");
-        this.addNode.addEvent("click", function(e){
-
-            var selecteds = [];
-            this.identitys.each(function(id){selecteds.push(id.data.id)});
-
-            var explorer = {
-                "actions": this.restActions,
-                "app": {
-                    "lp": this.app.lp
-                }
-            };
-
-            var options = {
-                "type": this.options.type,
-                "count": (this.options.type.toLowerCase()=="duty")? 1: 0,
-                "values": selecteds,
-                "zIndex": 20000,
-                "onComplete": function(items){
-                    this.identitys = [];
-                    if (this.options.type.toLowerCase()!="duty") this.node.empty();
-
-                    MWF.require("MWF.widget.Identity", function(){
-                        items.each(function(item){
-                            if (this.options.type.toLowerCase()=="identity") this.identitys.push(new MWF.widget.Identity(item.data, this.node, explorer));
-                            if (this.options.type.toLowerCase()=="department") this.identitys.push(new MWF.widget.Department(item.data, this.node, explorer));
-                            if (this.options.type.toLowerCase()=="company") this.identitys.push(new MWF.widget.Company(item.data, this.node, explorer));
-                            if (this.options.type.toLowerCase()=="person") this.identitys.push(new MWF.widget.Person(item.data, this.node, explorer));
-
-                            if (this.options.type.toLowerCase()=="application") this.identitys.push(new MWF.widget.Application(item.data, this.node, explorer));
-                            if (this.options.type.toLowerCase()=="process") this.identitys.push(new MWF.widget.Process(item.data, this.node, explorer));
-                        }.bind(this));
-                        if (this.options.type.toLowerCase()=="duty") {
-                            items.each(function(item){
-                                new MWF.xApplication.query.StatDesigner.widget.PersonSelector.DutyInput(this, item.data, this.node, explorer, 20000);
-                            }.bind(this));
-                        }
-
-                        this.fireEvent("change", [this.identitys]);
-                    }.bind(this));
-                }.bind(this)
-            };
-
-            var selector = new MWF.OrgSelector(this.app.content, options);
-        }.bind(this));
-    }
-});
-MWF.xApplication.query.StatDesigner.widget.PersonSelector.DutyInput = Class({
-    Implements: [Events],
-    initialize: function(selector, data, node, explorer, zIndex){
-        this.itemNode = $(node);
-        this.data = data;
-        this.isNew = false;
-
-        this.selector = selector;
-        this.css = this.selector.css;
-        this.app = this.selector.app;
-        this.explorer = explorer;
-        this.zIndex = zIndex;
-
-        this.selector.identitys = [];
-        this.load();
-    },
-    load: function(){
-        this.css.dutyMaskNode["z-index"] = this.zIndex;
-        this.app.content.mask({
-            "destroyOnHide": true,
-            "style": this.css.dutyMaskNode
-        });
-        this.node = new Element("div", {
-            "styles": this.css.dutyInputArea
-        });
-
-        this.titleNode = new Element("div", {
-            "styles": this.css.dutyTitleNode
-        }).inject(this.node);
-
-        this.titleActionNode = new Element("div", {
-            "styles": this.css.dutyTitleActionNode
-        }).inject(this.titleNode);
-        this.titleTextNode = new Element("div", {
-            "styles": this.css.dutyTitleTextNode,
-            "text": this.app.lp.dutyInputTitle
-        }).inject(this.titleNode);
-
-        this.contentNode = new Element("div", {
-            "styles": this.css.dutyContentNode
-        }).inject(this.node);
-        this.loadContent();
-
-        this.actionNode = new Element("div", {
-            "styles": this.css.dutyActionNode
-        }).inject(this.node);
-        this.actionNode.setStyle("text-align", "center");
-        this.loadAction();
-
-        this.node.setStyle("z-index", this.zIndex.toInt()+1);
-        this.node.inject(this.app.content);
-        this.node.position({
-            relativeTo: this.app.content,
-            position: "center",
-            edge: "center"
-        });
-
-        var size = this.app.content.getSize();
-        var nodeSize = this.node.getSize();
-        this.node.makeDraggable({
-            "handle": this.titleNode,
-            "limit": {
-                "x": [0, size.x-nodeSize.x],
-                "y": [0, size.y-nodeSize.y]
-            }
-        });
-
-        this.setEvent();
-    },
-    setEvent: function(){
-        if (this.titleActionNode){
-            this.titleActionNode.addEvent("click", function(){this.selector.fireEvent("cancel"); this.close();}.bind(this));
-        }
-        this.okActionNode.addEvent("click", function(){
-            this.selectDuty();
-            this.close();
-        }.bind(this));
-        this.cancelActionNode.addEvent("click", function(){this.selector.fireEvent("cancel"); this.close();}.bind(this));
-    },
-    selectDuty: function(){
-        var code = this.scriptEditor.editor.editor.getValue();
-        this.data.code = code;
-        if (!this.item){
-            var dutyItem = new MWF.widget.Duty(this.data, this.itemNode, this.explorer, true, function(e){
-                var _self = this;
-                var text = this.selector.app.lp.deleteDutyText.replace(/{duty}/g, this.data.name);
-                this.selector.app.confirm("warm", e, this.selector.app.lp.deleteDutyTitle, text, 300, 120, function(){
-                    _self.selector.fireEvent("removeDuty", [_self]);
-                    this.close();
-                }, function(){
-                    this.close();
-                });
-                e.stopPropagation();
-            });
-            dutyItem.selector = this.selector;
-            dutyItem.explorer = this.explorer;
-
-            this.selector.identitys.push(dutyItem);
-            this.selector.fireEvent("change", [this.selector.identitys]);
-        }else{
-            this.selector.identitys.push(this.item);
-            this.selector.fireEvent("change", [this.selector.identitys]);
-        }
-    },
-    "close": function(){
-        this.node.destroy();
-        this.app.content.unmask();
-        MWF.release(this);
-        delete this;
-    },
-    loadAction: function(){
-        this.okActionNode = new Element("button", {
-            "styles": this.css.dutyOkActionNode,
-            "text": "确 定"
-        }).inject(this.actionNode);
-        this.cancelActionNode = new Element("button", {
-            "styles": this.css.dutyCancelActionNode,
-            "text": "取 消"
-        }).inject(this.actionNode);
-    },
-    loadContent: function(){
-        this.contentAreaNode= new Element("div", {"styles": this.css.dutyContentAreaNode}).inject(this.contentNode);
-        var text = this.app.lp.dutyInput.replace(/{duty}/g, this.data.name);
-        this.textNode = new Element("div", {"styles": this.css.dutyTextNode, "text": text}).inject(this.contentAreaNode);
-        this.referenceAreaNode = new Element("div", {"styles": this.css.dutyReferenceAreaNode}).inject(this.contentAreaNode);
-        this.scriptAreaNode = new Element("div", {"styles": this.css.dutyScriptAreaNode}).inject(this.contentAreaNode);
-        this.createScriptNode();
-
-        this.createReference(this.app.lp.creatorCompany, "return this.workContext.getWork().creatorCompany");
-        this.createReference(this.app.lp.creatorDepartment, "return this.workContext.getWork().creatorDepartment");
-        this.createReference(this.app.lp.currentCompany, "return this.workContext.getTask().company");
-        this.createReference(this.app.lp.currentDepartment, "return this.workContext.getTask().department");
-
-    },
-    createScriptNode: function(){
-        this.scriptNode = new Element("div", {"styles": this.css.dutyScriptNode}).inject(this.scriptAreaNode);
-        MWF.xDesktop.requireApp("query.ProcessDesigner", "widget.ScriptText", function(){
-            this.scriptEditor = new MWF.xApplication.query.ProcessDesigner.widget.ScriptText(this.scriptNode, "", this.app, {
-                "height": 316,
-                "maskNode": this.app.content,
-                "maxObj": this.app.content
-                //"onChange": function(code){
-                //    _self.data[node.get("name")] = code;
-                //}
-            });
-            this.scriptEditor.loadEditor(function(){
-                if (this.data.code) this.scriptEditor.editor.editor.setValue(this.data.code);
-            }.bind(this));
-        }.bind(this));
-    },
-    createReference: function(text, code){
-        var node = new Element("div", {"styles": this.css.dutyReferenceItemNode}).inject(this.referenceAreaNode);
-        node.set("text", text);
-        node.store("code", code);
-        var css = this.css.dutyReferenceItemNode;
-        var overcss = this.css.dutyReferenceItemNode_over;
-        var downcss = this.css.dutyReferenceItemNode_down;
-        var _self = this;
-        node.addEvents({
-            "mouseover": function(){this.setStyles(overcss);},
-            "mouseout": function(){this.setStyles(css);},
-            "mousedown": function(){this.setStyles(downcss);},
-            "mouseup": function(){this.setStyles(overcss);},
-            "click": function(){
-                var code = this.retrieve("code");
-                var value = _self.scriptEditor.editor.editor.getValue();
-                if (!value){
-                    _self.scriptEditor.editor.editor.setValue(code);
-                }else{
-                    value = value + "\n" +code;
-                    _self.scriptEditor.editor.editor.setValue(value);
-                }
-            }
-        });
-    }
-});
-
-MWF.widget.Duty = new Class({
-    Extends: MWF.widget.Department,
-    setEvent: function(){
-        this.node.addEvent("click", function(){
-            this.modifyDuty();
-        }.bind(this));
-    },
-    modifyDuty: function(){
-        var dutyInput = new MWF.xApplication.query.ProcessDesigner.widget.PersonSelector.DutyInput(this.selector, this.data, this.selector.node, this.explorer, 20000);
-        dutyInput.item = this;
-    }
-});

+ 1147 - 0
o2web/source/x_component_query_StatementDesigner/widget/ViewFilter.js

@@ -0,0 +1,1147 @@
+MWF.xApplication.query = MWF.xApplication.query || {};
+MWF.xApplication.query.StatementDesigner = MWF.xApplication.query.StatementDesigner || {};
+if(!MWF.APPDSMD)MWF.APPDSMD = MWF.xApplication.query.StatementDesigner;
+MWF.xApplication.query.StatementDesigner.widget = MWF.xApplication.query.StatementDesigner.widget || {};
+if( !MWF.APPDSMD.LP ){
+    MWF.xDesktop.requireApp("query.StatementDesigner", "lp." + MWF.language, null, false);
+}
+
+MWF.xApplication.query.StatementDesigner.widget.ViewFilter = new Class({
+    Implements: [Options, Events],
+    Extends: MWF.widget.Common,
+    options: {
+        "style": "default",
+        "type": "identity",
+        "withForm" : false,
+        "names": []
+    },
+    initialize: function (node, app, filtrData, options) {
+        this.setOptions(options);
+        this.node = $(node);
+        this.app = app;
+        this.filtrData = filtrData;
+
+        this.path = "../x_component_query_StatementDesigner/widget/$ViewFilter/";
+        this.cssPath = "../x_component_query_StatementDesigner/widget/$ViewFilter/" + this.options.style + "/css.wcss";
+        this._loadCss();
+
+        this.items = [];
+        this.load();
+
+    },
+    load: function (data) {
+        var _load = function () {
+            this.getInputNodes();
+            this.createActionNode();
+            //this.createAddNode();
+            //this.loadIdentitys();
+            this.loadData();
+        }.bind(this)
+        if( this.app.statement && this.app.statement.data ){
+            this.statementData = this.app.statement.data;
+            _load();
+        }else if( this.options.statementId ){
+            o2.Actions.load("x_query_assemble_designer").StatementAction.get( this.options.statementId, function (json) {
+                this.statementData = json.data;
+                _load();
+            }.bind(this))
+        }else{
+            _load();
+        }
+    },
+    loadData: function () {
+        if (this.filtrData.filtrData && this.filtrData.filtrData.length) {
+            this.filtrData.filtrData.each(function (data) {
+                if( this.options.withForm ){
+                    this.items.push(new MWF.xApplication.query.StatementDesigner.widget.ViewFilter.ItemWithForm(this, data));
+                }else{
+                    this.items.push(new MWF.xApplication.query.StatementDesigner.widget.ViewFilter.Item(this, data));
+                }
+            }.bind(this));
+        }
+
+        if (this.filtrData.customData && this.filtrData.customData.length) {
+            this.filtrData.customData.each(function (data) {
+                data.type = "custom";
+                this.items.push(new MWF.xApplication.query.StatementDesigner.widget.ViewFilter.ItemCustom(this, data));
+            }.bind(this));
+        }
+    },
+    createScriptArea: function (node) {
+        this.scriptValueArea = node;
+        var title = node.get("title");
+
+        MWF.require("MWF.widget.ScriptArea", function () {
+            this.scriptArea = new MWF.widget.ScriptArea(node, {
+                "title": title,
+                "maxObj": this.app.formContentNode || this.app.pageContentNode,
+                "onChange": function () {
+                    this.scriptData = this.scriptArea.toJson();
+                }.bind(this),
+                "onSave": function () {
+                    //this.app.saveForm();
+                }.bind(this),
+                "style": "formula"
+            });
+            var v = (this.scriptData) ? this.scriptData.code : "";
+            this.scriptArea.load(v);
+        }.bind(this));
+    },
+    createFilterValueScriptArea: function (node) {
+        var title = node.get("title");
+
+        MWF.require("MWF.widget.ScriptArea", function () {
+            this.filterValueScriptArea = new MWF.widget.ScriptArea(node, {
+                "title": title,
+                "isload": true,
+                "isbind": false,
+                "maxObj": this.app.formContentNode || this.app.pageContentNode,
+                "onChange": function () {
+                    this.filterValueScriptData = this.filterValueScriptArea.toJson();
+                }.bind(this),
+                "onSave": function () {
+                    //this.app.saveForm();
+                }.bind(this),
+                "style": "formula"
+            });
+            var v = (this.filterValueScriptData) ? this.filterValueScriptData.code : "";
+            this.filterValueScriptArea.load(v);
+        }.bind(this));
+    },
+    createCustomFilterValueScriptArea: function (node) {
+        var title = node.get("title");
+
+        MWF.require("MWF.widget.ScriptArea", function () {
+            this.customFilterValueScriptArea = new MWF.widget.ScriptArea(node, {
+                "title": title,
+                "isload": true,
+                "isbind": false,
+                "maxObj": this.app.formContentNode || this.app.pageContentNode,
+                "onChange": function () {
+                    this.customFilterValueScriptData = this.customFilterValueScriptArea.toJson();
+                }.bind(this),
+                "onSave": function () {
+                    //this.app.saveForm();
+                }.bind(this),
+                "style": "formula"
+            });
+            var v = (this.customFilterValueScriptData) ? this.customFilterValueScriptData.code : "";
+            this.customFilterValueScriptArea.load(v);
+        }.bind(this));
+    },
+    getInputNodes: function () {
+        debugger;
+        this.inputAreaNode = this.node.getElement(".inputAreaNode_vf");
+        this.actionAreaNode = this.node.getElement(".actionAreaNode_vf");
+        this.actionAreaNode.setStyles(this.css.actionAreaNode);
+        this.listAreaNode = this.node.getElement(".listAreaNode_vf");
+        this.fieldListAreaNode = this.node.getElement(".fieldListAreaNode_vf");
+
+        this.restrictViewFilterTable = this.node.getElement(".restrictViewFilterTable_vf");
+
+        var scriptValueArea = this.node.getElement(".MWFFilterFormulaArea");
+        if (scriptValueArea) {
+            this.createScriptArea(scriptValueArea);
+        }
+
+        this.titleInput = this.inputAreaNode.getElement(".titleInput_vf");
+        this.pathInput = this.inputAreaNode.getElement(".pathInput_vf");
+        this.pathInputSelect = this.inputAreaNode.getElement(".pathInputSelect_vf");
+        this.parameterInput = this.inputAreaNode.getElement(".parameterInput_vf");
+        // this.parameterInputSelect = this.inputAreaNode.getElement(".parameterInputSelect_vf");
+        this.datatypeInput = this.inputAreaNode.getElement(".datatypeInput_vf");
+
+        this.restrictFilterInput = this.inputAreaNode.getElement(".restrictFilterInput_vf");
+        this.customFilterInput = this.inputAreaNode.getElement(".customFilterInput_vf");
+
+        // this.logicInput = this.inputAreaNode.getElement(".logicInput_vf");
+
+        this.comparisonInput = this.inputAreaNode.getElement(".comparisonInput_vf");
+        // this.comparisonInput.addEvent("change", function(){
+        //     this.switchInputDisplay();
+        // }.bind(this))
+
+        this.valueTextInput = this.inputAreaNode.getElement(".valueTextInput_vf");
+        this.valueNumberInput = this.inputAreaNode.getElement(".valueNumberInput_vf");
+        this.valueDatetimeInput = this.inputAreaNode.getElement(".valueDatetimeInput_vf");
+        this.valueBooleanInput = this.inputAreaNode.getElement(".valueBooleanInput_vf");
+        this.valueDateInput = this.inputAreaNode.getElement(".valueDateInput_vf");
+        this.valueTimeInput = this.inputAreaNode.getElement(".valueTimeInput_vf");
+
+        if (this.app.statement && this.app.statement.view) {
+            var dataId = this.app.statement.view.data.id;
+
+            this.filterValueType = this.inputAreaNode.getElements("[name='" + dataId + "viewFilterValueType']");
+            this.filterValueScriptDiv = this.inputAreaNode.getElement("#" + dataId + "viewFilterValueScriptDiv");
+            this.filterValueScript = this.inputAreaNode.getElement("[name='" + dataId + "viewFilterValueScript']");
+            if (this.filterValueScript) {
+                this.createFilterValueScriptArea(this.filterValueScript);
+            }
+
+            this.customFilterValueTypes = this.inputAreaNode.getElements("[name='" + dataId + "viewCustomFilterValueType']");
+            this.customFilterValueScriptDiv = this.inputAreaNode.getElement("#" + dataId + "viewCustomFilterValueScriptDiv");
+            this.customFilterValueScript = this.inputAreaNode.getElement("[name='" + dataId + "viewCustomFilterValueScript']");
+            if (this.customFilterValueScript) {
+                this.createCustomFilterValueScriptArea(this.customFilterValueScript);
+            }
+        }
+
+        MWF.require("MWF.widget.Calendar", function () {
+            this.calendar = new MWF.widget.Calendar(this.valueDatetimeInput, {
+                "style": "xform",
+                "isTime": true,
+                "secondEnable": true,
+                "target": this.app.content,
+                "format": "db",
+                "onComplate": function () {
+                    this.node.getElement("#" + id + "viewFilterDateFormulaSelector").getElements("input").set("checked", false);
+                }.bind(this)
+            });
+            new MWF.widget.Calendar(this.valueDateInput, {
+                "style": "xform",
+                "isTime": false,
+                "target": this.app.content,
+                "format": "%Y-%m-%d"
+            });
+            new MWF.widget.Calendar(this.valueTimeInput, {
+                "style": "xform",
+                "timeOnly": true,
+                "secondEnable": true,
+                "target": this.app.content,
+                "format": "%H:%M:%S"
+            });
+        }.bind(this));
+
+        this.datatypeInput.addEvent("change", function () {
+            this.switchInputDisplay();
+        }.bind(this));
+
+        this.valueTextInput.addEvent("keydown", function (e) {
+            if (e.code == 13) this.modifyOrAddFilterItem();
+        }.bind(this));
+        this.valueNumberInput.addEvent("keydown", function (e) {
+            if (e.code == 13) this.modifyOrAddFilterItem();
+        }.bind(this));
+
+        this.pathInputSelect.addEvent("change", function ( ev ) {
+            var option = ev.target.options[ev.target.selectedIndex];
+            if( !this.statementData )return;
+            debugger;
+            var type = option.retrieve("type");
+            var d = this.statementData;
+            var field = option.retrieve("field");
+            if( field ){
+                this.titleInput.set("value", (field.description || field.name).replace(/\./g,""));
+                if( field.name ){
+                    var path = this.pathInput.get("value");
+                    if( path.indexOf(".") > -1 ){
+                        path = path.split(".")[0] +"."+ field.name;
+                    }else{
+                        var alias;
+                        var tableName = option.retrieve("tableName");
+                        if( d.data.indexOf(tableName) > -1){
+                            var str = d.data.split(tableName)[1].trim();
+                            if( str.indexOf(" ") )alias = str.split(" ")[0];
+                        }
+                        path = alias ? ( alias +"."+ field.name ) : field.name;
+                    }
+                    this.pathInput.set("value", path);
+                }
+                if( field.type ){
+                    var t;
+                    switch (( field.type || "string" ).toLowerCase()) {
+                        case "string":
+                        case "stringList":
+                        case "stringLob":
+                        case "stringMap":
+                            t = "textValue";
+                            break;
+                        case "integer":
+                        case "long":
+                        case "double":
+                        case "integerList":
+                        case "longList":
+                        case "doubleList":
+                            t = "numberValue";
+                            break;
+                        case "dateTime":
+                        case "date":
+                            t = "dateTimeValue";
+                            break;
+                            // t = "dateValue";
+                            // break;
+                        case "time":
+                            t = "timeValue";
+                            break;
+                        case "boolean":
+                        case "booleanList":
+                            t = "booleanValue";
+                            break;
+                        default:
+                            t = "textValue";
+                            break;
+                    }
+                    for (var i = 0; i < this.datatypeInput.options.length; i++) {
+                        if (this.datatypeInput.options[i].value === t) {
+                            this.datatypeInput.options[i].set("selected", true);
+                            this.switchInputDisplay();
+                            if (this.datatypeInput.onchange) this.datatypeInput.onchange();
+                            break;
+                        }
+                    }
+                }
+            }else{
+                this.titleInput.set("value", "");
+                this.pathInput.set("value", "");
+                this.datatypeInput.options[0].set("selected", true);
+                this.switchInputDisplay();
+                if (this.datatypeInput.onchange)this.datatypeInput.onchange();
+            }
+        }.bind(this));
+        this.setPathInputSelectOptions()
+
+        //if (this.app.statement.view){
+        //    var id = this.app.view.data.id;
+        //     var div = this.node.getElement("#"+id+"viewFilterValueArea2");
+        //     // inputs = div.getElements("input");
+        //     if( div ){
+        //this.valueTextInput2 = div.getElement(".valueTextInput2_vf") || null;
+        //this.valueNumberInput2 = div.getElement(".valueNumberInput2_vf") || null;
+        //this.valueDatetimeInput2 = div.getElement(".valueDatetimeInput2_vf") || null;
+        //this.valueDateInput2 = div.getElement(".valueDateInput2_vf") || null;
+        //this.valueTimeInput2 = div.getElement(".valueTimeInput2_vf") || null;
+        //this.valueBooleanInput2 = div.getElement(".valueBooleanInput2_vf") || null;
+        //
+        //MWF.require("MWF.widget.Calendar", function(){
+        //    this.calendar = new MWF.widget.Calendar(this.valueDatetimeInput2, {
+        //        "style": "xform",
+        //        "isTime": true,
+        //        "secondEnable": true,
+        //        "target": this.app.content,
+        //        "format": "db",
+        //        "onComplate": function(){
+        //            this.node.getElement("#"+id+"viewFilterDateFormulaSelector2").getElements("input").set("checked", false);
+        //        }.bind(this)
+        //    });
+        //    new MWF.widget.Calendar(this.valueDateInput2, {
+        //        "style": "xform",
+        //        "isTime": false,
+        //        "target": this.app.content,
+        //        "format": "%Y-%m-%d"
+        //    });
+        //    new MWF.widget.Calendar(this.valueTimeInput2, {
+        //        "style": "xform",
+        //        "timeOnly": true,
+        //        "secondEnable": true,
+        //        "target": this.app.content,
+        //        "format": "%H:%M:%S"
+        //    });
+        //}.bind(this));
+        //
+        //this.valueTextInput2.addEvent("keydown", function(e){
+        //    if (e.code==13) this.modifyOrAddFilterItem();
+        //}.bind(this));
+        //this.valueNumberInput2.addEvent("keydown", function(e){
+        //    if (e.code==13) this.modifyOrAddFilterItem();
+        //}.bind(this));
+        //     }
+        // }
+    },
+    setPathInputSelectOptions : function(){
+        debugger;
+        this.pathInputSelect.empty();
+        if( !this.statementData )return;
+        var d = this.statementData;
+        var fun = function ( tableName ) {
+            o2.Actions.load("x_query_assemble_designer").QueryAction.getEntityProperties(
+                d.entityCategory === "dynamic" ? d.table : d.entityClassName,
+                d.entityCategory,
+                function(json){
+                    var ps = this.pathInput.get("value").split(".");
+                    var p = ps[1] ? ps[1] : ps[0];
+                    var option = new Element("option", { "text": "", "value": "" }).inject(this.pathInputSelect);
+                    option.store("type", d.entityCategory);
+                    option.store("tableName", tableName );
+                    (json.data||[]).each( function ( field ) {
+                        var option = new Element("option", {
+                            "text": field.name + ( field.description ? ("-" + field.description) : "" ),
+                            "value": field.name,
+                            "selected": (field.name===p)
+                        }).inject(this.pathInputSelect);
+                        option.store("field", field);
+                        option.store("type", d.entityCategory );
+                        option.store("tableName", tableName );
+                    }.bind(this))
+                }.bind(this)
+            )
+        }.bind(this);
+
+        if( d.entityCategory === "dynamic" ){
+            if( d.table ){
+                o2.Actions.load("x_query_assemble_designer").TableAction.get(d.table, function(json){
+                    fun( json.data.name )
+                })
+            }
+        }else{
+            fun( d.entityClassName.split(".").getLast() )
+        }
+    },
+    resetStatementData : function( statementId, callback ){
+        if( statementId && statementId !== "none" ){
+            this.options.statementId = statementId;
+            o2.Actions.load("x_query_assemble_designer").StatementAction.get( statementId, function (json) {
+                this.statementData = json.data;
+                this.setPathInputSelectOptions();
+                if(callback)callback();
+            }.bind(this))
+        }else{
+            this.options.statementId = "";
+            this.statementData = null;
+            this.setPathInputSelectOptions();
+            if(callback)callback();
+        }
+    },
+    switchInputDisplay: function () {
+        var formatType = this.datatypeInput.options[this.datatypeInput.selectedIndex].value;
+
+        if( !this.options.withForm ) {
+            var id = "";
+            if ( this.app.statement && this.app.statement.view ) {
+                id = this.app.statement.view.data.id;
+            }
+            var config = {
+                "textValue": {
+                    "selectorArea": "#" + id + "viewFilterTextFormulaSelector",
+                    "input": this.valueTextInput
+                },
+                "datetimeValue": {
+                    "selectorArea": "#" + id + "viewFilterDateFormulaSelector",
+                    "input": this.valueDatetimeInput
+                },
+                "dateTimeValue": {
+                    "selectorArea": "#" + id + "viewFilterDateFormulaSelector",
+                    "input": this.valueDatetimeInput
+                },
+                "dateValue": {
+                    "selectorArea": "#" + id + "viewFilterDateOnlyFormulaSelector",
+                    "input": this.valueDateInput
+                },
+                "timeValue": {
+                    "selectorArea": "#" + id + "viewFilterTimeOnlyFormulaSelector",
+                    "input": this.valueTimeInput
+                },
+                "numberValue": {
+                    "input": this.valueNumberInput
+                },
+                "booleanValue": {
+                    "input": this.valueBooleanInput
+                }
+            };
+
+            var formulaSelectorIdList = [
+                "#" + id + "viewFilterTextFormulaSelector",
+                "#" + id + "viewFilterDateFormulaSelector",
+                "#" + id + "viewFilterDateOnlyFormulaSelector",
+                "#" + id + "viewFilterTimeOnlyFormulaSelector"
+            ];
+
+            var inputList = [
+                this.valueTextInput,
+                this.valueDatetimeInput,
+                this.valueDateInput,
+                this.valueTimeInput,
+                this.valueNumberInput,
+                this.valueBooleanInput
+            ];
+            formulaSelectorIdList.each(function (id) {
+                var el = this.inputAreaNode.getElement(id);
+                if (!el) return;
+                el.setStyle("display", "none");
+            }.bind(this));
+            inputList.each(function (el) {
+                el.setStyle("display", "none");
+            }.bind(this));
+            var obj = config[formatType];
+            if (obj) {
+                if (obj.selectorArea) {
+                    var el = this.inputAreaNode.getElement(obj.selectorArea);
+                    if (el) el.setStyle("display", "block");
+                }
+                if (obj.input) obj.input.setStyle("display", "block");
+            }
+        }
+
+
+        var comparisonConfig = {
+            "textValue": ["equals", "notEquals", "greaterThan", "greaterThanOrEqualTo", "lessThan", "lessThanOrEqualTo", "like", "notLike"],
+            "numberValue": ["equals", "notEquals", "greaterThan", "greaterThanOrEqualTo", "lessThan", "lessThanOrEqualTo"],
+            "dateTimeValue": ["equals", "notEquals", "greaterThan", "greaterThanOrEqualTo", "lessThan", "lessThanOrEqualTo"],
+            "dateValue": ["equals", "notEquals", "greaterThan", "greaterThanOrEqualTo", "lessThan", "lessThanOrEqualTo" ],
+            "timeValue": [ "equals", "notEquals", "greaterThan", "greaterThanOrEqualTo", "lessThan", "lessThanOrEqualTo"],
+            "booleanValue": ["equals","notEquals"]
+        };
+        if( this.comparisonInput ){
+            var availableComparisonList = comparisonConfig[formatType];
+            var options = this.comparisonInput.options;
+            var comparison = options[this.comparisonInput.selectedIndex].value;
+            if( !this.originalComparisonOptions ){
+                this.originalComparisonOptions = [];
+                for( var i=0; i< options.length; i++ ){
+                    this.originalComparisonOptions.push({
+                        "text" : options[i].text,
+                        "value" : options[i].value
+                    });
+                }
+            }
+            while( this.comparisonInput.options && this.comparisonInput.options.length ){
+                this.comparisonInput.options[0].destroy();
+            }
+            for( var i=0; i<this.originalComparisonOptions.length; i++ ){
+                var opt = this.originalComparisonOptions[i];
+                if( availableComparisonList.contains( opt.value )){
+                    var option = new Element("option", {
+                        text : opt.text,
+                        value : opt.value
+                    }).inject( this.comparisonInput );
+                    if( opt.value === comparison )option.selected = true;
+                }
+            }
+        }
+    },
+    createActionNode: function () {
+        this.actionNode = new Element("div", {"styles": this.css.actionNode}).inject(this.actionAreaNode);
+        this.actionNode.addEvent("click", function () {
+            this.modifyOrAddFilterItem();
+        }.bind(this));
+    },
+    modifyOrAddFilterItem: function () {
+        var flag;
+        if (this.currentFilterItem) {
+            flag = this.modifyFilterItem();
+        } else {
+            if( this.options.withForm ){
+                flag = this.addFilterItemWithForm();
+            }else if (this.restrictFilterInput.checked) {
+                flag = this.addFilterItem();
+            } else {
+                flag = this.addCustomFilterItem();
+            }
+        }
+        if( flag ){
+            this.setData({
+                "logic": "and",
+                "path": "",
+                "parameter" : "",
+                "title": "",
+                "type": this.restrictFilterInput.checked ? "restrict" : "custom",
+                "comparison": "equals",
+                "formatType": "textValue",
+                "value": "",
+                "otherValue": "",
+                "code": ""
+            });
+        }
+    },
+    modifyFilterItem: function () {
+        var data = this.getInputData();
+        if( this.options.withForm ){
+            if (this.verificationDataWithForm(data)) {
+                this.currentFilterItem.reload(data);
+                this.currentFilterItem.unSelected();
+                this.fireEvent("change");
+                return true;
+            }
+        }else if( this.restrictFilterInput.checked ){
+            if (this.verificationData(data)) {
+                this.currentFilterItem.reload(data);
+                this.currentFilterItem.unSelected();
+                this.fireEvent("change");
+                return true;
+            }
+        }else{
+            if (this.verificationDataCustom(data)) {
+                this.currentFilterItem.reload(data);
+                this.currentFilterItem.unSelected();
+                this.fireEvent("change");
+                return true;
+            }
+        }
+        return false;
+    },
+    addFilterItem: function () {
+        var data = this.getInputData();
+        if (this.verificationData(data)) {
+            this.items.push(new MWF.xApplication.query.StatementDesigner.widget.ViewFilter.Item(this, data));
+            this.fireEvent("change");
+            return true;
+        }
+        return false;
+    },
+    addCustomFilterItem: function () {
+        var data = this.getInputData();
+        if (this.verificationDataCustom(data)) {
+            this.items.push(new MWF.xApplication.query.StatementDesigner.widget.ViewFilter.ItemCustom(this, data));
+            this.fireEvent("change");
+            return true;
+        }
+        return false;
+    },
+    addFilterItemWithForm : function(){
+        var data = this.getInputData();
+        if (this.verificationDataWithForm(data)) {
+            this.items.push(new MWF.xApplication.query.StatementDesigner.widget.ViewFilter.ItemWithForm(this, data));
+            this.fireEvent("change");
+            return true;
+        }
+        return false;
+    },
+    verificationData: function (data) {
+        if ( this.parameterInput && !data.parameter) {
+            this.verificationNode = new Element("div", {"styles": this.css.verificationNode}).inject(this.inputAreaNode);
+            new Element("div", {
+                "styles": this.css.verificationTextNode,
+                "text": MWF.APPDSMD.LP.mastInputParameter
+            }).inject(this.verificationNode);
+            this.parameterInput.focus();
+            this.parameterInput.setStyle("background-color", "#fbe8e8");
+
+            this.parameterInput.addEvents({
+                "keydown": function () {
+                    if (this.verificationNode) {
+                        this.verificationNode.destroy();
+                        this.verificationNode = null;
+                        this.parameterInput.setStyle("background-color", "#FFF");
+                    }
+                }.bind(this),
+                "click": function () {
+                    if (this.verificationNode) {
+                        this.verificationNode.destroy();
+                        this.verificationNode = null;
+                    }
+                }.bind(this)
+            });
+            return false;
+        }
+        // if (data.comparison=="range" && !data.otherValue){
+        //     this.verificationNode = new Element("div", {"styles": this.css.verificationNode}).inject(this.inputAreaNode);
+        //     new Element("div", {"styles": this.css.verificationTextNode, "text": MWF.APPDSMD.LP.mastInputPath}).inject(this.verificationNode);
+        // }
+        return true;
+    },
+    verificationDataCustom: function (data) {
+        if (!data.title) {
+            this.verificationNode = new Element("div", {"styles": this.css.verificationNode}).inject(this.inputAreaNode);
+            new Element("div", {
+                "styles": this.css.verificationTextNode,
+                "text": MWF.APPDSMD.LP.mastInputTitle
+            }).inject(this.verificationNode);
+            this.titleInput.focus();
+            this.titleInput.setStyle("background-color", "#fbe8e8");
+
+            this.titleInput.addEvents({
+                "keydown": function () {
+                    if (this.verificationNode) {
+                        this.verificationNode.destroy();
+                        this.verificationNode = null;
+                        this.titleInput.setStyle("background-color", "#FFF");
+                    }
+                }.bind(this),
+                "click": function () {
+                    if (this.verificationNode) {
+                        this.verificationNode.destroy();
+                        this.verificationNode = null;
+                    }
+                }.bind(this)
+            });
+            return false;
+        }
+        if (!data.path || data.path.indexOf(".")<1 ) {
+            this.verificationNode = new Element("div", {"styles": this.css.verificationNode}).inject(this.inputAreaNode);
+            var text = !data.path ? MWF.APPDSMD.LP.mastInputPath : MWF.APPDSMD.LP.pathExecption;
+            new Element("div", {
+                "styles": this.css.verificationTextNode,
+                "text": text
+            }).inject(this.verificationNode);
+            this.pathInput.focus();
+            this.pathInput.setStyle("background-color", "#fbe8e8");
+
+            this.pathInput.addEvents({
+                "keydown": function () {
+                    if (this.verificationNode) {
+                        this.verificationNode.destroy();
+                        this.verificationNode = null;
+                        this.pathInput.setStyle("background-color", "#FFF");
+                    }
+                }.bind(this),
+                "click": function () {
+                    if (this.verificationNode) {
+                        this.verificationNode.destroy();
+                        this.verificationNode = null;
+                    }
+                }.bind(this)
+            });
+            return false;
+        }
+        return true;
+    },
+    verificationDataWithForm: function (data) {
+        // if (!data.title) {
+        //     this.verificationNode = new Element("div", {"styles": this.css.verificationNode}).inject(this.inputAreaNode);
+        //     new Element("div", {
+        //         "styles": this.css.verificationTextNode,
+        //         "text": MWF.APPDSMD.LP.mastInputTitle
+        //     }).inject(this.verificationNode);
+        //     this.titleInput.focus();
+        //     this.titleInput.setStyle("background-color", "#fbe8e8");
+        //
+        //     this.titleInput.addEvents({
+        //         "keydown": function () {
+        //             if (this.verificationNode) {
+        //                 this.verificationNode.destroy();
+        //                 this.verificationNode = null;
+        //                 this.titleInput.setStyle("background-color", "#FFF");
+        //             }
+        //         }.bind(this),
+        //         "click": function () {
+        //             if (this.verificationNode) {
+        //                 this.verificationNode.destroy();
+        //                 this.verificationNode = null;
+        //             }
+        //         }.bind(this)
+        //     });
+        //     return false;
+        // }
+        if (!data.path || data.path.indexOf(".")<1 ) {
+            this.verificationNode = new Element("div", {"styles": this.css.verificationNode}).inject(this.inputAreaNode);
+            var text = !data.path ? MWF.APPDSMD.LP.mastInputPath : MWF.APPDSMD.LP.pathExecption;
+            new Element("div", {
+                "styles": this.css.verificationTextNode,
+                "text": text
+            }).inject(this.verificationNode);
+            this.pathInput.focus();
+            this.pathInput.setStyle("background-color", "#fbe8e8");
+
+            this.pathInput.addEvents({
+                "keydown": function () {
+                    if (this.verificationNode) {
+                        this.verificationNode.destroy();
+                        this.verificationNode = null;
+                        this.pathInput.setStyle("background-color", "#FFF");
+                    }
+                }.bind(this),
+                "click": function () {
+                    if (this.verificationNode) {
+                        this.verificationNode.destroy();
+                        this.verificationNode = null;
+                    }
+                }.bind(this)
+            });
+            return false;
+        }
+        return true;
+    },
+    getInputData: function () {
+        // var logic = this.logicInput.options[this.logicInput.selectedIndex].value;
+        var path = this.pathInput.get("value");
+        var parameter = this.parameterInput ? this.parameterInput.get("value") : "";
+
+        var title = this.titleInput.get("value");
+        if (this.restrictFilterInput.checked) var type = "restrict";
+        if (this.customFilterInput.checked) var type = "custom";
+
+        // var comparison = this.comparisonInput.options[this.comparisonInput.selectedIndex].value;
+        var comparison = "";
+        if( this.comparisonInput ){
+            comparison = this.comparisonInput.options[this.comparisonInput.selectedIndex].value;
+        }
+
+        var formatType = this.datatypeInput.options[this.datatypeInput.selectedIndex].value;
+        var value = "";
+        var value2 = "";
+        switch (formatType) {
+            case "textValue":
+                value = this.valueTextInput.get("value") || "";
+                //value2 = (this.valueTextInput2) ? (this.valueTextInput2.get("value") || "") : "";
+                break;
+            case "numberValue":
+                value = this.valueNumberInput.get("value").toFloat();
+                //value2 = (this.valueNumberInput2) ? this.valueNumberInput2.get("value").toFloat() : "";
+                break;
+            case "datetimeValue":
+            case "dateTimeValue":
+                value = this.valueDatetimeInput.get("value") || "";
+                //value2 = (this.valueDatetimeInput2) ? (this.valueDatetimeInput2.get("value") || "") : "";
+                break;
+            case "dateValue":
+                value = this.valueDateInput.get("value") || "";
+                //value2 = (this.valueDateInput2) ? (this.valueDateInput2.get("value") || "") : "";
+                break;
+            case "timeValue":
+                value = this.valueTimeInput.get("value") || "";
+                //value2 = (this.valueTimeInput2) ? (this.valueTimeInput2.get("value") || "") : "";
+                break;
+
+            case "booleanValue":
+                value = this.valueBooleanInput.options[this.valueBooleanInput.selectedIndex].value;
+                //value2 = (this.valueBooleanInput2) ? this.valueBooleanInput2.options[this.valueBooleanInput.selectedIndex].value : "";
+                if (value == "true") {
+                    value = true;
+                } else {
+                    value = false;
+                }
+                //if (value2=="true"){
+                //    value2 = true;
+                //}else{
+                //    value2 = false;
+                //}
+                break;
+        }
+        if (this.options.withForm ) {
+            return {
+                // "logic": "and",
+                "path": path,
+                "title": title,
+                "type": type,
+                "comparison": comparison,
+                "formatType": formatType,
+                "value": value,
+                "otherValue": value2,
+                "code": this.scriptData
+            };
+        }else if (type === "restrict") {
+            this.filterValueType.each(function (radio) {
+                if (radio.get("checked")) valueType = radio.get("value");
+            });
+            return {
+                //"logic": logic,
+                "parameter": parameter,
+                "title": title,
+                "type": type,
+                //"comparison": comparison,
+                "formatType": formatType,
+                "value": value,
+                //"otherValue": value2,
+                "code": this.scriptData,
+                "valueType": valueType,
+                "valueScript": this.filterValueScriptData
+            };
+        } else {
+            var valueType = "";
+            this.customFilterValueTypes.each(function (radio) {
+                if (radio.get("checked")) valueType = radio.get("value");
+            });
+            return {
+                // "logic": "and",
+                "path": path,
+                "title": title,
+                "type": type,
+                // "comparison": comparison,
+                "formatType": formatType,
+                "value": value,
+                "otherValue": value2,
+                "code": this.scriptData,
+                "valueType": valueType,
+                "valueScript": this.customFilterValueScriptData
+            };
+        }
+    },
+
+    setData: function (data) {
+        // for (var i=0; i<this.logicInput.options.length; i++){
+        //     if (this.logicInput.options[i].value===data.logic){
+        //this.logicInput.options[i].set("selected", true);
+        //break;
+        //     }
+        // }
+
+        if(this.titleInput)this.titleInput.set("value", data.title);
+        if(this.pathInput)this.pathInput.set("value", data.path);
+        if(this.parameterInput)this.parameterInput.set("value", data.parameter);
+
+        if( this.comparisonInput ){
+            for (var i=0; i<this.comparisonInput.options.length; i++){
+                if (this.comparisonInput.options[i].value===data.comparison){
+                    this.comparisonInput.options[i].set("selected", true);
+                    break;
+                }
+            }
+        }
+
+
+        for (var i = 0; i < this.datatypeInput.options.length; i++) {
+            if (this.datatypeInput.options[i].value === data.formatType) {
+                this.datatypeInput.options[i].set("selected", true);
+                break;
+            }
+        }
+
+        var ps = this.pathInput.get("value").split(".");
+        var p = ps[1] ? ps[1] : ps[0];
+        var flag = true;
+        for (var i = 0; i < this.pathInputSelect.options.length; i++) {
+            if (this.pathInputSelect.options[i].value === p) {
+                this.pathInputSelect.options[i].set("selected", true);
+                flag = false;
+                break;
+            }
+        }
+        if(flag && this.pathInputSelect.options.length)this.pathInputSelect.options[0].set("selected", true);
+
+
+        this.scriptData = data.code;
+        try {
+            if (this.scriptArea && this.scriptArea.editor) this.scriptArea.editor.setValue(this.scriptData.code);
+        } catch (e) {
+        }
+
+        if( this.options.withForm ){
+            this.switchInputDisplay();
+        }else{
+            switch (data.formatType) {
+                case "textValue":
+                    this.valueTextInput.set("value", data.value);
+                    //if (this.valueTextInput2) this.valueTextInput2.set("value", data.otherValue);
+                    break;
+                case "numberValue":
+                    this.valueNumberInput.set("value", data.value);
+                    //if (this.valueNumberInput2) this.valueNumberInput2.set("value", data.otherValue);
+                    break;
+                case "datetimeValue":
+                case "dateTimeValue":
+                    this.valueDatetimeInput.set("value", data.value);
+                    //if (this.valueDatetimeInput2) this.valueDatetimeInput2.set("value", data.otherValue);
+                    break;
+                case "dateValue":
+                    this.valueDateInput.set("value", data.value);
+                    //if (this.valueDateInput2) this.valueDateInput2.set("value", data.otherValue);
+                    break;
+                case "timeValue":
+                    this.valueTimeInput.set("value", data.value);
+                    //if (this.valueTimeInput2) this.valueTimeInput2.set("value", data.otherValue);
+                    break;
+                case "booleanValue":
+
+                    for (var i = 0; i < this.valueBooleanInput.options.length; i++) {
+                        var v = this.valueBooleanInput.options[i].value;
+                        if (v == "true") {
+                            v = true;
+                        } else {
+                            v = false;
+                        }
+                        if (v === data.value) {
+                            this.valueBooleanInput.options[i].set("selected", true);
+                            break;
+                        }
+                    }
+                    //if (this.valueBooleanInput2){
+                    //    for (var i=0; i<this.valueBooleanInput2.options.length; i++){
+                    //        var v = this.valueBooleanInput2.options[i].value;
+                    //        if (v=="true"){
+                    //            v = true;
+                    //        }else{
+                    //            v = false;
+                    //        }
+                    //        if (v===data.otherValue){
+                    //            this.valueBooleanInput2.options[i].set("selected", true);
+                    //            break;
+                    //        }
+                    //    }
+                    //}
+                    break;
+            }
+
+            if (data.type === "custom") {
+                this.customFilterValueTypes.each(function (radio) {
+                    if (data.valueType) {
+                        if (data.valueType === radio.get("value")) radio.set("checked", true);
+                    } else {
+                        if ("input" === radio.get("value")) radio.set("checked", true);
+                    }
+                });
+                if (this.customFilterValueScriptArea) {
+                    if (!data.valueType || data.valueType === "input") {
+                        this.customFilterValueScriptDiv.hide();
+                        this.customFilterValueScriptData = "";
+                        this.customFilterValueScriptArea.editor.setValue("");
+                    } else {
+                        this.customFilterValueScriptDiv.show();
+                        this.customFilterValueScriptData = data.valueScript;
+                        this.customFilterValueScriptArea.editor.setValue(data.valueScript ? data.valueScript.code : "");
+                    }
+                }
+            }
+
+            if (data.type === "restrict") {
+                this.filterValueType.each(function (radio) {
+                    if (data.valueType) {
+                        if (data.valueType === radio.get("value")) radio.set("checked", true);
+                    } else {
+                        if ("input" === radio.get("value")) radio.set("checked", true);
+                    }
+                });
+                if (this.filterValueScriptArea) {
+                    if (!data.valueType || data.valueType === "input") {
+                        this.filterValueScriptDiv.hide();
+                        this.filterValueScriptData = "";
+                        this.filterValueScriptArea.editor.setValue("");
+                    } else {
+                        this.filterValueScriptDiv.show();
+                        this.filterValueScriptData = data.valueScript;
+                        this.filterValueScriptArea.editor.setValue(data.valueScript ? data.valueScript.code : "");
+                    }
+                }
+            }
+            this.switchInputDisplay();
+        }
+
+        if (this.datatypeInput.onchange) {
+            this.datatypeInput.onchange();
+        }
+    },
+
+    deleteItem: function (item) {
+        if (this.currentFilterItem == item) item.unSelected();
+        this.items.erase(item);
+        item.node.destroy();
+        MWF.release(item);
+        this.fireEvent("change");
+    },
+    getData: function () {
+        var data = [];
+        var customData = [];
+        this.items.each(function (item) {
+            if (item.data.type === "custom") {
+                customData.push(item.data);
+            } else {
+                data.push(item.data);
+            }
+        }.bind(this));
+        return {"data": data, "customData": customData};
+    }
+});
+
+MWF.xApplication.query.StatementDesigner.widget.ViewFilter.Item = new Class({
+    Implements: [Events],
+    initialize: function (filter, data) {
+        this.filter = filter;
+        this.data = data;
+        this.container = this.filter.listAreaNode;
+        this.css = this.filter.css;
+        this.app = this.filter.app;
+        this.load();
+    },
+    load: function () {
+        this.node = new Element("div", {"styles": this.css.itemNode}).inject(this.container);
+        this.deleteNode = new Element("div", {"styles": this.css.itemDeleteNode}).inject(this.node);
+        this.contentNode = new Element("div", {"styles": this.css.itemContentNode}).inject(this.node);
+        this.contentNode.set("text", this.getText());
+
+        this.contentNode.addEvent("click", function () {
+            this.selected();
+        }.bind(this));
+
+        this.deleteNode.addEvent("click", function (e) {
+            this.deleteItem(e);
+        }.bind(this));
+    },
+    getText: function () {
+        var lp = MWF.APPDSMD.LP.filter;
+        if (this.data.formatType === "numberValue") {
+            return this.data.title + " " + this.data.parameter + " " + this.data.value;
+        } else {
+            return this.data.title + " " + this.data.parameter + " \"" + this.data.value + "\"";
+        }
+    },
+    reload: function (data) {
+        this.data = data;
+        this.contentNode.set("text", this.getText());
+    },
+    selected: function () {
+        if( this.filter.verificationNode ){
+            this.filter.verificationNode.destroy();
+            this.filter.verificationNode = null;
+            this.filter.parameterInput.setStyle("background-color", "#FFF");
+        }
+        this.filter.restrictFilterInput.set("checked", true);
+        this.filter.restrictFilterInput.click();
+        if (this.filter.currentFilterItem) this.filter.currentFilterItem.unSelected();
+        this.node.setStyles(this.css.itemNode_current);
+        this.filter.currentFilterItem = this;
+        this.filter.setData(this.data);
+    },
+    unSelected: function () {
+        this.node.setStyles(this.css.itemNode);
+        this.filter.currentFilterItem = null;
+        this.filter.currentItem = this;
+    },
+    deleteItem: function (e) {
+        var _self = this;
+        this.filter.app.confirm("warn", e, MWF.APPDSMD.LP.delete_filterItem_title, MWF.APPDSMD.LP.delete_filterItem, 300, 120, function () {
+            _self.destroy();
+            this.close();
+        }, function () {
+            this.close();
+        });
+    },
+    destroy: function () {
+        this.filter.deleteItem(this);
+    }
+});
+
+MWF.xApplication.query.StatementDesigner.widget.ViewFilter.ItemCustom = new Class({
+    Extends: MWF.xApplication.query.StatementDesigner.widget.ViewFilter.Item,
+    initialize: function (filter, data) {
+        this.filter = filter;
+        this.data = data;
+        this.container = this.filter.fieldListAreaNode;
+        this.css = this.filter.css;
+        this.app = this.filter.app;
+        this.load();
+    },
+    selected: function () {
+        if( this.filter.verificationNode ){
+            this.filter.verificationNode.destroy();
+            this.filter.verificationNode = null;
+            this.filter.pathInput.setStyle("background-color", "#FFF");
+        }
+         this.filter.customFilterInput.set("checked", true);
+         this.filter.customFilterInput.click();
+        if (this.filter.currentFilterItem) this.filter.currentFilterItem.unSelected();
+        this.node.setStyles(this.css.itemNode_current);
+        this.filter.currentFilterItem = this;
+        this.filter.setData(this.data);
+    },
+    getText: function () {
+        var lp = MWF.APPDSMD.LP.filter;
+        return this.data.title + "(" + this.data.path + ")";
+    },
+});
+
+MWF.xApplication.query.StatementDesigner.widget.ViewFilter.ItemWithForm = new Class({
+    Extends: MWF.xApplication.query.StatementDesigner.widget.ViewFilter.Item,
+    initialize: function (filter, data) {
+        this.filter = filter;
+        this.data = data;
+        this.container = this.filter.listAreaNode;
+        this.css = this.filter.css;
+        this.app = this.filter.app;
+        this.load();
+    },
+    selected: function () {
+        if( this.filter.verificationNode ){
+            this.filter.verificationNode.destroy();
+            this.filter.verificationNode = null;
+            this.filter.pathInput.setStyle("background-color", "#FFF");
+        }
+        // this.filter.customFilterInput.set("checked", true);
+        // this.filter.customFilterInput.click();
+        if (this.filter.currentFilterItem) this.filter.currentFilterItem.unSelected();
+        this.node.setStyles(this.css.itemNode_current);
+        this.filter.currentFilterItem = this;
+        this.filter.setData(this.data);
+    },
+    getText: function () {
+        var lp = MWF.APPDSMD.LP.filter;
+        return this.data.title + "(" + this.data.path + ")";
+    },
+});

Некоторые файлы не были показаны из-за большого количества измененных файлов