|
|
@@ -89,29 +89,44 @@ angular.module('app.basic')
|
|
89
|
89
|
}
|
|
90
|
90
|
|
|
91
|
91
|
// 油罐编码最多只能输入数字
|
|
92
|
|
- $scope.checkUp = function(key) {
|
|
93
|
|
- var text;
|
|
94
|
|
- var a;
|
|
95
|
|
- var reg = /^\d$/g;
|
|
96
|
|
- if (key == "ygbm") {
|
|
97
|
|
- text = $scope.tank.storagetankCode;
|
|
98
|
|
- if (text != null && text != "") {
|
|
99
|
|
- a = text.substring(text.length - 1, text.length);
|
|
100
|
|
- if (!reg.test(a)) {
|
|
101
|
|
- $scope.tank.storagetankCode = text.replace(a, "");
|
|
102
|
|
- }
|
|
103
|
|
- }
|
|
104
|
|
- }
|
|
105
|
|
-
|
|
106
|
|
-// var text = $scope.tank.storagetankCode;
|
|
107
|
|
-// if (text != null && text != "") {
|
|
108
|
|
-// var a = text.substring(text.length - 1, text.length);
|
|
109
|
|
-// var reg = /^\d$/g;
|
|
110
|
|
-// if (!reg.test(a)) {
|
|
111
|
|
-// $scope.tank.storagetankCode = text.replace(a, "");
|
|
112
|
|
-// }
|
|
|
92
|
+// $scope.checkUp = function(key) {
|
|
|
93
|
+// var text;
|
|
|
94
|
+// var a;
|
|
|
95
|
+// var reg = /^\d{3}/;
|
|
|
96
|
+// if (key == "ygbm") {
|
|
|
97
|
+// text = $scope.tank.storagetankCode;
|
|
|
98
|
+// if (text != null && text != "") {
|
|
|
99
|
+// a = text.substring(text.length - 1, text.length);
|
|
|
100
|
+// if (!reg.test(a)) {
|
|
|
101
|
+// $scope.tank.storagetankCode = text.replace(a, "");
|
|
|
102
|
+// }
|
|
|
103
|
+// }
|
|
113
|
104
|
// }
|
|
114
|
|
- }
|
|
|
105
|
+//
|
|
|
106
|
+// }
|
|
|
107
|
+
|
|
|
108
|
+ $.validator.addMethod("validTankCode",function(value,element, params) {
|
|
|
109
|
+ if(value == 0){
|
|
|
110
|
+ return this.optional(element);
|
|
|
111
|
+ }else{
|
|
|
112
|
+ var text;
|
|
|
113
|
+ //var a;
|
|
|
114
|
+ var reg = /^YG+\d{3}/;
|
|
|
115
|
+ //if (key == "ygbm") {
|
|
|
116
|
+ text = $scope.tank.storagetankCode;
|
|
|
117
|
+ if (text != null && text != "") {
|
|
|
118
|
+ //a = text.substring(text.length - 1, text.length);
|
|
|
119
|
+ if (!reg.test(text)) {
|
|
|
120
|
+ return this.optional(element) || false;
|
|
|
121
|
+ //$scope.tank.storagetankCode = text.replace(a, "");
|
|
|
122
|
+ }
|
|
|
123
|
+ } else {
|
|
|
124
|
+ return this.optional(element) || false;
|
|
|
125
|
+ }
|
|
|
126
|
+ //}
|
|
|
127
|
+ return this.optional(element) || true;
|
|
|
128
|
+ }
|
|
|
129
|
+ }, "请输入正确的编码格式,如:YG001!");
|
|
115
|
130
|
|
|
116
|
131
|
$.validator.addMethod("validThan0",function(value,element, params) {
|
|
117
|
132
|
if(value == 0){
|