var layer;
|
var timer;
|
var table;
|
var limit = 200;
|
$(function () {
|
layui.use(['layer', 'laydate', 'table'], function () {
|
layer = layui.layer;
|
table = layui.table;
|
|
//页面初始化刷新页面
|
flushData();
|
|
// 每间隔1分钟执行一次刷新
|
if (timer) clearInterval(timer);
|
timer = setInterval(function () {
|
flushData();
|
}, 60 * 1000);
|
|
});
|
});
|
|
function flushData() {
|
var param = {
|
deptId: deptId,
|
type: type
|
};
|
$.ajax({
|
type: "POST",
|
url: "../../basic/inout/list-progress",
|
dataType: "json",
|
contentType: "application/json;charset=UTF-8",
|
data: JSON.stringify(param),
|
success: function (result) {
|
if (result.code != "0000") {
|
layer.msg(result.msg);
|
} else {
|
renderTable(result.data);
|
}
|
},
|
error: function () {
|
layer.msg("系统获取数据出现异常,重新尝试");
|
}
|
});
|
}
|
|
function renderTable(data) {
|
var listProgress = data.listProgress;
|
var listComplete = data.listComplete;
|
|
renderInoutList(listProgress);
|
|
renderCompleteInoutList(listComplete);
|
}
|
|
// 渲染出入库列表数据
|
function renderInoutList(list) {
|
if (list.length == 0) {
|
return;
|
}
|
// 清空数据
|
$("#inoutList").empty();
|
table.render({
|
elem: '#inoutList',
|
limit: limit,
|
even: true,
|
width: 952,
|
cols: [[
|
{field: 'id', title: '单据号', width: '18%'},
|
{
|
field: 'type', title: '类型', width: '15%', templet: function (d) {
|
return ("IN" == d.type) ? "入库" : "出库"
|
}
|
},
|
{field: 'userName', title: '承运人', width: '16%'},
|
{field: 'plateNum', title: '车牌号', width: '16%'},
|
{
|
field: 'progress', title: '当前流程', width: '16%', templet: function (d) {
|
return mapProgress[d.progress]
|
}
|
},
|
{
|
field: 'depotId', title: '装卸仓库', width: '19%', templet: function (d) {
|
return (null == d.depotId) ? "" : mapDept[d.depotId]
|
}
|
}
|
]],
|
data: list
|
});
|
|
$("thead tr").css({
|
"border-bottom": "2px solid #53adce",
|
"background": "#eff4f6",
|
});
|
};
|
|
// 完成列表
|
function renderCompleteInoutList(list) {
|
if (list.length == 0) {
|
return;
|
}
|
// 清空数据
|
$("#inoutCompleteList").empty();
|
table.render({
|
elem: '#inoutCompleteList',
|
limit: limit,
|
even: true,
|
width: 952,
|
cols: [[
|
{field: 'id', title: '单据号', width: '18%'},
|
{
|
field: 'type', title: '类型', width: '15%', templet: function (d) {
|
return ("IN" == d.type) ? "入库" : "出库"
|
}
|
},
|
{field: 'userName', title: '承运人', width: '16%'},
|
{field: 'plateNum', title: '车牌号', width: '16%'},
|
{
|
field: 'depotId', title: '装卸仓库', width: '16%', templet: function (d) {
|
return (null == d.depotId) ? "" : mapDept[d.depotId]
|
}
|
},
|
{
|
field: 'completeTime', title: '完成时间', width: '19%', templet: function (d) {
|
return (null == d.completeTime) ? "" : d.completeTime
|
}
|
}
|
]],
|
data: list
|
});
|
$("thead tr").css({
|
"border-bottom": "2px solid #53adce",
|
"background": "#eff4f6",
|
});
|
};
|