fanxw 5 yıl önce
ebeveyn
işleme
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
                  if (drNum == 0) {
53
                  if (drNum == 0) {
54
                      drNum++;
54
                      drNum++;
55
                      $scope.storehouseList = data.list;
55
                      $scope.storehouseList = data.list;
@@ -288,7 +288,21 @@ angular.module('app.basic')
288
     	}
288
     	}
289
     	validator.form();
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
     $.validator.addMethod("validOutsideLength",function(value,element, params) {
306
     $.validator.addMethod("validOutsideLength",function(value,element, params) {
293
     	if(value == 0){ 
307
     	if(value == 0){ 
294
     		return this.optional(element); 
308
     		return this.optional(element); 

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

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