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

表单项更新需判断正则

上级 63cfadf4
...@@ -382,13 +382,38 @@ import { debounceTime, distinctUntilChanged } from 'rxjs/operators'; ...@@ -382,13 +382,38 @@ import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
if(Object.is(name, '${formitem.name}')){ if(Object.is(name, '${formitem.name}')){
const details: string[] = [<#list itemUpdate.getPSDEFIUpdateDetails() as detail><#if detail_index gt 0>, </#if>'${detail.getPSDEFormDetailName()?lower_case}'</#list>]; const details: string[] = [<#list itemUpdate.getPSDEFIUpdateDetails() as detail><#if detail_index gt 0>, </#if>'${detail.getPSDEFormDetailName()?lower_case}'</#list>];
this.updateFormItems('${itemUpdate.getPSAppDEMethod().getCodeName()}', this.data, details, ${itemUpdate.isShowBusyIndicator()?c}); if(this.checkItem('${formitem.name}')){
this.updateFormItems('${itemUpdate.getPSAppDEMethod().getCodeName()}', this.data, details, ${itemUpdate.isShowBusyIndicator()?c});
}
} }
</#if> </#if>
</#list> </#list>
</#if> </#if>
} }
/**
* 表单项检查逻辑
*
* @public
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public checkItem(name:string):boolean{
let regular :any = null;
let isRight :boolean = false;
this.rules[name].forEach((item:any)=>{
Object.keys(item).forEach((name:string)=>{
if(name == 'pattern'){
regular = item[name];
}
});
});
if(regular){
isRight = regular.test(this.data[name]);
}
return isRight;
}
/** /**
* 表单值变化 * 表单值变化
* *
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册