<!DOCTYPE html>
|
<html lang="zh-cn" xmlns:th=http://www.thymeleaf.org>
|
<head>
|
<meta charset="utf-8">
|
<title>Layui</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, maximum-scale=1">
|
<link rel="stylesheet"
|
th:href="@{../../static/plugins/layui/css/layui.css}">
|
|
|
<style>
|
body {
|
font-family: "微软雅黑", Arial, sans-serif;
|
font-size: 14px;
|
background: #f3f5f8;
|
}
|
|
table {
|
overflow-x: hidden;
|
}
|
|
.progress {
|
padding: 15px;
|
}
|
|
.progress-r {
|
padding-left: 15px;
|
}
|
|
.progress-r span {
|
font-size: 16px;
|
font-weight: bold;
|
}
|
|
.layui-progress {
|
background-color: #666;
|
}
|
|
.layui-table {
|
color: #0C0C0C;
|
}
|
|
.layui-table thead tr {
|
border-bottom: 3px solid #53adce;
|
}
|
|
.layui-table thead th {
|
font-weight: bold;
|
}
|
|
.remark {
|
padding: 0px 15px 0px 15px;
|
height: 22px;
|
line-height: 22px;
|
color: #FF5722;
|
font-size: 12px;
|
font-weight: bold;
|
float: left;
|
}
|
|
.btn-clean {
|
background-color: #FF5722;
|
color: #FFF;
|
}
|
|
.s-error {
|
font-weight: bold;
|
color: #FF5722;
|
}
|
|
.s-complete {
|
font-weight: bold;
|
color: #5FB878;
|
}
|
|
.s-none {
|
font-weight: bold;
|
}
|
</style>
|
</head>
|
|
<body>
|
<div class="layui-clear">
|
|
<div class="layui-row progress">
|
|
<div class="layui-col-md6">
|
<div class="layui-progress layui-progress-big"
|
lay-filter="filter-progress" lay-showpercent="yes">
|
<div class="layui-progress-bar" lay-percent="0%"
|
id="filter-progress"></div>
|
</div>
|
</div>
|
|
<div class="layui-col-md6">
|
<div class="progress-r">
|
共执行命令:<span id="check_sumNum">0</span>个
|
已执行:<span id="check_completeNum">0</span>个
|
失败:<span id="check_errorNum">0</span>个
|
</div>
|
</div>
|
|
</div>
|
|
<div class="layui-row">
|
<table class="layui-hide" id="tableOrder"
|
lay-data="{id: 'tableOrder'}"></table>
|
</div>
|
|
<div class="layui-row">
|
<span class="remark">注:数据为当前库区近8个小时内执行记录和统计,可以清除,不影响执行日志</span>
|
<button type="button"
|
class="layui-btn layui-btn-primary btn-clean layui-btn-xs"
|
onclick="clean()">点击清除</button>
|
|
<button type="button"
|
class="layui-btn layui-btn-primary btn-clean layui-btn-xs"
|
id="btn-auto" onclick="autoFlush()">自动刷新中</button>
|
</div>
|
|
</div>
|
|
<script th:src="@{../../static/plugins/layui/layui.js}"></script>
|
<script th:src="@{../../static/js/jquery.min.js}"></script>
|
<script th:inline="javascript">
|
//业务类型
|
var bizType = [[${bizType}]];
|
//userId
|
var userId = [[${loginUser.username}]];
|
var companyId = [[${loginUser.companyId}]];
|
var deptId = [[${deptId}]];//当前人所在部门ID
|
|
var orderList;
|
|
var autoTag = true;
|
|
var table;
|
var element;
|
|
layui.use(['table', 'element'], function () {
|
table = layui.table;
|
element = layui.element;
|
table.render({
|
elem: '#tableOrder',
|
url: '../../basic/grain/query-order-list?deptId=' + deptId,
|
width: 980,
|
height: 460,
|
cols: [[
|
{field: 'exeTime', width: 150, title: '执行时间', sort: true, align: 'center'},
|
{field: 'depotName', width: 150, title: '所属仓库', sort: true, align: 'center'},
|
{field: 'exeUser', width: 130, title: '检测人', align: 'center'},
|
{
|
field: 'status', width: 120, title: '执行状态', align: 'center', templet: function (d) {
|
if ('IN_PROGRESS' == d.status) {
|
return "<span class='s-none'>执行中</span>";
|
} else if ('SEND_ERROR' == d.status) {
|
return "<span class='s-error'>发送失败</span>";
|
} else if ('ANALYSIS_ERROR' == d.status) {
|
return "<span class='s-error'>解析失败</span>";
|
} else if ("TIMEOUT_ERROR" == d.status) {
|
return "<span class='s-error'>处理超时</span>";
|
} else {
|
return "<span class='s-complete'>成功完成</span>";
|
}
|
}
|
},
|
{field: 'msg', title: '执行说明', align: 'center'}
|
]],
|
page: false,
|
done: function (res, cuur, count) {
|
orderList = res.data;
|
exeProgress();
|
}
|
});
|
});
|
|
function exeProgress() {
|
//console.log("--------------exeProgress----------------");
|
//console.log(orderList);
|
var sumNum = 0, completeNum = 0, errorNum = 0, per = 0;
|
if (orderList) {
|
$.each(orderList, function (index, data) {
|
sumNum = orderList.length;
|
if ("SEND_ERROR" == data.status || "ANALYSIS_ERROR" == data.status || "TIMEOUT_ERROR" == data.status) {
|
completeNum++;
|
errorNum++;
|
}
|
if ("COMPLETE" == data.status) {
|
completeNum++;
|
}
|
});
|
}
|
|
if (sumNum > 0) {
|
per = (completeNum / sumNum * 100).toFixed(1);
|
}
|
// console.log("-------per------"+per);
|
element.progress('filter-progress', per + "%");
|
//赋值
|
$("#check_sumNum").text(sumNum);
|
$("#check_completeNum").text(completeNum);
|
$("#check_errorNum").text(errorNum);
|
}
|
|
/**
|
*清除日志
|
*/
|
function clean() {
|
var data = {
|
deptId: deptId,
|
companyId: companyId,
|
bizType: bizType
|
};
|
$.ajax({
|
type: "POST",
|
url: "../../basic/grain/clean-order-list",
|
dataType: "json",
|
contentType: "application/json;charset=UTF-8",
|
data: JSON.stringify(data),
|
success: function (result) {
|
if (result.code != "0000") {
|
layer.alert(result.data);
|
} else {
|
layer.msg("日志清除完成!");
|
}
|
},
|
error: function () {
|
layer.alert("系统后台执行失败,请刷新重试!");
|
}
|
});
|
}
|
|
|
|
|
function autoFlush() {
|
if (autoTag) {
|
autoTag = false;
|
$("#btn-auto").text("已停止刷新");
|
} else {
|
autoTag = true;
|
$("#btn-auto").text("自动刷新中");
|
}
|
}
|
|
|
//设置自动刷新
|
var iframeTimer;
|
window.onload = function () {
|
if (iframeTimer) {
|
clearInterval(iframeTimer);
|
}
|
iframeTimer = setInterval(function () {
|
if (autoTag) {
|
table.reload("tableOrder", {
|
url: '../../basic/grain/query-order-list?deptId=' + deptId
|
});
|
}
|
}, 6000);
|
};
|
</script>
|
</body>
|
</html>
|