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

update

上级 a186c266
......@@ -1278,30 +1278,18 @@ import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public checkRule(name:string){
const isType = (type : any) =>((/^\[object\s(.*)\]$/ as any).exec(Object.prototype.toString.call(type)))[1];
const isSymbol = isType(this.data[name]);
let erro_text = "";
let erro_text :any = "";
let checkValue = this.data[name];
this.rules[name].forEach((item:any)=>{
if(item.hasOwnProperty('type') && item.trigger == 'change'){
let type: any = item.type;
if(type != isSymbol.toLowerCase()){
erro_text = item.message;
return;
}
}
if(item.hasOwnProperty('pattern') && item.trigger == 'change'){
if(item.hasOwnProperty('pattern') && item.trigger == 'change' && checkValue){
let pattern: any = item.pattern;
if(!pattern.test(checkValue)){
erro_text = item.message;
return;
}
}
if(item.hasOwnProperty('required') && item.trigger == 'change'){
if(item.required && !checkValue){
erro_text = item.message
return;
erro_text = item.message;
}
}
});
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册