fanxw 5 gadi atpakaļ
vecāks
revīzija
de42f28d9a

+ 16 - 2
src/main/resources/static/app/basic/storehouse/controller/StorehouseCtrl.js

@@ -49,7 +49,7 @@ angular.module('app.basic')
49 49
                              }
50 50
                          }
51 51
                      }
52
-                 })
52
+                 });
53 53
                  if (drNum == 0) {
54 54
                      drNum++;
55 55
                      $scope.storehouseList = data.list;
@@ -288,7 +288,21 @@ angular.module('app.basic')
288 288
     	}
289 289
     	validator.form();
290 290
     }
291
-    
291
+
292
+    $.validator.addMethod("validHouseName",function(value,element, params) {
293
+    	if (value.toString().length >= 4) {
294
+    		var str_val = value.toString().substring(0,4);
295
+    		var code = /^(Q|P)\d{3}/;
296
+    		if (this.optional(element)||(code.test(str_val))) {
297
+    			return true;
298
+    		} else {
299
+    			return false;
300
+    		}
301
+    	} else {
302
+    		return false;
303
+    	}
304
+    },"仓房名称不可为空且前四位必须是P或Q开始+三位数字!");
305
+
292 306
     $.validator.addMethod("validOutsideLength",function(value,element, params) {
293 307
     	if(value == 0){ 
294 308
     		return this.optional(element); 

+ 1 - 1
src/main/resources/static/app/basic/storehouse/views/Storehouse-edit.html

@@ -64,7 +64,7 @@
64 64
 											</th>
65 65
 											<th>
66 66
 												<label class="input">
67
-													<input type="text" ng-model="basicStorehouse.storehouseName"
67
+													<input type="text" ng-model="basicStorehouse.storehouseName" validHouseName="true"
68 68
 													name="storehouseName" maxlength="20" required ng-readonly="isNotEdit">
69 69
 												</label>
70 70
 											</th>