From 2480366b716730c677b5d32688a63a942e97e431 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B8=A9?= <19910352037@163.com> Date: Tue, 20 Aug 2024 16:27:38 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E8=A1=A8=E5=8D=95=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E8=A7=84=E5=88=99):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E9=81=BF=E5=85=8D=E8=B6=85=E9=95=BF=E9=AA=8C=E8=AF=81=E8=A7=84?= =?UTF-8?q?=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/admin/client/form.vue | 12 ++++++++---- src/views/admin/dept/form.vue | 8 ++++---- src/views/admin/dict/dictItem/form.vue | 9 +++++---- src/views/admin/dict/form.vue | 5 +++-- src/views/admin/menu/form.vue | 16 ++++++++-------- src/views/admin/param/form.vue | 10 ++++++---- src/views/admin/post/form.vue | 8 +++++--- src/views/admin/role/form.vue | 4 +++- src/views/admin/user/form.vue | 12 +++++++----- src/views/daemon/job-manage/form.vue | 18 +++++++++--------- src/views/gen/datasource/form.vue | 19 ++++++++++--------- src/views/gen/field-type/form.vue | 4 +++- src/views/gen/group/form.vue | 5 +++-- src/views/gen/table/add-dict.vue | 4 ++-- src/views/gen/table/generator.vue | 2 +- src/views/login/component/register.vue | 1 + 16 files changed, 78 insertions(+), 59 deletions(-) diff --git a/src/views/admin/client/form.vue b/src/views/admin/client/form.vue index 83502555..b977f780 100644 --- a/src/views/admin/client/form.vue +++ b/src/views/admin/client/form.vue @@ -100,6 +100,7 @@ const form = reactive({ // 定义校验规则 const dataRules = ref({ clientId: [ + {validator: rule.overLength, trigger: 'blur'}, {required: true, message: '编号不能为空', trigger: 'blur'}, {validator: rule.validatorLowercase, trigger: 'blur'}, { @@ -110,21 +111,24 @@ const dataRules = ref({ }, ], clientSecret: [ + {validator: rule.overLength, trigger: 'blur'}, {required: true, message: '密钥不能为空', trigger: 'blur'}, {validator: rule.validatorLower, trigger: 'blur'}, ], - scope: [{required: true, message: '域不能为空', trigger: 'blur'}], - authorizedGrantTypes: [{required: true, message: '授权模式不能为空', trigger: 'blur'}], + scope: [{validator: rule.overLength, trigger: 'blur'},{ required: true, message: '域不能为空', trigger: 'blur' }], + authorizedGrantTypes: [{validator: rule.overLength, trigger: 'blur'},{ required: true, message: '授权模式不能为空', trigger: 'blur' }], accessTokenValidity: [ + {validator: rule.overLength, trigger: 'blur'}, {required: true, message: '令牌时效不能为空', trigger: 'blur'}, {type: 'number', min: 1, message: '令牌时效不能小于一小时', trigger: 'blur'}, ], refreshTokenValidity: [ + {validator: rule.overLength, trigger: 'blur'}, {required: true, message: '刷新时效不能为空', trigger: 'blur'}, {type: 'number', min: 1, message: '刷新时效不能小于两小时', trigger: 'blur'}, ], - autoapprove: [{required: true, message: '自动放行不能为空', trigger: 'blur'}], - webServerRedirectUri: [{required: true, message: '回调地址不能为空', trigger: 'blur'}], + autoapprove: [{validator: rule.overLength, trigger: 'blur'},{ required: true, message: '自动放行不能为空', trigger: 'blur' }], + webServerRedirectUri: [{validator: rule.overLength, trigger: 'blur'},{required: true, message: '回调地址不能为空', trigger: 'blur'}], }); // 打开弹窗 diff --git a/src/views/admin/dept/form.vue b/src/views/admin/dept/form.vue index 66d38d54..a7b4c736 100644 --- a/src/views/admin/dept/form.vue +++ b/src/views/admin/dept/form.vue @@ -37,7 +37,7 @@ import {useI18n} from 'vue-i18n'; import {getObj, deptTree, addObj, putObj} from '/@/api/admin/dept'; import {useMessage} from '/@/hooks/message'; - +import {rule} from "/@/utils/validate"; // 定义子组件向父组件传值/事件 const emit = defineEmits(['refresh']); const {t} = useI18n(); @@ -54,9 +54,9 @@ const visible = ref(false); const loading = ref(false); const dataRules = ref({ - parentId: [{required: true, message: '上级部门不能为空', trigger: 'blur'}], - name: [{required: true, message: '部门名称不能为空', trigger: 'blur'}], - sortOrder: [{required: true, message: '排序不能为空', trigger: 'blur'}], + parentId: [{validator: rule.overLength, trigger: 'blur'},{required: true, message: '上级部门不能为空', trigger: 'blur'}], + name: [{validator: rule.overLength, trigger: 'blur'},{required: true, message: '部门名称不能为空', trigger: 'blur'}], + sortOrder: [{validator: rule.overLength, trigger: 'blur'},{required: true, message: '排序不能为空', trigger: 'blur'}], }); // 打开弹窗 diff --git a/src/views/admin/dict/dictItem/form.vue b/src/views/admin/dict/dictItem/form.vue index a383de03..74f941ea 100644 --- a/src/views/admin/dict/dictItem/form.vue +++ b/src/views/admin/dict/dictItem/form.vue @@ -41,7 +41,7 @@ import {useI18n} from 'vue-i18n'; import {getItemObj, addItemObj, putItemObj, validateDictItemLabel} from '/@/api/admin/dict'; import {useMessage} from '/@/hooks/message'; - +import {rule} from "/@/utils/validate"; // 定义子组件向父组件传值/事件 const emit = defineEmits(['refresh']); const {t} = useI18n(); @@ -64,8 +64,9 @@ const dataForm = reactive({ }); const dataRules = reactive({ - value: [{required: true, message: '数据值不能为空', trigger: 'blur'}], + value: [{ validator: rule.overLength, trigger: 'blur' },{ required: true, message: '数据值不能为空', trigger: 'blur' }], label: [ + { validator: rule.overLength, trigger: 'blur' }, {required: true, message: '标签不能为空', trigger: 'blur'}, { validator: (rule: any, value: any, callback: any) => { @@ -74,8 +75,8 @@ const dataRules = reactive({ trigger: 'blur', }, ], - description: [{required: true, message: '描述不能为空', trigger: 'blur'}], - sortOrder: [{required: true, message: '排序不能为空', trigger: 'blur'}], + description: [{ validator: rule.overLength, trigger: 'blur' },{ required: true, message: '描述不能为空', trigger: 'blur' }], + sortOrder: [{ validator: rule.overLength, trigger: 'blur' },{ required: true, message: '排序不能为空', trigger: 'blur' }], }); // 打开弹窗 diff --git a/src/views/admin/dict/form.vue b/src/views/admin/dict/form.vue index 54f072be..1a63fa53 100644 --- a/src/views/admin/dict/form.vue +++ b/src/views/admin/dict/form.vue @@ -60,6 +60,7 @@ const dataForm = reactive({ const dataRules = reactive({ dictType: [ + {validator: rule.overLength, trigger: 'blur'}, {required: true, message: '类型不能为空', trigger: 'blur'}, {validator: rule.validatorNameCn, trigger: 'blur'}, { @@ -69,8 +70,8 @@ const dataRules = reactive({ trigger: 'blur', }, ], - systemFlag: [{required: true, message: '字典类型不能为空', trigger: 'blur'}], - description: [{required: true, message: '描述不能为空', trigger: 'blur'}], + systemFlag: [{validator: rule.overLength, trigger: 'blur'},{required: true, message: '字典类型不能为空', trigger: 'blur'}], + description: [{validator: rule.overLength, trigger: 'blur'},{required: true, message: '描述不能为空', trigger: 'blur'}], }); // 打开弹窗 diff --git a/src/views/admin/menu/form.vue b/src/views/admin/menu/form.vue index c449358f..e8d7eb5c 100644 --- a/src/views/admin/menu/form.vue +++ b/src/views/admin/menu/form.vue @@ -72,7 +72,7 @@ import {useI18n} from 'vue-i18n'; import {info, pageList, putObj, addObj} from '/@/api/admin/menu'; import {useMessage} from '/@/hooks/message'; - +import {rule} from "/@/utils/validate"; // 定义子组件向父组件传值/事件 const emit = defineEmits(['refresh']); const {t} = useI18n(); @@ -104,13 +104,13 @@ const state = reactive({ // 表单校验规则 const dataRules = reactive({ - menType: [{required: true, message: '菜单类型不能为空', trigger: 'blur'}], - parentId: [{required: true, message: '上级菜单不能为空', trigger: 'blur'}], - name: [{required: true, message: '菜单不能为空', trigger: 'blur'}], - path: [{required: true, message: '路径不能为空', trigger: 'blur'}], - icon: [{required: true, message: '图标不能为空', trigger: 'blur'}], - permission: [{required: true, message: '权限代码不能为空', trigger: 'blur'}], - sortOrder: [{required: true, message: '排序不能为空', trigger: 'blur'}], + menType: [{validator: rule.overLength, trigger: 'blur'},{required: true, message: '菜单类型不能为空', trigger: 'blur'}], + parentId: [{validator: rule.overLength, trigger: 'blur'},{required: true, message: '上级菜单不能为空', trigger: 'blur'}], + name: [{validator: rule.overLength, trigger: 'blur'},{required: true, message: '菜单不能为空', trigger: 'blur'}], + path: [{validator: rule.overLength, trigger: 'blur'},{required: true, message: '路径不能为空', trigger: 'blur'}], + icon: [{validator: rule.overLength, trigger: 'blur'},{required: true, message: '图标不能为空', trigger: 'blur'}], + permission: [{validator: rule.overLength, trigger: 'blur'},{required: true, message: '权限代码不能为空', trigger: 'blur'}], + sortOrder: [{validator: rule.overLength, trigger: 'blur'},{required: true, message: '排序不能为空', trigger: 'blur'}], }); // 打开弹窗 diff --git a/src/views/admin/param/form.vue b/src/views/admin/param/form.vue index e7b57481..6b4c245a 100644 --- a/src/views/admin/param/form.vue +++ b/src/views/admin/param/form.vue @@ -81,6 +81,7 @@ const form = reactive({ // 定义校验规则 const dataRules = reactive({ publicName: [ + {validator: rule.overLength, trigger: 'blur'}, {required: true, message: '名称不能为空', trigger: 'blur'}, { validator: (rule: any, value: any, callback: any) => { @@ -90,6 +91,7 @@ const dataRules = reactive({ }, ], publicKey: [ + {validator: rule.overLength, trigger: 'blur'}, {required: true, message: '参数键不能为空', trigger: 'blur'}, {validator: rule.validatorCapital, trigger: 'blur'}, { @@ -99,10 +101,10 @@ const dataRules = reactive({ trigger: 'blur', }, ], - publicValue: [{required: true, message: '参数值不能为空', trigger: 'blur'}], - status: [{required: true, message: '状态不能为空', trigger: 'blur'}], - publicType: [{required: true, message: '类型不能为空', trigger: 'blur'}], - systemFlag: [{required: true, message: '类型不能为空', trigger: 'blur'}], + publicValue: [{validator: rule.overLength, trigger: 'blur'},{required: true, message: '参数值不能为空', trigger: 'blur'}], + status: [{validator: rule.overLength, trigger: 'blur'},{required: true, message: '状态不能为空', trigger: 'blur'}], + publicType: [{validator: rule.overLength, trigger: 'blur'},{required: true, message: '类型不能为空', trigger: 'blur'}], + systemFlag: [{validator: rule.overLength, trigger: 'blur'},{required: true, message: '类型不能为空', trigger: 'blur'}], }); // 打开弹窗 diff --git a/src/views/admin/post/form.vue b/src/views/admin/post/form.vue index 798fd73c..44583772 100644 --- a/src/views/admin/post/form.vue +++ b/src/views/admin/post/form.vue @@ -28,7 +28,7 @@ import {useMessage} from '/@/hooks/message'; import {getObj, addObj, putObj, validatePostCode, validatePostName} from '/@/api/admin/post'; import {useI18n} from 'vue-i18n'; - +import {rule} from "/@/utils/validate"; // 定义子组件向父组件传值/事件 const emit = defineEmits(['refresh']); @@ -56,6 +56,7 @@ const form = reactive({ // 定义校验规则 const dataRules = ref({ postCode: [ + {validator: rule.overLength, trigger: 'blur'}, {required: true, message: '岗位编码不能为空', trigger: 'blur'}, { validator: (rule: any, value: any, callback: any) => { @@ -65,6 +66,7 @@ const dataRules = ref({ }, ], postName: [ + {validator: rule.overLength, trigger: 'blur'}, {required: true, message: '岗位名称不能为空', trigger: 'blur'}, { validator: (rule: any, value: any, callback: any) => { @@ -73,8 +75,8 @@ const dataRules = ref({ trigger: 'blur', }, ], - postSort: [{required: true, message: '岗位排序不能为空', trigger: 'blur'}], - remark: [{required: true, message: '岗位描述不能为空', trigger: 'blur'}], + postSort: [{ validator: rule.overLength, trigger: 'blur' },{ required: true, message: '岗位排序不能为空', trigger: 'blur' } ], + remark: [{ validator: rule.overLength, trigger: 'blur' },{ required: true, message: '岗位描述不能为空', trigger: 'blur' } ], }); // 打开弹窗 diff --git a/src/views/admin/role/form.vue b/src/views/admin/role/form.vue index 7df8b3d4..3056dfed 100644 --- a/src/views/admin/role/form.vue +++ b/src/views/admin/role/form.vue @@ -73,6 +73,7 @@ const dataForm = reactive({ // 定义校验规则 const dataRules = ref({ roleName: [ + {validator: rule.overLength, trigger: 'blur'}, {required: true, message: '角色名称不能为空', trigger: 'blur'}, {min: 3, max: 20, message: '长度在 3 到 20 个字符', trigger: 'blur'}, { @@ -83,6 +84,7 @@ const dataRules = ref({ }, ], roleCode: [ + {validator: rule.overLength, trigger: 'blur'}, {required: true, message: '角色标识不能为空', trigger: 'blur'}, {min: 3, max: 20, message: '长度在 3 到 20 个字符', trigger: 'blur'}, {validator: rule.validatorCapital, trigger: 'blur'}, @@ -93,7 +95,7 @@ const dataRules = ref({ trigger: 'blur', }, ], - roleDesc: [{max: 128, message: '长度在 128 个字符内', trigger: 'blur'}] + roleDesc: [{ validator: rule.overLength, trigger: 'blur' },{ max: 128, message: '长度在 128 个字符内', trigger: 'blur' }] }); // 打开弹窗 diff --git a/src/views/admin/user/form.vue b/src/views/admin/user/form.vue index a688ea48..003b13b7 100644 --- a/src/views/admin/user/form.vue +++ b/src/views/admin/user/form.vue @@ -148,14 +148,16 @@ const dataRules = ref({ ], // 姓名校验,不能为空、只能是中文 name: [ + {validator: rule.overLength, trigger: 'blur'}, { required: true, message: '姓名不能为空', trigger: 'blur' }, { validator: rule.chinese, trigger: 'blur' }, ], - deptId: [{ required: true, message: '部门不能为空', trigger: 'blur' }], - role: [{ required: true, message: '角色不能为空', trigger: 'blur' }], - post: [{ required: true, message: '岗位不能为空', trigger: 'blur' }], + deptId: [{validator: rule.overLength, trigger: 'blur'},{ required: true, message: '部门不能为空', trigger: 'blur' }], + role: [{validator: rule.overLength, trigger: 'blur'},{ required: true, message: '角色不能为空', trigger: 'blur' }], + post: [{validator: rule.overLength, trigger: 'blur'},{ required: true, message: '岗位不能为空', trigger: 'blur' }], // 手机号校验,不能为空、新增的时不能重复校验 phone: [ + {validator: rule.overLength, trigger: 'blur'}, { required: true, message: '手机号不能为空', trigger: 'blur' }, { validator: rule.validatePhone, trigger: 'blur' }, { @@ -165,8 +167,8 @@ const dataRules = ref({ trigger: 'blur', }, ], - email: [{ type: 'email', message: '请输入正确的邮箱地址', trigger: ['blur', 'change'] }], - lockFlag: [{ required: true, message: '状态不能为空', trigger: 'blur' }], + email: [{validator: rule.overLength, trigger: 'blur'},{ type: 'email', message: '请输入正确的邮箱地址', trigger: ['blur', 'change'] }], + lockFlag: [{validator: rule.overLength, trigger: 'blur'},{ required: true, message: '状态不能为空', trigger: 'blur' }], }); // 打开弹窗 diff --git a/src/views/daemon/job-manage/form.vue b/src/views/daemon/job-manage/form.vue index 9c677233..371aafbf 100644 --- a/src/views/daemon/job-manage/form.vue +++ b/src/views/daemon/job-manage/form.vue @@ -84,7 +84,7 @@ import {useDict} from '/@/hooks/dict'; import {useMessage} from '/@/hooks/message'; import {addObj, getObj, putObj} from '/@/api/daemon/job'; import {useI18n} from 'vue-i18n'; - +import {rule} from "/@/utils/validate"; const emit = defineEmits(['refresh']); const Crontab = defineAsyncComponent(() => import('/@/components/Crontab/index.vue')); @@ -122,14 +122,14 @@ const popoverVis = (bol: boolean) => { const popoverVisible = ref(false); // 定义校验规则 const dataRules = reactive({ - jobName: [{required: true, message: '任务名称不能为空', trigger: 'blur'}], - jobGroup: [{required: true, message: '任务组名不能为空', trigger: 'blur'}], - jobType: [{required: true, message: '任务类型不能为空', trigger: 'blur'}], - cronExpression: [{required: true, message: 'cron不能为空', trigger: 'blur'}], - misfirePolicy: [{required: true, message: '策略不能为空', trigger: 'blur'}], - executePath: [{required: true, message: '执行路径不能为空', trigger: 'blur'}], - className: [{required: true, message: '执行文件不能为空', trigger: 'blur'}], - methodName: [{required: true, message: '执行方法不能为空', trigger: 'blur'}], + jobName: [{validator: rule.overLength, trigger: 'blur'},{required: true, message: '任务名称不能为空', trigger: 'blur'}], + jobGroup: [{validator: rule.overLength, trigger: 'blur'},{required: true, message: '任务组名不能为空', trigger: 'blur'}], + jobType: [{validator: rule.overLength, trigger: 'blur'},{required: true, message: '任务类型不能为空', trigger: 'blur'}], + cronExpression: [{validator: rule.overLength, trigger: 'blur'},{required: true, message: 'cron不能为空', trigger: 'blur'}], + misfirePolicy: [{validator: rule.overLength, trigger: 'blur'},{required: true, message: '策略不能为空', trigger: 'blur'}], + executePath: [{validator: rule.overLength, trigger: 'blur'},{required: true, message: '执行路径不能为空', trigger: 'blur'}], + className: [{validator: rule.overLength, trigger: 'blur'},{required: true, message: '执行文件不能为空', trigger: 'blur'}], + methodName: [{validator: rule.overLength, trigger: 'blur'},{required: true, message: '执行方法不能为空', trigger: 'blur'}], }); // 打开弹窗 diff --git a/src/views/gen/datasource/form.vue b/src/views/gen/datasource/form.vue index 37d34a9c..8d1a5d10 100644 --- a/src/views/gen/datasource/form.vue +++ b/src/views/gen/datasource/form.vue @@ -124,23 +124,24 @@ const validateDsName = (_rule, value, callback) => { // 定义校验规则 const dataRules = ref({ name: [ + {validator: rule.overLength, trigger: 'blur'}, {required: true, message: '别名不能为空', trigger: 'blur'}, {validator: validateDsName, trigger: 'blur'}, ], - url: [{required: true, message: 'jdbcurl不能为空', trigger: 'blur'}, { + url: [{validator: rule.overLength, trigger: 'blur'},{required: true, message: 'jdbcurl不能为空', trigger: 'blur'}, { min: 10, max: 500, message: 'URL长度必须介于 10 和 500 字符之间', trigger: 'blur' },], - username: [{ validator: rule.overLength, trigger: 'blur' },{required: true, message: '用户名不能为空', trigger: 'blur'}], - password: [{ validator: rule.overLength, trigger: 'blur' },{required: true, message: '密码不能为空', trigger: 'blur'}], - dsType: [{required: true, message: '数据库类型不能为空', trigger: 'blur'}], - confType: [{required: true, message: '配置类型不能为空', trigger: 'blur'}], - dsName: [{ validator: rule.overLength, trigger: 'blur' },{required: true, message: '数据库名称不能为空', trigger: 'blur'}], - instance: [{ validator: rule.overLength, trigger: 'blur' },{required: true, message: '实例不能为空', trigger: 'blur'}], - port: [{required: true, message: '端口不能为空', trigger: 'blur'}], - host: [{ validator: rule.overLength, trigger: 'blur' },{required: true, message: '主机不能为空', trigger: 'blur'}], + username: [{validator: rule.overLength, trigger: 'blur'},{ validator: rule.overLength, trigger: 'blur' },{required: true, message: '用户名不能为空', trigger: 'blur'}], + password: [{validator: rule.overLength, trigger: 'blur'},{ validator: rule.overLength, trigger: 'blur' },{required: true, message: '密码不能为空', trigger: 'blur'}], + dsType: [{validator: rule.overLength, trigger: 'blur'},{required: true, message: '数据库类型不能为空', trigger: 'blur'}], + confType: [{validator: rule.overLength, trigger: 'blur'},{required: true, message: '配置类型不能为空', trigger: 'blur'}], + dsName: [{validator: rule.overLength, trigger: 'blur'},{ validator: rule.overLength, trigger: 'blur' },{required: true, message: '数据库名称不能为空', trigger: 'blur'}], + instance: [{validator: rule.overLength, trigger: 'blur'},{ validator: rule.overLength, trigger: 'blur' },{required: true, message: '实例不能为空', trigger: 'blur'}], + port: [{validator: rule.overLength, trigger: 'blur'},{required: true, message: '端口不能为空', trigger: 'blur'}], + host: [{validator: rule.overLength, trigger: 'blur'},{ validator: rule.overLength, trigger: 'blur' },{required: true, message: '主机不能为空', trigger: 'blur'}], }); // 打开弹窗 diff --git a/src/views/gen/field-type/form.vue b/src/views/gen/field-type/form.vue index 86540aef..ba86ac38 100644 --- a/src/views/gen/field-type/form.vue +++ b/src/views/gen/field-type/form.vue @@ -24,6 +24,7 @@ import { useMessage } from '/@/hooks/message'; import { getObj, addObj, putObj, validateColumnType } from '/@/api/gen/fieldtype'; import { useI18n } from 'vue-i18n'; +import {rule} from "/@/utils/validate"; // 定义子组件向父组件传值/事件 const emit = defineEmits(['refresh']); const { t } = useI18n(); @@ -45,6 +46,7 @@ const form = reactive({ // 定义校验规则 const dataRules = ref({ columnType: [ + {validator: rule.overLength, trigger: 'blur'}, { required: true, message: '字段类型不能为空', trigger: 'blur' }, { validator: (rule: any, value: any, callback: any) => { @@ -52,7 +54,7 @@ const dataRules = ref({ }, }, ], - attrType: [{ required: true, message: '属性类型不能为空', trigger: 'blur' }], + attrType: [{validator: rule.overLength, trigger: 'blur'},{ required: true, message: '属性类型不能为空', trigger: 'blur' }], }); // 打开弹窗 diff --git a/src/views/gen/group/form.vue b/src/views/gen/group/form.vue index 4d6fed5d..f79bb70e 100644 --- a/src/views/gen/group/form.vue +++ b/src/views/gen/group/form.vue @@ -27,6 +27,7 @@ import { useMessage } from '/@/hooks/message'; import { addObj, getObj, putObj } from '/@/api/gen/group'; import { useI18n } from 'vue-i18n'; import { list as templateList } from '/@/api/gen/template'; +import {rule} from "/@/utils/validate"; // 定义子组件向父组件传值/事件 const emit = defineEmits(['refresh']); const { t } = useI18n(); @@ -49,8 +50,8 @@ const form = reactive({ // 定义校验规则 const dataRules = ref({ - groupName: [{ required: true, message: '分组名称不能为空', trigger: 'blur' }], - templateId: [{ required: true, message: '模板不能为空', trigger: 'blur' }], + groupName: [{validator: rule.overLength, trigger: 'blur'},{ required: true, message: '分组名称不能为空', trigger: 'blur' }], + templateId: [{validator: rule.overLength, trigger: 'blur'},{ required: true, message: '模板不能为空', trigger: 'blur' }], }); const openDialog = (id: string) => { diff --git a/src/views/gen/table/add-dict.vue b/src/views/gen/table/add-dict.vue index c82223ef..f42abc45 100644 --- a/src/views/gen/table/add-dict.vue +++ b/src/views/gen/table/add-dict.vue @@ -90,13 +90,13 @@ const dataRules = reactive({ trigger: 'blur', }, ], - systemFlag: [{required: true, message: '字典类型不能为空', trigger: 'blur'}], + systemFlag: [{validator: rule.overLength, trigger: 'blur'},{required: true, message: '字典类型不能为空', trigger: 'blur'}], description: [{validator: rule.overLength, trigger: 'blur'}, { required: true, message: '描述不能为空', trigger: 'blur' }], - columns: [{required: true, message: '字典项不能为空', trigger: 'blur'}], + columns: [{validator: rule.overLength, trigger: 'blur'},{required: true, message: '字典项不能为空', trigger: 'blur'}], }); // 打开弹窗 diff --git a/src/views/gen/table/generator.vue b/src/views/gen/table/generator.vue index cb8d79a5..69b4bde5 100644 --- a/src/views/gen/table/generator.vue +++ b/src/views/gen/table/generator.vue @@ -218,7 +218,7 @@ const dataRules = ref({ message: '必填项不能为空', trigger: 'blur' }], - style: [{required: true, message: '必填项不能为空', trigger: 'blur'}], + style: [{validator: rule.overLength, trigger: 'blur'},{required: true, message: '必填项不能为空', trigger: 'blur'}], }); // 保存 diff --git a/src/views/login/component/register.vue b/src/views/login/component/register.vue index be63d1c2..450472a4 100644 --- a/src/views/login/component/register.vue +++ b/src/views/login/component/register.vue @@ -105,6 +105,7 @@ const dataRules = reactive({ }, ], phone: [ + {validator: rule.overLength, trigger: 'blur'}, { required: true, message: '手机号不能为空', trigger: 'blur' }, // 手机号格式验证方法 { -- Gitee