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

表单项更新需判断正则--fix1

上级 c8110430
...@@ -371,7 +371,7 @@ import { debounceTime, distinctUntilChanged } from 'rxjs/operators'; ...@@ -371,7 +371,7 @@ import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal } * @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @memberof ${srfclassname('${ctrl.codeName}')}Base * @memberof ${srfclassname('${ctrl.codeName}')}Base
*/ */
public formLogic({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void { public async formLogic({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }){
<#if P.getPartCode(item,'FORM_LOGIC').code?length gt 0> <#if P.getPartCode(item,'FORM_LOGIC').code?length gt 0>
${P.getPartCode(item,'FORM_LOGIC').code} ${P.getPartCode(item,'FORM_LOGIC').code}
</#if> </#if>
...@@ -382,7 +382,7 @@ import { debounceTime, distinctUntilChanged } from 'rxjs/operators'; ...@@ -382,7 +382,7 @@ 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>];
if(this.checkItem('${formitem.name}')){ if(await this.checkItem('${formitem.name}')){
this.updateFormItems('${itemUpdate.getPSAppDEMethod().getCodeName()}', this.data, details, ${itemUpdate.isShowBusyIndicator()?c}); this.updateFormItems('${itemUpdate.getPSAppDEMethod().getCodeName()}', this.data, details, ${itemUpdate.isShowBusyIndicator()?c});
} }
} }
...@@ -395,23 +395,19 @@ import { debounceTime, distinctUntilChanged } from 'rxjs/operators'; ...@@ -395,23 +395,19 @@ import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
* 表单项检查逻辑 * 表单项检查逻辑
* *
* @public * @public
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal } * @param name 属性名
* @memberof ${srfclassname('${ctrl.codeName}')}Base * @memberof ${srfclassname('${ctrl.codeName}')}Base
*/ */
public checkItem(name:string):boolean{ public checkItem(name:string):Promise<any> {
let regular :any = null; return new Promise((resolve, reject) => {
let isRight :boolean = false; var validator = new schema({[name]:this.rules[name]});
this.rules[name].forEach((item:any)=>{ validator.validate({[name]:this.data[name]}).then(()=>{
Object.keys(item).forEach((name:string)=>{ resolve(true);
if(name == 'pattern'){ })
regular = item[name]; .catch(() => {
} resolve(false);
}); });;
}); })
if(regular){
isRight = regular.test(this.data[name]);
}
return isRight;
} }
/** /**
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册