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

上下文种添加 getParentEnvirment

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

+ 1 - 1
o2web/source/o2_core/o2/xScript/CMSEnvironment.js

@@ -688,7 +688,7 @@ MWF.xScript.CMSEnvironment = function(ev){
                     }
 
                     MWF.xDesktop.requireApp("query.Query", "Viewer", function(){
-                        this.view = new MWF.xApplication.query.Query.Viewer(dlg.content.getFirst(), viewJson, {"style": "select"}, _form.app);
+                        this.view = new MWF.xApplication.query.Query.Viewer(dlg.content.getFirst(), viewJson, {"style": "select"}, _form.app, _form.Macro);
                     }.bind(this));
                 }.bind(this));
             }

+ 1 - 1
o2web/source/o2_core/o2/xScript/Environment.js

@@ -857,7 +857,7 @@ MWF.xScript.Environment = function(ev){
                     }
 
                     MWF.xDesktop.requireApp("query.Query", "Viewer", function(){
-                        this.view = new MWF.xApplication.query.Query.Viewer(dlg.content.getFirst(), viewJson, {"style": "select"}, _form.app);
+                        this.view = new MWF.xApplication.query.Query.Viewer(dlg.content.getFirst(), viewJson, {"style": "select"}, _form.app, _form.Macro);
                     }.bind(this));
                 }.bind(this));
             }

+ 1 - 1
o2web/source/o2_core/o2/xScript/PageEnvironment.js

@@ -736,7 +736,7 @@ MWF.xScript.PageEnvironment = function (ev) {
                     }
 
                     MWF.xDesktop.requireApp("query.Query", "Viewer", function () {
-                        this.view = new MWF.xApplication.query.Query.Viewer(dlg.content.getFirst(), viewJson, { "style": "select" }, _form.app);
+                        this.view = new MWF.xApplication.query.Query.Viewer(dlg.content.getFirst(), viewJson, { "style": "select" }, _form.app, _form.Macro);
                     }.bind(this));
                 }.bind(this));
             }

+ 2 - 2
o2web/source/o2_core/o2/xScript/ViewEnvironment.js

@@ -660,7 +660,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
                     }
 
                     MWF.xDesktop.requireApp("query.Query", "Viewer", function () {
-                        this.view = new MWF.xApplication.query.Query.Viewer(dlg.content.getFirst(), viewJson, { "style": "select" }, _form.app);
+                        this.view = new MWF.xApplication.query.Query.Viewer(dlg.content.getFirst(), viewJson, { "style": "select" }, _form.app, _form.Macro);
                     }.bind(this));
                 }.bind(this));
             }
@@ -748,7 +748,7 @@ MWF.xScript.ViewEnvironment = function (ev) {
     //仅前台对象-----------------------------------------
     //form
     this.page = this.form = this.queryView = {
-        "getParentEnvironment" : function () { return _form.parentEnvironment; }, //视图嵌入的表单或页面的上下文
+        "getParentEnvironment" : function () { return _form.getParentEnvironment(); }, //视图嵌入的表单或页面的上下文
         "getViewInfor" : function () { return _form.getViewInfor(); },
         "getPageInfor" : function () { return _form.getPageInfor(); },
         "getPageData" : function () { return _form.getPageData(); },

+ 1 - 1
o2web/source/x_component_process_Xform/View.js

@@ -80,7 +80,7 @@ MWF.xApplication.process.Xform.View = MWF.APPView =  new Class({
                     this.fireEvent("openDocument");
                     this.openOptions = null;
                 }.bind(this)
-            }, this.form.app);
+            }, this.form.app, this.form.Macro);
         //}.bind(this));
     },
 

+ 1 - 1
o2web/source/x_component_process_Xform/ViewSelector.js

@@ -334,7 +334,7 @@ MWF.xApplication.process.Xform.ViewSelector = MWF.APPViewSelector =  new Class({
                     ],
                     "onPostShow": function(){
                         MWF.xDesktop.requireApp("query.Query", "Viewer", function(){
-                            this.view = new MWF.xApplication.query.Query.Viewer(dlg.content, viewJson, {"style": "select"}, this.form.app );
+                            this.view = new MWF.xApplication.query.Query.Viewer(dlg.content, viewJson, {"style": "select"}, this.form.app, this.form.Macro );
                         }.bind(this));
                     }.bind(this)
                 });

+ 12 - 7
o2web/source/x_component_query_Query/Viewer.js

@@ -23,7 +23,7 @@ MWF.xApplication.query.Query.Viewer = MWF.QViewer = new Class({
         // },
         // "actionRoot": "x_query_assemble_surface"
     },
-    initialize: function(container, json, options, app){
+    initialize: function(container, json, options, app, parentMacro){
         //本类有三种事件,
         //一种是通过 options 传进来的事件,包括 loadView、openDocument、select
         //一种是用户配置的 事件, 在this.options.moduleEvents 中定义的作为类事件
@@ -41,6 +41,8 @@ MWF.xApplication.query.Query.Viewer = MWF.QViewer = new Class({
         this.container = $(container);
         this.json = json;
 
+        this.parentMacro = parentMacro;
+
         debugger;
         this.originalJson = Object.clone(json);
 
@@ -736,6 +738,9 @@ MWF.xApplication.query.Query.Viewer = MWF.QViewer = new Class({
         }.bind(this));
     },
     //api 使用 开始
+    getParentEnvironment : function(){
+      return this.parentMacro ? this.parentMacro.environment : null;
+    },
     getViewInfor : function(){
         return this.json;
     },
@@ -1718,9 +1723,9 @@ MWF.xApplication.query.Query.Viewer.Actionbar = new Class({
             }
             if (flag){
                 flag = true;
-                if (tool.control){
-                    flag = this.form.businessData.control[tool.control]
-                }
+                // if (tool.control){
+                //     flag = this.form.businessData.control[tool.control]
+                // }
                 if (tool.condition){
                     var hideFlag = this.form.Macro.exec(tool.condition, this);
                     flag = !hideFlag;
@@ -1756,9 +1761,9 @@ MWF.xApplication.query.Query.Viewer.Actionbar = new Class({
         //var path = "/x_component_process_FormDesigner/Module/Actionbar/";
         var path = "/x_component_query_ViewDesigner/$View/";
         var flag = true;
-        if (tool.control){
-            flag = this.form.businessData.control[tool.control]
-        }
+        // if (tool.control){
+        //     flag = this.form.businessData.control[tool.control]
+        // }
         if (!noCondition) if (tool.condition){
             var hideFlag = this.form.Macro.exec(tool.condition, this);
             flag = flag && (!hideFlag);