diff --git a/.idea/misc.xml b/.idea/misc.xml index 28a804d8..1c24890b 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -3,4 +3,7 @@ + + \ No newline at end of file diff --git a/manager/src/utils/regular.js b/manager/src/utils/regular.js index 05e78f2c..f55b197e 100644 --- a/manager/src/utils/regular.js +++ b/manager/src/utils/regular.js @@ -57,3 +57,34 @@ export const URL = // 固话 export const TEL = /0\d{2,3}-\d{7,8}/ + + +// 正整数 +export const INTEGER = { + pattern: /^[0-9]\d*$/, + message:'请输入正整数' +} + +export const VARCHAR5 = { + pattern:/^.{1,5}$/, + message:'长度应该限制在1-5个字符' +} + +export const VARCHAR20 = { + pattern:/^.{1,20}$/, + message:'长度应该限制在1-20个字符' +} + +export const VARCHAR255 = { + pattern:/^.{1,255}$/, + message:'超出最大长度限制' +} + +export const URL200 = { + pattern:/[a-zA-z]+\:\/\/[^\s]{1,190}/, + message:'请输入长度不超过200的URL地址' +} +export const REQUIRED = { + required: true, + message:'请填写参数' +} diff --git a/manager/src/views/goods-unit/index.vue b/manager/src/views/goods-unit/index.vue index e3e5e561..57f1131d 100644 --- a/manager/src/views/goods-unit/index.vue +++ b/manager/src/views/goods-unit/index.vue @@ -57,6 +57,9 @@ import { updateGoodsUnit, delGoodsUnit } from "@/api/index"; + +import {regular} from "@/utils"; + export default { name: "goods-unit", data() { @@ -79,12 +82,9 @@ export default { // 表单验证规则 formValidate: { name: [ - { - required: true, - message: "请输入计量单位", - trigger: "blur", - }, - ], + regular.REQUIRED, + regular.VARCHAR5 + ] }, submitLoading: false, // 添加或编辑提交状态 selectList: [], // 多选数据 diff --git a/manager/src/views/goods/goods-manage/brand.vue b/manager/src/views/goods/goods-manage/brand.vue index 8c91f298..42683b4a 100644 --- a/manager/src/views/goods/goods-manage/brand.vue +++ b/manager/src/views/goods/goods-manage/brand.vue @@ -1,9 +1,10 @@