diff --git a/o2web/source/x_component_process_Xform/DatatablePC.js b/o2web/source/x_component_process_Xform/DatatablePC.js index bf7e06041fbf2ae365ed9f5fd39c6d51509338e4..4971922228553382974cb58b4101d6cf6ae7a2c8 100644 --- a/o2web/source/x_component_process_Xform/DatatablePC.js +++ b/o2web/source/x_component_process_Xform/DatatablePC.js @@ -379,17 +379,46 @@ MWF.xApplication.process.Xform.DatatablePC = new Class( this.totalColumns.each(function(column, index){ var json = column.moduleJson; if(!json)return; + + var pointLength = 0; //小数点后的最大数位 + var tmpV; if (column.type === "count"){ tmpV = data.data.length; }else if(column.type === "number"){ - var tmpV = new Decimal(0); + tmpV = new Decimal(0); for (var i=0; i -1 ){ + pointLength = Math.max(pointLength, v.split(".")[1].length); + } + } + } + } + + if( isNaN( tmpV ) ){ + totalData[json.id] = ""; + column.td.set("text", "" ); + }else{ + if( pointLength > 0 && tmpV.toString() !== "0" ){ + var s = tmpV.toString(); + if( s.indexOf(".") > -1 ){ + var length = s.split(".")[1].length; + if( length < pointLength ){ + totalData[json.id] = s + "0".repeat(pointLength-length); + }else{ + totalData[json.id] = s; + } + }else{ + totalData[json.id] = s +"."+ "0".repeat(pointLength) + } + }else{ + totalData[json.id] = tmpV.toString(); } + column.td.set("text", totalData[json.id] ); } - totalData[json.id] = tmpV.toString(); - column.td.set("text", isNaN( tmpV ) ? "" : tmpV ); }.bind(this)); data.total = totalData; return totalData;