diff --git a/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java b/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java index a2a8b464..e67f7431 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java @@ -316,15 +316,27 @@ public class PageController { } @GetMapping("/split_edit") - public ModelAndView split_edit(Integer id) { + public ModelAndView split_edit(Integer id,HttpServletRequest request) { if (id == null) { throw new MyException("缺少必要参数"); } + String token = request.getHeader("user-token"); + if (token == null) { + token = (String) request.getSession().getAttribute("userToken"); + } + UserByPort userToken = AuthenticationTokenPool.getUserToken(token); + ModelAndView mv = new ModelAndView(); // 获取所进行查询的拆单详细信息 SplitInfoP splitInfoPById = splitUnitService.findSplitInfoPById(id); mv.addObject("record", splitInfoPById); mv.setViewName("pages/split/split_edit"); + Integer maindeparment = userToken.getMaindeparment(); + if (PortConfig.roleAdminorgList.contains(maindeparment)) { + mv.addObject("display", "block"); + } else { + mv.addObject("display", "none"); + } return mv; } diff --git a/src/main/resources/templates/pages/split/split-out.html b/src/main/resources/templates/pages/split/split-out.html index 379e92be..c2ed706d 100644 --- a/src/main/resources/templates/pages/split/split-out.html +++ b/src/main/resources/templates/pages/split/split-out.html @@ -74,7 +74,7 @@ @@ -397,114 +397,119 @@ //监听状态操作 form.on('switch(changeState)', function (obj) { - var req = new Map; - req["id"] = this.value; - if (obj.elem.checked) { - req["state"] = 1; - $.ajax({ - url: "/split/split_edit", - type: 'post', - dataType: 'json', - contentType: "application/json;charset=utf-8", - data: JSON.stringify(req), - beforeSend: function () { - this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']}); - }, - success: function (data) { - layer.close(this.layerIndex); - if (data.status >= 300) { - layer.msg(data.statusInfo.message);//失败的表情 - - } else { - layer.msg("修改成功", { - icon: 6,//成功的表情 - time: 500 //1秒关闭(如果不配置,默认是3秒) - }, function () { - window.location = '/split_out' - }) + let display = $("#display").css("display"); + if(display !== "none"){ + var req = new Map; + req["id"] = this.value; + if (obj.elem.checked) { + req["state"] = 1; + $.ajax({ + url: "/split/split_edit", + type: 'post', + dataType: 'json', + contentType: "application/json;charset=utf-8", + data: JSON.stringify(req), + beforeSend: function () { + this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']}); + }, + success: function (data) { + layer.close(this.layerIndex); + if (data.status >= 300) { + layer.msg(data.statusInfo.message);//失败的表情 + + } else { + layer.msg("修改成功", { + icon: 6,//成功的表情 + time: 500 //1秒关闭(如果不配置,默认是3秒) + }, function () { + window.location = '/split_out' + }) + } + } + }) + } + else{ + $.ajax({ + url: "/split/findAllSplitInfoForbidden", + type: 'post', + dataType: 'json', + contentType: "application/json;charset=utf-8", + data: JSON.stringify(req), + success: function (data) { + data = data.data; + if(data){ + $.ajax({ + url: "/split/split_edit", + type: 'post', + dataType: 'json', + contentType: "application/json;charset=utf-8", + data: JSON.stringify(req), + beforeSend: function () { + this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']}); + }, + success: function (data) { + layer.close(this.layerIndex); + if (data.status >= 300) { + layer.msg(data.statusInfo.message);//失败的表情 + + } else { + layer.msg("修改成功", { + icon: 6,//成功的表情 + time: 500 //1秒关闭(如果不配置,默认是3秒) + }, function () { + window.location = '/split_out' + }) + } + } + }) + }else{ + layer.confirm('该拆单正在使用中,是否禁用?', { + btn: ['继续', '取消'] //按钮 + }, function () { + $.ajax({ + url: "/split/split_edit", + type: 'post', + dataType: 'json', + contentType: "application/json;charset=utf-8", + data: JSON.stringify(req), + beforeSend: function () { + this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']}); + }, + success: function (data) { + layer.close(this.layerIndex); + if (data.status >= 300) { + layer.msg(data.statusInfo.message);//失败的表情 + + } else { + layer.msg("修改成功", { + icon: 6,//成功的表情 + time: 500 //1秒关闭(如果不配置,默认是3秒) + }, function () { + window.location = '/split_out' + }) + } + } + }) + }, function () { + // 执行重加载 + table.reload('currentTableId', { + url: '/split/split_out', + page: { + curr: 1 + } + },'data'); + }); + } } - } - }) - }else{ - $.ajax({ - url: "/split/findAllSplitInfoForbidden", - type: 'post', - dataType: 'json', - contentType: "application/json;charset=utf-8", - data: JSON.stringify(req), - success: function (data) { - data = data.data; - if(data){ - $.ajax({ - url: "/split/split_edit", - type: 'post', - dataType: 'json', - contentType: "application/json;charset=utf-8", - data: JSON.stringify(req), - beforeSend: function () { - this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']}); - }, - success: function (data) { - layer.close(this.layerIndex); - if (data.status >= 300) { - layer.msg(data.statusInfo.message);//失败的表情 - - } else { - layer.msg("修改成功", { - icon: 6,//成功的表情 - time: 500 //1秒关闭(如果不配置,默认是3秒) - }, function () { - window.location = '/split_out' - }) - } - } - }) - }else{ - layer.confirm('该拆单正在使用中,是否禁用?', { - btn: ['继续', '取消'] //按钮 - }, function () { - $.ajax({ - url: "/split/split_edit", - type: 'post', - dataType: 'json', - contentType: "application/json;charset=utf-8", - data: JSON.stringify(req), - beforeSend: function () { - this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']}); - }, - success: function (data) { - layer.close(this.layerIndex); - if (data.status >= 300) { - layer.msg(data.statusInfo.message);//失败的表情 - - } else { - layer.msg("修改成功", { - icon: 6,//成功的表情 - time: 500 //1秒关闭(如果不配置,默认是3秒) - }, function () { - window.location = '/split_out' - }) - } - } - }) - }, function () { - // 执行重加载 - table.reload('currentTableId', { - url: '/split/split_out', - page: { - curr: 1 - } - },'data'); - }); - } - } - }) + }) + } } + }); @@ -532,10 +537,6 @@ }); } - $('body').on('click', '[data-refresh]', function () { - location.reload(); - }) - }); diff --git a/src/main/resources/templates/pages/split/split_edit.html b/src/main/resources/templates/pages/split/split_edit.html index 083ad808..ad7fc10a 100644 --- a/src/main/resources/templates/pages/split/split_edit.html +++ b/src/main/resources/templates/pages/split/split_edit.html @@ -140,7 +140,7 @@ -