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/tDriver/tDriver_info.js |  147 ++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 139 insertions(+), 8 deletions(-)

diff --git a/management/guns-admin/src/main/webapp/static/modular/system/tDriver/tDriver_info.js b/management/guns-admin/src/main/webapp/static/modular/system/tDriver/tDriver_info.js
index f7c9bf5..c6869b1 100644
--- a/management/guns-admin/src/main/webapp/static/modular/system/tDriver/tDriver_info.js
+++ b/management/guns-admin/src/main/webapp/static/modular/system/tDriver/tDriver_info.js
@@ -2,7 +2,80 @@
  * 初始化详情对话框
  */
 var TDriverInfoDlg = {
-    tDriverInfoData : {}
+    tDriverInfoData : {},
+    validateFields: {
+        name: {
+            validators: {
+                notEmpty: {
+                    message: '姓名不能为空'
+                },
+                regexp: {
+                    regexp:  /^[\u4E00-\u9FA5A-Za-z\s]+$/,
+                    message: '不能输入特殊字符和数字'
+                }
+            }
+        },
+        phone: {
+            validators: {
+                notEmpty: {
+                    message: '手机号不能为空'
+                },
+                regexp: {
+                    regexp: /^1[3-9]\d{9}$/,
+                    message: '请输入合法手机号'
+                }
+            }
+        },
+        emergencyContact: {
+            validators: {
+                notEmpty: {
+                    message: '紧急联系人姓名不能为空'
+                },
+                regexp: {
+                    regexp:  /^[\u4E00-\u9FA5A-Za-z\s]+$/,
+                    message: '不能输入特殊字符和数字'
+                }
+            }
+        },
+        emergencyPhone: {
+            validators: {
+                notEmpty: {
+                    message: '紧急联系人电话不能为空'
+                },
+                regexp: {
+                    regexp: /^1[3-9]\d{9}$/,
+                    message: '请输入合法手机号'
+                }
+            }
+        },
+        area: {
+            validators: {
+                notEmpty: {
+                    message: '请选择服务区域'
+                }
+            }
+        },
+        idcard: {
+            validators: {
+                notEmpty: {
+                    message: '身份证号码不能为空'
+                },
+                regexp: {
+                    regexp: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/,
+                    message: '请输入合法身份证号码'
+                }
+            }
+        },
+    }
+};
+
+/**
+ * 验证数据是否为空
+ */
+TDriverInfoDlg.validate = function () {
+    $('#driverInfoForm').data("bootstrapValidator").resetForm();
+    $('#driverInfoForm').bootstrapValidator('validate');
+    return $("#driverInfoForm").data('bootstrapValidator').isValid();
 };
 
 /**
@@ -66,6 +139,8 @@
     .set('idcardBack')
     .set('inviterType')
     .set('inviterId')
+    .set('inviterName')
+    .set('inviterPhone')
     .set('agentId')
     .set('branchOfficeId')
     .set('balance')
@@ -76,6 +151,8 @@
     .set('serverStatus')
     .set('integral')
     .set('status')
+        .set('area')
+        .set('areaId')
     .set('createTime');
 }
 
@@ -87,11 +164,38 @@
     this.clearData();
     this.collectData();
 
+    if(!this.validate()){
+        return ;
+    }
+
+    var idcardFront = $("#idcardFront").val();
+    if ("" == idcardFront){
+        Feng.info("请上传身份证正面照");
+        return;
+    }
+
+    var idcardBack = $("#idcardBack").val();
+    if ("" == idcardBack){
+        Feng.info("请上传身份证背面照");
+        return;
+    }
+
+    var driverLicense = $("#driverLicense").val();
+    if ("" == driverLicense){
+        Feng.info("请上传驾驶证");
+        return;
+    }
+
     //提交信息
     var ajax = new $ax(Feng.ctxPath + "/tDriver/add", function(data){
-        Feng.success("添加成功!");
-        window.parent.TDriver.table.refresh();
-        TDriverInfoDlg.close();
+        if(data.code == 500){
+            Feng.error("添加失败!" + data.message + "!");
+            return false;
+        }else {
+            Feng.success("添加成功!");
+            window.parent.TDriver.table.refresh();
+            TDriverInfoDlg.close();
+        }
     },function(data){
         Feng.error("添加失败!" + data.responseJSON.message + "!");
     });
@@ -107,11 +211,38 @@
     this.clearData();
     this.collectData();
 
+    if(!this.validate()){
+        return ;
+    }
+
+    var idcardFront = $("#idcardFront").val();
+    if ("" == idcardFront){
+        Feng.info("请上传身份证正面照");
+        return;
+    }
+
+    var idcardBack = $("#idcardBack").val();
+    if ("" == idcardBack){
+        Feng.info("请上传身份证背面照");
+        return;
+    }
+
+    var driverLicense = $("#driverLicense").val();
+    if ("" == driverLicense){
+        Feng.info("请上传驾驶证");
+        return;
+    }
+
     //提交信息
     var ajax = new $ax(Feng.ctxPath + "/tDriver/update", function(data){
-        Feng.success("修改成功!");
-        window.parent.TDriver.table.refresh();
-        TDriverInfoDlg.close();
+        if(data.code == 500){
+            Feng.error("修改失败!" + data.message + "!");
+            return false;
+        }else {
+            Feng.success("修改成功!");
+            window.parent.TDriver.table.refresh();
+            TDriverInfoDlg.close();
+        }
     },function(data){
         Feng.error("修改失败!" + data.responseJSON.message + "!");
     });
@@ -120,5 +251,5 @@
 }
 
 $(function() {
-
+    Feng.initValidator("driverInfoForm", TDriverInfoDlg.validateFields);
 });

--
Gitblit v1.7.1