Эх сурвалжийг харах

流程表单组件添加isEmpty方法

unknown 5 жил өмнө
parent
commit
f78be6b81c

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

@@ -217,7 +217,8 @@ MWF.xApplication.process.Xform.$Input = MWF.APP$Input =  new Class({
 		return {"value": [value || ""] , "text": [text || value || ""]};
 	},
     isEmpty : function(){
-	    return !!this.getData();
+	    var data = this.getData();
+	    return !data || !data.trim();
     },
 	getData: function(when){
         if (this.json.compute == "save") this._setValue(this._computeValue());

+ 2 - 2
o2web/source/x_component_process_Xform/Attachment.js

@@ -1107,9 +1107,9 @@ MWF.xApplication.process.Xform.Attachment = MWF.APPAttachment = new Class({
     isEmpty : function(){
         var data = this.getData();
         if( typeOf(data) === "array" ){
-            return data.length !== 0
+            return data.length == 0
         }else{
-            return !!data;
+            return !data;
         }
     },
     getData: function () {

+ 2 - 2
o2web/source/x_component_process_Xform/Combox.js

@@ -182,9 +182,9 @@ MWF.xApplication.process.Xform.Combox = MWF.APPCombox =  new Class({
     isEmpty : function(){
         var data = this.getData();
         if( typeOf(data) === "array" ){
-            return data.length !== 0;
+            return data.length === 0;
         }else{
-            return !!data;
+            return !data;
         }
     },
     getInputData: function(){

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

@@ -1799,7 +1799,7 @@ debugger;
     isEmpty: function(){
         var data = this.getData();
         if( typeOf(data) !== "object" )return true;
-        return !!data.filetext;
+        return !data.filetext || data.filetext===this.json.defaultValue.filetext;
     },
     getData: function(){
         //if (this.editMode){

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

@@ -373,7 +373,7 @@ MWF.xApplication.process.Xform.Htmleditor = MWF.APPHtmleditor =  new Class({
         this.setData(this._getBusinessData());
     },
     isEmpty : function(){
-        return !!this.getData();
+        return !this.getData().trim();
     },
     getData: function(){
         this.clearEcnetNodes();

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

@@ -87,7 +87,7 @@ MWF.xApplication.process.Xform.ImageClipper = MWF.APPImageClipper =  new Class({
         return {"value": [value], "text": [value]};
     },
     isEmpty : function(){
-        return !!this.getData();
+        return !this.getData();
     },
     getData: function( data ){
         return this._getBusinessData() || "";

+ 3 - 1
o2web/source/x_component_process_Xform/Number.js

@@ -3,7 +3,9 @@ MWF.xApplication.process.Xform.Number = MWF.APPNumber =  new Class({
     Implements: [Events],
     Extends: MWF.APPTextfield,
     iconStyle: "numberIcon",
-
+    isEmpty : function(){
+        return !this.getData();
+    },
     getInputData: function(){
         if (this.node.getFirst()){
             var v = this.node.getElement("input").get("value");

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

@@ -1205,7 +1205,7 @@ MWF.xApplication.process.Xform.Office = MWF.APPOffice =  new Class({
     },
     isEmpty : function(){
         var data = this.getData();
-        return !!data;
+        return !data.trim();
     },
     getData: function(){
         if (this.officeOCX && (this.officeOCX.DocType==1 || this.officeOCX.DocType==6)){