值班工作统计、异常上报统计

This commit is contained in:
cwchen 2025-01-24 15:07:03 +08:00
parent 7c93d24f64
commit a882cebac0
11 changed files with 871 additions and 1 deletions

View File

@ -77,6 +77,8 @@
style="background-color: #2F82FB;" onclick="query(1)">查询
</button>
</div>
<button type="button" style="width: 120px;background-color: #2F82FB;" class="layui-btn layui-btn-normal"
onclick="vioStatistics()">异常上报统计</button>
</div>
</form>
</div>

View File

@ -52,6 +52,8 @@
src="../../img/common-icon/export-icon.png">
<p>导出</p></div>
</button>
<button type="button" style="width: 100px;" class="layui-btn layui-btn-normal layui-btn-sm"
onclick="vioStatistics()">值班工作统计</button>
</div>
</div>
</form>

View File

@ -151,6 +151,8 @@
<p>导出</p>
</div>
</button> -->
<button type="button" style="width: 120px;background-color: #2F82FB;" class="layui-btn layui-btn-normal layui-btn-sm"
onclick="dutyWorkStatistics()">值班工作统计</button>
</div>
</div>
</form>

View File

@ -0,0 +1,56 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="../../../js/layui-v2.9.2/layui/css/layui.css">
<link rel="stylesheet" href="../../../css/font.css">
<link rel="stylesheet" href="../../../css/dutyTask/remotePatrol/vioStatistics.css">
<!--拦截及公共ip-->
<script src="../../../js/public/jquery-3.6.0.js" type="text/javascript"></script>
<script src="../../../js/system/IPUtils.js"></script>
<script src="../../../js/system/ajax_intercept.js"></script>
<script src="../../../js/system/public_utils.js"></script>
<script src="../../../js/smutil/sm2Utils.js"></script>
<script src="../../../js/smutil/smUtil.js"></script>
<!--拦截及公共ip-->
<script src="../../../js/public/public.js" type="text/javascript"></script>
<script src="../../../js/public/sm3.js" type="text/javascript"></script>
<script src="../../../js/public/permission.js" type="text/javascript"></script>
<script src="../../../js/layui-v2.9.2/layui/layui.js"></script>
<script src="../../../js/public/aes.js"></script>
<script src="../../../js/public/commonUtils.js"></script>
<script src="../../../js/public/echarts.js"></script>
<title>异常上报统计</title>
</head>
<body>
<div class="search-box">
<form class="layui-form" onsubmit="return false;">
<!-- <div class="layui-form-item">
<div class="layui-inline" style="margin-bottom: 0;">
<div class="layui-inline" id="ID-laydate-rangeLinked">
<div class="layui-input-inline">
<input type="text" autocomplete="off" id="startDay" class="layui-input" readonly
placeholder="开始日期" style="cursor: pointer;">
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline">
<input type="text" autocomplete="off" id="endDay" class="layui-input" readonly
placeholder="结束日期" style="cursor: pointer;">
</div>
</div>
</div>
<div class="layui-inline">
<button class="layui-btn layui-btn-normal" onclick="query()">查询</button>
<button class="layui-btn layui-btn-normal" onclick="exportExcel()">导出</button>
</div>
</div> -->
</form>
</div>
<div class="content-box">
<div class="echarts-content" id="echarts-one"></div>
</div>
</body>
<script src="../../../js/dutyTask/violation/abnormalReporting.js"></script>
</html>

View File

@ -0,0 +1,56 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="../../../js/layui-v2.9.2/layui/css/layui.css">
<link rel="stylesheet" href="../../../css/font.css">
<link rel="stylesheet" href="../../../css/dutyTask/remotePatrol/vioStatistics.css">
<!--拦截及公共ip-->
<script src="../../../js/public/jquery-3.6.0.js" type="text/javascript"></script>
<script src="../../../js/system/IPUtils.js"></script>
<script src="../../../js/system/ajax_intercept.js"></script>
<script src="../../../js/system/public_utils.js"></script>
<script src="../../../js/smutil/sm2Utils.js"></script>
<script src="../../../js/smutil/smUtil.js"></script>
<!--拦截及公共ip-->
<script src="../../../js/public/public.js" type="text/javascript"></script>
<script src="../../../js/public/sm3.js" type="text/javascript"></script>
<script src="../../../js/public/permission.js" type="text/javascript"></script>
<script src="../../../js/layui-v2.9.2/layui/layui.js"></script>
<script src="../../../js/public/aes.js"></script>
<script src="../../../js/public/commonUtils.js"></script>
<script src="../../../js/public/echarts.js"></script>
<title>值班工作统计</title>
</head>
<body>
<div class="search-box">
<!-- <form class="layui-form" onsubmit="return false;">
<div class="layui-form-item">
<div class="layui-inline" style="margin-bottom: 0;">
<div class="layui-inline" id="ID-laydate-rangeLinked">
<div class="layui-input-inline">
<input type="text" autocomplete="off" id="startDay" class="layui-input" readonly
placeholder="开始日期" style="cursor: pointer;">
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline">
<input type="text" autocomplete="off" id="endDay" class="layui-input" readonly
placeholder="结束日期" style="cursor: pointer;">
</div>
</div>
</div>
<div class="layui-inline">
<button class="layui-btn layui-btn-normal" onclick="query()">查询</button>
<button class="layui-btn layui-btn-normal" onclick="exportExcel()">导出</button>
</div>
</div>
</form> -->
</div>
<div class="content-box">
<div class="echarts-content" id="echarts-one"></div>
</div>
</body>
<script src="../../../js/dutyTask/violation/dutyWorkStatistics.js"></script>
</html>

View File

@ -353,4 +353,24 @@ function setRiskLevel() {
arr: keys
});
layui.form.render();
}
function vioStatistics(){
let title = '异常上报统计';
let layerIndex = layer.open({
id: 'viewTicket',
type: 2,
title: ['<div style="border-left: 3px solid #409EFF;color:#409EFF;font-size:18px;letter-spacing:1px;display: flex;align-items: center;height: 20px;padding: 0 10px;">' + title + '</div>', 'font-size:16px;background-color:#f0f0f0;display: flex;align-items: center;'],
content: './violation/abnormalReporting.html',
shade: 0.3,
anim: 2,
shadeClose: false,
area: ['80%', '90%'],
move: false,
success: function () {
let iframeWin = window["layui-layer-iframe" + layerIndex];
},
cancel: function () { },
end: function () { }
});
}

View File

@ -211,3 +211,22 @@ function query() {
}
function vioStatistics(){
let title = '值班工作统计';
let layerIndex = layer.open({
id: 'viewTicket',
type: 2,
title: ['<div style="border-left: 3px solid #409EFF;color:#409EFF;font-size:18px;letter-spacing:1px;display: flex;align-items: center;height: 20px;padding: 0 10px;">' + title + '</div>', 'font-size:16px;background-color:#f0f0f0;display: flex;align-items: center;'],
content: './violation/vioStatistics.html',
shade: 0.3,
anim: 2,
shadeClose: false,
area: ['80%', '90%'],
move: false,
success: function () {
let iframeWin = window["layui-layer-iframe" + layerIndex];
},
cancel: function () { },
end: function () { }
});
}

View File

@ -724,4 +724,25 @@ function setTrBackgroundColor(value) {
// 违章信息
function openNewDetail2() {
parent.openNewTab('../dutyTask/violationStatistics.html', '19', '违章统计')
}
function dutyWorkStatistics(){
let title = '值班工作统计';
let layerIndex = layer.open({
id: 'viewTicket',
type: 2,
title: ['<div style="border-left: 3px solid #409EFF;color:#409EFF;font-size:18px;letter-spacing:1px;display: flex;align-items: center;height: 20px;padding: 0 10px;">' + title + '</div>', 'font-size:16px;background-color:#f0f0f0;display: flex;align-items: center;'],
content: './violation/dutyWorkStatistics.html',
shade: 0.3,
anim: 2,
shadeClose: false,
area: ['80%', '90%'],
move: false,
success: function () {
let iframeWin = window["layui-layer-iframe" + layerIndex];
},
cancel: function () { },
end: function () { }
});
}

View File

@ -0,0 +1,343 @@
let form, layer, laydate;
let user = getUser();
let myChart12 = echarts.init(document.getElementById('echarts-one'));
layui.use(['form', 'layer', 'laydate'], function () {
layer = layui.layer;
form = layui.form;
laydate = layui.laydate;
laydate.render({
elem: '#ID-laydate-rangeLinked',
range: ['#startDay', '#endDay'],
rangeLinked: true,
btns: ['confirm']
});
$('#startDay').val(getNowTime());
$('#endDay').val(getNowTime());
form.render();
getVioStatistics();
});
// 查询
function query() {
myChart12.dispose();
myChart12 = echarts.init(document.getElementById('echarts-one'));
getVioStatistics();
}
function getVioStatistics() {
let param = {
startTime: $('#startDay').val(),
endTime: $('#endDay').val(),
currentUserId: user.userId + '',
isSup: user.isSup,
currentUserOrgId: user.orgId
};
$.ajax({
headers: {
"encrypt": sm3(JSON.stringify(param))
},
url: dataUrl + 'proteam/pot/superStatistics/getVioStatistics?token=' + token,
data: param,
type: 'POST',
async: true,
success: function (result) {
if (result.code === 200) {
initEchartsOne(result.data);
} else if (result.code === 401) {
logout(1)
}
}, error: function () {
}
});
}
// 导出
function exportExcel() {
let startTime = $("#startDay").val(),
endTime = $("#endDay").val(),
currentUserId = user.userId + '',
isSup = user.isSup,
currentUserOrgId = user.orgId;
let loadingMsg = layer.msg("数据导出中,请稍候...", { icon: 16, scrollbar: false, time: 0, });
let url = dataUrl + "proteam/pot/superStatistics/exportExcel?startTime=" + startTime + "&endTime=" + endTime + "&currentUserId=" + currentUserId + "&isSup=" + isSup + "&currentUserOrgId=" + currentUserOrgId + "&token=" + token;
let xhr = new XMLHttpRequest();
xhr.open("get", url, true);
xhr.responseType = "blob"; // 转换流
xhr.setRequestHeader("encrypt",
sm3(JSON.stringify({
startTime: startTime,
endTime: endTime,
currentUserId: currentUserId,
isSup: isSup,
currentUserOrgId: currentUserOrgId
})));
xhr.setRequestHeader('encryption','encryption');
xhr.setRequestHeader('token',token);
xhr.onload = function () {
layer.close(loadingMsg);
if (this.status === 200) {
let blob = this.response;
var a = document.createElement("a");
var url = window.URL.createObjectURL(blob);
a.href = url;
a.download = startTime + '至' + endTime + "违章统计" + ".xlsx"; // 文件名
} else {
layer.msg("服务异常,请稍后重试", { icon: 16, scrollbar: false, time: 2000 });
}
a.click();
window.URL.revokeObjectURL(url);
};
xhr.send();
}
/*按违章等级统计-echarts*/
function initEchartsOne(list) {
list = [{orgName:'合肥',classNum:30,vioNum:3,vioRate:10},
{orgName:'芜湖',classNum:42,vioNum:5,vioRate:11},
{orgName:'滁州',classNum:11,vioNum:2,vioRate:18},
{orgName:'马鞍山',classNum:21,vioNum:3,vioRate:14},
{orgName:'宣城',classNum:21,vioNum:3,vioRate:14},
];
let myData5 = []; // 地市
let fwrs = []; // 站班会数量
let xdrs = []; // 违章数量
let zhl = []; // 违章率
$.each(list, function (index, item) {
myData5.push(item.orgName);
fwrs.push(item.classNum);
xdrs.push(item.vioNum);
zhl.push(item.vioRate);
})
let option = {
backgroundColor: "transparent",
tooltip: {
trigger: "axis",
axisPointer: {
type: "shadow",
},
textStyle: {
color: "#fff",
},
backgroundColor: "rgba(0, 58, 99, 0.8)", //设置背景颜色
borderColor: "rgba(0, 58, 99, 0.8)",
confine: true,
formatter: `{b}<br>{a}{c}个<br>{a1}{c1}个<br>{a2}{c2}个`,
},
legend: {
itemWidth: 12,
itemHeight: 8,
itemGap: 20,
right: "2%",
top: "3%",
x: "center",
textStyle: {
fontSize: 14,
color: "#000",
},
// data: ["站班会数量", "违章数量", "违章占比"],
data: ["站班会数量", "异常上报数量", "上报占比"],
// data: ["已完成", "未完成", "任务数"],
selectedMode: false,
},
grid: {
top: "8%",
left: "2%",
right: "2%",
bottom: "2%",
containLabel: true,
},
xAxis: {
type: "category",
data: myData5,
axisLabel: {
color: "#000",
interval: 0,
fontSize: 12,
},
axisLine: {
show: true,
lineStyle: {
color: "rgba(127, 214, 255, .4)",
},
},
splitLine: {
show: false,
},
axisTick: {
show: false,
},
},
yAxis: [
{
type: "value",
name: "数量 / 个",
splitNumber: 5,
nameTextStyle: {
color: "#000",
fontSize: 12,
align: "center",
// padding: [0, 20, 5, 0],
},
axisLabel: {
formatter: "{value}",
color: "rgba(95, 187, 235, 1)",
textStyle: {
fontSize: 14,
color: "#000",
lineHeight: 16,
},
},
axisTick: {
show: false,
},
splitLine: {
show: true,
lineStyle: {
color: "rgba(28, 130, 197, .3)",
type: "dashed",
},
},
},
{
name: "违章占比 / %",
// name: "任务数",
splitNumber: 5,
max: 100,
type: "value",
nameTextStyle: {
color: "#000",
fontSize: 12,
align: "center",
// padding: [0, 0, 5, 0],
},
axisLabel: {
show: true,
fontSize: 12,
color: "#000",
},
axisLine: {
show: false,
},
axisTick: {
show: false,
},
splitLine: {
show: false,
},
},
],
series: [
{
name: "站班会数量",
type: "bar",
data: fwrs,
barWidth: "15px",
barGap: "50%",
itemStyle: {
normal: {
borderColor: "#3681FF",
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: "rgba(15, 51, 82, 1)",
},
{
offset: 1,
color: "rgba(0, 168, 255, 1)",
},
]),
},
},
label: {
show: true,
position: "top",
fontSize: 12,
color: "#000",
offset: [0, -5],
formatter: "{c}",
},
},
{
// name: "违章数量",
name: "异常上报数量",
// name: "未完成",
type: "bar",
data: xdrs,
barWidth: "15px",
barGap: "50%",
itemStyle: {
normal: {
borderColor: "rgba(54, 234, 255, 1)",
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: "rgba(15, 51, 82, 1)",
},
{
offset: 1,
color: "rgba(21, 219, 203, 1)",
},
]),
},
},
label: {
show: true,
position: "top",
fontSize: 12,
color: "#000",
offset: [0, -5],
formatter: "{c}",
},
},
{
// name: "违章占比",
name: "上报占比",
// name: "任务数",
type: "line",
yAxisIndex: 1,
showSymbol: true,
symbolSize: 8,
smooth: true,
symbol: "circle",
lineStyle: {
normal: {
color: "#02D6B0",
},
},
itemStyle: {
color: "#02D6B0",
borderColor: "#fff",
borderWidth: 1,
},
areaStyle: {
normal: {
color: new echarts.graphic.LinearGradient(
0,
0,
0,
1,
[
{
offset: 0,
color: "rgba(0, 255, 246, 0.5)",
},
{
offset: 1,
color: "rgba(0, 255, 246, 0)",
},
],
false
),
},
},
data: zhl, // 折线图的数据
},
],
};
myChart12.setOption(option, true);
window.addEventListener("resize", function () {
myChart12.resize();
});
}

View File

@ -0,0 +1,349 @@
let form, layer, laydate;
let user = getUser();
let myChart12 = echarts.init(document.getElementById('echarts-one'));
layui.use(['form', 'layer', 'laydate'], function () {
layer = layui.layer;
form = layui.form;
laydate = layui.laydate;
laydate.render({
elem: '#ID-laydate-rangeLinked',
range: ['#startDay', '#endDay'],
rangeLinked: true,
btns: ['confirm']
});
$('#startDay').val(getNowTime());
$('#endDay').val(getNowTime());
form.render();
getVioStatistics();
});
// 查询
function query() {
myChart12.dispose();
myChart12 = echarts.init(document.getElementById('echarts-one'));
getVioStatistics();
}
function getVioStatistics() {
let param = {
startTime: $('#startDay').val(),
endTime: $('#endDay').val(),
currentUserId: user.userId + '',
isSup: user.isSup,
currentUserOrgId: user.orgId
};
$.ajax({
headers: {
"encrypt": sm3(JSON.stringify(param))
},
url: dataUrl + 'proteam/pot/superStatistics/getVioStatistics?token=' + token,
data: param,
type: 'POST',
async: true,
success: function (result) {
if (result.code === 200) {
initEchartsOne(result.data);
} else if (result.code === 401) {
logout(1)
}
}, error: function () {
}
});
}
// 导出
function exportExcel() {
let startTime = $("#startDay").val(),
endTime = $("#endDay").val(),
currentUserId = user.userId + '',
isSup = user.isSup,
currentUserOrgId = user.orgId;
let loadingMsg = layer.msg("数据导出中,请稍候...", { icon: 16, scrollbar: false, time: 0, });
let url = dataUrl + "proteam/pot/superStatistics/exportExcel?startTime=" + startTime + "&endTime=" + endTime + "&currentUserId=" + currentUserId + "&isSup=" + isSup + "&currentUserOrgId=" + currentUserOrgId + "&token=" + token;
let xhr = new XMLHttpRequest();
xhr.open("get", url, true);
xhr.responseType = "blob"; // 转换流
xhr.setRequestHeader("encrypt",
sm3(JSON.stringify({
startTime: startTime,
endTime: endTime,
currentUserId: currentUserId,
isSup: isSup,
currentUserOrgId: currentUserOrgId
})));
xhr.setRequestHeader('encryption','encryption');
xhr.setRequestHeader('token',token);
xhr.onload = function () {
layer.close(loadingMsg);
if (this.status === 200) {
let blob = this.response;
var a = document.createElement("a");
var url = window.URL.createObjectURL(blob);
a.href = url;
a.download = startTime + '至' + endTime + "违章统计" + ".xlsx"; // 文件名
} else {
layer.msg("服务异常,请稍后重试", { icon: 16, scrollbar: false, time: 2000 });
}
a.click();
window.URL.revokeObjectURL(url);
};
xhr.send();
}
/*按违章等级统计-echarts*/
function initEchartsOne(list) {
/* list = [{orgName:'',classNum:30,vioNum:3,vioRate:10},
{orgName:'芜湖',classNum:42,vioNum:5,vioRate:11},
{orgName:'滁州',classNum:11,vioNum:2,vioRate:18},
{orgName:'马鞍山',classNum:21,vioNum:3,vioRate:14},
{orgName:'宣城',classNum:21,vioNum:3,vioRate:14},
]; */
list = [{orgName:'合肥',classNum:15,vioNum:36,vioRate:51},
{orgName:'芜湖',classNum:12,vioNum:18,vioRate:30},
{orgName:'滁州',classNum:46,vioNum:23,vioRate:69},
{orgName:'马鞍山',classNum:22,vioNum:6,vioRate:28},
{orgName:'宣城',classNum:12,vioNum:3,vioRate:15},
];
let myData5 = []; // 地市
let fwrs = []; // 站班会数量
let xdrs = []; // 违章数量
let zhl = []; // 违章率
$.each(list, function (index, item) {
myData5.push(item.orgName);
fwrs.push(item.classNum);
xdrs.push(item.vioNum);
zhl.push(item.vioRate);
})
let option = {
backgroundColor: "transparent",
tooltip: {
trigger: "axis",
axisPointer: {
type: "shadow",
},
textStyle: {
color: "#fff",
},
backgroundColor: "rgba(0, 58, 99, 0.8)", //设置背景颜色
borderColor: "rgba(0, 58, 99, 0.8)",
confine: true,
formatter: `{b}<br>{a}{c}个<br>{a1}{c1}个<br>{a2}{c2}个`,
},
legend: {
itemWidth: 12,
itemHeight: 8,
itemGap: 20,
right: "2%",
top: "3%",
x: "center",
textStyle: {
fontSize: 14,
color: "#000",
},
// data: ["站班会数量", "违章数量", "违章占比"],
// data: ["站班会数量", "异常上报数量", "上报占比"],
data: ["已完成", "未完成", "任务数"],
selectedMode: false,
},
grid: {
top: "8%",
left: "2%",
right: "2%",
bottom: "2%",
containLabel: true,
},
xAxis: {
type: "category",
data: myData5,
axisLabel: {
color: "#000",
interval: 0,
fontSize: 12,
},
axisLine: {
show: true,
lineStyle: {
color: "rgba(127, 214, 255, .4)",
},
},
splitLine: {
show: false,
},
axisTick: {
show: false,
},
},
yAxis: [
{
type: "value",
name: "数量 / 个",
splitNumber: 5,
nameTextStyle: {
color: "#000",
fontSize: 12,
align: "center",
// padding: [0, 20, 5, 0],
},
axisLabel: {
formatter: "{value}",
color: "rgba(95, 187, 235, 1)",
textStyle: {
fontSize: 14,
color: "#000",
lineHeight: 16,
},
},
axisTick: {
show: false,
},
splitLine: {
show: true,
lineStyle: {
color: "rgba(28, 130, 197, .3)",
type: "dashed",
},
},
},
{
// name: "违章占比 / %",
name: "任务数",
splitNumber: 5,
max: 100,
type: "value",
nameTextStyle: {
color: "#000",
fontSize: 12,
align: "center",
// padding: [0, 0, 5, 0],
},
axisLabel: {
show: true,
fontSize: 12,
color: "#000",
},
axisLine: {
show: false,
},
axisTick: {
show: false,
},
splitLine: {
show: false,
},
},
],
series: [
{
name: "已完成",
type: "bar",
data: fwrs,
barWidth: "15px",
barGap: "50%",
itemStyle: {
normal: {
borderColor: "#3681FF",
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: "rgba(15, 51, 82, 1)",
},
{
offset: 1,
color: "rgba(0, 168, 255, 1)",
},
]),
},
},
label: {
show: true,
position: "top",
fontSize: 12,
color: "#000",
offset: [0, -5],
formatter: "{c}",
},
},
{
// name: "违章数量",
// name: "异常上报数量",
name: "未完成",
type: "bar",
data: xdrs,
barWidth: "15px",
barGap: "50%",
itemStyle: {
normal: {
borderColor: "rgba(54, 234, 255, 1)",
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: "rgba(15, 51, 82, 1)",
},
{
offset: 1,
color: "rgba(21, 219, 203, 1)",
},
]),
},
},
label: {
show: true,
position: "top",
fontSize: 12,
color: "#000",
offset: [0, -5],
formatter: "{c}",
},
},
{
// name: "违章占比",
// name: "上报占比",
name: "任务数",
type: "line",
yAxisIndex: 1,
showSymbol: true,
symbolSize: 8,
smooth: true,
symbol: "circle",
lineStyle: {
normal: {
color: "#02D6B0",
},
},
itemStyle: {
color: "#02D6B0",
borderColor: "#fff",
borderWidth: 1,
},
areaStyle: {
normal: {
color: new echarts.graphic.LinearGradient(
0,
0,
0,
1,
[
{
offset: 0,
color: "rgba(0, 255, 246, 0.5)",
},
{
offset: 1,
color: "rgba(0, 255, 246, 0)",
},
],
false
),
},
},
data: zhl, // 折线图的数据
},
],
};
myChart12.setOption(option, true);
window.addEventListener("resize", function () {
myChart12.resize();
});
}

View File

@ -1111,7 +1111,7 @@ function compareTime(time, time2) {
}
function vioStatistics(){
let title = '违章统计';
let title = '异常上报统计';
let layerIndex = layer.open({
id: 'viewTicket',
type: 2,