From b088628cf9be70c36e34032bb0d024548351541b Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期六, 11 三月 2023 17:37:12 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 management/guns-admin/src/main/webapp/static/modular/system/tAgent/tAgent_info.js |   44 ++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 42 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..77ce37c 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,39 @@
  * 初始化详情对话框
  */
 var TAgentInfoDlg = {
-    tAgentInfoData : {}
+    tAgentInfoData : {},
+    validateFields: {
+        principal: {
+            validators: {
+                notEmpty: {
+                    message: '负责人姓名不能为空'
+                }
+            }
+        },
+        principalPhone: {
+            validators: {
+                notEmpty: {
+                    message: '联系电话不能为空'
+                }
+            }
+        },
+        area: {
+            validators: {
+                notEmpty: {
+                    message: '请选择代理区域'
+                }
+            }
+        },
+    }
+};
+
+/**
+ * 验证数据是否为空
+ */
+TAgentInfoDlg.validate = function () {
+    $('#tAgentInfoForm').data("bootstrapValidator").resetForm();
+    $('#tAgentInfoForm').bootstrapValidator('validate');
+    return $("#tAgentInfoForm").data('bootstrapValidator').isValid();
 };
 
 /**
@@ -67,6 +99,10 @@
     this.clearData();
     this.collectData();
 
+    if(!this.validate()){
+        return ;
+    }
+
     //提交信息
     var ajax = new $ax(Feng.ctxPath + "/tAgent/add", function(data){
         if(data.code == 500){
@@ -91,6 +127,10 @@
     this.clearData();
     this.collectData();
 
+    if(!this.validate()){
+        return ;
+    }
+
     //提交信息
     var ajax = new $ax(Feng.ctxPath + "/tAgent/update", function(data){
         Feng.success("修改成功!");
@@ -104,5 +144,5 @@
 }
 
 $(function() {
-
+    Feng.initValidator("tAgentInfoForm", TAgentInfoDlg.validateFields);
 });

--
Gitblit v1.7.1