提交 cc5faf56 编写于 作者: RedPig97's avatar RedPig97

update: 更新

上级 b7922fe4
......@@ -87,3 +87,36 @@ export function useContextParams(props: Record<any, any>) {
return { context, viewParams };
}
/**
* @description 值规则校验
* @export
* @param {Record<any, any>} props
*/
export async function verifyRules(_rule: any, value: any, condition: any) {
//常规规则
if (Object.is(condition.Type, 'SIMPLE')) {
//todo
// 数值范围
} else if (Object.is(condition.Type, 'VALUERANGE2')) {
if (!value) {
return;
}
if (!Number.isInteger(value)) {
return Promise.reject('请输入数值!');
} else {
if (condition.includeMinValue && Object.is(value,condition.minValue)) {
return Promise.resolve();
} else if (condition.includeMaxValue && Object.is(value,condition.maxValue)) {
return Promise.resolve();
} else if (value > condition.minValue && value < condition.maxValue) {
return Promise.resolve();
}
}
// 正则式
} else if (Object.is(condition.Type, 'REGEX')) {
// 长度
} else if (Object.is(condition.Type, 'STRINGLENGTH')) {
// 系统值规则
} else if (Object.is(condition.Type, 'SYSVALUERULE')) {
}
}
\ No newline at end of file
export const ViewConfig = {
viewCodeName: '{{page.codeName}}',
viewName: '{{page.name}}',
viewCaption: '{{page.caption}}',
{{> @macro/front-end/view/common/viewBaseConfig.hbs}}
{{#page.ctrls}}
{{#eq controlType "TOOLBAR"}}
{{lowerCase codeName}}:{
......
......@@ -34,9 +34,15 @@ const { state, handleToolbarEvent } = new EditView(ViewConfig).moduleInstall(pro
</script>
<template>
<IbizDefaultViewLayout class="ibiz-edit-view">
<IbizDefaultViewLayout :class="['ibiz-edit-view', state.viewSysCss]">
<template v-slot:header-left>
<IbizIconText class="ibiz-view__caption" size="large" :text="state.viewCaption" />
<IbizIconText
class="ibiz-view__caption"
size="large"
:subCaption="state.subCaption"
:showCaptionBar="state.showCaptionBar"
:text="state.viewCaption"
/>
</template>
{{#page.ctrls}}
{{#eq controlType "TOOLBAR"}}
......
import { ControlVOBase } from '@ibiz-core';
import { ControlVOBase, verifyRules } from '@ibiz-core';
import { ControlService } from './{{spinalCase ctrl.codeName}}-form-service';
export const CtrlConfig = {
......@@ -6,6 +6,28 @@ export const CtrlConfig = {
controlName: '{{ctrl.name}}',
controlService: new ControlService(),
data: {},
rules: {
{{#each ctrl.psDEFormEditItemVRs as | ruleItem |}}
{{#neq ruleItem 2}}
{{#if ruleItem.valueRuleType 'DEFVALUERULE'}}
{{psDEFormEditItemName}}: [
{{#each ruleItem.psDEFVRGroupCondition as | condition |}}
{trigger: ['change', 'blur'],
validator: (_rule: RuleObject, value: string) => verifyRules(_rule,value,{
{{#condition.condType}}'Type': {{condition.condType}},{{/condition.condType}}
{{#condition.name}}'name': {{condition.name}},{{/condition.name}}
{{#condition.maxValue}}'maxValue': {{condition.maxValue}},{{/condition.maxValue}}
{{#condition.minValue}}'minValue': {{condition.minValue}},{{/condition.minValue}}
{{#condition.ruleInfo}}'ruleInfo': {{condition.ruleInfo}},{{/condition.ruleInfo}}
{{#condition.includeMaxValue}}'includeMaxValue': {{condition.includeMaxValue}},{{/condition.includeMaxValue}}
{{#condition.includeMinValue}}'includeMinValue': {{condition.includeMinValue}},{{/condition.includeMinValue}}
}) }
{{/each}}
]
{{/if}}
{{/neq}}
{{/each}}
}
};
/**
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册