From 1cfb9bd0b30b935184e490a0cd2de07f71ecc851 Mon Sep 17 00:00:00 2001 From: java110 <928255095@qq.com> Date: Tue, 2 Jun 2020 23:22:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/property/addOwner/addOwner.html | 6 +++--- public/components/property/addOwner/addOwner.js | 16 ++++++---------- public/vcCore/vcFramework.js | 15 +++++++++++++++ 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/public/components/property/addOwner/addOwner.html b/public/components/property/addOwner/addOwner.html index e623cdd03..d09ed8e97 100644 --- a/public/components/property/addOwner/addOwner.html +++ b/public/components/property/addOwner/addOwner.html @@ -19,9 +19,9 @@
- +
+ placeholder="必填,请填写姓名" class="form-control">
@@ -36,7 +36,7 @@
+ placeholder="可选,请填写年龄" class="form-control">
diff --git a/public/components/property/addOwner/addOwner.js b/public/components/property/addOwner/addOwner.js index 4197a2fc0..f56b2e670 100644 --- a/public/components/property/addOwner/addOwner.js +++ b/public/components/property/addOwner/addOwner.js @@ -41,20 +41,16 @@ { limit: "required", param: "", - errInfo: "名称不能为空" + errInfo: "姓名不能为空" }, { limit: "maxin", param: "2,10", - errInfo: "名称长度必须在2位至10位" + errInfo: "姓名长度必须在2位至10位" }, ], 'addOwnerInfo.age': [ - { - limit: "required", - param: "", - errInfo: "年龄不能为空" - }, + { limit: "num", param: "", @@ -82,9 +78,9 @@ ], 'addOwnerInfo.idCard': [ { - limit: "maxLength", - param: "18", - errInfo: "身份证长度不能超过200位" + limit: "idCard", + param: "", + errInfo: "身份证格式错误" } ], 'addOwnerInfo.ownerTypeCd': [ diff --git a/public/vcCore/vcFramework.js b/public/vcCore/vcFramework.js index 80052f0e1..8beb6dbc4 100644 --- a/public/vcCore/vcFramework.js +++ b/public/vcCore/vcFramework.js @@ -1620,14 +1620,23 @@ vc 校验 工具类 -method * @param {校验文本} text */ num: function (text) { + if(text == null || text == undefined){ + return true; + } let regNum = /^[0-9][0-9]*$/; return regNum.test(text); }, date: function (str) { + if(str == null || str == undefined){ + return true; + } let regDate = /^(\d{4})-(\d{2})-(\d{2})$/; return regDate.test(str); }, dateTime: function (str) { + if(str == null || str == undefined){ + return true; + } let reDateTime = /^[1-9]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])\s+(20|21|22|23|[0-1]\d):[0-5]\d:[0-5]\d$/; return reDateTime.test(str); }, @@ -1635,10 +1644,16 @@ vc 校验 工具类 -method 金额校验 **/ money: function (text) { + if(text == null || text == undefined){ + return true; + } let regMoney = /^\d+\.?\d{0,2}$/; return regMoney.test(text); }, idCard: function (num) { + if(num == null || num == undefined){ + return true; + } num = num.toUpperCase(); //身份证号码为15位或者18位,15位时全为数字,18位前17位为数字,最后一位是校验位,可能为数字或字符X。 if (!(/(^\d{15}$)|(^\d{17}([0-9]|X)$)/.test(num))) {