<!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" style="margin-bottom: 0;">
|
<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: 70px;">物品编码</label>
|
<div class="layui-input-inline">
|
<input type="text" id="GoodsCode" onkeyup="this.value=this.value.replace(/[, ]/g,'')" name="GoodsCode" placeholder="物品编码" autocomplete="off"
|
class="layui-input" onkeyup="this.value=this.value.replace(/[, ]/g,'')">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 70px;">物品名称</label>
|
<div class="layui-input-inline">
|
<input type="text" id="GoodsName" onkeyup="this.value=this.value.replace(/[, ]/g,'')" name="GoodsName" placeholder="物品名称" autocomplete="off"
|
class="layui-input" onkeyup="this.value=this.value.replace(/[, ]/g,'')">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 70px;">物品类型</label>
|
<div class="layui-input-inline" >
|
<select name="GoodsModelname" id="GoodsModelname" lay-filter="GoodsModelname"
|
lay-search>
|
<option value=""></option>
|
</select>
|
</div>
|
</div>
|
<!-- <div class="layui-inline">
|
<label class="layui-form-label" style="width: 70px;">存储条件:</label>
|
<div class="layui-input-inline" style="">
|
<select name="GoodsTempname" id="GoodsTempname"
|
lay-filter="GoodsTempname" lay-search>
|
<option value=""></option>
|
</select>
|
</div>
|
</div> -->
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 70px;">所属仓库</label>
|
<div class="layui-input-inline" >
|
<select name="WarehouseName" id="WarehouseName" lay-filter="WarehouseName" lay-search>
|
<option value=""></option>
|
</select>
|
</div>
|
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 70px;">是否免检</label>
|
<div class="layui-input-inline" >
|
<select name="IsMJ" id="IsMJ" lay-filter="IsMJ" lay-search>
|
<option value=""></option>
|
<option value="1">是</option>
|
<option value="0">否</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">
|
<div style="padding-bottom: 5px;display: flex; flex-direction: row-reverse;">
|
<button class="layui-btn layui-btn-sm layuiadmin-btn-list layui-btn-danger" data-type="batchdel" id="approvalBtndel">
|
<i class="layui-icon layui-icon-delete"></i>删除
|
</button>
|
<button type="button" style="margin-right: 10px;" class="layui-btn layui-btn-sm" id="daoru">
|
<i class="layui-icon layui-icon-upload"></i>导入
|
</button>
|
<button class="layui-btn layui-btn-sm layuiadmin-btn-list" data-type="add" id="approvalBtn">
|
<i class="layui-icon"></i>添加
|
</button>
|
|
<button class="layui-btn layui-btn-sm layuiadmin-btn-list layui-hide layui-btn-danger"
|
data-type="hide"><i class="layui-icon"></i>隐藏按钮</button>
|
<!-- <input type="file" style="display: none;" class="layui-btn layuiadmin-btn-import" id="impExcel" multiple="multiple" accept=".xls,.xlsx,.csv" >
|
<button class="layui-btn " onclick="javascript:$('#impExcel').click()"><i class="layui-icon"></i>上传文件</button>-->
|
</div>
|
<table id="LAY-app-content-list" lay-filter="LAY-app-content-list"></table>
|
<script type="text/html" id="buttonTpl">
|
{{# if(d.IsMJ=='1'){ }}
|
是
|
{{# } else { }}
|
否
|
{{# } }}
|
</script>
|
<script type="text/html" id="table-content-list">
|
<a class="approvalBtn layui-btn layui-btn-normal layui-btn-xs" style="display: none;" lay-event="edit"><i
|
class="layui-icon layui-icon-edit"></i>编辑</a>
|
<a class="approvalBtndel layui-btn layui-btn-danger layui-btn-xs" style="display: none;" lay-event="del"><i
|
class="layui-icon layui-icon-delete"></i>删除</a>
|
</script>
|
</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.extend({
|
excel: '../../../layuiadmin/layui/layui_exts/excel' // {/}的意思即代表采用自有路径,即不跟随 base 路径
|
})
|
layui.config({
|
base: '../../../layuiadmin/', //静态资源所在路径
|
//base1:'../../layuiadmin/layui/'
|
}).extend({
|
index: 'lib/index', //主入口模块
|
//excel:'layui_exts/excel'
|
}).use(['index', 'table', 'laypage', 'layer','excel','upload'], function() {
|
var table = layui.table,
|
form = layui.form,
|
laypage = layui.laypage,
|
layer = layui.layer;
|
var user = $.cookie('userId');
|
|
var upload = layui.upload;
|
var list= [
|
|
];
|
//执行实例
|
var uploadInst = upload.render({
|
elem: '#daoru' //绑定元素
|
,url:'' //上传接口
|
,auto:false //是否选完文件后自动上传。如果设定 false,那么需要设置 bindAction 参数来指向一个其它按钮提交上传
|
,exts:'slx|excel|xlsx' //允许上传的文件后缀
|
,accept:'file' //指定允许上传时校验的文件类型
|
,bindAction: '#daoru' //指向一个按钮触发上传
|
,choose: function (obj) {// 选择文件回调
|
console.log(obj);
|
var files = obj.pushFile(); //将每次选择的文件追加到文件队列
|
var fileArr = Object.values(files);// 注意这里的数据需要是数组,所以需要转换一下
|
console.log(fileArr)
|
// 用完就清理掉,避免多次选中相同文件时出现问题
|
for (var index in files) {
|
console.log(index);
|
if (files.hasOwnProperty(index)) {
|
delete files[index];
|
}
|
}
|
uploadExcel(fileArr); // 如果只需要最新选择的文件,可以这样写: uploadExcel([files.pop()])
|
}
|
//,data:list
|
,done: function(res){
|
console.log(res);
|
//上传完毕回调
|
}
|
,error: function(){
|
//请求异常回调
|
}
|
});
|
function uploadExcel(files) {
|
try {
|
|
var excel = layui.excel;
|
excel.importExcel(files, {
|
// 读取数据的同时梳理数据
|
fields: {
|
'GoodsCode' : 'A',
|
'GoodsName' : 'B',
|
'GoodsStandard' : 'C',
|
//'GoodsPackagingname' : 'D',
|
'UnitName' : 'D',
|
'GoodsModelname' : 'E',
|
'GoodsValidityDay' : 'F',
|
'GoodsGenrename' : 'G',
|
'GoodsRemark' : 'H',
|
}
|
},
|
function (data) {
|
console.log(data);
|
// var arr = new Array();
|
for(i = 0; i < data[0].Sheet1.length; i++){
|
var tt = {
|
GoodsCode : data[0].Sheet1[i].GoodsCode,
|
GoodsName: data[0].Sheet1[i].GoodsName,
|
GoodsStandard: data[0].Sheet1[i].GoodsStandard,
|
//GoodsPackagingname: data[0].Sheet1[i].GoodsPackagingname,
|
UnitName: data[0].Sheet1[i].UnitName,
|
GoodsModelname: data[0].Sheet1[i].GoodsModelname,
|
GoodsValidityDay: data[0].Sheet1[i].GoodsValidityDay,
|
GoodsGenrename: data[0].Sheet1[i].GoodsGenrename,
|
GoodsRemark: data[0].Sheet1[i].GoodsRemark,
|
CreateUser:user,
|
};
|
list.push(tt);
|
}
|
console.log(list);
|
sendData(IP + "/BaseGoods/UploadExcel", list, 'post', function(res) {
|
if (res.code == 1) { //成功
|
layer.msg(res.msg, {
|
icon: 1,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
refreshTable("", "", "", "", "");
|
// table.reload('LAY-app-content-list'); //数据刷新
|
layer.close(index); //关闭弹层
|
});
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {});
|
}
|
});
|
// tableIns2.reload({
|
// data:list,
|
// page: {
|
// curr: 1 //重新从第 1 页开始
|
// }
|
// });
|
|
|
});
|
} catch (e) {
|
layer.alert(e.message);
|
}
|
|
}
|
refreshTable("", "", "", "", "");
|
searchlist();
|
|
function searchlist() {
|
var param = {
|
|
};
|
sendData(IP + "/BaseGoods/GetWmsBaseWareHouse", param, 'post', function(res) {
|
if (res.code == 1) { //成功
|
for (var i = 0; i < res.data.length; i++) {
|
$("#WarehouseName").append('<option value =' + res.data[i].WarehouseId + '>' +
|
res
|
.data[i].WarehouseName +
|
'</option>');
|
}
|
|
form.render('select');
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {});
|
}
|
});
|
sendData(IP + "/BaseGoods/GoodsModel", param, 'post', function(res) {
|
if (res.code == 1) { //成功
|
for (var i = 0; i < res.data.length; i++) {
|
$("#GoodsModelname").append('<option value =' + res.data[i].ID + '>' + res
|
.data[i].TypeName +
|
'</option>');
|
}
|
|
form.render('select');
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {});
|
}
|
});
|
sendData(IP + "/BaseGoods/getGoodsTemp", param, 'post', function(res) {
|
if (res.code == 1) { //成功
|
for (var i = 0; i < res.data.length; i++) {
|
$("#GoodsTempname").append('<option value =' + res.data[i].ID + '>' + res
|
.data[i].TypeName +
|
'</option>');
|
}
|
|
form.render('select');
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {});
|
}
|
});
|
};
|
|
function refreshTable(GoodsCode, GoodsName, GoodsModelname, WarehouseName, IsMJ) {
|
var param = {
|
GoodsCode: GoodsCode,
|
GoodsName: GoodsName,
|
GoodsModelname: GoodsModelname,
|
WarehouseName: WarehouseName,
|
IsMJ: IsMJ,
|
|
};
|
// sendData(IP + "/BaseGoods/GetGoodsList", param, 'post', function(res) {
|
// console.log(res);
|
// if (res.code == 1) { //成功
|
// var list = res.data;
|
// $.extend(infoOptions, {
|
// data: list
|
// });
|
// infoOptions.page = {
|
// curr: 1
|
// }
|
// tableIns = table.render(infoOptions);
|
// } else { //不成功
|
// layer.msg('获取物品信息失败!', {
|
// icon: 2,
|
// time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
// }, function() {});
|
// }
|
// });
|
var url = IP + "/BaseGoods/GetGoodsList";
|
// 表单需要的变量
|
table.render({
|
elem: '#LAY-app-content-list',
|
url: url,
|
method: 'POST',
|
height: 'full-130',
|
where: param,
|
contentType: 'application/json',
|
id: 'LAY-app-content-list',
|
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) {
|
console.log(res);
|
if (res.code == 1) { //成功
|
|
for (var k = 0; k < res.data.length; k++) {
|
if (res.data[k].ModuleId == "9b30ff23027f4b79afa1ec69938b0290") {
|
$(function() {
|
console.log(1);
|
$(".approvalBtn").show();
|
});
|
}
|
if (res.data[k].ModuleId == "b7b743b602f34995be72e91a37aaff6d") {
|
$(function() {
|
$(".approvalBtndel").show();
|
console.log(2);
|
});
|
}
|
// else{
|
// $("#approvalBtn").css({"display": "none"});
|
// }
|
}
|
} else { //不成功
|
console.log(3);
|
layer.msg('获取信息失败', {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
//回调
|
});
|
}
|
});
|
},
|
cols: [
|
[{
|
field: 'GoodId',
|
title: 'GoodId',
|
type: 'checkbox',
|
width: 50,
|
align: 'center',
|
fixed: 'left'
|
}, {
|
field: 'GoodsCode',
|
title: '物品编码',
|
width: 120,
|
//sort: true,
|
align: 'center',
|
fixed: 'left'
|
}, {
|
field: 'GoodsName',
|
title: '物品名称',
|
fixed: 'left',
|
align: 'center',
|
width: 200,
|
}, {
|
field: 'GoodsStandard',
|
title: '物品规格',
|
align: 'center',
|
width: 220
|
}, {
|
field: 'GoodsPackagingname',
|
title: '物品包装',
|
align: 'center',
|
width: 220
|
}, {
|
field: 'UnitName',
|
title: '计量单位',
|
align: 'center',
|
width: 100,
|
},
|
{
|
field: 'GoodsModelname',
|
title: '物品类型',
|
align: 'center',
|
width: 120
|
},
|
{
|
field: 'GoodsTempname',
|
title: '储存条件',
|
align: 'center',
|
width: 120
|
},
|
{
|
field: 'WarehouseName',
|
title: '所属仓库',
|
align: 'center',
|
width: 120
|
},
|
// {
|
// field: 'AreaName',
|
// title: '专属区域',
|
// align: 'center',
|
// width: 120
|
// },
|
{
|
field: 'IsMJ',
|
title: '是否免检',
|
templet: '#buttonTpl',
|
align: 'center',
|
width: 100,
|
|
},
|
{
|
field: 'GoodsValidityDay',
|
title: '保质期(天)',
|
align: 'center',
|
width: 120
|
},
|
// {
|
// field: 'GoodsAlarmDay',
|
// title: '提前报警(天)',
|
// align: 'center',
|
// width: 120,
|
// },
|
// {
|
// field: 'GoodsStockHigh',
|
// title: '最高储备',
|
// align: 'center',
|
// width: 100
|
// },
|
{
|
field: 'GoodsStockLow',
|
title: '最低储备',
|
align: 'center',
|
width: 100
|
},
|
{
|
field: 'GoodsGenrename',
|
title: '类别',
|
align: 'center',
|
width: 100
|
},
|
{
|
field: 'GoodsOrigin',
|
title: '来源',
|
align: 'center',
|
width: 100
|
},
|
// {
|
// field: 'ChestCountOfTray',
|
// title: '满托箱数',
|
// align: 'center',
|
// width: 100
|
// }, {
|
// field: 'BigBoxCountOfChest',
|
// title: '满箱盒数(大)',
|
// align: 'center',
|
// width: 120
|
// }, {
|
// field: 'MidBoxCountOfBigBox',
|
// title: '满盒(大)盒数(中)',
|
// align: 'center',
|
// width: 150
|
// }, {
|
// field: 'CountOfMidBox',
|
// title: '满盒(中)支数',
|
// align: 'center',
|
// width: 120
|
// },
|
{
|
field: 'GoodsRemark',
|
title: '备注',
|
align: 'center',
|
width: 200
|
}, {
|
field: 'CreateName',
|
title: '创建人',
|
align: 'center',
|
width: 200
|
},
|
{
|
field: 'CreatTime',
|
title: '创建时间',
|
align: 'center',
|
width: 200,
|
templet: function(d) {
|
return formatDate(d.CreateTime);
|
}
|
},
|
{
|
field: 'UpdateName',
|
title: '修改人',
|
align: 'center',
|
width: 200
|
},
|
{
|
field: 'UpdateTime',
|
title: '修改时间',
|
align: 'center',
|
width: 200,
|
templet: function(d) {
|
return formatDate(d.UpdateTime);
|
}
|
},
|
{
|
title: '操作',
|
fixed: 'right',
|
width: 178,
|
align: 'center',
|
toolbar: '#table-content-list'
|
}
|
|
]
|
],
|
|
});
|
|
}
|
// table.reload()
|
//监听搜索
|
form.on('submit(LAY-app-contlist-search)', function(data) {
|
var GoodsCode = data.field.GoodsCode;
|
var GoodsName = data.field.GoodsName;
|
var GoodsModelname = data.field.GoodsModelname;
|
var WarehouseName = data.field.WarehouseName;
|
var IsMJ = data.field.IsMJ;
|
refreshTable(GoodsCode, GoodsName, GoodsModelname, WarehouseName, IsMJ);
|
});
|
//var $ = layui.$,
|
var doing = true;
|
active = {
|
batchdel: function() {
|
var checkStatus = table.checkStatus('LAY-app-content-list'),
|
checkData = checkStatus.data; //得到选中的数据
|
|
if (checkData.length === 0) {
|
return layer.msg('请选择数据');
|
}
|
|
layer.confirm('确定删除吗?', function(index) {
|
if (doing) {
|
doing = false;
|
|
console.log(checkData);
|
var msg = "";
|
for (var i = 0; i < checkData.length; i++) {
|
msg += checkData[i].GoodId + ',';
|
}
|
msg += '0';
|
var param = {
|
GoodId: msg,
|
CreateUser:$.cookie('userId')
|
};
|
sendData(IP + "/BaseGoods/DelGoods", param, 'post', function(res) {
|
console.log(res);
|
if (res.code == 1) { //成功
|
layer.msg(res.msg, {
|
icon: 1,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
refreshTable($("#Msg").val());
|
doing = true;
|
});
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {doing = true;});
|
}
|
});
|
}
|
});
|
},
|
add: function() {
|
layer.open({
|
type: 2,
|
title: '添加物品信息',
|
content: 'goodslistform.html',
|
maxmin: true,
|
area: ['700px', '650px'],
|
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) {
|
if (doing) {
|
doing = false;
|
|
|
var field = data.field; //获取提交的字
|
console.log(field);
|
//提交 Ajax 成功后,静态更新表格中的数据
|
var param = {
|
GoodId: "",
|
GoodsCode: field.goodsCode,
|
GoodsName: field.goodsName,
|
GoodsStandard: field.goodsStandard,
|
GoodsStockHigh: field.goodsStockHigh,
|
GoodsStockLow: field.goodsStockLow,
|
GoodsValidityDay: field.goodsValidityDay,
|
GoodsAlarmDay: field.goodsAlarmDay,
|
GoodsRemark: field.goodsRemark,
|
GoodsAreaId: field.goodsArea,
|
GoodsUnit: field.goodsUnit,
|
IsMJ: field.IsMJ,
|
ChestCountOfTray: field.ChestCountOfTray,
|
BigBoxCountOfChest: field.BigBoxCountOfChest,
|
MidBoxCountOfBigBox: field.MidBoxCountOfBigBox,
|
CountOfMidBox: field.CountOfMidBox,
|
GoodsDeleteFlag: 0,
|
GoodsPackaging: field.GoodsPackaging,
|
GoodsModel: field.GoodsModel,
|
GoodsTemp: field.GoodsTemp,
|
GoodsGenre: field.GoodsGenre,
|
GoodsWarehouseId: field.GoodsWarehouseId,
|
CreateUser: user, //当前登录人
|
};
|
sendData(IP + "/BaseGoods/AddGoods", param, 'post',
|
function(res) {
|
console.log(res);
|
if (res.code == 1) { //成功
|
layer.msg(res.msg, {
|
icon: 1,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
refreshTable($("#Msg")
|
.val());
|
// table.reload('LAY-app-content-list'); //数据刷新
|
layer.close(index); //关闭弹层
|
doing = true;
|
});
|
} else { //不成功
|
layer.msg(res.msg, {
|
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) : '';
|
});
|
|
|
|
$(function() {
|
$("#approvalBtn").hide();
|
}); $(function() {
|
$("#approvalBtndel").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 == "9b30ff23027f4b79afa1ec69938b0290") {
|
$(function() {
|
|
$("#approvalBtn").show();
|
});
|
}
|
if (res.data[k].ModuleId == "b7b743b602f34995be72e91a37aaff6d") {
|
$(function() {
|
$("#approvalBtndel").show();
|
|
});
|
}
|
// else{
|
// $("#approvalBtn").css({"display": "none"});
|
// }
|
}
|
} else { //不成功
|
layer.msg('获取信息失败', {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
//回调
|
});
|
}
|
});
|
|
var goodid = 0; table.on('tool(LAY-app-content-list)', function(obj) {
|
var data = obj.data;
|
|
if (obj.event === 'del') {
|
layer.confirm('确定删除选中的物品?', function(index) {
|
if (doing) {
|
doing = false;
|
// console.log(data);
|
goodid = data.GoodId;
|
var param = {
|
GoodId: goodid,
|
};
|
sendData(IP + "/BaseGoods/DelGoods", param, 'post', function(res) {
|
console.log(res);
|
if (res.code == 1) { //成功
|
layer.msg(res.msg, {
|
icon: 1,
|
time: 1000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
refreshTable($("#Msg").val());
|
doing = true;
|
});
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {doing = true;});
|
}
|
});
|
}
|
});
|
} else if (obj.event === 'edit') {
|
goodid = data.GoodId;
|
layer.open({
|
type: 2,
|
title: '编辑物品信息',
|
content: 'goodslistform.html?id=' + goodid,
|
maxmin: true,
|
area: ['700px', '650px'],
|
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) {
|
if (doing) {
|
doing = false;
|
|
var field = data.field; //获取提交的字段
|
console.log(field);
|
//提交 Ajax 成功后,静态更新表格中的数据
|
var param = {
|
GoodId: goodid,
|
GoodsCode: field.goodsCode,
|
GoodsName: field.goodsName,
|
GoodsStandard: field.goodsStandard,
|
GoodsStockHigh: field.goodsStockHigh,
|
GoodsStockLow: field.goodsStockLow,
|
GoodsValidityDay: field.goodsValidityDay,
|
GoodsAlarmDay: field.goodsAlarmDay,
|
GoodsRemark: field.goodsRemark,
|
GoodsAreaId: field.goodsArea,
|
GoodsWarehouseId: field.GoodsWarehouseId,
|
GoodsUnit: field.goodsUnit,
|
IsMJ: field.IsMJ,
|
ChestCountOfTray: field.ChestCountOfTray,
|
BigBoxCountOfChest: field.BigBoxCountOfChest,
|
MidBoxCountOfBigBox: field.MidBoxCountOfBigBox,
|
CountOfMidBox: field.CountOfMidBox,
|
GoodsDeleteFlag: 0,
|
GoodsPackaging: field.GoodsPackaging,
|
GoodsModel: field.GoodsModel,
|
GoodsTemp: field.GoodsTemp,
|
GoodsGenre: field.GoodsGenre,
|
CreateUser: user, //当前登录人
|
|
};
|
|
sendData(IP + "/BaseGoods/AddGoods", param, 'post',
|
function(res) {
|
console.log(res);
|
if (res.code == 1) { //成功
|
layer.msg("修改成功", {
|
icon: 1,
|
time: 1000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
refreshTable($("#Msg")
|
.val());
|
// table.reload('LAY-app-content-list'); //数据刷新
|
layer.close(index); //关闭弹层
|
doing = true;
|
});
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {doing = true;});
|
}
|
});
|
}
|
//$.ajax({});
|
});
|
submit.trigger('click');
|
}
|
});
|
}
|
});
|
});
|
</script>
|
</body>
|
</html>
|