Ver Fonte

查询中允许使用视图

unknown há 5 anos atrás
pai
commit
94fc823f5c
37 ficheiros alterados com 481 adições e 39 exclusões
  1. BIN
      o2web/source/x_component_cms_FormDesigner/$Main/bottom/icon/statement.png
  2. BIN
      o2web/source/x_component_cms_FormDesigner/$Main/bottom/icon/statementSelector.png
  3. 1 1
      o2web/source/x_component_cms_FormDesigner/$Main/bottom/tools.json
  4. BIN
      o2web/source/x_component_cms_FormDesigner/$Main/default/icon/statement.png
  5. BIN
      o2web/source/x_component_cms_FormDesigner/$Main/default/icon/statementSelector.png
  6. 1 1
      o2web/source/x_component_cms_FormDesigner/$Main/default/tools.json
  7. 5 0
      o2web/source/x_component_cms_Xform/Statement.js
  8. 4 0
      o2web/source/x_component_cms_Xform/StatementSelector.js
  9. BIN
      o2web/source/x_component_portal_PageDesigner/$Main/bottom/icon/statement.png
  10. 5 0
      o2web/source/x_component_portal_PageDesigner/$Main/bottom/tools.json
  11. BIN
      o2web/source/x_component_portal_PageDesigner/$Main/default/icon/statement.png
  12. 5 0
      o2web/source/x_component_portal_PageDesigner/$Main/default/tools.json
  13. 2 1
      o2web/source/x_component_portal_PageDesigner/Module/Package.js
  14. 3 0
      o2web/source/x_component_portal_PageDesigner/Module/Statement.js
  15. 90 0
      o2web/source/x_component_portal_PageDesigner/Module/Statement/template.json
  16. BIN
      o2web/source/x_component_process_FormDesigner/$Main/bottom/icon/statement.png
  17. BIN
      o2web/source/x_component_process_FormDesigner/$Main/bottom/icon/statementSelector.png
  18. 1 1
      o2web/source/x_component_process_FormDesigner/$Main/bottom/tools.json
  19. BIN
      o2web/source/x_component_process_FormDesigner/$Main/default/icon/statement.png
  20. BIN
      o2web/source/x_component_process_FormDesigner/$Main/default/icon/statementSelector.png
  21. 1 1
      o2web/source/x_component_process_FormDesigner/$Main/default/tools.json
  22. 32 5
      o2web/source/x_component_process_FormDesigner/Module/Statement.js
  23. 1 1
      o2web/source/x_component_process_FormDesigner/Module/StatementSelector/StatementSelector.html
  24. 1 1
      o2web/source/x_component_process_ProcessDesigner/widget/PersonSelector.js
  25. 2 0
      o2web/source/x_component_process_Xform/Package.js
  26. 94 0
      o2web/source/x_component_process_Xform/Statement.js
  27. 118 0
      o2web/source/x_component_process_Xform/StatementSelector.js
  28. 15 0
      o2web/source/x_component_query_Query/$Main/default/css.wcss
  29. BIN
      o2web/source/x_component_query_Query/$Main/default/icon/statement.png
  30. 36 0
      o2web/source/x_component_query_Query/Main.js
  31. 20 8
      o2web/source/x_component_query_Query/Statement.js
  32. BIN
      o2web/source/x_component_query_StatementDesigner/$Main/default/toolbar/preview.png
  33. 1 1
      o2web/source/x_component_query_StatementDesigner/$Main/default/toolbars.html
  34. 14 14
      o2web/source/x_component_query_StatementDesigner/$Statement/column.html
  35. 3 3
      o2web/source/x_component_query_StatementDesigner/Main.js
  36. 23 1
      o2web/source/x_component_query_StatementDesigner/Statement.js
  37. 3 0
      o2web/source/x_component_query_StatementDesigner/lp/zh-cn.js

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


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


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

@@ -196,7 +196,7 @@
     "className": "Comment"
   },
   "statementSelector": {
-    "icon": "statement.png",
+    "icon": "statementSelector.png",
     "text": "选择查询",
     "className": "StatementSelector"
   },

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


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


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

@@ -197,7 +197,7 @@
     "className": "Comment"
   },
   "statementSelector": {
-    "icon": "statement.png",
+    "icon": "statementSelector.png",
     "text": "选择查询",
     "className": "StatementSelector"
   },

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

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


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


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

@@ -176,7 +176,7 @@
     "className": "Office"
   },
   "statementSelector": {
-    "icon": "statement.png",
+    "icon": "statementSelector.png",
     "text": "选择查询",
     "className": "StatementSelector"
   },

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


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


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

@@ -193,7 +193,7 @@
     "className": "Office"
   },
   "statementSelector": {
-    "icon": "statement.png",
+    "icon": "statementSelector.png",
     "text": "选择查询",
     "className": "StatementSelector"
   },

+ 32 - 5
o2web/source/x_component_process_FormDesigner/Module/Statement.js

@@ -36,7 +36,6 @@ MWF.xApplication.process.FormDesigner.Module.Statement = MWF.FCStatement = new C
 			}
 		}).inject(this.form.container);
 	},
-
 	_createNode: function(){
 		this.node = this.moveNode.clone(true, true);
 		this.node.setStyles(this.css.moduleNode);
@@ -44,7 +43,7 @@ MWF.xApplication.process.FormDesigner.Module.Statement = MWF.FCStatement = new C
 		this.node.addEvent("selectstart", function(){
 			return false;
 		});
-		
+
 		this.iconNode = new Element("div", {
 			"styles": this.css.iconNode
 		}).inject(this.node);
@@ -83,8 +82,8 @@ MWF.xApplication.process.FormDesigner.Module.Statement = MWF.FCStatement = new C
             this.viewSelectCell.setStyle("width", "10px");
         }
 
-        MWF.Actions.get("x_query_assemble_designer").getView(this.json["queryView"].id, function(json){
-            var viewData = JSON.decode(json.data.data);
+        MWF.Actions.get("x_query_assemble_designer").getStatement(this.json["queryStatement"].id, function(json){
+            var viewData = JSON.decode(json.data.view);
 
             this.viewData = viewData;
             if( this.json.actionbar === "show" ){
@@ -107,7 +106,7 @@ MWF.xApplication.process.FormDesigner.Module.Statement = MWF.FCStatement = new C
         this._setViewNodeTitle();
     },
     _checkView: function(callback){
-        if (this.json["queryView"] && this.json["queryView"]!="none"){
+        if (this.json["queryStatement"] && this.json["queryStatement"]!="none"){
             this.iconNode.setStyle("display", "none");
             if (this.viewNode) this.viewNode.destroy();
             this.viewNode = null;
@@ -120,5 +119,33 @@ MWF.xApplication.process.FormDesigner.Module.Statement = MWF.FCStatement = new C
             this.node.setStyles(this.css.moduleNode);
             if (callback) callback();
         }
+    },
+    _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);
+
     }
 });

+ 1 - 1
o2web/source/x_component_process_FormDesigner/Module/StatementSelector/StatementSelector.html

@@ -18,7 +18,7 @@
 		<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 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>

+ 1 - 1
o2web/source/x_component_process_ProcessDesigner/widget/PersonSelector.js

@@ -143,9 +143,9 @@ 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){
-                            var type = this.options.type.toLowerCase();
                             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));

+ 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();

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

@@ -0,0 +1,94 @@
+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,
+            "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 [];
+        }
+    }
+});

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

@@ -0,0 +1,118 @@
+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,
+                "viewId": 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);
+                                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));
+        }
+    }
+	
+}); 

+ 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


+ 36 - 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.stat}).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,18 @@ MWF.xApplication.query.Query.Main = new Class({
                 }.bind(this));
             }
         }.bind(this));
+        MWF.Actions.get("x_query_assemble_surface").listStatement(this.options.id, 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 +152,10 @@ MWF.xApplication.query.Query.Main = new Class({
         var item = new MWF.xApplication.query.Query.StatItem(stat, this);
         return item;
     },
+    createStatementNaviItem: function(stat){
+        var item = new MWF.xApplication.query.Query.StatementItem(stat, this);
+        return item;
+    },
 
 
     recordStatus: function(){
@@ -219,4 +239,20 @@ 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();
+            this.viewer = new MWF.QStatement(this.app, this.viewContent, {
+                "application": this.view.query,
+                "statementName": this.view.name
+            });
+        }.bind(this));
+    }
 });

+ 20 - 8
o2web/source/x_component_query_Query/Statement.js

@@ -215,13 +215,13 @@ MWF.xApplication.query.Query.Statement = MWF.QStatement = new Class({
     getView: function(callback){
         this.getLookupAction(function(){
             if (this.json.application){
-                this.getViewRes = this.lookupAction.getView(this.json.viewName, this.json.application, function(json){
+                this.getViewRes = this.lookupAction.getStatement(this.json.statementName, this.json.application, function(json){
                     this.viewJson = JSON.decode(json.data.data);
                     this.json = Object.merge(this.json, json.data);
                     if (callback) callback();
                 }.bind(this));
 
-                // this.lookupAction.invoke({"name": "getView","async": true, "parameter": {"view": this.json.viewName, "application": this.json.application},"success": function(json){
+                // this.lookupAction.invoke({"name": "getView","async": true, "parameter": {"view": this.json.statementName, "application": this.json.application},"success": function(json){
                 //     this.viewJson = JSON.decode(json.data.data);
                 //     this.json = Object.merge(this.json, json.data);
                 //     //var viewData = JSON.decode(json.data.data);
@@ -467,17 +467,29 @@ MWF.xApplication.query.Query.Statement.Item = new Class({
     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);
-            // }
+            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.json.type==="cms"){
+            //     td.addEvent("click", function(ev){
+            //         this.openCms(ev)
+            //         ev.stopPropagation();
+            //     }.bind(this));
+            // }else{
+                td.addEvent("click", function(ev){
+                    this.openWorkAndCompleted(ev)
+                    ev.stopPropagation();
+                }.bind(this));
+            // }
         }
     }
 });

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>

+ 14 - 14
o2web/source/x_component_query_StatementDesigner/$Statement/column.html

@@ -13,20 +13,20 @@
                 <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', '');}"/>是-->
-<!--                    <input class="editTableRadio" name="allowOpen" text{($.allowOpen!==true)?'checked':''} type="radio" value="false"-->
-<!--                           onclick="if(this.checked){ $('text{$.pid}clickCodeTr').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>
+                <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', '');}"/>是
+                    <input class="editTableRadio" name="allowOpen" text{($.allowOpen!==true)?'checked':''} type="radio" value="false"
+                           onclick="if(this.checked){ $('text{$.pid}clickCodeTr').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>
         </table>
 
         <div style="border-top: 1px solid #999; margin-top:10px">

+ 3 - 3
o2web/source/x_component_query_StatementDesigner/Main.js

@@ -497,9 +497,9 @@ MWF.xApplication.query.StatementDesigner.Main = new Class({
 		}.bind(this));
 	},
 
-
-
-
+    preview : function(){
+        this.statement.preview();
+    },
 
     saveStatement: function(){
         this.statement.save(function(){

+ 23 - 1
o2web/source/x_component_query_StatementDesigner/Statement.js

@@ -692,6 +692,28 @@ MWF.xApplication.query.StatementDesigner.Statement = new Class({
         // 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));
     }
 });
 
@@ -1299,7 +1321,7 @@ MWF.xApplication.query.StatementDesigner.View = new Class({
             if (!this.json.data.viewStyles[to][key]) this.json.data.viewStyles[to][key] = style;
         }.bind(this));
     }
-// preview: function(){
+    // preview: function(){
     //     if( this.isNewView ){
     //         this.designer.notice( this.designer.lp.saveViewNotice, "error" );
     //         return;

+ 3 - 0
o2web/source/x_component_query_StatementDesigner/lp/zh-cn.js

@@ -16,6 +16,9 @@ MWF.xApplication.query.StatementDesigner.LP = Object.merge( MWF.xApplication.que
     "save_success": "查询配置保存成功!",
     "inputStatementName": "请输入查询配置名称",
     "inputStatementData": "请先编辑JPQL查询语句",
+    "saveStatementNotice" : "请先保存!",
+    "noViewNotice" : "未创建视图,请先创建视图!",
+    "previewNotSelectStatementNotice" : "只有查询语句才可以预览",
 
     "statementFormat": "如何创建语句:",
     "statementJpql": "直接编写JPQL创建语句",