提交 0a99e164 编写于 作者: KK's avatar KK

恢复

上级 0344d774
...@@ -323,54 +323,42 @@ import schema from 'async-validator'; ...@@ -323,54 +323,42 @@ import schema from 'async-validator';
* @param {{ name: string }} { name } * @param {{ name: string }} { name }
* @memberof ${srfclassname('${ctrl.codeName}')}Base * @memberof ${srfclassname('${ctrl.codeName}')}Base
*/ */
public verifyDeRules(name:string,rule:any = this.deRules,op:string = "AND") :{isPast:boolean,infoMessage:string}{ public verifyDeRules(name:string,rule:any = this.deRules) :{isPast:boolean,infoMessage:string}{
let falg = {isPast:true,infoMessage:""}; let falg = {isPast:true,infoMessage:""};
if(!rule[name]){ if(!rule[name]){
return falg; return falg;
} }
rule[name].forEach((item:any) => { rule[name].forEach((item:any) => {
let opValue = op=='AND'?true:false; if(!falg.isPast){
return falg;
}
// 常规规则 // 常规规则
if(item.type == 'SIMPLE'){ if(item.type == 'SIMPLE'){
if(opValue){ falg.isPast = this.$verify.checkFieldSimpleRule(this.data[this.service.getItemNameByDeName(item.deName)],item.condOP,item.paramValue,item.ruleInfo,item.paramType,{},item.isKeyCond);
falg.isPast = falg.isPast && this.$verify.checkFieldSimpleRule(this.data[this.service.getItemNameByDeName(item.deName)],item.condOP,item.paramValue,item.ruleInfo,item.paramType,{},item.isKeyCond); falg.infoMessage = item.ruleInfo;
}else{
falg.isPast = falg.isPast || this.$verify.checkFieldSimpleRule(this.data[this.service.getItemNameByDeName(item.deName)],item.condOP,item.paramValue,item.ruleInfo,item.paramType,{},item.isKeyCond);
}
}
// 正则式
if(item.type == 'REGEX'){
if(opValue){
falg.isPast = falg.isPast && !this.$verify.checkFieldRegExRule(this.data[this.service.getItemNameByDeName(item.deName)],item.RegExCode,item.ruleInfo,item.isKeyCond);
}else{
falg.isPast = falg.isPast || !this.$verify.checkFieldRegExRule(this.data[this.service.getItemNameByDeName(item.deName)],item.RegExCode,item.ruleInfo,item.isKeyCond);
}
} }
// 数值范围 // 数值范围
if(item.type == 'VALUERANGE2'){ if(item.type == 'VALUERANGE2'){
if(opValue){ falg.isPast = !this.$verify.checkFieldValueRangeRule(this.data[this.service.getItemNameByDeName(item.deName)],item.minValue,item.isIncludeMinValue,item.maxValue,item.isIncludeMaxValue,item.ruleInfo,item.isKeyCond);
falg.isPast = falg.isPast && !this.$verify.checkFieldValueRangeRule(this.data[this.service.getItemNameByDeName(item.deName)],item.minValue,item.isIncludeMinValue,item.maxValue,item.isIncludeMaxValue,item.ruleInfo,item.isKeyCond); falg.infoMessage = item.ruleInfo;
}else{ }
falg.isPast = falg.isPast || !this.$verify.checkFieldValueRangeRule(this.data[this.service.getItemNameByDeName(item.deName)],item.minValue,item.isIncludeMinValue,item.maxValue,item.isIncludeMaxValue,item.ruleInfo,item.isKeyCond); // 正则式
} if (item.type == "REGEX") {
falg.isPast = !this.$verify.checkFieldRegExRule(this.data[this.service.getItemNameByDeName(item.deName)],item.RegExCode,item.ruleInfo,item.isKeyCond);
falg.infoMessage = item.ruleInfo;
} }
// 长度 // 长度
if (item.type == "STRINGLENGTH") { if (item.type == "STRINGLENGTH") {
if(opValue){ falg.isPast = !this.$verify.checkFieldStringLengthRule(this.data[this.service.getItemNameByDeName(item.deName)],item.minValue,item.isIncludeMinValue,item.maxValue,item.isIncludeMaxValue,item.ruleInfo,item.isKeyCond);
falg.isPast = falg.isPast && !this.$verify.checkFieldStringLengthRule(this.data[this.service.getItemNameByDeName(item.deName)],item.minValue,item.isIncludeMinValue,item.maxValue,item.isIncludeManValue,item.ruleInfo,item.isKeyCond); falg.infoMessage = item.ruleInfo;
}else{
falg.isPast = falg.isPast || !this.$verify.checkFieldStringLengthRule(this.data[this.service.getItemNameByDeName(item.deName)],item.minValue,item.isIncludeMinValue,item.maxValue,item.isIncludeManValue,item.ruleInfo,item.isKeyCond);
}
} }
// 系统值规则 // 系统值规则
if(item.type === "SYSVALUERULE" && (item.isNotMode ? item.sysRule.RegExCode.test(this.data[name]) : !item.sysRule.RegExCode.test(this.data[name]))) { if(item.type == "SYSVALUERULE") {
falg.isPast = false; falg.isPast = !this.$verify.checkFieldSysValueRule(this.data[this.service.getItemNameByDeName(item.deName)],item.sysRule.RegExCode,item.ruleInfo,item.isKeyCond);
} }
falg.infoMessage = item.ruleInfo;
// 分组 // 分组
if(item.type == 'GROUP'){ if(item.type == 'GROUP'){
falg = this.verifyDeRules('group',item,item.condOP) falg = this.verifyDeRules('group',item)
} }
}); });
return falg; return falg;
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册