|  |  |  | 
|---|
|  |  |  | 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', | 
|---|
|  |  |  | 
|---|
|  |  |  | // 场地管理首页 选择对应的省市 | 
|---|
|  |  |  | // 传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); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | $("#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) { | 
|---|
|  |  |  | 
|---|
|  |  |  | $("#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(); | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | 
|---|
|  |  |  | var em = "";// 门店经营结束时间:分钟 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | TSite.addSubmit = function(){ | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var data = { | 
|---|
|  |  |  | id:null, | 
|---|
|  |  |  | province:"", | 
|---|
|  |  |  | 
|---|
|  |  |  | data.graduateSchool     = $('#graduateSchool').val() | 
|---|
|  |  |  | data.diploma            = $('#img').val() | 
|---|
|  |  |  | data.certificate        = $('#certificate').val() | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if($('#platform_account').is(':checked')){ | 
|---|
|  |  |  | data.cityManagerId = $("#platform_account").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(data.cityManagerId=='' ){ | 
|---|
|  |  |  | 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() | 
|---|
|  |  |  | if($('#platform_account').is(':checked')){ | 
|---|
|  |  |  | data.cityManagerId = $("#platform_account").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()==''){ | 
|---|
|  |  |  | 
|---|
|  |  |  | Feng.info("请选择市") | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if($("#account").val()=='' ){ | 
|---|
|  |  |  | if(data.cityManagerId=='' ){ | 
|---|
|  |  |  | Feng.info("请选择账号") | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | 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("请上传资格证书图片") | 
|---|
|  |  |  | 
|---|
|  |  |  | var carPhoto = new $WebUpload("img"); | 
|---|
|  |  |  | carPhoto.setUploadBarId("progressBar"); | 
|---|
|  |  |  | carPhoto.init(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | $('#platform_account').on('click', function (){ | 
|---|
|  |  |  | if($('#platform_account').is(':checked')){ | 
|---|
|  |  |  | $('#account').val(""); | 
|---|
|  |  |  | $('#account').attr("disabled", 'disabled'); | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | $('#account').removeAttr("disabled"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | }); | 
|---|