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

属性值规则 --fix

上级 dff0f526
......@@ -5,7 +5,7 @@
<#if item.render??>
${item.render.code}
<#else>
<app-form-item name='${item.name}' :itemRules="this.rules.${item.name}" class='<#if item.getPSSysCss?? && item.getPSSysCss()??>${item.getPSSysCss().getCssName()}</#if>'<#if item.getLabelPSSysCss?? && item.getLabelPSSysCss()??> labelStyle="${item.getLabelPSSysCss().getCssName()}"</#if> :caption="<#if langbase??>$t('${langbase}.details.${item.name}')<#else>'${item.getCaption()}'</#if>" uiStyle="${item.getDetailStyle()}" :labelWidth="${item.getLabelWidth()?c}" :isShowCaption="${item.isShowCaption()?c}" :error="detailsModel.${item.name}.error" :isEmptyCaption="${item.isEmptyCaption()?c}" labelPos="${item.getLabelPos()}">
<app-form-item name='${item.name}' :itemRules="this.rules().${item.name}" class='<#if item.getPSSysCss?? && item.getPSSysCss()??>${item.getPSSysCss().getCssName()}</#if>'<#if item.getLabelPSSysCss?? && item.getLabelPSSysCss()??> labelStyle="${item.getLabelPSSysCss().getCssName()}"</#if> :caption="<#if langbase??>$t('${langbase}.details.${item.name}')<#else>'${item.getCaption()}'</#if>" uiStyle="${item.getDetailStyle()}" :labelWidth="${item.getLabelWidth()?c}" :isShowCaption="${item.isShowCaption()?c}" :error="detailsModel.${item.name}.error" :isEmptyCaption="${item.isEmptyCaption()?c}" labelPos="${item.getLabelPos()}">
<#if item.isCompositeItem()>
<#assign formitems=item.getPSDEFormItems()>
<app-range-editor v-model="data.${item.name}" :activeData="data" :disabled="detailsModel.${item.name}.disabled" name="${item.name}" editorType="${item.getEditorType()}" format="${item.getEditorParam("TIMEFMT","")}" :refFormItem="[<#list formitems as formitem><#if formitem_index gt 0>,</#if>'${formitem.name}'</#list>]" @formitemvaluechange="onFormItemValueChange" style="<#if item.getContentWidth()?? && item.getContentWidth() != 0>width:${item.getContentWidth()}px;</#if><#if item.getContentHeight()?? && item.getContentHeight() != 0>height:${item.getContentHeight()}px;</#if>"></app-range-editor>
......
......@@ -240,7 +240,8 @@ import schema from 'async-validator';
* @type {*}
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public rules: any = {
public rules() :any {
return {
<#list ctrl.getAllPSDEFormDetails() as formdetail>
<#if formdetail.getDetailType?? && formdetail.getDetailType() == 'FORMITEM'>
${formdetail.getName()}: [
......@@ -276,8 +277,8 @@ import schema from 'async-validator';
<#-- 属性值规则 -->
<#if fideValueRule.getPSDEFValueRule?? && fideValueRule.getPSDEFValueRule()??>
<#assign deRule = fideValueRule.getPSDEFValueRule()/>
{validator:(rule:any, value:any)=>{return this.verifyDeRules("${fideValueRule.getPSDEFormItemName()}")},message: '<#if deRule.getRuleInfo?? && deRule.getRuleInfo()??>${deRule.getRuleInfo()}</#if>', trigger: 'change' },
{validator:(rule:any, value:any)=>{return this.verifyDeRules("${fideValueRule.getPSDEFormItemName()}")},message: '<#if deRule.getRuleInfo?? && deRule.getRuleInfo()??>${deRule.getRuleInfo()}</#if>', trigger: 'blur' },
{validator:(rule:any, value:any)=>{return this.verifyDeRules("${fideValueRule.getPSDEFormItemName()}").isPast},message: this.verifyDeRules("${fideValueRule.getPSDEFormItemName()}").infoMessage, trigger: 'change' },
{validator:(rule:any, value:any)=>{return this.verifyDeRules("${fideValueRule.getPSDEFormItemName()}").isPast},message: this.verifyDeRules("${fideValueRule.getPSDEFormItemName()}").infoMessage, trigger: 'blur' },
</#if>
</#if>
</#list>
......@@ -285,6 +286,7 @@ import schema from 'async-validator';
],
</#if>
</#list>
}
}
/**
......@@ -304,13 +306,26 @@ import schema from 'async-validator';
<#list deRule.getPSDEFVRGroupCondition().getPSDEFVRConditions() as condItem>
{
type:"<#if condItem.getCondType?? && condItem.getCondType()??>${condItem.getCondType()}</#if>",
<#if condItem.getParamValue?? && condItem.getParamValue()??>paramValue:"${condItem.getParamValue()}",</#if>
<#if condItem.getParamType?? && condItem.getParamType()??>paramType:"${condItem.getParamType()}",</#if>
<#if condItem.isNotMode?? && condItem.isNotMode()??>isNotMode:${condItem.isNotMode()?c},</#if>
<#if condItem.getRegExCode?? && condItem.getRegExCode()??>RegExCode:/${condItem.getRegExCode()}/,</#if>
<#if condItem.getMaxValue?? && condItem.getMaxValue()??>maxValue:${condItem.getMaxValue()?c},</#if>
<#if condItem.getMinValue?? && condItem.getMinValue()??>minValue:${condItem.getMinValue()?c},</#if>
<#if condItem.getParamValue?? && condItem.getParamValue()??>
paramValue:"${condItem.getParamValue()}",<#t>
</#if>
<#if condItem.getParamType?? && condItem.getParamType()??>
paramType:"${condItem.getParamType()}",<#t>
</#if>
<#if condItem.isNotMode?? && condItem.isNotMode()??>
isNotMode:${condItem.isNotMode()?c},<#t>
</#if>
<#if condItem.getRegExCode?? && condItem.getRegExCode()??>
RegExCode:/${condItem.getRegExCode()}/,<#t>
</#if>
<#if condItem.getMaxValue?? && condItem.getMaxValue()??>
maxValue:${condItem.getMaxValue()?c},<#t>
</#if>
<#if condItem.getMinValue?? && condItem.getMinValue()??>
minValue:${condItem.getMinValue()?c},<#t>
</#if>
condOP:"<#if condItem.getCondOP?? && condItem.getCondOP()??>${condItem.getCondOP()}</#if>",
ruleInfo:"<#if condItem.getRuleInfo?? && condItem.getRuleInfo()??>${condItem.getRuleInfo()}</#if>",
},
</#list>
</#if>],
......@@ -327,22 +342,25 @@ import schema from 'async-validator';
* @param {{ name: string }} { name }
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public verifyDeRules(name:string) :boolean{
let falg :boolean= true;
public verifyDeRules(name:string) :{isPast:boolean,infoMessage:string}{
let falg = {isPast:true,infoMessage:""};
if(!this.deRules[name]){
return falg;
}
this.deRules[name].forEach((item:any) => {
if(item.type == 'SIMPLE' && this.data[name] != item.paramValue){
falg = false;
falg.isPast = false;
falg.infoMessage = item.ruleInfo;
}
if(item.type == 'REGEX' && (item.isNotMode? item.RegExCode.test(this.data[name]) : !item.RegExCode.test(this.data[name]))){
falg = false;
falg.isPast = false;
falg.infoMessage = item.ruleInfo;
}
if(item.type == 'STRINGLENGTH' ){
let valueLength :number = this.data[name]?this.data[name].length:0;
if(item.isNotMode? valueLength > item.minValue && valueLength < item.maxValue : !(valueLength > item.minValue && valueLength < item.maxValue)){
falg = false;
falg.isPast = false;
falg.infoMessage = item.ruleInfo;
}
}
......@@ -479,7 +497,7 @@ import schema from 'async-validator';
*/
public checkItem(name:string):Promise<any> {
return new Promise((resolve, reject) => {
var validator = new schema({[name]:this.rules[name]});
var validator = new schema({[name]:this.rules()[name]});
validator.validate({[name]:this.data[name]}).then(()=>{
resolve(true);
})
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册