提交 7b06f35b 编写于 作者: Mosher's avatar Mosher

update:调整表格值规则

上级 11f2cee9
......@@ -5,6 +5,30 @@
"notMode": {{item.notMode}},
"condType": "{{item.condType}}",
"ruleInfo": "{{item.ruleInfo}}",
"keyCond": {{item.keyCond}},
{{#eq item.condType 'SIMPLE'}}
"paramType": "{{item.paramType}}",
"paramValue": "{{item.paramValue}}",
{{/eq}}
{{#if (or (eq item.condType 'VALUERANGE2') (eq item.condType 'STRINGLENGTH'))}}
"includeMinValue": {{item.includeMinValue}},
"minValue": "{{item.minValue}}",
"includeMaxValue": {{item.includeMaxValue}},
"maxValue": "{{item.maxValue}}",
{{/if}}
{{#eq item.condType 'REGEX'}}
"regExCode": {{item.regExCode}},
{{/eq}}
{{#if (and (eq item.condType 'SYSVALUERULE') item.psSysValueRule)}}
{{#with item.psSysValueRule as | sysRule |}}
"sysValueRule": {
"ruleType": "{{sysRule.ruleType}}",
"regExCode": "{{sysRule.regExCode}}",
"ruleInfo": "{{sysRule.ruleInfo}}",
"scriptCode": `{{sysRule.scriptCode}}`
}
{{/with}}
{{/if}}
{{#if item.psDEFVRConditions}}
"conditions": [
{{#each item.psDEFVRConditions as | condition |}}
......
......@@ -614,24 +614,24 @@ export class Verify {
try {
// 常规规则
if (condition.condType == 'SIMPLE') {
flag.isPast = !Verify.checkFieldSimpleRule(data[name], condition.condOp, condition.paramValue, condition.ruleInfo, condition.paramType, data, condition.isKeyCond);
flag.isPast = !Verify.checkFieldSimpleRule(data[name], condition.condOp, condition.paramValue, condition.ruleInfo, condition.paramType, data, condition.keyCond);
// 数值范围
} else if (condition.condType == 'VALUERANGE2') {
flag.isPast = !Verify.checkFieldValueRangeRule(data[name], condition.minValue, condition.includeMinValue, condition.maxValue, condition.includeMaxValue, condition.ruleInfo, condition.isKeyCond);
flag.isPast = !Verify.checkFieldValueRangeRule(data[name], condition.minValue, condition.includeMinValue, condition.maxValue, condition.includeMaxValue, condition.ruleInfo, condition.keyCond);
// 正则式
} else if (condition.condType == 'REGEX') {
flag.isPast = !Verify.checkFieldRegExRule(data[name], condition.regExCode, condition.ruleInfo, condition.isKeyCond);
flag.isPast = !Verify.checkFieldRegExRule(data[name], condition.regExCode, condition.ruleInfo, condition.keyCond);
// 长度
} else if (condition.condType == 'STRINGLENGTH') {
flag.isPast = !Verify.checkFieldStringLengthRule(data[name], condition.minValue, condition.includeMinValue, condition.maxValue, condition.includeMaxValue, condition.ruleInfo, condition.isKeyCond);
flag.isPast = !Verify.checkFieldStringLengthRule(data[name], condition.minValue, condition.includeMinValue, condition.maxValue, condition.includeMaxValue, condition.ruleInfo, condition.keyCond);
// 系统值规则
} else if (condition.condType == 'SYSVALUERULE' && condition?.getPSSysValueRule?.()) {
const { ruleType, regExCode, scriptCode, ruleInfo } = condition.getPSSysValueRule();
} else if (condition.condType == 'SYSVALUERULE' && condition.sysValueRule) {
const { ruleType, regExCode, scriptCode, ruleInfo } = condition.sysValueRule;
flag.infoMessage = condition.ruleInfo || ruleInfo;
if (ruleType == 'REG') {
flag.isPast = !Verify.checkFieldRegExRule(data[name], regExCode, flag.infoMessage, condition.isKeyCond);
flag.isPast = !Verify.checkFieldRegExRule(data[name], regExCode, flag.infoMessage, condition.keyCond);
} else if (ruleType == 'SCRIPT') {
const { isPast, infoMessage } = Verify.checkFieldScriptRule(data[name], data, scriptCode, flag.infoMessage, condition.isKeyCond);
const { isPast, infoMessage } = Verify.checkFieldScriptRule(data[name], data, scriptCode, flag.infoMessage, condition.keyCond);
flag.isPast = isPast;
flag.infoMessage = infoMessage || flag.infoMessage;
}
......
......@@ -195,7 +195,7 @@ export const ctrlState = {
{{#eq editItem.codeName ruleItem.psDEGridEditItemName}}
{
validator: (rule: any, value: any, callback: any, source: any) => {
if (isEmpty(source['{{#if editItem.valueItemName}}{{editItem.valueItemName}}{{else}}{{ruleItem.psDEGridEditItemName}}{{/if}}'])) {
if (!source || isEmpty(source['{{#if editItem.valueItemName}}{{editItem.valueItemName}}{{else}}{{ruleItem.psDEGridEditItemName}}{{/if}}'])) {
return true;
}
const { isPast, infoMessage } = Verify.verifyDeRules(
......@@ -207,7 +207,8 @@ export const ctrlState = {
callback(new Error(infoMessage || '{{ruleItem.psDEFValueRule.ruleInfo}}'));
}
return true;
}
},
trigger: ['change', 'blur']
}
{{/eq}}
{{/each}}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册