From db7fa6a91b9534ac90e219b6f554c54c43c83a5a Mon Sep 17 00:00:00 2001
From: liujie <liujie>
Date: 星期三, 16 八月 2023 09:28:15 +0800
Subject: [PATCH] update

---
 management/guns-admin/src/main/webapp/static/modular/system/tAgent/tAgent_info.js |   83 ++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 81 insertions(+), 2 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..ef7f181 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,76 @@
  * 初始化详情对话框
  */
 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: '两次密码不一致'
+                },
+            }
+        }
+    }
+};
+
+/**
+ * 验证数据是否为空
+ */
+TAgentInfoDlg.validate = function () {
+    $('#tAgentInfoForm').data("bootstrapValidator").resetForm();
+    $('#tAgentInfoForm').bootstrapValidator('validate');
+    return $("#tAgentInfoForm").data('bootstrapValidator').isValid();
 };
 
 /**
@@ -56,6 +125,8 @@
     .set('status')
         .set('area')
         .set('areaId')
+        .set('account')
+        .set('password')
     .set('createTime');
 }
 
@@ -66,6 +137,10 @@
 
     this.clearData();
     this.collectData();
+
+    if(!this.validate()){
+        return ;
+    }
 
     //提交信息
     var ajax = new $ax(Feng.ctxPath + "/tAgent/add", function(data){
@@ -91,6 +166,10 @@
     this.clearData();
     this.collectData();
 
+    if(!this.validate()){
+        return ;
+    }
+
     //提交信息
     var ajax = new $ax(Feng.ctxPath + "/tAgent/update", function(data){
         Feng.success("修改成功!");
@@ -104,5 +183,5 @@
 }
 
 $(function() {
-
+    Feng.initValidator("tAgentInfoForm", TAgentInfoDlg.validateFields);
 });

--
Gitblit v1.7.1