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

逻辑调整

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