From d0204d5a1f99851880d945e8a46c5d0801dd512b Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期一, 09 六月 2025 16:52:13 +0800 Subject: [PATCH] bug修改 --- cloud-server-management/src/main/webapp/static/modular/system/referee/referee.js | 284 ++++++++++++++++++++++++++++++++++++++------------------ 1 files changed, 194 insertions(+), 90 deletions(-) diff --git a/cloud-server-management/src/main/webapp/static/modular/system/referee/referee.js b/cloud-server-management/src/main/webapp/static/modular/system/referee/referee.js index 9876c80..f91fb27 100644 --- a/cloud-server-management/src/main/webapp/static/modular/system/referee/referee.js +++ b/cloud-server-management/src/main/webapp/static/modular/system/referee/referee.js @@ -60,7 +60,7 @@ ' <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="请输入">' + + ' <input class="form-control" id="addPhone" type="text" placeholder="请输入" maxlength="11">' + ' </div>\n' + ' </div>\n' + ' <div class="form-group" >\n' + @@ -80,7 +80,7 @@ layer.open({ type: 1 ,title: '添加裁判' - ,area: ['390px', '260px'] + ,area: ['500px', '350px'] ,shade: 0 ,content: div ,btn: ['保存', '关闭'] //只是为了演示 @@ -97,6 +97,15 @@ Feng.info("手机号不能为空"); return } + //定义正则表达式 + var reg='^((13[0-9])|(14[5,7])|(15[0-3,5-9])|(17[0,3,5-9])|(18[0-9])|166|198|199|191|(147))\\d{8}$'; + //创建正则表达式对象 + var regExp=new RegExp(reg); + //使用test()函数验证数据是否匹配正则表达式,匹配返回true,否则返回false + if (!regExp.test(addPhone)) { + Feng.info("手机号格式不正确"); + return + } if(null == addProvince || '' == addProvince){ Feng.info("请选择所在省"); return @@ -109,10 +118,10 @@ if(res.code == 200){ Feng.success("添加成功"); layer.closeAll(); + Referee.table.refresh(); }else{ Feng.error(res.msg); } - MgrUser.table.refresh(); }, function (data) { Feng.error("添加失败!" + data.responseJSON.message + "!"); }); @@ -138,19 +147,133 @@ }; /** - * 商户号认证页面 + * 编辑 */ 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" type="text" placeholder="请输入" maxlength="11"/>' + + ' </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 + } + //定义正则表达式 + var reg='^((13[0-9])|(14[5,7])|(15[0-3,5-9])|(17[0,3,5-9])|(18[0-9])|166|198|199|191|(147))\\d{8}$'; + //创建正则表达式对象 + var regExp=new RegExp(reg); + //使用test()函数验证数据是否匹配正则表达式,匹配返回true,否则返回false + if (!regExp.test(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(); + Referee.table.refresh(); + } else { + Feng.error(res.msg); + } + }, 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; } }; @@ -160,29 +283,24 @@ Referee.delReferee = function (){ if(this.check()){ var operation = function(){ - var userId = MgrUser.seItem.id; - var ajax = new $ax(Feng.ctxPath + "/mgr/delete", function () { - if(language==1){ - Feng.success("删除成功!"); - }else if(language==2){ - Feng.success("Delete succeeded!"); - }else { - Feng.success("Hapus berhasil!"); + var ajax = new $ax(Feng.ctxPath + "/referee/updateState", function (res) { + if (res.code == 200) { + Feng.success("删除成功"); + layer.closeAll(); + Referee.search(); + } else { + Feng.error(res.msg); } - MgrUser.table.refresh(); }, function (data) { - if(language==1){ - Feng.error("删除失败!" + data.responseJSON.message + "!"); - }else if(language==2){ - Feng.error("Delete failed!" + data.responseJSON.message + "!"); - }else { - Feng.error("Hapus gagal!" + data.responseJSON.message + "!"); - } + Feng.error("删除失败!" + data.responseJSON.message + "!"); }); - ajax.set("userId", userId); + ajax.setData({ + 'id': Referee.seItem.id, + 'state': 3 + }); ajax.start(); }; - Feng.confirm("是否删除员工: " + MgrUser.seItem.name + "?",operation); + Feng.confirm("是否删除裁判:" + Referee.seItem.name + "?",operation); } } @@ -192,33 +310,26 @@ * 上架 */ Referee.onShelf = function () { - if (this.check()){ - var selected = $('#' + this.id).bootstrapTable('getSelections'); - const data1 = { - ids:[], - state:null + if(this.check()){ + var operation = function(){ + var ajax = new $ax(Feng.ctxPath + "/referee/updateState", function (res) { + if (res.code == 200) { + Feng.success("解冻成功"); + layer.closeAll(); + Referee.search(); + } else { + Feng.error(res.msg); + } + }, function (data) { + Feng.error("解冻失败!" + data.responseJSON.message + "!"); + }); + ajax.setData({ + 'id': Referee.seItem.id, + 'state': 1 + }); + ajax.start(); }; - selected.forEach(function(obj) { - console.log("查看选中") - console.log(obj) - var id = obj.id; - data1.ids.push(id); - }); - data1.state = 1; - - $.ajax({ - url: Feng.ctxPath + "/referee/changeState", - type: "POST", - contentType: "application/json", // 设置请求头的 Content-Type - data: JSON.stringify(data1), // 将数据转换为 JSON 字符串 - success: function(response) { - Feng.success("解冻成功!"); - Referee.search(); - }, - error: function(xhr, status, error) { - var errorMessage = xhr.responseText ? xhr.responseText : "解冻失败!"; - } - }); + Feng.confirm("是否解冻裁判:" + Referee.seItem.name + "?",operation); } }; @@ -226,30 +337,26 @@ * 下架 */ Referee.offShelf = function () { - if (this.check()){ - var selected = $('#' + this.id).bootstrapTable('getSelections'); - const data1 = { - ids:[], - state:null + if(this.check()){ + var operation = function(){ + var ajax = new $ax(Feng.ctxPath + "/referee/updateState", function (res) { + if (res.code == 200) { + Feng.success("冻结成功"); + layer.closeAll(); + Referee.search(); + } else { + Feng.error(res.msg); + } + }, function (data) { + Feng.error("冻结失败!" + data.responseJSON.message + "!"); + }); + ajax.setData({ + 'id': Referee.seItem.id, + 'state': 2 + }); + ajax.start(); }; - selected.forEach(function(obj) { - var id = obj.id; - data1.ids.push(id); - }); - data1.state = 2; - $.ajax({ - url: Feng.ctxPath + "/referee/changeState", - type: "POST", - contentType: "application/json", // 设置请求头的 Content-Type - data: JSON.stringify(data1), // 将数据转换为 JSON 字符串 - success: function(response) { - Feng.success("冻结成功!"); - Referee.search(); - }, - error: function(xhr, status, error) { - var errorMessage = xhr.responseText ? xhr.responseText : "冻结失败!"; - } - }); + Feng.confirm("是否冻结裁判:" + Referee.seItem.name + "?",operation); } }; @@ -261,16 +368,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 + "!"); }); @@ -292,7 +394,7 @@ Referee.search = function () { var queryData = {}; - queryData['userName'] = $("#name").val(); + queryData['name'] = $("#name").val(); queryData['phone'] =$("#phone").val(); queryData['provinceCode'] =$("#provinceCode").val(); queryData['cityCode'] =$("#cityCode").val(); @@ -312,4 +414,6 @@ var table = new BSTable(Referee.id, "/referee/listAll", defaultColunms); table.setPaginationType("server"); Referee.table = table.init(); + + Referee.region('provinceCode', null); }); -- Gitblit v1.7.1