Commit d82316e64e99840a36f4ada6c6ab26bd08085278

Authored by fengwotao
1 parent d98c4f4b

pref:优化场景联动条件筛选 里面的数字操作值不能为负数

@@ -4,6 +4,21 @@ import { Rule } from 'ant-design-vue/lib/form/interface'; @@ -4,6 +4,21 @@ import { Rule } from 'ant-design-vue/lib/form/interface';
4 * 4 *
5 */ 5 */
6 6
  7 +//正整数并且可以是英文
  8 +export const numberAndEngLishRule: Rule[] = [
  9 + {
  10 + validator: (_, value: string) => {
  11 + const reg1 = /^[0-9]*[1-9][0-9]*$/;
  12 + const reg2 = /^[A-Za-z0-9]+$/;
  13 + if (!reg1.test(value) && !reg2.test(value)) {
  14 + return Promise.reject('不能为负数');
  15 + }
  16 + return Promise.resolve();
  17 + },
  18 + validateTrigger: 'blur',
  19 + },
  20 +];
  21 +
7 //数字和非负数 22 //数字和非负数
8 export const numberAndNonegativeRule: Rule[] = [ 23 export const numberAndNonegativeRule: Rule[] = [
9 { 24 {
@@ -3,7 +3,7 @@ import { BasicColumn, FormSchema } from '/@/components/Table'; @@ -3,7 +3,7 @@ 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 import { copyTransFun } from '/@/utils/fnUtils'; 5 import { copyTransFun } from '/@/utils/fnUtils';
6 -import { numberAndNonegativeRule } from '/@/utils/rules'; 6 +import { numberAndNonegativeRule,numberAndEngLishRule } from '/@/utils/rules';
7 7
8 /** 8 /**
9 * 所使用的枚举值 9 * 所使用的枚举值
@@ -265,6 +265,7 @@ export const trigger_condition_schema: FormSchema[] = [ @@ -265,6 +265,7 @@ export const trigger_condition_schema: FormSchema[] = [
265 }, 265 },
266 ifShow: ({ values }) => isDevice(values.triggerType), 266 ifShow: ({ values }) => isDevice(values.triggerType),
267 colProps: { span: 6 }, 267 colProps: { span: 6 },
  268 + rules: numberAndEngLishRule,
268 }, 269 },
269 { 270 {
270 field: 'operationType', 271 field: 'operationType',