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

恢复

上级 0344d774
......@@ -323,54 +323,42 @@ import schema from 'async-validator';
* @param {{ name: string }} { name }
* @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:""};
if(!rule[name]){
return falg;
}
rule[name].forEach((item:any) => {
let opValue = op=='AND'?true:false;
if(!falg.isPast){
return falg;
}
// 常规规则
if(item.type == 'SIMPLE'){
if(opValue){
falg.isPast = falg.isPast && this.$verify.checkFieldSimpleRule(this.data[this.service.getItemNameByDeName(item.deName)],item.condOP,item.paramValue,item.ruleInfo,item.paramType,{},item.isKeyCond);
}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);
}
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;
}
// 数值范围
if(item.type == 'VALUERANGE2'){
if(opValue){
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);
}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);
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;
}
// 正则式
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(opValue){
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);
}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);
}
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.infoMessage = item.ruleInfo;
}
// 系统值规则
if(item.type === "SYSVALUERULE" && (item.isNotMode ? item.sysRule.RegExCode.test(this.data[name]) : !item.sysRule.RegExCode.test(this.data[name]))) {
falg.isPast = false;
if(item.type == "SYSVALUERULE") {
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'){
falg = this.verifyDeRules('group',item,item.condOP)
falg = this.verifyDeRules('group',item)
}
});
return falg;
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册