Commit 1ebca00fc99ef223bae4d598efcd698bf6110013

Authored by fengwotao
1 parent a8d0bfbe

pref:优化场景联动事件计数值不能非负

@@ -4,6 +4,20 @@ import { Rule } from 'ant-design-vue/lib/form/interface'; @@ -4,6 +4,20 @@ import { Rule } from 'ant-design-vue/lib/form/interface';
4 * 4 *
5 */ 5 */
6 6
  7 +//数字和非负数
  8 +export const numberAndNonegativeRule: Rule[] = [
  9 + {
  10 + validator: (_, value: string) => {
  11 + const reg = /^[+]{0,1}(\d+)$|^[+]{0,1}(\d+\.\d+)$/;
  12 + if (!reg.test(value)) {
  13 + return Promise.reject('不能为负数或者不能输入非数字');
  14 + }
  15 + return Promise.resolve();
  16 + },
  17 + validateTrigger: 'blur',
  18 + },
  19 +];
  20 +
7 // 数字验证 21 // 数字验证
8 export const numberRule: Rule[] = [ 22 export const numberRule: Rule[] = [
9 { 23 {
@@ -2,8 +2,8 @@ import { ref } from 'vue'; @@ -2,8 +2,8 @@ import { ref } from 'vue';
2 import { BasicColumn, FormSchema } from '/@/components/Table'; 2 import { BasicColumn, FormSchema } from '/@/components/Table';
3 import { screenLinkOrganizationGetApi } from '/@/api/ruleengine/ruleengineApi'; 3 import { screenLinkOrganizationGetApi } from '/@/api/ruleengine/ruleengineApi';
4 import { scheduleOptions } from './formatData'; 4 import { scheduleOptions } from './formatData';
5 -  
6 import { copyTransFun } from '/@/utils/fnUtils'; 5 import { copyTransFun } from '/@/utils/fnUtils';
  6 +import { numberAndNonegativeRule } from '/@/utils/rules';
7 7
8 /** 8 /**
9 * 所使用的枚举值 9 * 所使用的枚举值
@@ -226,6 +226,7 @@ export const trigger_condition_schema: FormSchema[] = [ @@ -226,6 +226,7 @@ export const trigger_condition_schema: FormSchema[] = [
226 }, 226 },
227 ifShow: ({ values }) => isReplace(values.triggered), 227 ifShow: ({ values }) => isReplace(values.triggered),
228 colProps: { span: 6 }, 228 colProps: { span: 6 },
  229 + rules: numberAndNonegativeRule,
229 }, 230 },
230 { 231 {
231 field: 'triggerType', 232 field: 'triggerType',