فهرست منبع

修复数据网格

unknown 5 سال پیش
والد
کامیت
7a8a2c6e18

+ 41 - 38
o2web/source/x_component_process_Xform/DatagridMobile.js

@@ -297,49 +297,52 @@ MWF.xApplication.process.Xform.DatagridMobile = new Class(
                     cell.set("MWFId", tds[index].get("id"));
 
                     var cellData = data[th.get("id")];
-                    if (cellData){
-                        for (key in cellData){
-                            var v = cellData[key];
 
-                            var module = this.editModules[index];
-                            if( module && module.json.type == "ImageClipper" ){
-                                this._createImage( cell, module, v );
-                            }else if( module && (module.json.type == "Attachment" || module.json.type == "AttachmentDg") ){
-                                this._createAttachment( cell, module, v );
-                            }else{
-                                text = this._getValueText(index, v);
-                                if( module && module.json.type == "Textarea" ){
-                                    cell.set("html", text);
-                                }else{
-                                    cell.set("text", text);
+                    if( typeOf( cellData ) !== "array" ) {
+                        if (cellData) {
+                            for (key in cellData) {
+                                var v = cellData[key];
+
+                                var module = this.editModules[index];
+                                if (module && module.json.type == "ImageClipper") {
+                                    this._createImage(cell, module, v);
+                                } else if (module && (module.json.type == "Attachment" || module.json.type == "AttachmentDg")) {
+                                    this._createAttachment(cell, module, v);
+                                } else {
+                                    text = this._getValueText(index, v);
+                                    if (module && module.json.type == "Textarea") {
+                                        cell.set("html", text);
+                                    } else {
+                                        cell.set("text", text);
+                                    }
+                                    //cell.set("text", text);
                                 }
-                                //cell.set("text", text);
-                            }
 
 
-                            // if (typeOf(v)==="array"){
-                            //     var textArray = [];
-                            //     v.each( function( item ){
-                            //         if (typeOf(item)==="object"){
-                            //             textArray.push( item.name+((item.unitName) ? "("+item.unitName+")" : "") );
-                            //         }else{
-                            //             textArray.push(item);
-                            //         }
-                            //     }.bind(this));
-                            //     cell.set("text", textArray.join(", "));
-                            // }else if (typeOf(v)==="object"){
-                            //     cell.set("text", v.name+((v.unitName) ? "("+v.unitName+")" : ""));
-                            // }else{
-                            //     cell.set("text", v);
-                            // }
-                            break;
-                            //
-                            // cell.set("text", cellData[key]);
-                            // break;
+                                // if (typeOf(v)==="array"){
+                                //     var textArray = [];
+                                //     v.each( function( item ){
+                                //         if (typeOf(item)==="object"){
+                                //             textArray.push( item.name+((item.unitName) ? "("+item.unitName+")" : "") );
+                                //         }else{
+                                //             textArray.push(item);
+                                //         }
+                                //     }.bind(this));
+                                //     cell.set("text", textArray.join(", "));
+                                // }else if (typeOf(v)==="object"){
+                                //     cell.set("text", v.name+((v.unitName) ? "("+v.unitName+")" : ""));
+                                // }else{
+                                //     cell.set("text", v);
+                                // }
+                                break;
+                                //
+                                // cell.set("text", cellData[key]);
+                                // break;
+                            }
+                        } else { //Sequence
+                            cell.setStyle("text-align", "left");
+                            cell.set("text", idx + 1);
                         }
-                    }else{ //Sequence
-                        cell.setStyle("text-align", "left");
-                        cell.set("text", idx+1);
                     }
 
                     var json = this.form._getDomjson(th);

+ 26 - 17
o2web/source/x_component_process_Xform/DatagridPC.js

@@ -572,6 +572,9 @@ MWF.xApplication.process.Xform.DatagridPC = new Class(
 
 	},
 	_completeLineEdit: function( ev ){
+
+		debugger;
+
 		//this.currentEditLine.getElemets(td);
 		if (!this.editValidation()){
 			return false;
@@ -985,6 +988,8 @@ MWF.xApplication.process.Xform.DatagridPC = new Class(
 		var lastTr = lastTrs[lastTrs.length-1];
 		//var tds = lastTr.getElements("td");
 
+		debugger;
+
 		if (this.gridData.data){
 			this.gridData.data.each(function(data, idx){
 				var tr = this.table.insertRow(idx+1);
@@ -994,31 +999,35 @@ MWF.xApplication.process.Xform.DatagridPC = new Class(
 					var cell = tr.insertCell(index);
 					// cell.set("MWFId", tds[index].get("id"));
 					var cellData = data[th.get("id")];
-					if (cellData){
 
-						for (key in cellData){
-							var v = cellData[key];
+					if( typeOf( cellData ) !== "array" ){
+						if (cellData){
 
-							var module = this.editModules[index];
-							if( module && module.json.type == "ImageClipper" ) {
-								this._createImage(cell, module, v);
-							}else if( module && (module.json.type == "Attachment" || module.json.type == "AttachmentDg") ){
-								this._createAttachment( cell, module, v );
-							}else{
-								var text = this._getValueText(index, v);
-								if( module && module.json.type == "Textarea" ){
-									cell.set("html", text);
+							for (key in cellData){
+								var v = cellData[key];
+
+								var module = this.editModules[index];
+								if( module && module.json.type == "ImageClipper" ) {
+									this._createImage(cell, module, v);
+								}else if( module && (module.json.type == "Attachment" || module.json.type == "AttachmentDg") ){
+									this._createAttachment( cell, module, v );
 								}else{
-									cell.set("text", text);
+									var text = this._getValueText(index, v);
+									if( module && module.json.type == "Textarea" ){
+										cell.set("html", text);
+									}else{
+										cell.set("text", text);
+									}
 								}
+								break;
 							}
-							break;
+						}else{ //Sequence
+							cell.setStyle("text-align", "center");
+							cell.set("text", tr.rowIndex);
 						}
-					}else{ //Sequence
-						cell.setStyle("text-align", "center");
-						cell.set("text", tr.rowIndex);
 					}
 
+
 					var json = this.form._getDomjson(th);
 					if( json && json.isShow === false )cell.hide();
 				}.bind(this));

+ 13 - 8
o2web/source/x_component_process_Xform/Org.js

@@ -137,14 +137,19 @@ MWF.xApplication.process.Xform.Org = MWF.APPOrg =  new Class(
         var value = this.getValue();
         //var text = (this.node.getFirst()) ? this.node.getFirst().get("text") : this.node.get("text");
         var text = [];
-        value.each(function(v){
-            if( typeOf(v) === "string" ){
-                text.push(v);
-            }else{
-                text.push(v.name+((v.unitName) ? "("+v.unitName+")" : ""));
-            }
-        }.bind(this));
-        return {"value": value || "", "text": [text.join(",")]};
+        if( typeOf( value ) === "object" )value = [value];
+        if( typeOf( value ) === "array" ){
+            value.each(function(v){
+                if( typeOf(v) === "string" ){
+                    text.push(v);
+                }else{
+                    text.push(v.name+((v.unitName) ? "("+v.unitName+")" : ""));
+                }
+            }.bind(this));
+            return {"value": value || "", "text": [text.join(",")]};
+        }else{
+            return {"value": [""], "text": [""]};
+        }
     },
 
     loadDescription: function(){

+ 19 - 14
o2web/source/x_component_process_Xform/Personfield.js

@@ -2,14 +2,14 @@ MWF.xDesktop.requireApp("process.Xform", "$Input", null, false);
 MWF.xDesktop.requireApp("Selector", "package", null, false);
 MWF.require("MWF.widget.O2Identity", null, false);
 MWF.xApplication.process.Xform.Personfield = MWF.APPPersonfield =  new Class({
-	Implements: [Events],
-	Extends: MWF.APP$Input,
+    Implements: [Events],
+    Extends: MWF.APP$Input,
     options: {
         "moduleEvents": ["load", "queryLoad", "postLoad", "change", "select"],
         "readonly": true
     },
 
-	iconStyle: "personfieldIcon",
+    iconStyle: "personfieldIcon",
 
     getTextData: function(){
         //var value = this.node.get("value");
@@ -17,14 +17,19 @@ MWF.xApplication.process.Xform.Personfield = MWF.APPPersonfield =  new Class({
         var value = this.getValue();
         //var text = (this.node.getFirst()) ? this.node.getFirst().get("text") : this.node.get("text");
         var text = [];
-        value.each(function(v){
-            if( typeOf(v) === "string" ){
-                text.push(v);
-            }else{
-                text.push(v.name+((v.unitName) ? "("+v.unitName+")" : ""));
-            }
-        }.bind(this));
-        return {"value": value || "", "text": [text.join(",")]};
+        if( typeOf( value ) === "object" )value = [value];
+        if( typeOf( value ) === "array" ){
+            value.each(function(v){
+                if( typeOf(v) === "string" ){
+                    text.push(v);
+                }else{
+                    text.push(v.name+((v.unitName) ? "("+v.unitName+")" : ""));
+                }
+            }.bind(this));
+            return {"value": value || "", "text": [text.join(",")]};
+        }else{
+            return {"value": [""], "text": [""]};
+        }
     },
 
     loadDescription: function(){
@@ -387,7 +392,7 @@ MWF.xApplication.process.Xform.Personfield = MWF.APPPersonfield =  new Class({
         if (!v || !v.length) if (this.descriptionNode)  this.descriptionNode.setStyle("display", "block");
     },
 
-	clickSelect: function( ev ){
+    clickSelect: function( ev ){
 
         var options = this.getOptions();
         if( this.selector && this.selector.loading ) {
@@ -395,7 +400,7 @@ MWF.xApplication.process.Xform.Personfield = MWF.APPPersonfield =  new Class({
         }else{
             this.selector = new MWF.O2Selector(this.form.app.content, options);
         }
-	},
+    },
     resetData: function(){
         var v = this.getValue();
         //this.setData((v) ? v.join(", ") : "");
@@ -648,7 +653,7 @@ MWF.xApplication.process.Xform.Personfield = MWF.APPPersonfield =  new Class({
     },
     setData: function(value){
         if (!value) return false;
-	    var oldValues = this.getData();
+        var oldValues = this.getData();
         var values = [];
         var comboxValues = [];