Pārlūkot izejas kodu

Merge branch 'master' of http://git.iamberry.com/hexiugang/iamberry-common-parent

liujiankang 7 gadi atpakaļ
vecāks
revīzija
69d4a8764b

+ 81 - 4
watero-rst-web/src/main/webapp/WEB-INF/views/customer/save_customer_info.ftl

@@ -707,6 +707,22 @@
         }
     }
 
+    function getByteLen(val) {
+        var len = 0;
+        for (var i = 0; i < val.length; i++) {
+            var length = val.charCodeAt(i);
+            if(length>=0&&length<=128)
+            {
+                len += 1;
+            }
+            else
+            {
+                len += 2;
+            }
+        }
+        return len;
+    }
+
     /*保存对接联系人信息到列表*/
     function toAddDockedContactInfo() {
         var contactName = document.getElementById("contactName").value;
@@ -717,6 +733,9 @@
             //alert("联系人姓名不能为空");
             layer.msg("联系人姓名不能为空",{icon:2,time:2000});
             return;
+        }else if(getByteLen(contactName) > 20){
+            layer.msg("联系人姓名长度超限");
+            return;
         }
         if(contactPhone == "" || contactPhone == null ){
             //alert("电话不能为空");
@@ -733,6 +752,9 @@
         if(contactType == "" || contactType == null ){
             layer.msg("职位/身份不能为空");
             return;
+        }else if(getByteLen(contactType) > 20){
+            layer.msg("职位/身份长度超限");
+            return;
         }
         if(contactEmail == "" || contactEmail == null ){
             layer.msg("联系邮箱不能为空");
@@ -742,6 +764,9 @@
             if(!reg.test(contactEmail)){
                 layer.msg("请填写正确的邮箱!", {icon: 5, time: 3000});
                 return;
+            }else if(getByteLen(contactEmail) > 30){
+                layer.msg("邮箱长度超限");
+                return;
             }
         }
         //var operation = "删除";
@@ -809,6 +834,9 @@
         if(writeSupplyPrice != null && writeSupplyPrice !=""){
             writeSupplyPrice = toDecimal2(writeSupplyPrice);
             supplyPrice = writeSupplyPrice;
+        }else if(getByteLen(writeSupplyPrice) > 9){
+            layer.msg("产品价格长度超限");
+            return;
         }
         var accountPeriod = document.getElementById("accountPeriod").value;
         if(accountPeriod == "1"){
@@ -829,6 +857,9 @@
         if(channelName == "" || channelName == null ){
             layer.msg("渠道平台/名称不能为空");
             return;
+        }else if(getByteLen(channelName) > 30){
+            layer.msg("渠道平台/名称长度超限");
+            return;
         }
         if(promotingProducts == "" || promotingProducts == null ){
             layer.msg("销售产品不能为空");
@@ -837,6 +868,9 @@
         if(supplyPrice == "" || supplyPrice == null ){
             layer.msg("供货价格不能为空");
             return;
+        }else if(getByteLen(supplyPrice) > 9){
+            layer.msg("供货价格长度超限");
+            return;
         }
         var promotingProductsHtml = '<input type="hidden" value="'+promotingProducts+'">';
         //var operation = "删除";
@@ -885,6 +919,13 @@
         if(customerBasicInfo.customerName == "" || customerBasicInfo.customerName == null ){
             layer.msg("客户名称不能为空");
             return;
+        }else if(getByteLen(customerBasicInfo.customerName) > 20){
+            layer.msg("客户名称长度超限");
+            return;
+        }
+        if(getByteLen(customerBasicInfo.customerIndustry) > 20){
+            layer.msg("客户行业长度超限");
+            return;
         }
         if(customerBasicInfo.customerProvinceCode == "" || customerBasicInfo.customerProvinceCode == null ){
             layer.msg("客户省份不能为空");
@@ -893,10 +934,15 @@
         if(customerBasicInfo.customerCityCode == "" || customerBasicInfo.customerCityCode == null ){
             layer.msg("客户城市不能为空");
             return;
-        }/*if(customerBasicInfo.customerAddress == "" || customerBasicInfo.customerAddress == null ){
-            alert("客户地址不能为空");
+        }
+        if(getByteLen(customerBasicInfo.customerAddress) > 100){
+            layer.msg("客户详细地址长度超限");
             return;
-        }*/
+        }
+        if(getByteLen(customerBasicInfo.customerRemarks) > 100){
+            layer.msg("备注信息长度超限");
+            return;
+        }
         //对接联系人信息
         var dockedContactInfoList =  new Array();
         $("#contactListId").find("tr").each(function (index,element){
@@ -989,14 +1035,23 @@
             if(billingInfo.accountOpeningBranch == "" || billingInfo.accountOpeningBranch == null ){
                 layer.msg("开户支行不能为空");
                 return;
+            }else if(getByteLen(billingInfo.accountOpeningBranch) > 50){
+                layer.msg("开户支行长度超限");
+                return;
             }
             if(billingInfo.accountName == "" || billingInfo.accountName == null ){
                 layer.msg("账号名称不能为空");
                 return;
+            }else if(getByteLen(billingInfo.accountName) > 30){
+                layer.msg("账号名称长度超限");
+                return;
             }
             if(billingInfo.accountNum == "" || billingInfo.accountNum == null ){
                 layer.msg("账号不能为空");
                 return;
+            }else if(getByteLen(billingInfo.accountNum) > 20){
+                layer.msg("账号长度超限");
+                return;
             }
             /*if(billingInfo.receivablesName == "" || billingInfo.receivablesName == null ){
                 layer.msg("收款人姓名不能为空");
@@ -1028,18 +1083,30 @@
                 if(ticketOpeningInfo.accountOpeningBranch == "" || ticketOpeningInfo.accountOpeningBranch == null ){
                     layer.msg("开户支行不能为空");
                     return;
+                }else if(getByteLen(ticketOpeningInfo.accountOpeningBranch) > 50){
+                    layer.msg("开户支行长度超限");
+                    return;
                 }
                 if(ticketOpeningInfo.ticketOpeningAccount == "" || ticketOpeningInfo.ticketOpeningAccount == null ){
                     layer.msg("开票账户不能为空");
                     return;
+                }else if(getByteLen(ticketOpeningInfo.ticketOpeningAccount) > 30){
+                    layer.msg("开票账户长度超限");
+                    return;
                 }
                 if(ticketOpeningInfo.enterpriseName == "" || ticketOpeningInfo.enterpriseName == null ){
                     layer.msg("企业名称不能为空");
                     return;
+                }else if(getByteLen(ticketOpeningInfo.enterpriseName) > 30){
+                    layer.msg("企业名称长度超限");
+                    return;
                 }
                 if(ticketOpeningInfo.taxpayerIdentificationNum == "" || ticketOpeningInfo.taxpayerIdentificationNum == null ){
                     layer.msg("纳税人识别号不能为空");
                     return;
+                }else if(getByteLen(ticketOpeningInfo.taxpayerIdentificationNum) > 30){
+                    layer.msg("纳税人识别号长度超限");
+                    return;
                 }
                 if(ticketOpeningInfo.ticketOpeningPhone == "" || ticketOpeningInfo.ticketOpeningPhone == null ){
                     layer.msg("开票电话不能为空");
@@ -1050,18 +1117,28 @@
                         layer.msg("请填写正确的手机号码!", {icon: 5, time: 3000});
                         return;
                     }
-                }if(ticketOpeningInfo.enterpriseAddress == "" || ticketOpeningInfo.enterpriseAddress == null ){
+                }
+                if(ticketOpeningInfo.enterpriseAddress == "" || ticketOpeningInfo.enterpriseAddress == null ){
                     layer.msg("企业地址不能为空");
                     return;
+                }else if(getByteLen(ticketOpeningInfo.enterpriseAddress) > 30){
+                    layer.msg("企业地址长度超限");
+                    return;
                 }
             }else{
                 if(ticketOpeningInfo.enterpriseName == "" || ticketOpeningInfo.enterpriseName == null ){
                     layer.msg("企业名称不能为空");
                     return;
+                }else if(getByteLen(ticketOpeningInfo.enterpriseName) > 30){
+                    layer.msg("企业名称长度超限");
+                    return;
                 }
                 if(ticketOpeningInfo.taxpayerIdentificationNum == "" || ticketOpeningInfo.taxpayerIdentificationNum == null ){
                     layer.msg("纳税人识别号不能为空");
                     return;
+                }else if(getByteLen(ticketOpeningInfo.taxpayerIdentificationNum) > 30){
+                    layer.msg("纳税人识别号长度超限");
+                    return;
                 }
             }
         }

+ 4 - 3
watero-rst-web/src/main/webapp/WEB-INF/views/customer/update_customer_info.ftl

@@ -784,7 +784,7 @@
         if(contactName == "" || contactName == null ){
             layer.msg("联系人姓名不能为空");
             return;
-        }else if(getByteLen(contactName) > 10){
+        }else if(getByteLen(contactName) > 20){
             layer.msg("联系人姓名长度超限");
             return;
         }
@@ -802,7 +802,7 @@
         if(contactType == "" || contactType == null ){
             layer.msg("职位/身份不能为空");
             return;
-        }else if(getByteLen(contactType) > 10){
+        }else if(getByteLen(contactType) > 20){
             layer.msg("职位/身份长度超限");
             return;
         }
@@ -1144,7 +1144,8 @@
                     layer.msg("请填写正确的电话号码!", {icon: 5, time: 3000});
                     return;
                 }
-            }if(ticketOpeningInfo.enterpriseAddress == "" || ticketOpeningInfo.enterpriseAddress == null ){
+            }
+            if(ticketOpeningInfo.enterpriseAddress == "" || ticketOpeningInfo.enterpriseAddress == null ){
                 layer.msg("企业地址不能为空");
                 return;
             }else if(getByteLen(ticketOpeningInfo.enterpriseAddress) > 30){