Browse Source

修改拆零时的编辑权限

lwx_dev
erdanergou 3 years ago
parent
commit
2a966beb21
  1. 14
      src/main/java/com/dreamchaser/depository_manage/controller/PageController.java
  2. 213
      src/main/resources/templates/pages/split/split-out.html
  3. 9
      src/main/resources/templates/pages/split/split_edit.html

14
src/main/java/com/dreamchaser/depository_manage/controller/PageController.java

@ -316,15 +316,27 @@ public class PageController {
} }
@GetMapping("/split_edit") @GetMapping("/split_edit")
public ModelAndView split_edit(Integer id) { public ModelAndView split_edit(Integer id,HttpServletRequest request) {
if (id == null) { if (id == null) {
throw new MyException("缺少必要参数"); 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(); ModelAndView mv = new ModelAndView();
// 获取所进行查询的拆单详细信息 // 获取所进行查询的拆单详细信息
SplitInfoP splitInfoPById = splitUnitService.findSplitInfoPById(id); SplitInfoP splitInfoPById = splitUnitService.findSplitInfoPById(id);
mv.addObject("record", splitInfoPById); mv.addObject("record", splitInfoPById);
mv.setViewName("pages/split/split_edit"); 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; return mv;
} }

213
src/main/resources/templates/pages/split/split-out.html

@ -74,7 +74,7 @@
<script type="text/html" id="toolbarDemo"> <script type="text/html" id="toolbarDemo">
<div class="layui-btn-container"> <div class="layui-btn-container">
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn" lay-event="add" th:style="'display:'+${display}"> 添加</button> <button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn" lay-event="add" th:style="'display:'+${display}"> 添加</button>
<button class="layui-btn layui-btn-sm layui-btn-danger data-delete-btn" lay-event="delete" th:style="'display:'+${display}"> 删除</button> <button class="layui-btn layui-btn-sm layui-btn-danger data-delete-btn" lay-event="delete" id="display" th:style="'display:'+${display}"> 删除</button>
</div> </div>
</script> </script>
@ -397,114 +397,119 @@
//监听状态操作 //监听状态操作
form.on('switch(changeState)', function (obj) { form.on('switch(changeState)', function (obj) {
var req = new Map; let display = $("#display").css("display");
req["id"] = this.value; if(display !== "none"){
if (obj.elem.checked) { var req = new Map;
req["state"] = 1; req["id"] = this.value;
$.ajax({ if (obj.elem.checked) {
url: "/split/split_edit", req["state"] = 1;
type: 'post', $.ajax({
dataType: 'json', url: "/split/split_edit",
contentType: "application/json;charset=utf-8", type: 'post',
data: JSON.stringify(req), dataType: 'json',
beforeSend: function () { contentType: "application/json;charset=utf-8",
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']}); data: JSON.stringify(req),
}, beforeSend: function () {
success: function (data) { this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']});
layer.close(this.layerIndex); },
if (data.status >= 300) { success: function (data) {
layer.msg(data.statusInfo.message);//失败的表情 layer.close(this.layerIndex);
if (data.status >= 300) {
} else { layer.msg(data.statusInfo.message);//失败的表情
layer.msg("修改成功", {
icon: 6,//成功的表情 } else {
time: 500 //1秒关闭(如果不配置,默认是3秒) layer.msg("修改成功", {
}, function () { icon: 6,//成功的表情
window.location = '/split_out' 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();
})
}); });
</script> </script>

9
src/main/resources/templates/pages/split/split_edit.html

@ -140,7 +140,7 @@
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item" th:style="'display:'+${display}" id="display">
<div class="layui-input-block"> <div class="layui-input-block">
<button class="layui-btn" type="button" lay-submit lay-filter="formStep"> <button class="layui-btn" type="button" lay-submit lay-filter="formStep">
&emsp;提交&emsp; &emsp;提交&emsp;
@ -166,6 +166,13 @@
form = layui.form, form = layui.form,
layer = layui.layer; layer = layui.layer;
let id = $("#id").val(); let id = $("#id").val();
let display = $("#display").css("display");
$(function () {
if(display === "none"){
$("#quantity").attr("readonly","readonly");
$("#newUnit").attr("readonly","readonly");
}
})
form.on('submit(formStep)', function (data) { form.on('submit(formStep)', function (data) {
if(!flagForForm){ if(!flagForForm){
flagForForm = true; flagForForm = true;

Loading…
Cancel
Save