|
|
@@ -76,10 +76,48 @@ angular.module('app.business').controller("customerSaveCtrl", function($scope, $
|
|
76
|
76
|
return this.optional(element)||(checkNumber.test(value));
|
|
77
|
77
|
},"请输入正确的数字类型,最多两位小数!");
|
|
78
|
78
|
|
|
|
79
|
+ $scope.checkRepeat = function () {
|
|
|
80
|
+ var khlx = $scope.customer.classify;
|
|
|
81
|
+ var zjh;
|
|
|
82
|
+ var checkNumber;
|
|
|
83
|
+ var flag = false;
|
|
|
84
|
+ if (null != khlx && khlx == "3152") {
|
|
|
85
|
+ //个人客户的身份证号
|
|
|
86
|
+ zjh = $scope.customer.identification;
|
|
|
87
|
+ checkNumber = /(^\d{18}$)|(^\d{17}(\d|X)$)/g;
|
|
|
88
|
+ flag = checkNumber.test(zjh);
|
|
|
89
|
+ }else if (null != khlx && khlx == "3153") {
|
|
|
90
|
+ //企业客户的统一信用代码
|
|
|
91
|
+ zjh = $scope.customer.socialCreditCode;
|
|
|
92
|
+ checkNumber = /^([0-9A-HJ-NPQRTUWXY]{2}\d{6}[0-9A-HJ-NPQRTUWXY]{10}|[1-9]\d{14})$/g;
|
|
|
93
|
+ flag = checkNumber.test(zjh);
|
|
|
94
|
+ } else {
|
|
|
95
|
+ alert("请先选择客户类型!");
|
|
|
96
|
+ return false;
|
|
|
97
|
+ }
|
|
|
98
|
+ if (flag) {
|
|
|
99
|
+ var param = {
|
|
|
100
|
+ orgId : $rootScope.orgInfo.orgId,
|
|
|
101
|
+ zjh : zjh,
|
|
|
102
|
+ customerId : $scope.customer.id,
|
|
|
103
|
+ customerType : khlx
|
|
|
104
|
+ };
|
|
|
105
|
+ $.get(APP_CONFIG.keeperHouseUrl + '/depot/business/customer/checkRepeat', param, function(data){
|
|
|
106
|
+ if (data == "false") {
|
|
|
107
|
+ alert("请输入正确的身份证号码,且不能重复!");
|
|
|
108
|
+ return false;
|
|
|
109
|
+ }
|
|
|
110
|
+ });
|
|
|
111
|
+ } else {
|
|
|
112
|
+ alert("请输入正确的身份证号码,且不能重复!");
|
|
|
113
|
+ return false;
|
|
|
114
|
+ }
|
|
|
115
|
+ }
|
|
|
116
|
+
|
|
79
|
117
|
$.validator.addMethod("validLength",function(value,element, params) {
|
|
80
|
118
|
var checkNumber = /(^\d{18}$)|(^\d{17}(\d|X)$)/g;
|
|
81
|
|
- return this.optional(element)||(checkNumber.test(value));
|
|
82
|
|
- },"请输入正确的身份证号码!");
|
|
|
119
|
+ return this.optional(element)||(checkNumber.test(value));
|
|
|
120
|
+ },"请输入正确的身份证号码,且不能重复!");
|
|
83
|
121
|
|
|
84
|
122
|
$.validator.addMethod("qyLength",function(value,element, params) {
|
|
85
|
123
|
//var checkNumber = /^\w{18}$/g;
|
|
|
@@ -113,51 +151,7 @@ angular.module('app.business').controller("customerSaveCtrl", function($scope, $
|
|
113
|
151
|
var checkNumber = /^[0-9]{1,30}$/g;
|
|
114
|
152
|
return this.optional(element)||(checkNumber.test(value));
|
|
115
|
153
|
},"请输入正确的开户账号!");
|
|
116
|
|
-
|
|
117
|
|
- // 自定义验证,验证用身份证或统一信用代码是否重复
|
|
118
|
|
- $.validator.addMethod("zjh", function(value, element) {
|
|
119
|
|
- var result = false;
|
|
120
|
|
- // 设置同步
|
|
121
|
|
- $.ajaxSetup({
|
|
122
|
|
- async: false
|
|
123
|
|
- });
|
|
124
|
|
-
|
|
125
|
|
- var khlx = $scope.customer.classify;
|
|
126
|
|
- var zjh;
|
|
127
|
|
- if (null != khlx && khlx == "3152") {
|
|
128
|
|
- //个人客户的身份证号
|
|
129
|
|
- zjh = $scope.customer.identification;
|
|
130
|
|
- }else if (null != khlx && khlx == "3153") {
|
|
131
|
|
- //企业客户的统一信用代码
|
|
132
|
|
- zjh = $scope.customer.socialCreditCode;
|
|
133
|
|
- } else {
|
|
134
|
|
- alert("请先选择客户类型!");
|
|
135
|
|
- return result;
|
|
136
|
|
- }
|
|
137
|
|
-
|
|
138
|
|
- var param = {
|
|
139
|
|
- orgId : $rootScope.orgInfo.orgId,
|
|
140
|
|
- zjh : zjh,
|
|
141
|
|
- customerId : $scope.customer.id,
|
|
142
|
|
- customerType : khlx
|
|
143
|
|
- };
|
|
144
|
|
- $.get(APP_CONFIG.keeperHouseUrl + '/depot/business/customer/checkRepeat', param, function(data){
|
|
145
|
|
- if (data == "true") {
|
|
146
|
|
- result = true;
|
|
147
|
|
- }
|
|
148
|
|
- });
|
|
149
|
|
- // 恢复异步
|
|
150
|
|
- $.ajaxSetup({
|
|
151
|
|
- async: true
|
|
152
|
|
- });
|
|
153
|
|
- return result;
|
|
154
|
|
- }, "身份证号或统一信用代码重复,请重新输入");
|
|
155
|
|
-
|
|
156
|
|
-
|
|
157
|
|
- // 返回.
|
|
158
|
|
- /* $scope.retList = function () {
|
|
159
|
|
- $state.go('app.business.customer.list');
|
|
160
|
|
- }*/
|
|
|
154
|
+
|
|
161
|
155
|
// 返回.
|
|
162
|
156
|
$scope.retList = function () {
|
|
163
|
157
|
if ($rootScope.previousState_name != '') {
|