puzhibing
2024-03-02 48f8fffb3df2d8fd77c0a52df0e56e04eb5931ae
cloud-server-management/src/main/webapp/static/modular/system/referee/referee.js
@@ -80,7 +80,7 @@
    layer.open({
        type: 1
        ,title: '添加裁判'
        ,area: ['390px', '260px']
        ,area: ['500px', '350px']
        ,shade: 0
        ,content: div
        ,btn: ['保存', '关闭'] //只是为了演示
@@ -138,19 +138,124 @@
};
/**
 * 商户号认证页面
 * 编辑
 */
Referee.openEditReferee = function () {
    if (this.check()) {
        var index = layer.open({
            type: 2,
            title: "编辑裁判",
            area: ['100%', '100%'], //宽高
            fix: false, //不固定
            maxmin: true,
            content: Feng.ctxPath + '/referee/proportionAuth/' + Referee.seItem.id
    if(this.check()){
        let div = '<div class="ibox-content">\n' +
            '        <div class="form-horizontal" id="carInfoForm1">\n' +
            '            <input id="editId" type="hidden">' +
            '            <div class="form-group" >\n' +
            '                <label class="col-sm-3 control-label">*裁判姓名:</label>\n' +
            '                <div class="col-sm-9" style="display: flex;">\n' +
            '                    <input class="form-control" id="addName" placeholder="请输入">\n' +
            '                </div>\n' +
            '            </div>\n' +
            '            <div class="form-group" >\n' +
            '                <label class="col-sm-3 control-label">*手机号:</label>\n' +
            '                <div class="col-sm-9">\n' +
            '                    <input class="form-control" id="addPhone" placeholder="请输入">' +
            '                </div>\n' +
            '            </div>\n' +
            '            <div class="form-group" >\n' +
            '                <label class="col-sm-3 control-label">*所在省:</label>\n' +
            '                <div class="col-sm-9">\n' +
            '                    <select class="form-control" id="addProvince" onchange="Referee.region(\'addCity\', this)"></select>' +
            '                </div>\n' +
            '            </div>\n' +
            '            <div class="form-group" >\n' +
            '                <label class="col-sm-3 control-label">*所在市:</label>\n' +
            '                <div class="col-sm-9">\n' +
            '                    <select class="form-control" id="addCity"></select>' +
            '                </div>\n' +
            '            </div>\n' +
            '        </div>\n' +
            '    </div>';
        layer.open({
            type: 1
            , title: '编辑裁判'
            , area: ['500px', '350px']
            , shade: 0
            , content: div
            , btn: ['保存', '关闭'] //只是为了演示
            , yes: function () {
                let editId = $('#editId').val();
                let addName = $('#addName').val();
                let addPhone = $('#addPhone').val();
                let addProvince = $('#addProvince').val();
                let addCity = $('#addCity').val();
                if (null == addName || '' == addName) {
                    Feng.info("裁判姓名不能为空");
                    return
                }
                if (null == addPhone || '' == addPhone) {
                    Feng.info("手机号不能为空");
                    return
                }
                if (null == addProvince || '' == addProvince) {
                    Feng.info("请选择所在省");
                    return
                }
                if (null == addCity || '' == addCity) {
                    Feng.info("请选择所在市");
                    return
                }
                var ajax = new $ax(Feng.ctxPath + "/referee/editReferee", function (res) {
                    if (res.code == 200) {
                        Feng.success("添加成功");
                        layer.closeAll();
                    } else {
                        Feng.error(res.msg);
                    }
                    MgrUser.table.refresh();
                }, function (data) {
                    Feng.error("添加失败!" + data.responseJSON.message + "!");
                });
                ajax.setData({
                    'id': editId,
                    'name': addName,
                    'phone': addPhone,
                    'provinceCode': addProvince,
                    'cityCode': addCity
                });
                ajax.start();
            }
            , btn2: function () {
                layer.closeAll();
            }
            , success: function () {
                var ajax = new $ax(Feng.ctxPath + "/referee/getReferee", function (res) {
                    let referee = res.referee;
                    let province = res.province;
                    let city = res.city;
                    let html1 = '<option value="">请选择</option>';
                    for (let i = 0; i < province.length; i++) {
                        html1 += '<option value="' + province[i].code + '">' + province[i].name + '</option>'
                    }
                    $('#addProvince').html(html1);
                    let html2 = '<option value="">请选择</option>';
                    for (let i = 0; i < city.length; i++) {
                        html2 += '<option value="' + city[i].code + '">' + city[i].name + '</option>'
                    }
                    $('#addCity').html(html2);
                    $('#editId').val(referee.id);
                    $('#addName').val(referee.name);
                    $('#addPhone').val(referee.phone);
                    $('#addProvince').val(referee.provinceCode);
                    $('#addCity').val(referee.cityCode);
                }, function (data) {
                    Feng.error("获取失败!" + data.responseJSON.message + "!");
                });
                ajax.setData({
                    'id': Referee.seItem.id
                });
                ajax.start();
            }
            , end: function () {
            }
        });
        this.layerIndex = index;
    }
};
@@ -261,16 +366,11 @@
        pcode = $(e).val();
    }
    var ajax = new $ax(Feng.ctxPath + "/region/getRegion", function (res) {
        if(res.code == 200){
            let html = '<option value="">请选择</option>';
            for (let i = 0; i < res.data.length; i++) {
                html += '<option value="' + res.data.code + '">' + res.data.name + '</option>';
            }
            $('#' + node).html(html)
        }else{
            Feng.error(res.msg);
        let html = '<option value="">请选择</option>';
        for (let i = 0; i < res.length; i++) {
            html += '<option value="' + res[i].code + '">' + res[i].name + '</option>';
        }
        MgrUser.table.refresh();
        $('#' + node).html(html)
    }, function (data) {
        Feng.error("添加失败!" + data.responseJSON.message + "!");
    });