<!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">
|
<!-- style="width: 80%;padding-top: 40px;" -->
|
<label class="layui-form-label">单据编码</label>
|
<div class="layui-input-inline">
|
<input type="text" id="BillTypeCode" onkeyup="this.value=this.value.replace(/[, ]/g,'')" name="BillTypeCode" placeholder="单据类型编码"
|
autocomplete="off" class="layui-input">
|
</div>
|
<label class="layui-form-label">单据名称</label>
|
<div class="layui-input-inline">
|
<input type="text" id="BillTypeName" onkeyup="this.value=this.value.replace(/[, ]/g,'')" name="BillTypeName" placeholder="单据类型名称"
|
autocomplete="off" class="layui-input">
|
</div>
|
|
<label class="layui-form-label">单据类别</label>
|
<div class="layui-input-inline">
|
|
<select name="BillTypeType" id="BillTypeType">
|
<option value=""></option>
|
<option value="1">入库</option>
|
<option value="2">出库</option>
|
</select>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<!-- style="padding-top: 40px;" -->
|
<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 style="margin-right: 10px;" 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>
|
</div>
|
<table id="LAY-app-content-list" lay-filter="LAY-app-content-list"></table>
|
<script type="text/html" id="buttonTpl">
|
{{# if(d.BillTypeType=='1'){ }}
|
<button class="layui-btn layui-btn-radius layui-btn-xs">入库</button>
|
{{# } else { }}
|
<button class="layui-btn layui-btn-radius layui-btn-normal layui-btn-xs">出库</button>
|
{{# } }}
|
</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>
|
</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 url = IP + "/BillType/GetBillTypeList"
|
//var tableIns;
|
var where = {
|
BillTypeCode: $("#BillTypeCode").val(),
|
BillTypeName: $("#BillTypeName").val(),
|
BillTypeType: $("#BillTypeName").val() == "" ? 0 : $("#BillTypeName").val()
|
}
|
var tableIns = table.render({
|
elem: '#LAY-app-content-list',
|
height: 'full-130',
|
id: 'LAY-app-content-list',
|
url: url,
|
method: 'post',
|
where: where,
|
contentType: 'application/json',
|
page: true,
|
limit: pageCnt,
|
limits: pageLimits,
|
cellMinWidth: 80, //全局定义常规单元格的最小宽度,layui 2.2.1 新增
|
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 == "c3d5bb31490446d4be6d91352174904f") {
|
$(function() {
|
$(".approvalBtn").show();
|
});
|
}
|
if (res.data[k].ModuleId == "a59678bd5bf0407383d79b3ca9bbf4e6") {
|
$(function() {
|
$(".approvalBtndel").show();
|
});
|
}
|
// else{
|
// $("#approvalBtn").css({"display": "none"});
|
// }
|
}
|
} else { //不成功
|
layer.msg('获取信息失败', {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
//回调
|
});
|
}
|
});
|
},
|
cols: [
|
[{
|
field: 'Id',
|
title: 'Id',
|
type: 'checkbox',
|
width: 80,
|
sort: true,
|
fixed: 'left',
|
align: 'center',
|
}, {
|
field: 'BillTypeCode',
|
title: '单据编码',
|
width: 200,
|
fixed: 'left',
|
align: 'center',
|
}, {
|
field: 'BillTypeName',
|
title: '单据名称',
|
width: 220,
|
align: 'center',
|
}, {
|
field: 'BillTypeType',
|
templet: '#buttonTpl',
|
title: '单据类别',
|
width: 220,
|
align: 'center',
|
}, {
|
field: 'WarehouseName',
|
title: '仓库名称',
|
width: 220,
|
align: 'center',
|
}, {
|
field: 'BillTypeRemark',
|
title: '备注',
|
align: 'center',
|
}, {
|
title: '操作',
|
fixed: 'right',
|
width: 220,
|
align: 'center',
|
toolbar: '#table-content-list'
|
}]
|
],
|
|
})
|
// function refreshTable(msg,BillTypeCode,BillTypeName,BillTypeType) {
|
// var param = {
|
// msg: msg,
|
// BillTypeCode:BillTypeCode,
|
// BillTypeName:BillTypeName,
|
// status:0,
|
// BillTypeType:BillTypeType==""?0:BillTypeType
|
// };
|
// sendData(IP + "/Base/GetBillTypeList", 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(res.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: 'Id',
|
// title: 'Id',
|
// type: 'checkbox',
|
// width: 50,
|
// sort: true,
|
// fixed: 'left'
|
// }, {
|
// field: 'BillTypeCode',
|
// title: '单据类型编码',
|
// width: 120,
|
// fixed: 'left'
|
// }, {
|
// field: 'BillTypeName',
|
// title: '单据类型名称',
|
// width: 200,
|
// }, {
|
// field: 'BillTypeType',
|
// templet: '#buttonTpl',
|
// title: '单据类型类别',
|
// width: 180
|
// }, {
|
// field: 'BillTypeRemark',
|
// title: '备注'
|
// }, {
|
// title: '操作',
|
// fixed: 'right',
|
// width: 178,
|
// align: 'center',
|
// toolbar: '#table-content-list'
|
// }]
|
// ],
|
|
// };
|
//监听搜索
|
form.on('submit(LAY-app-contlist-search)', function(data) {
|
//msg = data.field.Msg;
|
//BillTypeCode=data.field.BillTypeCode;
|
//BillTypeName=data.field.BillTypeName;
|
//BillTypeType=data.field.BillTypeType;
|
tableIns.reload({
|
where: {
|
BillTypeCode: $("#BillTypeCode").val(),
|
BillTypeName: $("#BillTypeName").val(),
|
BillTypeType: $("#BillTypeType").val() == "" ? 0 : $("#BillTypeType").val()
|
},
|
page: {
|
curr: 1, //重新从第一页开始
|
|
}
|
})
|
//refreshTable(msg,BillTypeCode,BillTypeName,BillTypeType);
|
});
|
//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].Id + ',';
|
}
|
msg += '0';
|
var param = {
|
msg: msg
|
};
|
sendData(IP + "/BillType/DelBillType", 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());
|
tableIns.reload({
|
where: { //设定异步数据接口的额外参数,任意设
|
Code: $(
|
"#ComCode")
|
.val(),
|
Name: $(
|
"#ComName")
|
.val(),
|
},
|
page: {
|
curr: 1
|
}
|
});
|
layer.close(index); //关闭弹层
|
doing = true;
|
});
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {doing = true;});
|
}
|
});
|
}
|
});
|
},
|
add: function() {
|
console.log
|
layer.open({
|
type: 2,
|
title: '添加单据类型信息',
|
content: 'billtypelistform.html',
|
maxmin: true,
|
area: ['550px', '520px'],
|
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 = {
|
Id: '',
|
BillTypeCode: field.BillTypeCode,
|
BillTypeName: field.BillTypeName,
|
BillTypeType: field.BillTypeType,
|
BillTypeRemark: field.BillTypeRemark,
|
WarehouseId:field.Warehouse
|
};
|
sendData(IP + "/BillType/AddBillType", param, 'post',
|
function(res) {
|
console.log(res);
|
if (res.code == 1) { //成功
|
layer.msg(res.msg, {
|
icon: 1,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
tableIns.reload({
|
where: { //设定异步数据接口的额外参数,任意设
|
Code: $(
|
"#ComCode"
|
)
|
.val(),
|
Name: $(
|
"#ComName"
|
)
|
.val(),
|
},
|
page: {
|
curr: 1
|
}
|
});
|
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 == "c3d5bb31490446d4be6d91352174904f") {
|
$(function() {
|
$("#approvalBtn").show();
|
});
|
}
|
if (res.data[k].ModuleId == "a59678bd5bf0407383d79b3ca9bbf4e6") {
|
$(function() {
|
$("#approvalBtndel").show();
|
});
|
}
|
// else{
|
// $("#approvalBtn").css({"display": "none"});
|
// }
|
}
|
} else { //不成功
|
layer.msg('获取信息失败', {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
//回调
|
});
|
}
|
});
|
var cusid = 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;
|
|
cusid = data.Id;
|
var param = {
|
msg: cusid,
|
};
|
sendData(IP + "/BillType/DelBillType", param, 'post', function(res) {
|
console.log(res);
|
if (res.code == 1) { //成功
|
layer.msg(res.msg, {
|
icon: 1,
|
time: 1000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
tableIns.reload({
|
where: { //设定异步数据接口的额外参数,任意设
|
Code: $(
|
"#ComCode")
|
.val(),
|
Name: $(
|
"#ComName")
|
.val(),
|
},
|
page: {
|
curr: 1
|
}
|
});
|
layer.close(index); //关闭弹层
|
doing = true;
|
});
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {doing = true;});
|
}
|
});
|
}
|
});
|
} else if (obj.event === 'edit') {
|
cusId = data.Id;
|
layer.open({
|
type: 2,
|
title: '编辑单据类型信息',
|
content: 'billtypelistform.html?id=' + cusId,
|
maxmin: true,
|
area: ['550px', '500px'],
|
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 = {
|
Id: cusId,
|
BillTypeCode: field.BillTypeCode,
|
BillTypeName: field.BillTypeName,
|
BillTypeType: field.BillTypeType,
|
BillTypeRemark: field.BillTypeRemark,
|
WarehouseId:field.Warehouse
|
};
|
sendData(IP + "/BillType/AddBillType", param, 'post',
|
function(res) {
|
console.log(res);
|
if (res.code == 1) { //成功
|
layer.msg("修改成功", {
|
icon: 1,
|
time: 1000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
tableIns.reload({
|
where: { //设定异步数据接口的额外参数,任意设
|
Code: $(
|
"#ComCode"
|
)
|
.val(),
|
Name: $(
|
"#ComName"
|
)
|
.val(),
|
},
|
page: {
|
curr: 1
|
}
|
});
|
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>
|