Explorar o código

修复setData方法省略参数后报错的问题

huqi %!s(int64=5) %!d(string=hai) anos
pai
achega
697f3fd75d

+ 2 - 2
o2web/source/x_component_process_Xform/$Input.js

@@ -200,7 +200,7 @@ MWF.xApplication.process.Xform.$Input = MWF.APP$Input =  new Class({
         //         this.moduleValueAG = null;
         //     }.bind(this));
         // }else {
-        if (o2.typeOf(value.then)=="function"){
+        if (!!value && o2.typeOf(value.then)=="function"){
             var p = o2.promiseAll(value).then(function(v){
                 this.__setValue(v);
             }.bind(this));
@@ -299,7 +299,7 @@ MWF.xApplication.process.Xform.$Input = MWF.APP$Input =  new Class({
         //         this.moduleValueAG = null;
         //     }.bind(this));
         // }else{
-        if (o2.typeOf(data.then)=="function"){
+        if (!!data && o2.typeOf(data.then)=="function"){
             var p = o2.promiseAll(data).then(function(v){
                 this.__setValue(v);
             }.bind(this));

+ 22 - 17
o2web/source/x_component_process_Xform/Checkbox.js

@@ -156,23 +156,28 @@ MWF.xApplication.process.Xform.Checkbox = MWF.APPCheckbox =  new Class({
 	},
 
     _setValue: function(value){
-        var p = o2.promiseAll(value).then(function(v){
-            //if (o2.typeOf(v)=="array") v = v[0];
-            if (this.moduleSelectAG){
-                this.moduleValueAG = this.moduleSelectAG;
-                this.moduleSelectAG.then(function(){
-                    this.__setValue(v);
-                    return v;
-                }.bind(this));
-            }else{
-                this.__setValue(v)
-            }
-            return v;
-        }.bind(this));
-        this.moduleValueAG = p;
-        if (this.moduleValueAG) this.moduleValueAG.then(function(){
-            this.moduleValueAG = null;
-        }.bind(this));
+	    if (!!value){
+            var p = o2.promiseAll(value).then(function(v){
+                //if (o2.typeOf(v)=="array") v = v[0];
+                if (this.moduleSelectAG){
+                    this.moduleValueAG = this.moduleSelectAG;
+                    this.moduleSelectAG.then(function(){
+                        this.__setValue(v);
+                        return v;
+                    }.bind(this));
+                }else{
+                    this.__setValue(v)
+                }
+                return v;
+            }.bind(this));
+            this.moduleValueAG = p;
+            if (this.moduleValueAG) this.moduleValueAG.then(function(){
+                this.moduleValueAG = null;
+            }.bind(this));
+        }else{
+            this.__setValue(value);
+        }
+
 
         // this.moduleValueAG = o2.AG.all(value).then(function(v){
         //     if (this.moduleSelectAG){

+ 6 - 3
o2web/source/x_component_process_Xform/Label.js

@@ -56,10 +56,13 @@ MWF.xApplication.process.Xform.Label = MWF.APPLabel =  new Class({
         }
     },
     setText: function(text){
-        o2.promiseAll(text).then(function(v){
+	    if (!!text){
+            o2.promiseAll(text).then(function(v){
+                this.node.set("text", v || "");
+            }.bind(this));
+        }else{
             this.node.set("text", v || "");
-        }.bind(this));
-
+        }
         //this.node.set("text", text);
     }
 });

+ 22 - 17
o2web/source/x_component_process_Xform/Radio.js

@@ -215,24 +215,29 @@ MWF.xApplication.process.Xform.Radio = MWF.APPRadio =  new Class({
 	},
 
     _setValue: function(value){
-        var p = o2.promiseAll(value).then(function(v){
-            if (o2.typeOf(v)=="array") v = v[0];
-            if (this.moduleSelectAG){
-                this.moduleValueAG = this.moduleSelectAG;
-                this.moduleSelectAG.then(function(){
-                    this.__setValue(v);
-                    return v;
-                }.bind(this));
-            }else{
-                this.__setValue(v)
-            }
-            return v;
-        }.bind(this));
+	    if (!!value){
+            var p = o2.promiseAll(value).then(function(v){
+                if (o2.typeOf(v)=="array") v = v[0];
+                if (this.moduleSelectAG){
+                    this.moduleValueAG = this.moduleSelectAG;
+                    this.moduleSelectAG.then(function(){
+                        this.__setValue(v);
+                        return v;
+                    }.bind(this));
+                }else{
+                    this.__setValue(v)
+                }
+                return v;
+            }.bind(this));
+
+            this.moduleValueAG = p;
+            if (this.moduleValueAG) this.moduleValueAG.then(function(){
+                this.moduleValueAG = null;
+            }.bind(this));
+        }else{
+            this.__setValue(value);
+        }
 
-        this.moduleValueAG = p;
-        if (this.moduleValueAG) this.moduleValueAG.then(function(){
-            this.moduleValueAG = null;
-        }.bind(this));
 
         // this.moduleValueAG = o2.AG.all(value).then(function(v){
         //     if (o2.typeOf(v)=="array") v = v[0];

+ 22 - 17
o2web/source/x_component_process_Xform/Select.js

@@ -203,24 +203,29 @@ MWF.xApplication.process.Xform.Select = MWF.APPSelect =  new Class({
 	},
 
 	_setValue: function(value){
-		var p = o2.promiseAll(value).then(function(v){
-			if (o2.typeOf(v)=="array") v = v[0];
-			if (this.moduleSelectAG){
-				this.moduleValueAG = this.moduleSelectAG;
-				this.moduleSelectAG.then(function(){
-					this.__setValue(v);
-					return v;
-				}.bind(this));
-			}else{
-				this.__setValue(v)
-			}
-			return v;
-		}.bind(this));
+		if (!!value){
+			var p = o2.promiseAll(value).then(function(v){
+				if (o2.typeOf(v)=="array") v = v[0];
+				if (this.moduleSelectAG){
+					this.moduleValueAG = this.moduleSelectAG;
+					this.moduleSelectAG.then(function(){
+						this.__setValue(v);
+						return v;
+					}.bind(this));
+				}else{
+					this.__setValue(v)
+				}
+				return v;
+			}.bind(this));
+
+			this.moduleValueAG = p;
+			if (this.moduleValueAG) this.moduleValueAG.then(function(){
+				this.moduleValueAG = null;
+			}.bind(this));
+		}else{
+			this.__setValue(value);
+		}
 
-		this.moduleValueAG = p;
-		if (this.moduleValueAG) this.moduleValueAG.then(function(){
-			this.moduleValueAG = null;
-		}.bind(this));
 
 		// this.moduleValueAG = o2.AG.all(value).then(function(v){
 		// 	if (o2.typeOf(v)=="array") v = v[0];

+ 1 - 0
o2web/source/x_component_process_Xform/Textarea.js

@@ -24,6 +24,7 @@ MWF.xApplication.process.Xform.Textarea = MWF.APPTextarea =  new Class({
 
 
     _setValue: function(value){
+	    if (!value) value = "";
         var p = o2.promiseAll(value).then(function(v){
             if (o2.typeOf(v)=="array") v = v[0];
             this._setBusinessData(v);