提交 41ebda20 编写于 作者: KK's avatar KK

属性值规则异常信息缓存

上级 092a0bb5
...@@ -206,6 +206,14 @@ import { Util } from '@/ibiz-core/utils'; ...@@ -206,6 +206,14 @@ import { Util } from '@/ibiz-core/utils';
*/ */
protected saveState:any ; protected saveState:any ;
/**
* 异常信息缓存
*
* @type {any}
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public errorCache :any;
/** /**
* 属性值规则 * 属性值规则
* *
...@@ -287,7 +295,7 @@ import { Util } from '@/ibiz-core/utils'; ...@@ -287,7 +295,7 @@ import { Util } from '@/ibiz-core/utils';
* *
* @public * @public
* @param {{ name: string }} { name } * @param {{ name: string }} { name }
* @memberof ${srfclassname('${ctrl.codeName}')}Base * @memberof MobNewFormBase
*/ */
public verifyDeRules(name:string,rule:any = this.deRules,op:string = "AND") :{isPast:boolean,infoMessage:string}{ public verifyDeRules(name:string,rule:any = this.deRules,op:string = "AND") :{isPast:boolean,infoMessage:string}{
let falg:any = {infoMessage:""}; let falg:any = {infoMessage:""};
...@@ -312,25 +320,30 @@ import { Util } from '@/ibiz-core/utils'; ...@@ -312,25 +320,30 @@ import { Util } from '@/ibiz-core/utils';
if(item.type == 'SIMPLE'){ if(item.type == 'SIMPLE'){
startOp(!this.$verify.checkFieldSimpleRule(dataValue,item.condOP,item.paramValue,item.ruleInfo,item.paramType,this.data,item.isKeyCond)); startOp(!this.$verify.checkFieldSimpleRule(dataValue,item.condOP,item.paramValue,item.ruleInfo,item.paramType,this.data,item.isKeyCond));
falg.infoMessage = item.ruleInfo; falg.infoMessage = item.ruleInfo;
this.errorCache[item.deName] = item.ruleInfo;
} }
// 数值范围 // 数值范围
if(item.type == 'VALUERANGE2'){ if(item.type == 'VALUERANGE2'){
startOp( !this.$verify.checkFieldValueRangeRule(dataValue,item.minValue,item.isIncludeMinValue,item.maxValue,item.isIncludeMaxValue,item.ruleInfo,item.isKeyCond)); startOp( !this.$verify.checkFieldValueRangeRule(dataValue,item.minValue,item.isIncludeMinValue,item.maxValue,item.isIncludeMaxValue,item.ruleInfo,item.isKeyCond));
this.errorCache[item.deName] = item.ruleInfo;
falg.infoMessage = item.ruleInfo; falg.infoMessage = item.ruleInfo;
} }
// 正则式 // 正则式
if (item.type == "REGEX") { if (item.type == "REGEX") {
startOp(!this.$verify.checkFieldRegExRule(dataValue,item.regExCode,item.ruleInfo,item.isKeyCond)); startOp(!this.$verify.checkFieldRegExRule(dataValue,item.regExCode,item.ruleInfo,item.isKeyCond));
this.errorCache[item.deName] = item.ruleInfo;
falg.infoMessage = item.ruleInfo; falg.infoMessage = item.ruleInfo;
} }
// 长度 // 长度
if (item.type == "STRINGLENGTH") { if (item.type == "STRINGLENGTH") {
startOp(!this.$verify.checkFieldStringLengthRule(dataValue,item.minValue,item.isIncludeMinValue,item.maxValue,item.isIncludeMaxValue,item.ruleInfo,item.isKeyCond)); startOp(!this.$verify.checkFieldStringLengthRule(dataValue,item.minValue,item.isIncludeMinValue,item.maxValue,item.isIncludeMaxValue,item.ruleInfo,item.isKeyCond));
this.errorCache[item.deName] = item.ruleInfo;
falg.infoMessage = item.ruleInfo; falg.infoMessage = item.ruleInfo;
} }
// 系统值规则 // 系统值规则
if(item.type == "SYSVALUERULE") { if(item.type == "SYSVALUERULE") {
startOp(!this.$verify.checkFieldSysValueRule(dataValue,item.sysRule.regExCode,item.ruleInfo,item.isKeyCond)); startOp(!this.$verify.checkFieldSysValueRule(dataValue,item.sysRule.regExCode,item.ruleInfo,item.isKeyCond));
this.errorCache[item.deName] = item.ruleInfo;
falg.infoMessage = item.ruleInfo; falg.infoMessage = item.ruleInfo;
} }
// 分组 // 分组
...@@ -464,7 +477,7 @@ import { Util } from '@/ibiz-core/utils'; ...@@ -464,7 +477,7 @@ import { Util } from '@/ibiz-core/utils';
this.detailsModel[property].setError(""); this.detailsModel[property].setError("");
resolve(true); resolve(true);
}).catch(({ errors, fields }) => { }).catch(({ errors, fields }) => {
this.detailsModel[property].setError(errors[0].message); this.detailsModel[property].setError(this.errorCache[property]);
resolve(false); resolve(false);
}); });
}); });
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册