From ef04ce57881e6a338b10d596c5eb76b2220598bf Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期四, 31 八月 2023 11:16:49 +0800
Subject: [PATCH] 更新版本

---
 management/guns-admin/src/main/webapp/static/modular/system/tAgent/tAgent_info.js |  268 +++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 256 insertions(+), 12 deletions(-)

diff --git a/management/guns-admin/src/main/webapp/static/modular/system/tAgent/tAgent_info.js b/management/guns-admin/src/main/webapp/static/modular/system/tAgent/tAgent_info.js
index 3077a02..16a3346 100644
--- a/management/guns-admin/src/main/webapp/static/modular/system/tAgent/tAgent_info.js
+++ b/management/guns-admin/src/main/webapp/static/modular/system/tAgent/tAgent_info.js
@@ -2,7 +2,216 @@
  * 初始化详情对话框
  */
 var TAgentInfoDlg = {
-    tAgentInfoData : {}
+    tAgentInfoData : {},
+    validateFields: {
+        principal: {
+            validators: {
+                notEmpty: {
+                    message: '负责人姓名不能为空'
+                },
+                regexp: {
+                    regexp:  /^[\u4E00-\u9FA5A-Za-z\s]+$/,
+                    message: '不能输入特殊字符和数字'
+                }
+            }
+        },
+        principalPhone: {
+            validators: {
+                notEmpty: {
+                    message: '联系电话不能为空'
+                },
+                regexp: {
+                    regexp: /^1[3-9]\d{9}$/,
+                    message: '请输入合法手机号'
+                }
+            }
+        },
+        area: {
+            validators: {
+                notEmpty: {
+                    message: '请选择代理区域'
+                }
+            }
+        },
+        account: {
+            validators: {
+                notEmpty: {
+                    message: '登录账号不能为空'
+                }
+            }
+        },
+        password: {
+            validators: {
+                notEmpty: {
+                    message:  '登录密码不能为空'
+                },
+                identical: {
+                    field: 'rePassword',
+                    message: '两次密码不一致'
+                },
+            }
+        },
+        rePassword: {
+            validators: {
+                notEmpty: {
+                    message: '密码不能为空'
+                },
+                identical: {
+                    field: 'password',
+                    message: '两次密码不一致'
+                },
+            }
+        },
+        merchantName: {
+            validators: {
+                notEmpty: {
+                    message: '公司名称不能为空'
+                }
+            }
+        },
+        businessScope: {
+            validators: {
+                notEmpty: {
+                    message: '经营范围不能为空'
+                }
+            }
+        },
+        socialCreditCode: {
+            validators: {
+                notEmpty: {
+                    message: '统一社会信用码不能为空'
+                }
+            }
+        },
+        socialCreditCodeExpires: {
+            validators: {
+                notEmpty: {
+                    message: '统一社会信用证有效期不能为空'
+                }
+            }
+        },
+        provCodeEnterprise: {
+            validators: {
+                notEmpty: {
+                    message: '地区不能为空'
+                }
+            }
+        },
+        cityCodeEnterprise: {
+            validators: {
+                notEmpty: {
+                    message: '地区不能为空'
+                }
+            }
+        },
+        areaCodeEnterprise: {
+            validators: {
+                notEmpty: {
+                    message: '地区不能为空'
+                }
+            }
+        },
+        address: {
+            validators: {
+                notEmpty: {
+                    message: '企业详细地址不能为空'
+                }
+            }
+        },
+        legalPerson: {
+            validators: {
+                notEmpty: {
+                    message: '法人姓名不能为空'
+                }
+            }
+        },
+        merchantIDCode: {
+            validators: {
+                notEmpty: {
+                    message: '法人身份证号不能为空'
+                }
+            }
+        },
+        certIdExpires: {
+            validators: {
+                notEmpty: {
+                    message: '法人身份证有效期不能为空'
+                }
+            }
+        },
+        legalPhone: {
+            validators: {
+                notEmpty: {
+                    message: '法人手机号不能为空'
+                }
+            }
+        },
+        fileNo: {
+            validators: {
+                notEmpty: {
+                    message: '营业执照扫描件不能为空'
+                }
+            }
+        },
+        cardName: {
+            validators: {
+                notEmpty: {
+                    message: '结算账户名不能为空'
+                }
+            }
+        },
+        cardNo: {
+            validators: {
+                notEmpty: {
+                    message: '结算账户号不能为空'
+                }
+            }
+        },
+        phone: {
+            validators: {
+                notEmpty: {
+                    message: '银行预留手机号不能为空'
+                }
+            }
+        },
+        bankCode: {
+            validators: {
+                notEmpty: {
+                    message: '银行名称不能为空'
+                }
+            }
+        },
+        provCodeBank: {
+            validators: {
+                notEmpty: {
+                    message: '开户行地区不能为空'
+                }
+            }
+        },
+        cityCodeBank: {
+            validators: {
+                notEmpty: {
+                    message: '开户行地区不能为空'
+                }
+            }
+        },
+        areaCodeBank: {
+            validators: {
+                notEmpty: {
+                    message: '开户行地区不能为空'
+                }
+            }
+        }
+    }
+};
+
+/**
+ * 验证数据是否为空
+ */
+TAgentInfoDlg.validate = function () {
+    $('#tAgentInfoForm').data("bootstrapValidator").resetForm();
+    $('#tAgentInfoForm').bootstrapValidator('validate');
+    return $("#tAgentInfoForm").data('bootstrapValidator').isValid();
 };
 
 /**
@@ -45,18 +254,41 @@
  */
 TAgentInfoDlg.collectData = function() {
     this
-    .set('id')
-    .set('principal')
-    .set('principalPhone')
-    .set('email')
-    .set('provinceCode')
-    .set('provinceName')
-    .set('cityCode')
-    .set('cityName')
-    .set('status')
+        .set('id')
+        .set('principal')
+        .set('principalPhone')
+        .set('email')
+        .set('provinceCode')
+        .set('provinceName')
+        .set('cityCode')
+        .set('cityName')
+        .set('status')
         .set('area')
         .set('areaId')
-    .set('createTime');
+        .set('account')
+        .set('password')
+        .set('createTime')
+        .set('userType')
+        .set('merchantName')
+        .set('businessScope')
+        .set('socialCreditCode')
+        .set('socialCreditCodeExpires')
+        .set('provCodeEnterprise')
+        .set('cityCodeEnterprise')
+        .set('areaCodeEnterprise')
+        .set('address')
+        .set('cardName')
+        .set('cardNo')
+        .set('bankAcctType')
+        .set('phone')
+        .set('legalPerson')
+        .set('merchantIDCode')
+        .set('certIdExpires')
+        .set('legalPhone')
+        .set('bankCode')
+        .set('provCodeBank')
+        .set('cityCodeBank')
+        .set('areaCodeBank');
 }
 
 /**
@@ -66,6 +298,14 @@
 
     this.clearData();
     this.collectData();
+
+    if(!this.validate()){
+        return ;
+    }
+    if(this.tAgentInfoData.userType == 0){
+        delete this.tAgentInfoData.socialCreditCodeExpires;
+        delete this.tAgentInfoData.certIdExpires;
+    }
 
     //提交信息
     var ajax = new $ax(Feng.ctxPath + "/tAgent/add", function(data){
@@ -91,6 +331,10 @@
     this.clearData();
     this.collectData();
 
+    if(!this.validate()){
+        return ;
+    }
+
     //提交信息
     var ajax = new $ax(Feng.ctxPath + "/tAgent/update", function(data){
         Feng.success("修改成功!");
@@ -104,5 +348,5 @@
 }
 
 $(function() {
-
+    Feng.initValidator("tAgentInfoForm", TAgentInfoDlg.validateFields);
 });

--
Gitblit v1.7.1