<!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">
|
<link rel="stylesheet" href="../../css/public.css" media="all">
|
<style>
|
/* 表格下拉小箭头隐藏 */
|
.layui-table-grid-down {
|
display: none;
|
}
|
</style>
|
<script>
|
// 这里是需要在页面渲染之前执行的代码
|
document.addEventListener("DOMContentLoaded", function() {
|
//获取table默认显示数
|
pageCntFirst();
|
//判断是否开启table列表列宽调整功能。
|
GetIsSetColW();
|
});
|
</script>
|
</head>
|
|
<body id="body">
|
<div class="layui-fluid" style="padding-bottom: 0; ">
|
<div class="layui-card">
|
<div class="layui-form layui-card-header layuiadmin-card-header-auto" id="top">
|
<div class="layui-form-item">
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 60px;">任务号</label>
|
<div class="layui-input-inline">
|
<input type="text" id="TaskNo" name="TaskNo" 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">
|
<select name="Status" id="Status" lay-filter="Status" 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>
|
</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="PalletNo" name="PalletNo" 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="text" id="Msg" name="Msg" 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">
|
<select name="Type" id="Type" lay-filter="Type" 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">
|
<select name="IsSuccess" id="IsSuccess" lay-filter="IsSuccess" lay-search>
|
<option value="-1">请选择</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 id="center"></div>
|
<div class="layui-card-body">
|
<div class="position-relative"><!-- class="position-relative" --><!-- 自定义表头加上 -->
|
<table id="LAY-app-content-list" lay-filter="LAY-app-content-list"></table>
|
<!-- #region 自定义表头 -->
|
<div class="headerSetIcon">
|
<button class="layui-btn layui-btn-primary layui-btn-sm" data-type="customCols">
|
<i class="layui-icon"></i>
|
</button>
|
</div>
|
<!-- #endregion -->
|
|
<!-- #region 自定义表头 -->
|
<script type="text/html" id="templetType">
|
{{# function GetBtn2(d){
|
switch (d.Type) {
|
case "0":
|
return "入库";
|
case "1":
|
return "出库";
|
case "2":
|
return "移库";
|
default:
|
return "";
|
}
|
}
|
}}
|
{{ GetBtn2(d) }}
|
</script>
|
|
<script type="text/html" id="templetIsSuccess">
|
{{# function GetBtn3(d){
|
switch (d.IsSuccess) {
|
case 0:
|
return "否";
|
case 1:
|
return "是";
|
default:
|
return "";
|
}
|
}
|
}}
|
{{ GetBtn3(d) }}
|
</script>
|
|
<script type="text/html" id="templetStatus">
|
{{# function GetBtn4(d){
|
switch (d.Status) {
|
case "0":
|
return `<button class="layui-btn layui-btn-radius layui-btn-xs">等待执行</button>`;
|
case "1":
|
return `<button class="layui-btn layui-btn-radius layui-btn-danger layui-btn-xs">正在执行</button>`;
|
case "2":
|
return `<button class="layui-btn layui-btn-radius layui-btn-normal layui-btn-xs">执行完成</button>`;
|
case "3":
|
return `<button class="layui-btn layui-btn-radius layui-btn-warm layui-btn-xs">异常结束</button>`;
|
case "4":
|
return `<button class="layui-btn layui-btn-radius layui-btn-warm layui-btn-xs">已取消</button>`;
|
default:
|
return "";
|
}
|
}
|
}}
|
{{ GetBtn4(d) }}
|
</script>
|
|
<script type="text/html" id="templetSendDate">
|
{{# function GetBtn5(d){
|
return formatDate(d.SendDate);
|
}
|
}}
|
{{ GetBtn5(d) }}
|
</script>
|
|
<script type="text/html" id="templetBackDate">
|
{{# function GetBtn6(d){
|
return formatDate(d.BackDate);
|
}
|
}}
|
{{ GetBtn6(d) }}
|
</script>
|
|
<script type="text/html" id="templetFinishDate">
|
{{# function GetBtn7(d){
|
return formatDate(d.FinishDate);
|
}
|
}}
|
{{ GetBtn7(d) }}
|
</script>
|
|
<script type="text/html" id="templetCancelDate">
|
{{# function GetBtn8(d){
|
return formatDate(d.CancelDate);
|
}
|
}}
|
{{ GetBtn8(d) }}
|
</script>
|
|
<script type="text/html" id="templetCreateTime">
|
{{# function GetBtn9(d){
|
return formatDate(d.CreateTime);
|
}
|
}}
|
{{ GetBtn9(d) }}
|
</script>
|
<!-- #endregion -->
|
</div>
|
|
<script type="text/html" id="buttonTpl">
|
{{# function GetBtn1(d){
|
var html = '';
|
if(d.IsSend=='1'){
|
html =`<a class="layui-btn layui-btn-xs xiaClass" lay-event="send"><i
|
class="layui-icon layui-icon-ok"></i>下发</a>`;
|
}
|
if(d.IsCancel == "1"){
|
html +=`<a class="layui-btn layui-btn-danger layui-btn-xs quClass" lay-event="cancel"><i
|
class="layui-icon layui-icon-refresh"></i>取消</a>`;
|
}
|
if(d.IsFinish=='1'){
|
html +=`<a class="layui-btn layui-btn-normal layui-btn-xs outClass" lay-event="finish"><i
|
class="layui-icon layui-icon-ok"></i>完成</a>`;
|
}
|
return html;
|
}
|
}}
|
{{ GetBtn1(d) }}
|
</script>
|
</div>
|
</div>
|
</div>
|
<script src="../../layuiadmin/layui/layui.js"></script>
|
<script src="../../js/jquery-3.5.1.min.js"></script>
|
<script src="../../js/jquery.cookie.js"></script>
|
<script src="../../js/public.js"></script>
|
|
<script>
|
var uid = $.cookie('userId');
|
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 h1 = GetTableHeight();
|
console.log(h1);
|
// 表单需要的变量
|
var where = {
|
TaskNo: $("#TaskNo").val(),
|
Type: $("#Type").val(),
|
Status: $("#Status").val(),
|
PalletNo: $("#PalletNo").val(),
|
Msg: $("#Msg").val(),
|
IsSuccess: parseInt($("#IsSuccess").val()),
|
};
|
//渲染表格
|
//#region 原始非自定义列
|
// var tableIns = table.render({
|
// elem: '#LAY-app-content-list',
|
// height: h1,
|
// id: 'LAY-app-content-list',
|
// url: IP + "/BllSo/GetExportTaskList",
|
// 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: 80,
|
// done: function(){
|
// initMenu();
|
// },
|
// cols: [
|
// [{
|
// title: '序号',
|
// type: 'numbers',
|
// width: 60,
|
// fixed: 'left'
|
// }, {
|
// field: 'TaskNo',
|
// title: '任务号',
|
// width: 170,
|
// align: 'center',
|
// fixed: 'left'
|
// }, {
|
// field: 'Type',
|
// title: '任务类型',
|
// width: 95,
|
// align: 'center',
|
// templet: function (d) {
|
// switch (d.Type) {
|
// case "0":
|
// return "入库";
|
// case "1":
|
// return "出库";
|
// case "2":
|
// return "移库";
|
// default:
|
// return "";
|
// }
|
|
// },
|
// }, {
|
// field: 'IsSuccess',
|
// title: '是否下发成功',
|
// width: 120,
|
// align: 'center',
|
// templet: function (d) {
|
// switch (d.IsSuccess) {
|
// case 0:
|
// return "否";
|
// case 1:
|
// return "是";
|
// default:
|
// return "";
|
// }
|
|
// },
|
// }, {
|
// field: 'PalletNo',
|
// title: '托盘号',
|
// width: 110,
|
// align: 'center',
|
// }, {
|
// field: 'StartLocat',
|
// title: '起始位置',
|
// width: 100,
|
// align: 'center',
|
// }, {
|
// field: 'EndLocat',
|
// title: '目标位置',
|
// width: 100,
|
// align: 'center',
|
// }, {
|
// field: 'Status',
|
// title: '状态',
|
// width: 95,
|
// align: 'center',
|
// templet: function (d) {
|
// switch (d.Status) {
|
// case "0":
|
// return `<button class="layui-btn layui-btn-radius layui-btn-xs">等待执行</button>`;
|
// case "1":
|
// return `<button class="layui-btn layui-btn-radius layui-btn-danger layui-btn-xs">正在执行</button>`;
|
// case "2":
|
// return `<button class="layui-btn layui-btn-radius layui-btn-normal layui-btn-xs">执行完成</button>`;
|
// case "3":
|
// return `<button class="layui-btn layui-btn-radius layui-btn-warm layui-btn-xs">异常结束</button>`;
|
// case "4":
|
// return `<button class="layui-btn layui-btn-radius layui-btn-warm layui-btn-xs">已取消</button>`;
|
// default:
|
// return "";
|
// }
|
|
// },
|
// }, {
|
// field: 'Msg',
|
// title: '关键信息',
|
// width: 210,
|
// align: 'center',
|
// }, {
|
// field: 'Information',
|
// title: '异常信息',
|
// minWidth: 100,
|
// align: 'center',
|
// }, {
|
// field: 'SendDate',
|
// title: '发送时间',
|
// width: 165,
|
// align: 'center',
|
// templet: function (d) {
|
// return formatDate(d.SendDate);
|
// },
|
// }, {
|
// field: 'BackDate',
|
// title: '返回时间',
|
// templet: function (d) {
|
// return formatDate(d.BackDate);
|
// },
|
// width: 165,
|
// align: 'center',
|
// }, {
|
// field: 'Sender',
|
// title: '发送方',
|
// width: 80,
|
// align: 'center',
|
// }, {
|
// field: 'Receiver',
|
// title: '接受方',
|
// width: 80,
|
// align: 'center',
|
// }, {
|
// field: 'FinishDate',
|
// title: '完成时间',
|
// width: 165,
|
// align: 'center',
|
// templet: function (d) {
|
// return formatDate(d.FinishDate);
|
// },
|
// }, {
|
// field: 'CancelDate',
|
// title: '取消时间',
|
// width: 165,
|
// align: 'center',
|
// templet: function (d) {
|
// return formatDate(d.CancelDate);
|
// },
|
// }, {
|
// field: 'CreateTime',
|
// title: '创建时间',
|
// width: 160,
|
// align: 'center',
|
// templet: function (d) {
|
// return formatDate(d.CreateTime);
|
// },
|
// }, {
|
// title: '操作',
|
// fixed: 'right',
|
// align: 'center',
|
// width: 205,
|
// toolbar: '#buttonTpl'
|
// }]
|
// ],
|
// })
|
//#endregion
|
|
//#region 自定义表头
|
var tableIns;
|
var TotalColsArr = [[
|
{field: '',title: '序号',type:'numbers',width: 60,align: 'center',fixed: 'left', "disabled": true},
|
{field: 'TaskNo',title: '任务号',width: 170,align: 'center',fixed: 'left', "disabled": true},
|
{field: 'Type',title: '任务类型',width: 95,align: 'center',templet:'#templetType'},
|
{field: 'IsSuccess',title: '是否下发成功',width: 120,align: 'center',templet: '#templetIsSuccess'},
|
{field: 'PalletNo',title: '托盘号',width: 110,align: 'center',},
|
{field: 'StartLocat',title: '起始位置',width: 100,align: 'center'},
|
{field: 'EndLocat',title: '目标位置',width: 100,align: 'center'},
|
{field: 'Status',title: '状态',width: 95,align: 'center',templet: '#templetStatus'},
|
{field: 'Msg',title: '关键信息',width: 210,align: 'center'},
|
{field: 'Information',title: '异常信息',minWidth: 100,align: 'center'},
|
{field: 'SendDate',title: '发送时间',width: 165,align: 'center',templet: '#templetSendDate'},
|
{field: 'BackDate',title: '返回时间',templet: '#templetBackDate',width: 165,align: 'center'},
|
{field: 'Sender',title: '发送方',width: 80,align: 'center'},
|
{field: 'Receiver',title: '接受方',width: 80,align: 'center'},
|
{field: 'FinishDate',title: '完成时间',width: 165,align: 'center',templet:'#templetFinishDate'},
|
{field: 'CancelDate',title: '取消时间',width: 165,align: 'center',templet: '#templetCancelDate'},
|
{field: 'CreateTime',title: '创建时间',width: 160,align: 'center',templet: '#templetCreateTime'},
|
{field: 'caozuo',title: '操作',fixed: 'right',align: 'center',width: 205,toolbar: '#buttonTpl',"disabled": true}
|
]];
|
var TotalColsSysArr=encodeURIComponent(encodeURIComponent(JSON.stringify(TotalColsArr)))//将表头数据进行url编码
|
var colsJson
|
var param1={
|
Href:'BllSo/GetExportTaskList'
|
};
|
sendData(IP + "/Sys/GetTableColsByUserId", param1, 'post', function(res) {
|
if (res.code == 0){
|
if(res.data=='' || res.data==undefined || res.data==null){
|
colsJson=TotalColsArr
|
}else{
|
colsJson= eval(res.data);
|
}
|
}else{
|
colsJson=TotalColsArr
|
}
|
tableIns =table.render({
|
elem: '#LAY-app-content-list',
|
height: h1,
|
id: 'LAY-app-content-list',
|
url: IP + "/BllSo/GetExportTaskList",
|
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: 80,
|
done: function(){
|
initMenu();
|
//自定义列宽
|
SetTableColW('LAY-app-content-list','BllSo/GetExportTaskList',TotalColsSysArr);
|
},
|
cols: colsJson
|
});
|
});
|
//#endregion
|
|
//监听搜索
|
form.on('submit(LAY-app-contlist-search)', function (data) {
|
tableIns.reload({
|
where: { //设定异步数据接口的额外参数,任意设
|
TaskNo: $("#TaskNo").val(),
|
Type: $("#Type").val(),
|
Status: $("#Status").val(),
|
PalletNo: $("#PalletNo").val(),
|
Msg: $("#Msg").val(),
|
IsSuccess: parseInt($("#IsSuccess").val()),
|
},
|
page: {
|
curr: 1 //重新从第 1 页开始
|
}
|
});
|
});
|
//权限
|
function initMenu() {
|
$(function() {
|
$(".xiaClass").hide(); //下发
|
$(".quClass").hide(); //取消
|
$(".outClass").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].ParentNo == "2600")
|
{
|
if (res.data[k].MenuName == "下发") {
|
console.log(res.data[k].MenuName);
|
$(function() {
|
$(".xiaClass").show();
|
});
|
}
|
if (res.data[k].MenuName == "取消") {
|
console.log(res.data[k].MenuName);
|
$(function() {
|
$(".quClass").show();
|
});
|
}
|
if (res.data[k].MenuName == "完成") {
|
console.log(res.data[k].MenuName);
|
$(function() {
|
$(".outClass").show();
|
});
|
}
|
}
|
}
|
} else { //不成功
|
layer.msg('获取权限信息失败', {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {});
|
}
|
});
|
}
|
|
//监听事件操作数据事件
|
table.on('tool(LAY-app-content-list)', function (obj) {
|
var data = obj.data;
|
if (obj.event === 'cancel') {
|
layer.confirm('确定取消选中的出库任务?', function (index) {
|
var param = {
|
taskNo: data.TaskNo
|
};
|
sendData(IP + "/BllSo/ExportCancelTask", param, 'get', function (res) {
|
console.log(res);
|
if (res.code == 0) { //成功
|
layer.msg(res.msg, {
|
icon: 1,
|
time: 1000 //2秒关闭(如果不配置,默认是3秒)
|
}, function () {
|
tableIns.reload({
|
page: {
|
curr: 1
|
}
|
});
|
});
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function () { });
|
}
|
});
|
});
|
} else if (obj.event === 'finish') {
|
layer.confirm('确定完成选中的出库任务?', function (index) {
|
var param = {
|
taskNo: data.TaskNo,
|
};
|
console.log(param)
|
sendData(IP + "/BllSo/ExportFinishTask", param, 'get', function (res) {
|
console.log(res);
|
if (res.code == 0) { //成功
|
layer.msg(res.msg, {
|
icon: 1,
|
time: 1000 //2秒关闭(如果不配置,默认是3秒)
|
}, function () {
|
tableIns.reload({
|
page: {
|
curr: 1
|
}
|
});
|
});
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function () { });
|
}
|
});
|
});
|
} else if (obj.event === 'send') {
|
layer.confirm('确定要下发选中的出库任务?', function (index) {
|
|
var param = {
|
taskNo: data.TaskNo,
|
receiver: data.Receiver
|
};
|
console.log(param)
|
sendData(IP + "/DownApi/AgainSendSoTask", param, 'get', function (res) {
|
console.log(res);
|
if (res.code == 0) { //成功
|
layer.msg(res.msg, {
|
icon: 1,
|
time: 1000 //2秒关闭(如果不配置,默认是3秒)
|
}, function () {
|
refreshTable();
|
});
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function () { });
|
}
|
});
|
});
|
}
|
})
|
|
//#region 自定义表头
|
//自定义表头
|
active = {
|
customCols: function(){
|
layer.open({
|
type: 2,
|
title: '自定义列',
|
content: '../SystemSettings/HeaderSetting.html?Href=BllSo/GetExportTaskList&ColsSysArr='+TotalColsSysArr,
|
maxmin: false,
|
resize: false,
|
area: ['970px', '650px']
|
});
|
}
|
};
|
$('.layui-btn').on('click', function() {
|
var type = $(this).data('type');
|
active[type] ? active[type].call(this) : '';
|
});
|
//#endregion
|
});
|
</script>
|
</body>
|
|
</html>
|