puzhibing
2024-02-05 640ff18d2d7f4be02ddb7f8f75e899f05545eb98
cloud-server-management/src/main/webapp/static/modular/system/bodySideAppointment/tBodySideAppointment_edit.js
@@ -14,7 +14,7 @@
TQuestion.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: 'type', visible: true, align: 'center', valign: 'middle',
            formatter:function (data) {
                return {1:"课后练习",2:"运动教学视频",3:"器材教学视频"}[data]
@@ -37,6 +37,20 @@
    ];
};
TQuestion.oneChange = function (e) {
    var oneId=$(e).val();
    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.code+"'>"+v.name+"</option>";
            });
            $("#cCode").empty().append(content);
        }
    });
    ajax.set("oneId",oneId);
    ajax.start();
};
/**
 * 检查是否选中
 */
@@ -54,7 +68,34 @@
TQuestion.dataCount = 0;
TQuestion.phone = "";
TQuestion.phoneId = "";
// 选择省 获取对应市区
// 选择市 获取对应门店
TQuestion.oneChangeNext = function (e) {
    var oneId=$(e).val();
    var city = $('#cCode option:selected').text();
    var citySelect = document.getElementById("account");
    var storeSelect = document.getElementById("store");
    if (oneId === ""){
        citySelect.innerHTML = '<option style="width: 300px" value="">请先选择省/市</option>';
        storeSelect.innerHTML = '<option style="width: 300px" value="">请先选择省/市</option>';
    }
    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",city);
    ajax1.start();
};
/**
 * 点击添加
 */
@@ -241,83 +282,98 @@
        });
    }
};
TQuestion.close = function() {
    parent.layer.close(window.parent.TQuestion.layerIndex);
};
TQuestion.addSubmit = function(){
    var data = {
        id:null,
        name:"",
        position:"",
        sort:"",
        province:"",
        provinceCode:"",
        city:"",
        cityCode:"",
        storeId:null,
        storeName:"",
        parentName:"",
        phone:"",
        learnerName:"",
        learnerAge:null,
        birthday:"",
        appointmentTime:"",
        status:null,
        state:null
    };
    data.name       = $("#name").val()
    data.position           = $("#position").val()
    data.sort           = $("#sort").val()
    data.id                         = $("#id").val()
    data.province                   = $('#pCode option:selected').text();
    data.provinceCode               = $("#pCode").val()
    data.city                       = $('#cCode option:selected').text();
    data.cityCode                   = $("#cCode").val()
    data.storeId                    = $("#store").val()
    data.storeName                  = $('#store option:selected').text();
    data.parentName                 = $("#parentName").val()
    data.phone                      = $("#phone").val()
    data.learnerName                = $("#learnerName").val()
    data.learnerAge                 = $("#learnerAge").val()
    data.birthday                   = $("#birthday").val()
    data.appointmentTime            = $("#appointmentTime").val().replace("T"," ")
    var roleType = $("#roleType").val()
    if($("#name").val()==''){
        Feng.info("请输入分类名称")
    if(roleType == 1){
        if($("#pCode").val()==''){
            Feng.info("请选择省")
            return;
        }
        if($("#cCode").val()==''){
            Feng.info("请选择市")
            return;
        }
    }
    if(roleType == 1 || roleType == 2) {
        if ($("#store").val() == '') {
            Feng.info("请选择门店")
            return;
        }
    }
    if($("#parentName").val()=='' ){
        Feng.info("请输入家长姓名")
        return;
    }
    if($("#cCode").val()==''){
        Feng.info("请选择所在位置")
    if($("#phone").val()=='' ){
        Feng.info("请输入家长联系方式")
        return;
    }
    if($("#account").val()=='' ){
        Feng.info("请输入排序")
    if($("#learnerName").val()=='' ){
        Feng.info("请输入学员姓名")
        return;
    }
    if($("#learnerAge").val()=='' ){
        Feng.info("请输入学员年龄")
        return;
    }
    if($("#birthday").val()=='' ){
        Feng.info("请选择学员生日")
        return;
    }
    if($("#appointmentTime").val()=='' ){
        Feng.info("请选择预约时间")
        return;
    }
    $.ajax({
        url: Feng.ctxPath + "/benefits/addBenefits" ,
        url: Feng.ctxPath + "/bodySideAppointment/addBodySideAppointments" ,
        type: "POST",
        data: JSON.stringify(data),
        contentType: "application/json",
        success: function (response) {
            Feng.success("添加成功");
            window.parent.TQuestion.table.refresh();
            TQuestion.close();
            Feng.success("修改成功");
        },
        error: function (xhr, status, error) {
            Feng.error("添加失败!" + error);
            Feng.error("修改失败!" + error);
        }
    });
    TSite.search();
};
TQuestion.updateSubmit = function(){
    var data = {
        id:null,
        name:"",
        position:"",
        sort:"",
    };
    data.name     = $("#name").val()
    data.position = $("#position").val()
    data.sort     = $("#sort").val()
    data.id       = $("#dataId").val()
    if($("#name").val()==''){
        Feng.info("请输入分类名称")
        return;
    }
    if($("#cCode").val()==''){
        Feng.info("请选择所在位置")
        return;
    }
    if($("#account").val()=='' ){
        Feng.info("请输入排序")
        return;
    }
    $.ajax({
        url: Feng.ctxPath + "/benefits/addBenefits" ,
        type: "POST",
        data: JSON.stringify(data),
        contentType: "application/json",
        success: function (response) {
            Feng.success("添加成功");
        },
        error: function (xhr, status, error) {
            Feng.error("添加失败!" + error);
        }
    });
    TSite.search();
};
/**
 * 查询列表