<!DOCTYPE html>
|
<html>
|
<head>
|
<meta charset="utf-8">
|
<title>储位列表信息</title>
|
<meta name="renderer" content="webkit">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
<meta name="viewport"
|
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
<link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
|
<link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
|
</head>
|
<body>
|
|
<div class="layui-fluid" style="padding-bottom: 0;">
|
<div class="layui-card">
|
<div class="layui-form layui-card-header layuiadmin-card-header-auto" style="border-bottom:1px solid #CCC">
|
<div class="layui-form-item">
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 60px;">所属仓库</label>
|
<div class="layui-input-inline">
|
<select name="WareHouseNo" id="WareHouseNo" lay-filter="getWareHouseNo" lay-search>
|
<option value=""></option>
|
</select>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 60px;">所属区域</label>
|
<div class="layui-input-inline">
|
<select name="AreaNo" id="AreaNo" lay-filter="getAreaNo" lay-search>
|
<option value=""></option>
|
</select>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 60px;">所属巷道</label>
|
<div class="layui-input-inline">
|
<select name="RoadwayNo" id="RoadwayNo" lay-filter="getRoadwayNo" lay-search>
|
<option value=""></option>
|
</select>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 60px;">储位状态</label>
|
<div class="layui-input-inline">
|
<select name="Status" id="Status" lay-verify="" lay-search>
|
<option value=""></option>
|
<option value="0">空储位</option>
|
<option value="1">有物品</option>
|
<option value="2">入库中</option>
|
<option value="3">出库中</option>
|
<option value="4">移入中</option>
|
<option value="5">移出中</option>
|
</select>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 60px;">储位标志</label>
|
<div class="layui-input-inline">
|
<select name="Flag" id="Flag" lay-search>
|
<option value=""></option>
|
<option value="0">正常</option>
|
<option value="1">屏蔽</option>
|
<option value="2">损坏</option>
|
</select>
|
</div>
|
</div>
|
<div class="layui-inline" >
|
<label class="layui-form-label" style="width: 60px;">储位编码</label>
|
<div class="layui-input-inline">
|
<input type="text" id="LocatNo" name="LocatNo" placeholder="储位编码···" autocomplete="off"
|
class="layui-input">
|
</div>
|
</div>
|
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 60px;">储排</label>
|
<div class="layui-input-inline">
|
<input type="number" id="Row" onkeyup="this.value=this.value.replace(/[, ]/g,'')" name="Row" placeholder="排···" autocomplete="off"
|
class="layui-input">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 60px;">储列</label>
|
<div class="layui-input-inline">
|
<input type="number" id="Column" onkeyup="this.value=this.value.replace(/[, ]/g,'')" name="Column" placeholder="列···"
|
autocomplete="off" class="layui-input">
|
</div>
|
</div>
|
<div class="layui-inline" >
|
<label class="layui-form-label" style="width: 60px;">储层</label>
|
<div class="layui-input-inline">
|
<input type="number" id="Layer" onkeyup="this.value=this.value.replace(/[, ]/g,'')" name="Layer" placeholder="层···"
|
autocomplete="off" class="layui-input">
|
</div>
|
</div>
|
|
<div class="layui-inline">
|
<button class="layui-btn layui-btn-sm layuiadmin-btn-list" lay-submit
|
lay-filter="LAY-app-contlist-search">
|
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>搜索
|
</button>
|
</div>
|
|
</div>
|
</div>
|
<div class="layui-card-body">
|
<!-- <div style="padding-bottom: 5px; display: flex; flex-direction: row-reverse;">
|
<button style="margin-right: 10px;" class="layui-btn layui-btn-normal layui-btn-sm layuiadmin-btn-list editClass"
|
data-type="add" id="approvalBtn"><i class="layui-icon layui-icon-edit"> </i>编辑</button>
|
</div> -->
|
<table id="LAY-app-content-list" lay-filter="LAY-app-content-list" style="width: 100%;"></table>
|
<script type="text/html" id="table-content-list">
|
<a class="editBtn layui-btn layui-btn-normal layui-btn-xs editClass" lay-event="edit">
|
<i class="layui-icon layui-icon-edit"></i>编辑</a>
|
</script>
|
</div>
|
</div>
|
</div>
|
<script src="../../layuiadmin/layui/layui.js"></script>
|
<script src="../../js/public.js"></script>
|
<script src="../../js/jquery-3.5.1.min.js"></script>
|
<script src="../../js/jquery.cookie.js"></script>
|
<script>
|
var uid = $.cookie('token');
|
if (uid == null) {
|
alert('登录失效,请重新登录后操作');
|
window.parent.location.href = '../Login.html'
|
}
|
layui.config({
|
base: '../../layuiadmin/' //静态资源所在路径
|
}).extend({
|
index: 'lib/index' //主入口模块
|
}).use(['index', 'table', 'laypage', 'layer'], function() {
|
var table = layui.table,
|
form = layui.form,
|
laypage = layui.laypage,
|
layer = layui.layer,
|
$ = layui.$;
|
var houseid = 0;
|
// 表单需要的变量
|
var doing = true;
|
active = {
|
|
add: function () {
|
var checkStatus = table.checkStatus('LAY-app-content-list'),
|
checkData = checkStatus.data; //得到选中的数据
|
if (checkData.length === 0) {
|
return layer.msg('请选择数据');
|
}
|
layer.open({
|
type: 2,
|
title: '修改储位信息集合',
|
content: 'LocateFrom.html',
|
maxmin: true,
|
area: ['40%', '65%'],
|
btn: ['确定', '取消'],
|
yes: function (index, layero) {
|
var iframeWindow = window['layui-layer-iframe' + index],
|
submitID = 'layuiadmin-app-form-submit',
|
submit = layero.find('iframe').contents().find('#' + submitID);
|
//监听提交
|
iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
|
var field = data.field; //获取提交的字段
|
console.log(field);
|
var msg = [];
|
for (var i = 0; i < checkData.length; i++) {
|
// msg.push(checkData[i].Id);
|
msg.push(checkData[i].Id)
|
}
|
console.log(msg);
|
|
//提交 Ajax 成功后,静态更新表格中的数据
|
var param = {
|
Id: msg,
|
Status:field.Status,
|
Flag:field.Flag,
|
};
|
if (doing) {
|
doing = false;
|
sendData(IP + "/Sys/EditStorageLocatList", param, 'post', function (res) {
|
console.log(res);
|
if (res.code == 0) { //成功
|
layer.msg(res.msg, {
|
icon: 1,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function () {
|
tableIns.reload({
|
page: {
|
curr: 1
|
}
|
});
|
layer.close(index); //关闭弹层
|
doing = true;
|
});
|
} else if(res.code == 1){
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {doing = true;});
|
} else { //不成功
|
layer.msg(res.statusText, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {doing = true;});
|
}
|
});
|
}
|
|
//$.ajax({});
|
});
|
submit.trigger('click');
|
}
|
});
|
}
|
};
|
$('.layui-btn.layuiadmin-btn-list').on('click', function () {
|
var type = $(this).data('type');
|
active[type] ? active[type].call(this) : '';
|
});
|
var where = {
|
HouseNo: $("#WareHouseNo").val(),
|
RoadwayNo: $("#RoadwayNo").val(),
|
AreaNo: $("#AreaNo").val(),
|
Status: $("#Status").val(),
|
Flag: $("#Flag").val(),
|
Locat: $("#LocatNo").val(),
|
Row: parseInt($("#Row").val()),
|
Col: parseInt($("#Column").val()),
|
Layer: parseInt($("#Layer").val()),
|
};
|
console.log(where);
|
var tableIns = table.render({
|
elem: '#LAY-app-content-list',
|
height: 'full-173',
|
id: 'LAY-app-content-list',
|
url: IP + "/Sys/GetStorageLocatList",
|
method: 'post',
|
where: where,
|
contentType: 'application/json',
|
headers:{ToKen:$.cookie('token')},
|
page: true,
|
even: true,
|
limit: pageCnt, //默认多少页
|
limits: pageLimits, //默认数组[10,20,30,40,50]
|
cellMinWidth: 70,
|
done: function() {
|
$(function() {
|
$(".editClass").hide();
|
});
|
sendData(IP + "/Basis/GetRoleRightList", {}, 'get', function(res) {
|
if (res.code == 0) { //成功
|
for (var k = 0; k < res.data.length; k++) {
|
if (res.data[k].MenuName == "编辑储位") {
|
$(function() {
|
$(".editClass").show();
|
});
|
}
|
}
|
} else { //不成功
|
layer.msg('获取权限信息失败', {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {});
|
}
|
});
|
},
|
cols: [
|
[ {
|
title: '序号',
|
type: 'checkbox',
|
width: 65,
|
fixed: 'left'
|
},{
|
title: '序号',
|
type: 'numbers',
|
width: 65,
|
fixed: 'left'
|
}, {
|
field: 'WareHouseName',
|
title: '所属仓库',
|
align: 'center',
|
width: 140,
|
fixed: 'left'
|
}, {
|
field: 'RoadwayNo',
|
title: '所属巷道',
|
align: 'center',
|
width: 130,
|
}, {
|
field: 'AreaName',
|
title: '所属区域',
|
align: 'center',
|
width: 130,
|
}, {
|
field: 'LocatNo',
|
title: '储位编码',
|
align: 'center',
|
}, {
|
field: 'StatusName',
|
title: '储位状态',
|
align: 'center',
|
width: 140,
|
}, {
|
field: 'FlagName',
|
title: '储位标识',
|
align: 'center',
|
width: 90,
|
}, {
|
field: 'Row',
|
title: '排',
|
align: 'center',
|
width: 70,
|
}, {
|
field: 'Column',
|
title: '列',
|
align: 'center',
|
width: 70,
|
}, {
|
field: 'Layer',
|
title: '层',
|
align: 'center',
|
width: 70,
|
}, {
|
field: 'Depth',
|
title: '深度',
|
align: 'center',
|
width: 70,
|
}, {
|
field: 'Height',
|
title: '高度',
|
align: 'center',
|
width: 90,
|
}, {
|
field: 'Weight',
|
title: '重量',
|
align: 'center',
|
width: 90,
|
}, {
|
field: 'TempName',
|
title: '存储坏境',
|
align: 'center',
|
width: 110,
|
}, {
|
title: '操作',
|
fixed: 'right',
|
width: 120,
|
align: 'center',
|
toolbar: '#table-content-list'
|
}
|
]
|
],
|
})
|
//监听搜索
|
form.on('submit(LAY-app-contlist-search)', function(data) {
|
tableIns.reload({
|
where: { //设定异步数据接口的额外参数,任意设
|
HouseNo: $("#WareHouseNo").val(),
|
RoadwayNo: $("#RoadwayNo").val(),
|
AreaNo: $("#AreaNo").val(),
|
Status: $("#Status").val(),
|
Flag: $("#Flag").val(),
|
Locat: $("#LocatNo").val(),
|
Row: parseInt($("#Row").val()),
|
Col: parseInt($("#Column").val()),
|
Layer: parseInt($("#Layer").val()),
|
},
|
page: {
|
curr: 1 //重新从第 1 页开始
|
}
|
});
|
});
|
|
table.on('tool(LAY-app-content-list)', function(obj) {
|
var data = obj.data;
|
var id = 0;
|
if (obj.event === 'edit') {
|
id = data.Id;
|
layer.open({
|
type: 2,
|
title: '储位信息管理',
|
content: 'LocateFrom.html?id=' + id,
|
maxmin: true,
|
area: ['40%', '65%'],
|
btn: ['确定', '取消'],
|
yes: function(index, layero) {
|
var iframeWindow = window['layui-layer-iframe' + index],
|
submitID = 'layuiadmin-app-form-edit',
|
submit = layero.find('iframe').contents().find('#' + submitID);
|
//监听提交
|
iframeWindow.layui.form.on('submit(' + submitID + ')', function(data) {
|
|
var field = data.field; //获取提交的字段
|
console.log(data)
|
//提交 Ajax 成功后,静态更新表格中的数据
|
var param = {
|
Id: id,
|
Status:field.Status,
|
Flag:field.Flag,
|
Temperature:field.Temp
|
};
|
sendData(IP + "/Sys/EditStorageLocat", param, 'post', function(res) {
|
console.log(res);
|
if (res.code == 0) { //成功
|
layer.msg("修改成功", {
|
icon: 1,
|
time: 1000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
tableIns.reload({
|
page: {
|
curr: 1
|
}
|
});
|
layer.close(index); //关闭弹层
|
});
|
} else if(res.code == 1){
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {});
|
} else { //不成功
|
layer.msg(res.statusText, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {});
|
}
|
});
|
});
|
submit.trigger('click');
|
}
|
});
|
}
|
});
|
|
//获取仓库下拉框信息
|
sendData(IP + "/Sys/GetWarehouseDic", {}, 'get', function(res) {
|
if (res.code == 0) { //成功
|
for (var i = 0; i < res.data.length; i++) {
|
$("#WareHouseNo").append('<option value =' + res.data[i].WareHouseNo + '>' +
|
res.data[i].WareHouseName + '</option>');
|
}
|
form.render('select');
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {});
|
}
|
});
|
|
getAR("");
|
form.on('select(getWareHouseNo)', function(data) {
|
console.log(data);
|
getAR(data.value);
|
});
|
function getAR(val) {
|
//获取 巷道下拉框
|
sendData(IP + "/Sys/GetStorageRoadwayByHouseNo?wareHouseNo="+val, {}, 'get', function(res) {
|
$("#RoadwayNo").empty();
|
$("#RoadwayNo").append('<option value =""></option>');
|
if (res.code == 0) { //成功
|
for (var i = 0; i < res.data.length; i++) {
|
$("#RoadwayNo").append('<option value =' + res.data[i].RoadwayNo + '>' +
|
res.data[i].RoadwayName + '</option>');
|
}
|
form.render('select');
|
} else { //不成功
|
layer.msg('获取巷道信息失败', {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
//回调
|
form.render('select');
|
});
|
}
|
});
|
//获取 区域下拉框
|
sendData(IP + "/Sys/GetStorageAreaByHouseNo?wareHouseNo="+val, {}, 'get', function(res) {
|
$("#AreaNo").empty();
|
$("#AreaNo").append('<option value =""></option>');
|
if (res.code == 0) { //成功
|
for (var i = 0; i < res.data.length; i++) {
|
$("#AreaNo").append('<option value =' + res.data[i].AreaNo + '>' +
|
res.data[i].AreaName + '</option>');
|
}
|
form.render('select');
|
} else { //不成功
|
layer.msg('获取区域信息失败', {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
//回调
|
form.render('select');
|
});
|
}
|
});
|
|
};
|
|
});
|
|
|
</script>
|
</body>
|
</html>
|