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

表单部件——表单更新项校验通过后才触发

上级 bda22283
...@@ -424,7 +424,7 @@ import { debounceTime, distinctUntilChanged } from 'rxjs/operators'; ...@@ -424,7 +424,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}')} * @memberof ${srfclassname('${ctrl.codeName}')}
*/ */
private formLogic({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void { private 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>
...@@ -435,13 +435,34 @@ import { debounceTime, distinctUntilChanged } from 'rxjs/operators'; ...@@ -435,13 +435,34 @@ 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.codeName}', this.data, details, ${itemUpdate.isShowBusyIndicator()?c}); if(await this.checkItem('${formitem.name}')){
this.updateFormItems('${itemUpdate.getPSAppDEMethod().getCodeName()}', this.data, details, ${itemUpdate.isShowBusyIndicator()?c});
}
} }
</#if> </#if>
</#list> </#list>
</#if> </#if>
} }
/**
* 表单项检查逻辑
*
* @public
* @param name 属性名
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public checkItem(name:string):Promise<any> {
return new Promise((resolve, reject) => {
var validator = new schema({[name]:this.rules()[name]});
validator.validate({[name]:this.data[name]}).then(()=>{
resolve(true);
})
.catch(() => {
resolve(false);
});;
})
}
/** /**
* 表单值变化 * 表单值变化
* *
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册