Commit 89c7786453512957da5f93b2936e91d4b57b91f6

Authored by YRF
1 parent 1170f160

添加线路 编码验证

src/main/resources/static/pages/base/line/js/line-add-form.js
@@ -94,7 +94,7 @@ $(function(){ @@ -94,7 +94,7 @@ $(function(){
94 // 需要验证的表单元素 94 // 需要验证的表单元素
95 rules : { 95 rules : {
96 'name' : {required : true,maxlength: 30},// 线路名称 必填项、 最大长度. 96 'name' : {required : true,maxlength: 30},// 线路名称 必填项、 最大长度.
97 - 'lineCode' : {required : true,maxlength: 6,digits:true , 97 + 'lineCode' : {required : true,maxlength: 6,digits:true ,isLineCode:true,
98 remote:{type: 'GET', 98 remote:{type: 'GET',
99 url: '/line/lineCodeVerification', 99 url: '/line/lineCodeVerification',
100 cache:false, 100 cache:false,
@@ -262,7 +262,14 @@ $(function(){ @@ -262,7 +262,14 @@ $(function(){
262 } 262 }
263 } 263 }
264 }); 264 });
265 - 265 +
  266 + // 线路编码不能0开头
  267 + $.validator.addMethod("isLineCode", function(value,element) {
  268 + // 线路编码正则表达式
  269 + var lineCode = /^([1-9])/;
  270 + return lineCode.test(value);
  271 + }, "线路编码不能以0开头");
  272 +
266 // 联系电话(手机/电话皆可)验证 273 // 联系电话(手机/电话皆可)验证
267 $.validator.addMethod("isPhone", function(value,element) { 274 $.validator.addMethod("isPhone", function(value,element) {
268 // 长度 275 // 长度