|
|
|
@ -76,8 +76,8 @@ |
|
|
|
|
|
|
|
<script id="toolbarDemo" type="text/html"> |
|
|
|
<div class="layui-btn-container"> |
|
|
|
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn" lay-event="add"> 添加</button> |
|
|
|
<button class="layui-btn layui-btn-sm layui-btn-danger data-delete-btn" lay-event="delete"> 删除</button> |
|
|
|
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn" lay-event="add" th:style="'display:'+${display}" id="display"> 添加</button> |
|
|
|
<button class="layui-btn layui-btn-sm layui-btn-danger data-delete-btn" lay-event="delete" th:style="'display:'+${display}"> 删除</button> |
|
|
|
</div> |
|
|
|
</script> |
|
|
|
|
|
|
|
@ -86,7 +86,7 @@ |
|
|
|
<script id="currentTableBar" type="text/html"> |
|
|
|
<a class="layui-btn layui-btn-normal layui-btn-xs data-count-subclass" lay-event="subclass">子仓</a> |
|
|
|
<a class="layui-btn layui-btn-xs data-count-edit" lay-event="detail">详情</a> |
|
|
|
<a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a> |
|
|
|
<a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" th:style="'display:'+${display}" lay-event="delete">删除</a> |
|
|
|
<a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" th:style="'display:'+${display}" |
|
|
|
lay-event="realDelete">彻底删除</a> |
|
|
|
</script> |
|
|
|
@ -460,109 +460,146 @@ |
|
|
|
//监听状态操作 |
|
|
|
form.on('switch(changeState)', function (obj) { |
|
|
|
// 首先发送请求判断待禁用的仓库是否还有货物,如果没有就直接禁用,否则进行判断 |
|
|
|
var hasMaterial = false |
|
|
|
var req = new Map |
|
|
|
if (obj.elem.checked) { |
|
|
|
req["state"] = 1 |
|
|
|
} |
|
|
|
req["id"] = this.value; |
|
|
|
if (req["state"] === undefined) {// 如果禁用 |
|
|
|
$.ajax({ |
|
|
|
url: "/repository/findMaterialByDepository?depositoryId=" + this.value, |
|
|
|
type: "get", |
|
|
|
dataType: "json", |
|
|
|
contentType: "application/json;charset=utf-8", |
|
|
|
success: function (d) { |
|
|
|
hasMaterial = d.data; |
|
|
|
// 子仓库下是否有物品 |
|
|
|
if (hasMaterial) { // 有 |
|
|
|
let display = $("#display").css("display"); |
|
|
|
if(display !== "none"){ |
|
|
|
var hasMaterial = false; |
|
|
|
var req = new Map; |
|
|
|
if (obj.elem.checked) { |
|
|
|
req["state"] = 1 |
|
|
|
} |
|
|
|
req["id"] = this.value; |
|
|
|
if (req["state"] === undefined) {// 如果禁用 |
|
|
|
$.ajax({ |
|
|
|
url: "/repository/findMaterialByDepository?depositoryId=" + this.value, |
|
|
|
type: "get", |
|
|
|
dataType: "json", |
|
|
|
contentType: "application/json;charset=utf-8", |
|
|
|
success: function (d) { |
|
|
|
hasMaterial = d.data; |
|
|
|
// 子仓库下是否有物品 |
|
|
|
if (hasMaterial) { // 有 |
|
|
|
|
|
|
|
layer.confirm('仓库下还有物品,确定封库?', { |
|
|
|
btn: ['封库', '取消'] //按钮 |
|
|
|
}, |
|
|
|
function () { |
|
|
|
req["envelop"] = 1; // 封库操作 |
|
|
|
$.ajax({ |
|
|
|
url: "/repository/EditDepositoryState", |
|
|
|
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']}); |
|
|
|
layer.confirm('仓库下还有物品,确定封库?', { |
|
|
|
btn: ['封库', '取消'] //按钮 |
|
|
|
}, |
|
|
|
success: function (data) { |
|
|
|
layer.close(this.layerIndex); |
|
|
|
if (data.status >= 300) { |
|
|
|
layer.msg(data.statusInfo.message);//失败的表情 |
|
|
|
return; |
|
|
|
} else { |
|
|
|
layer.msg("封库成功", { |
|
|
|
icon: 6,//成功的表情 |
|
|
|
time: 500 //1秒关闭(如果不配置,默认是3秒) |
|
|
|
}, function () { |
|
|
|
// 执行重加载 |
|
|
|
table.reload('currentTableId', { |
|
|
|
url: '/repository/warehouseRecord', |
|
|
|
page: { |
|
|
|
curr: 1 |
|
|
|
}, |
|
|
|
where: {"parentId": parentId} |
|
|
|
}); |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
function () { |
|
|
|
// 执行重加载 |
|
|
|
table.reload('currentTableId', { |
|
|
|
url: '/repository/warehouseRecord', |
|
|
|
page: { |
|
|
|
curr: 1 |
|
|
|
function () { |
|
|
|
req["envelop"] = 1; // 封库操作 |
|
|
|
$.ajax({ |
|
|
|
url: "/repository/EditDepositoryState", |
|
|
|
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);//失败的表情 |
|
|
|
return; |
|
|
|
} else { |
|
|
|
layer.msg("封库成功", { |
|
|
|
icon: 6,//成功的表情 |
|
|
|
time: 500 //1秒关闭(如果不配置,默认是3秒) |
|
|
|
}, function () { |
|
|
|
// 执行重加载 |
|
|
|
table.reload('currentTableId', { |
|
|
|
url: '/repository/warehouseRecord', |
|
|
|
page: { |
|
|
|
curr: 1 |
|
|
|
}, |
|
|
|
where: {"parentId": parentId} |
|
|
|
}); |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
where: {"parentId": parentId} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
else { |
|
|
|
layer.confirm('确定封库?',{ |
|
|
|
btn:['确定','取消'] |
|
|
|
}, |
|
|
|
function () { |
|
|
|
$.ajax({ |
|
|
|
url: "/repository/EditDepositoryState", |
|
|
|
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']}); |
|
|
|
function () { |
|
|
|
// 执行重加载 |
|
|
|
table.reload('currentTableId', { |
|
|
|
url: '/repository/warehouseRecord', |
|
|
|
page: { |
|
|
|
curr: 1 |
|
|
|
}, |
|
|
|
where: {"parentId": parentId} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
else { |
|
|
|
layer.confirm('确定封库?',{ |
|
|
|
btn:['确定','取消'] |
|
|
|
}, |
|
|
|
success: function (data) { |
|
|
|
layer.close(this.layerIndex); |
|
|
|
if (data.status >= 300) { |
|
|
|
layer.msg(data.statusInfo.message);//失败的表情 |
|
|
|
return; |
|
|
|
} else { |
|
|
|
layer.msg("修改成功", { |
|
|
|
icon: 6,//成功的表情 |
|
|
|
time: 500 //1秒关闭(如果不配置,默认是3秒) |
|
|
|
}, function () { |
|
|
|
// 执行重加载 |
|
|
|
table.reload('currentTableId', { |
|
|
|
url: '/repository/warehouseRecord', |
|
|
|
page: { |
|
|
|
curr: 1 |
|
|
|
}, |
|
|
|
where: {"parentId": parentId} |
|
|
|
}); |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
function () { |
|
|
|
function () { |
|
|
|
$.ajax({ |
|
|
|
url: "/repository/EditDepositoryState", |
|
|
|
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);//失败的表情 |
|
|
|
return; |
|
|
|
} else { |
|
|
|
layer.msg("修改成功", { |
|
|
|
icon: 6,//成功的表情 |
|
|
|
time: 500 //1秒关闭(如果不配置,默认是3秒) |
|
|
|
}, function () { |
|
|
|
// 执行重加载 |
|
|
|
table.reload('currentTableId', { |
|
|
|
url: '/repository/warehouseRecord', |
|
|
|
page: { |
|
|
|
curr: 1 |
|
|
|
}, |
|
|
|
where: {"parentId": parentId} |
|
|
|
}); |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
function () { |
|
|
|
// 执行重加载 |
|
|
|
table.reload('currentTableId', { |
|
|
|
url: '/repository/warehouseRecord', |
|
|
|
page: { |
|
|
|
curr: 1 |
|
|
|
}, |
|
|
|
where: {"parentId": parentId} |
|
|
|
}); |
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
else { // 如果启用 |
|
|
|
$.ajax({ |
|
|
|
url: "/repository/EditDepositoryState", |
|
|
|
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);//失败的表情 |
|
|
|
return; |
|
|
|
} else { |
|
|
|
layer.msg("修改成功", { |
|
|
|
icon: 6,//成功的表情 |
|
|
|
time: 500 //1秒关闭(如果不配置,默认是3秒) |
|
|
|
}, function () { |
|
|
|
// window.location='/findWareHouseByParentId?parentId=0'+parentId |
|
|
|
// 执行重加载 |
|
|
|
table.reload('currentTableId', { |
|
|
|
url: '/repository/warehouseRecord', |
|
|
|
@ -572,45 +609,14 @@ |
|
|
|
where: {"parentId": parentId} |
|
|
|
}); |
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
} else { // 如果启用 |
|
|
|
$.ajax({ |
|
|
|
url: "/repository/EditDepositoryState", |
|
|
|
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);//失败的表情 |
|
|
|
return; |
|
|
|
} else { |
|
|
|
layer.msg("修改成功", { |
|
|
|
icon: 6,//成功的表情 |
|
|
|
time: 500 //1秒关闭(如果不配置,默认是3秒) |
|
|
|
}, function () { |
|
|
|
// window.location='/findWareHouseByParentId?parentId=0'+parentId |
|
|
|
// 执行重加载 |
|
|
|
table.reload('currentTableId', { |
|
|
|
url: '/repository/warehouseRecord', |
|
|
|
page: { |
|
|
|
curr: 1 |
|
|
|
}, |
|
|
|
where: {"parentId": parentId} |
|
|
|
}); |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
showDetail = function (obj) { |
|
|
|
|