From 7e7f901b2172281dc294dfbc67e6ad00625f09f4 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期一, 04 三月 2024 10:11:21 +0800
Subject: [PATCH] 合并代码

---
 cloud-server-management/src/main/webapp/static/modular/system/tCoach/tCoach_add.js |  191 ++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 160 insertions(+), 31 deletions(-)

diff --git a/cloud-server-management/src/main/webapp/static/modular/system/tCoach/tCoach_add.js b/cloud-server-management/src/main/webapp/static/modular/system/tCoach/tCoach_add.js
index 8c1338e..e64677f 100644
--- a/cloud-server-management/src/main/webapp/static/modular/system/tCoach/tCoach_add.js
+++ b/cloud-server-management/src/main/webapp/static/modular/system/tCoach/tCoach_add.js
@@ -21,7 +21,7 @@
 TSite.initColumn = function () {
     return [
         {field: 'selectItem', checkbox: true},
-        {title: '主键ID', field: 'id', visible: false, align: 'center', valign: 'middle'},
+        {title: '序号', field: 'id', visible: true, align: 'center', valign: 'middle'},
         {title: '所在省', field: 'province', visible: objectType==1?true:false, align: 'center', valign: 'middle',width:'20%',
         },
         {title: '所在市', field: 'city', visible: objectType==1?true:false, align: 'center', valign: 'middle',
@@ -169,13 +169,13 @@
 // 场地管理首页 选择对应的省市
 // 传1是场地管理首页 传2是场地管理添加页面
 TSite.oneChange = function () {
-    var province = $('#pCode option:selected').text();
+    var province = $('#pCode').val();
     var citySelect = document.getElementById("cCode");
-    var ajax = new $ax(Feng.ctxPath + "/tSite/getCity", function(data){
+    var ajax = new $ax(Feng.ctxPath + "/tCompetition/onChange", function(data){
         if(data!=null){
             var content='<option value="">选择市</option>';
             $.each(data, function(k,v) {
-                content += "<option value='"+v.cityCode+"'>"+v.city+"</option>";
+                content += "<option value='"+v.code+"'>"+v.name+"</option>";
             });
             $("#cCode").empty().append(content);
         }
@@ -185,14 +185,13 @@
         $("#cCode").innerHTML = '<option value="">请先选择省/市</option>';
     }
 
-    ajax.set("province",province);
+    ajax.set("oneId",province);
     ajax.start();
 };
 
 TSite.oneChangeNext = function (e) {
     var oneId=$(e).val();
-    var city = $('#cCode option:selected').text();
-    var ajax = new $ax(Feng.ctxPath + "/tSite/accountChangeNext", function(data){
+    var ajax = new $ax(Feng.ctxPath + "/tCoach/getYys", function(data){
         if(data!=null){
             var content='<option value="">选择账号</option>';
             $.each(data, function(k,v) {
@@ -201,26 +200,14 @@
             $("#account").empty().append(content);
         }
     });
+
+    ajax.set("pCode",$("#pCode").val());
+    ajax.set("cCode",$("#cCode").val());
+    ajax.start();
     if (oneId === ""){
         $("#account").innerHTML = '<option style="width: 300px" value="">请先选择省/市</option>';
 
     }
-    ajax.set("oneId",city);
-    ajax.start();
-
-    // var ajax1 = new $ax(Feng.ctxPath + "/tSite/storeChangeNext", function(data){
-    //     if(data!=null && data.length !== 0){
-    //         var content='<option value="">选择门店</option>';
-    //         $.each(data, function(k,v) {
-    //             content += "<option style='width: 300px' value='"+v.id+"'>"+v.name+"</option>";
-    //         });
-    //         $("#store").empty().append(content);
-    //     }else {
-    //         storeSelect.innerHTML = '<option value="">当前所选市没有门店</option>';
-    //     }
-    // });
-    // ajax1.set("oneId",oneId);
-    // ajax1.start();
 };
 
 /**
@@ -314,8 +301,6 @@
 var em = "";// 门店经营结束时间:分钟
 
 TSite.addSubmit = function(){
-
-
     var data = {
         id:null,
         province:"",
@@ -357,9 +342,147 @@
     data.certificate        = $('#certificate').val()
 
     var temp = ""
-    TSite.goodsPicArray.forEach(function (data) {
-        temp = temp+","+data
+
+    for (let i = 0; i < TSite.goodsPicArray.length; i++) {
+        console.log("循环")
+        console.log(TSite.goodsPicArray[i])
+        temp = temp+","+TSite.goodsPicArray[i];
+    }
+    data.certificateImg        = temp
+    if ($("#objectType").val()==1){
+    if($("#pCode").val()==''){
+        Feng.info("请选择省")
+        return;
+    }
+    if($("#cCode").val()==''){
+        Feng.info("请选择市")
+        return;
+    }
+    if($("#account").val()=='' ){
+        Feng.info("请选择账号")
+        return;
+    }
+    }
+    if($("#coachTypeId").val()=='' ){
+        Feng.info("请选择教练类型")
+        return;
+    }
+    if($("#name").val()=='' ){
+        Feng.info("请输入教练名称")
+        return;
+    }
+    if($("#birthday").val()==''){
+        Feng.info("请输入教练生日")
+        return;
+    }
+    if($("#gender").val()=='' ){
+        Feng.info("请选择教练性别")
+        return;
+    }
+    if($("#phone").val()==''){
+        Feng.info("请输入教练电话")
+        return;
+    }
+    if($("#idcard").val()==''){
+        Feng.info("请输入教练身份证号")
+        return;
+    }
+    if($("#height").val()==''){
+        Feng.info("请输入教练身高")
+        return;
+    }
+    if($("#weight").val()==''){
+        Feng.info("请输入教练体重")
+        return;
+    }
+    if($("#graduateSchool").val()==''){
+        Feng.info("请输入毕业院校")
+        return;
+    }
+    if($("#img").val()==''){
+        if ($("#diploma").val()==""){
+        Feng.info("请输入毕业证图片")
+            return;
+
+        }
+
+    }
+    if($("#certificate").val()==''){
+
+            Feng.info("请输入资格证书")
+            return;
+    }
+    if(TSite.goodsPicArray.length === 0){
+        Feng.info("请上传资格证书图片")
+        return;
+    }
+    $.ajax({
+        url: Feng.ctxPath + "/tCoach/add" ,
+        type: "POST",
+        data: JSON.stringify(data),
+        contentType: "application/json",
+        success: function (response) {
+            window.parent.TSite.table.refresh();
+            TSite.close();
+            Feng.success("添加成功");
+
+        },
+        error: function (xhr, status, error) {
+            Feng.error("添加失败!" + error);
+        }
     });
+};
+TSite.editSubmit = function(){
+    var data = {
+        id:null,
+        province:"",
+        provinceCode:"",
+        city:"",
+        cityCode:"",
+        cityManagerId:null,
+        coachTypeId:null,
+        name:"",
+        birthday:"",
+        gender:null,
+        phone:"",
+        idcard:"",
+        height:null,
+        weight:null,
+        graduateSchool:"",
+        diploma:"",
+        certificate:"",
+        certificateImg:"",
+    };
+    if ($("#dataId").val()!=="undefined"){
+        data.id = $("#dataId").val();
+    }
+    data.provinceCode       = $("#pCode").val()
+    data.province           = $('#pCode option:selected').text();
+    data.cityCode           = $("#cCode").val()
+    data.city               = $('#cCode option:selected').text();
+    data.cityManagerId      = $("#account").val()
+    data.coachTypeId         = $("#coachTypeId").val()
+    data.name               = $("#name").val()
+    data.birthday           = $("#birthday").val()
+    data.gender             = $("#gender").val()
+    data.phone              = $("#phone").val()
+    data.idcard             = $("#idcard").val()
+    data.height             = $("#height").val()
+    data.weight             = $("#weight").val()
+    data.graduateSchool     = $('#graduateSchool').val()
+    data.diploma            = $('#img').val()
+    data.certificate        = $('#certificate').val()
+    var goodImgs = this.goodsPicArray;
+    if(goodImgs.length==0){
+        Feng.info("请上传实景图")
+        return;
+    }
+    var temp = ""
+    for (let i = 0; i < TSite.goodsPicArray.length; i++) {
+        console.log("循环")
+        console.log(TSite.goodsPicArray[i])
+        temp = temp+","+TSite.goodsPicArray[i];
+    }
     data.certificateImg        = temp
 
     if($("#pCode").val()==''){
@@ -411,12 +534,17 @@
         return;
     }
     if($("#img").val()==''){
+        if ($("#diploma").val()==""){
         Feng.info("请输入毕业证图片")
-        return;
+            return;
+
+        }
+
     }
     if($("#certificate").val()==''){
-        Feng.info("请输入资格证书")
-        return;
+
+            Feng.info("请输入资格证书")
+            return;
     }
     if(TSite.goodsPicArray.length === 0){
         Feng.info("请上传资格证书图片")
@@ -428,6 +556,8 @@
         data: JSON.stringify(data),
         contentType: "application/json",
         success: function (response) {
+            window.parent.TSite.table.refresh();
+            TSite.close();
             Feng.success("添加成功");
 
         },
@@ -435,7 +565,6 @@
             Feng.error("添加失败!" + error);
         }
     });
-    TSite.search();
 };
 
 TSite.search = function () {

--
Gitblit v1.7.1