提交 5ed0a454 编写于 作者: U unknown

数字组件允许使用空字符串

上级 9e4e6272
......@@ -1067,6 +1067,9 @@ MWF.xApplication.process.FormDesigner.LP = {
"showOptions": "Show Options",
"onInput": "When inputting",
"onFocus": "On Click",
"emptyValue": "Empty Value",
"showZero": "Show Zero",
"showNullString": "Show an empty string",
"wps" : {
"config":"Config",
"options" : "options",
......@@ -1141,10 +1144,7 @@ MWF.xApplication.process.FormDesigner.LP = {
"www":"www",
"feedbackUrl":"feedbackUrl",
"logoImg":"left logo(172x40)",
"logoUrl":"logo link",
"emptyValue": "Empty Value",
"showZero": "Show Zero",
"showNullString": "Show an empty string"
"logoUrl":"logo link"
}
},
"actionBar": {
......
......@@ -1086,6 +1086,9 @@ MWF.xApplication.process.FormDesigner.LP = {
"showOptions": "显示选项",
"onInput": "输入时",
"onFocus": "点击时",
"emptyValue": "空值",
"showZero": "显示零",
"showNullString": "显示空字符串",
"wps" : {
"config":"配置",
"options" : "通用选项",
......@@ -1160,10 +1163,7 @@ MWF.xApplication.process.FormDesigner.LP = {
"www":"网址",
"feedbackUrl":"反馈地址",
"logoImg":"左上角logo(172x40)",
"logoUrl":"logo链接",
"emptyValue": "空值",
"showZero": "显示零",
"showNullString": "显示空字符串"
"logoUrl":"logo链接"
}
},
"actionBar": {
......
......@@ -1288,7 +1288,7 @@ MWF.xApplication.process.Xform.DatagridMobile = new Class(
var tmpV = new Decimal(totalResaults[idx]);
if (m.type=="number"){
var cell = cells[m.index];
var addv = cell.get("text").toFloat();
var addv = ( cell.get("text") || "0" ).toFloat();
tmpV = tmpV.plus(addv||0);
//tmpV = tmpV + addv;
}
......
......@@ -1324,7 +1324,7 @@ MWF.xApplication.process.Xform.DatagridPC = new Class(
var tmpV = new Decimal(totalResaults[i]);
if (m.type=="number"){
var cell = cells[m.index];
var addv = cell.get("text").toFloat();
var addv = ( cell.get("text") || "0" ).toFloat();
tmpV = tmpV.plus(addv||0);
//tmpV = tmpV + addv;
}
......
......@@ -22,7 +22,8 @@ MWF.xApplication.process.Xform.Number = MWF.APPNumber = new Class({
if (this.node.getFirst()){
var v = this.node.getElement("input").get("value");
var n = v.toFloat();
return (isNaN(n)) ? 0 : n;
return (isNaN(n)) ? (this.json.emptyValue === "string" ? "" : 0) : n;
//return (isNaN(n)) ? 0 : n;
}else{
return this._getBusinessData();
}
......@@ -67,12 +68,15 @@ debugger;
if( !this.node.getElement("input") )return true;
var n = this.node.getElement("input").get("value");
if (isNaN(n)) {
this.notValidationMode(MWF.xApplication.process.Xform.LP.notValidation_number);
return false;
if( n === "" && this.json.emptyValue === "string" ){
return true;
}else{
this.notValidationMode(MWF.xApplication.process.Xform.LP.notValidation_number);
return false;
}
}else{
this.node.getFirst().set("value", this.formatNumber(n));
}
this.node.getFirst().set("value", this.formatNumber(n));
// var v = n.toFloat();
// if (v){
// if (this.json.decimals && (this.json.decimals!="*")){
......@@ -106,6 +110,7 @@ debugger;
var flag = (data.status=="all") ? true: (routeName == data.decision);
if (flag){
var n = this.getInputData();
if( n === "" && this.json.emptyValue === "string" )n = 0;
var v = (data.valueType=="value") ? n : n.length;
switch (data.operateor){
case "isnull":
......@@ -249,18 +254,31 @@ debugger;
}.bind(this));
},
_computeValue: function(value){
return (this.json.defaultValue && this.json.defaultValue.code) ? this.form.Macro.exec(this.json.defaultValue.code, this): (value || "0");
if( this.json.defaultValue && this.json.defaultValue.code){
return this.form.Macro.exec(this.json.defaultValue.code, this)
}else{
if(value){
return value;
}else{
return this.json.emptyValue === "string" ? "" : "0";
}
}
},
getValue: function(){
debugger;
if (this.moduleValueAG) return this.moduleValueAG;
var value = this._getBusinessData();
if (!value) value = this._computeValue();
value = this.formatNumber(value);
return value || "0";
if(!value && this.json.emptyValue === "string"){
return "";
}else{
value = this.formatNumber(value);
return value || "0";
}
},
__setValue: function(value){
this._setBusinessData(value);
if (this.node.getFirst()) this.node.getFirst().set("value", value || "0");
if (this.node.getFirst()) this.node.getFirst().set("value", value || (this.json.emptyValue === "string" ? "" : "0"));
if (this.readonly || this.json.isReadonly) this.node.set("text", value);
this.moduleValueAG = null;
this.fieldModuleLoaded = true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册