<!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">
|
<div class="layui-form-item">
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 56px;">仓库编码</label>
|
<div class="layui-input-inline">
|
<input type="text" id="WarehouseCode" name="WarehouseCode" placeholder="仓库编码" autocomplete="off"
|
class="layui-input">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 56px;">仓库名称</label>
|
<div class="layui-input-inline">
|
<input type="text" id="WarehouseName" name="WarehouseName" placeholder="仓库名称" autocomplete="off"
|
class="layui-input">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 56px;">仓库类型</label>
|
<div class="layui-input-inline">
|
<select name="WarehouseType" id="WarehouseType" lay-filter="WarehouseType" lay-search>
|
<option value=""></option>
|
</select>
|
</div>
|
</div>
|
<!-- <div class="layui-inline">
|
<label class="layui-form-label" style="width: 56px;">仓库温度</label>
|
<div class="layui-input-inline" style="">
|
<select name="WarehouseTemperature" id="WarehouseTemperature"
|
lay-filter="WarehouseTemperature" lay-search>
|
<option value=""></option>
|
</select>
|
</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">
|
<table id="LAY-app-content-list" lay-filter="LAY-app-content-list"></table>
|
<script type="text/html" id="table-content-list">
|
<a class="layui-btn layui-btn-normal layui-btn-xs approvalBtn" style="display: none;" 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>
|
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;
|
refreshTable("","","");
|
var tableIns;
|
|
function refreshTable(WarehouseCode,WarehouseName, WarehouseType) {
|
var param = {
|
WarehouseCode: WarehouseCode,
|
WarehouseName: WarehouseName,
|
WarehouseType: WarehouseType
|
};
|
var url = IP + "/WarehouseManage/GetWarehouse";
|
|
table.render({
|
elem: '#LAY-app-content-list',
|
url: url,
|
method: 'POST',
|
height: 'full-95',
|
id: 'LAY-app-content-list',
|
where: param,
|
contentType:'application/json',
|
page: true,
|
limit: pageCnt,
|
limits: pageLimits,
|
cellMinWidth: 80, //全局定义常规单元格的最小宽度,layui 2.2.1 新增
|
even:true,
|
done:function(){
|
var param = {
|
Id: $.cookie('userId')
|
}
|
sendData(IP + "/Menu/GetPermission", param, 'post', function(res) {
|
if (res.code == 1) { //成功
|
for (var k = 0; k < res.data.length; k++) {
|
if (res.data[k].ModuleId == "ffc1a121f9e84696bf62fce353037fw7") {
|
$(function() {
|
$(".approvalBtn").show();
|
});
|
}
|
}
|
} else { //不成功
|
layer.msg('获取信息失败', {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
//回调
|
});
|
}
|
});
|
},
|
cols: [
|
[{
|
field: 'WarehouseCode',
|
title: '仓库编码',
|
width: 120,
|
fixed: 'left'
|
}, {
|
field: 'WarehouseName',
|
title: '仓库名称',
|
width: 200,
|
}, {
|
field: 'WarehouseTypeName',
|
title: '仓库类型',
|
width: 120,
|
}, {
|
field: 'CreateUserName',
|
title: '创建人',
|
width: 120,
|
}, {
|
field: 'CreateTime',
|
title: '创建时间',
|
width: 150,
|
templet: function (d) {
|
return formatDate(d.CreateTime);
|
}
|
}, {
|
field: 'UpdateUserName',
|
title: '修改人',
|
width: 120,
|
}, {
|
field: 'UpdateTime',
|
title: '修改时间',
|
width: 150,
|
templet: function (d) {
|
return formatDate(d.UpdateTime) ;
|
}
|
}, {
|
field: 'WarehouseRemark',
|
title: '备注'
|
}, {
|
title: '操作',
|
fixed: 'right',
|
width: 178,
|
align: 'center',
|
toolbar: '#table-content-list'
|
}]
|
]
|
});
|
}
|
|
sendData(IP + "/WarehouseManage/GetWarehouseType", {}, 'post', function(res) {
|
var html = '';
|
console.log(res);
|
if (res.code == 1) { //成功
|
var list = res.data;
|
for (var i = 0; i < list.length; i++) {
|
html += '<option value = "' + list[i].Code + '">' + list[i].TypeName + '</option>';
|
}
|
$("#WarehouseType").append(html);
|
form.render('select');
|
} else { //不成功
|
layer.msg('获取仓库类型信息失败!', {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {});
|
}
|
});
|
|
// sendData(IP + "/WarehouseManage/GetWarehouseTemperature", {}, 'post', function(res) {
|
// var html = '';
|
// console.log(res);
|
// if (res.code == 1) { //成功
|
// var list = res.data;
|
// for (var i = 0; i < list.length; i++) {
|
// html += '<option value = "' + list[i].Code + '">' + list[i].TypeName + '</option>';
|
// }
|
// $("#WarehouseTemperature").append(html);
|
// form.render('select');
|
// } else { //不成功
|
// layer.msg('获取仓库温度信息失败!', {
|
// icon: 2,
|
// time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
// }, function() {});
|
// }
|
// });
|
|
// table.reload()
|
// 表单需要的变量
|
var infoOptions = {
|
elem: '#LAY-app-content-list',
|
height: 'full-200',
|
id: 'LAY-app-content-list',
|
page: true,
|
limit: pageCnt,
|
limits: pageLimits,
|
cellMinWidth: 80, //全局定义常规单元格的最小宽度,layui 2.2.1 新增
|
cols: [
|
[{
|
field: 'WarehouseCode',
|
title: '仓库编码',
|
width: 120,
|
fixed: 'left'
|
}, {
|
field: 'WarehouseName',
|
title: '仓库名称',
|
width: 200,
|
}, {
|
field: 'WarehouseTypeName',
|
title: '仓库类型',
|
width: 120,
|
}, {
|
field: 'WarehouseTemperatureName',
|
title: '仓库温度',
|
width: 120,
|
}, {
|
field: 'WarehouseRemark',
|
title: '备注'
|
}, {
|
title: '操作',
|
fixed: 'right',
|
width: 178,
|
align: 'center',
|
toolbar: '#table-content-list'
|
}]
|
],
|
|
};
|
//监听搜索
|
form.on('submit(LAY-app-contlist-search)', function(data) {
|
var WarehouseCode = data.field.WarehouseCode;
|
var WarehouseName = data.field.WarehouseName;
|
var WarehouseType = data.field.WarehouseType;
|
refreshTable(WarehouseCode,WarehouseName, WarehouseType);
|
});
|
|
var id = 0;
|
table.on('tool(LAY-app-content-list)', function(obj) {
|
var data = obj.data;
|
if (obj.event === 'edit') {
|
id = data.WarehouseId;
|
layer.open({
|
type: 2,
|
title: '编辑仓库信息',
|
content: 'AddWareHouseManage.html?id=' + id,
|
maxmin: true,
|
area: ['550px', '440px'],
|
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(field);
|
//提交 Ajax 成功后,静态更新表格中的数据
|
var param = {
|
WarehouseId: id,
|
WarehouseCode: field.WarehouseCode,
|
WarehouseName: field.WarehouseName,
|
WarehouseType: field.WarehouseType,
|
WarehouseRemark: field.WarehouseRemark,
|
UpdateUser: $.cookie('userId')
|
};
|
sendData(IP + "/WarehouseManage/AddWarehouse", param,
|
'post',
|
function(res) {
|
console.log(res);
|
if (res.code == 1) { //成功
|
layer.msg("修改成功", {
|
icon: 1,
|
time: 1000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
refreshTable($("#WarehouseCode").val(),$("#WarehouseName").val(),$("#WarehouseType").val());
|
layer.close(index); //关闭弹层
|
});
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {});
|
}
|
});
|
//$.ajax({});
|
});
|
submit.trigger('click');
|
}
|
});
|
}
|
});
|
|
|
// $(function() {
|
// $(".approvalBtn").hide();
|
// });
|
var element = layui.element;
|
var houseId = 0;
|
var param = {
|
Id: $.cookie('userId')
|
}
|
var xml = '';
|
|
function getchiled(data, mainId) {
|
if (data) {
|
var list = data.filter(item => item.ParentId == mainId);
|
if (list) {
|
for (var i = 0; i < list.length; i++) {
|
var id = list[i].Id;
|
//查询有无子菜单
|
var count = data.filter(item => item.ParentId == id).length;
|
if (count > 0) {
|
xml = xml +
|
'<dd>' +
|
'<a href="javascript:;">' + list[i].Name + '</a>' +
|
'<dl class="layui-nav-child">';
|
getchiled(data, id);
|
xml = xml +
|
'</dl></dd>';
|
|
} else {
|
xml = xml +
|
'<dd>' +
|
'<a lay-href="' + list[i].Url + '">' + list[i].Name + '</a>' +
|
'</dd>';
|
|
}
|
}
|
|
}
|
|
}
|
}
|
var menuList;
|
sendData(IP + "/Menu/GetPermission", param, 'post', function(res) {
|
if (res.code == 1) { //成功
|
var list = res.data.filter(item => item.Layer == 0);
|
if (list) {
|
for (var i = 0; i < list.length; i++) {
|
xml = xml +
|
'<li class="layui-nav-item">' +
|
'<a href="javascript:;" lay-tips=' + list[i].Icon + ' lay-direction="2">' +
|
// '<i class="layui-icon ' + list[i].Icon + '"></i>' +
|
'<span class="iconfont ' + list[i].Icon + '"></span>' +
|
'<cite>' + list[i].Name + '</cite>' +
|
'</a>';
|
var id = list[i].Id;
|
//查询有无子菜单
|
var count = res.data.filter(item => item.ParentId == id).length;
|
if (count > 0) {
|
xml = xml +
|
'<dl class="layui-nav-child">';
|
getchiled(res.data, id);
|
xml = xml +
|
'</dl>';
|
}
|
xml = xml +
|
'</li>'
|
}
|
}
|
$("#LAY-system-side-menu").append(xml);
|
element.render("#leftmenu");
|
for (var k = 0; k < res.data.length; k++) {
|
if (res.data[k].ModuleId == "ffc1a121f9e84696bf62fce353037fw7") {
|
$(function() {
|
$(".approvalBtn").show();
|
});
|
}
|
}
|
} else { //不成功
|
layer.msg('获取信息失败', {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
//回调
|
});
|
}
|
});
|
});
|
</script>
|
</body>
|
</html>
|