anxiao_web/pages/information/nursingSchoolExamSituation/js/showPoliceSummary.js

191 lines
5.5 KiB
JavaScript
Raw Normal View History

2024-07-24 09:22:32 +08:00
import {drawInformationEchart } from "./drawEchart.js";
import { schoolClockInList,layuiObj } from "./index.js";
function showSchoolPolicemanSummaryInfo(){
showPoliceTotalData(schoolClockInList);
}
//显示统计数据
function showPoliceTotalData(schoolClockInList){
var guardCount=0
var policeCount=0
var guardSignCount=0
var policeSignCount=0
var teacherCount=0
var teacherSignCount=0
var volunteerCount=0
var volunteerSignCount=0
var stationClockCount=0;
var stationNoClockCount=0;
schoolClockInList.forEach(item=>{
var schoolSummaryList=item["schoolSummaryList"];
for(var i=0;i<schoolSummaryList.length;i++){
var station=schoolSummaryList[i]["station"];
if(
schoolSummaryList[i]["guardSignCount"]>0
||
schoolSummaryList[i]["policeSignCount"]>0
||
schoolSummaryList[i]["teacherSignCount"]>0
||
schoolSummaryList[i]["volunteerSignCount"]>0
){
stationClockCount++;
}else{
stationNoClockCount++;
}
}
guardCount+=item["guardCount"]
policeCount+=item["policeCount"]
teacherCount+=item["teacherCount"]
volunteerCount+=item["volunteerCount"]
guardSignCount+=item["guardSignCount"]
policeSignCount+=item["policeSignCount"]
teacherSignCount+=item["teacherSignCount"]
volunteerSignCount+=item["volunteerSignCount"]
})
$(".guardCount").html(guardCount);
$(".policeCount").html(policeCount);
$(".teacherCount").html(teacherCount);
$(".volunteerCount").html(volunteerCount);
$(".guardSignCount").html(guardSignCount);
$(".policeSignCount").html(policeSignCount);
$(".teacherSignCount").html(teacherSignCount);
$(".volunteerSignCount").html(volunteerSignCount);
$(".clockStationCount").html(stationClockCount);
$(".noClockStationCount").html(stationNoClockCount);
var clockObj={
guardCount,
policeCount,
teacherCount,
volunteerCount,
guardSignCount,
policeSignCount,
teacherSignCount,
volunteerSignCount,
stationClockCount,
stationNoClockCount
}
drawEchartjs(clockObj);
showPoliceDetailData(schoolClockInList)
}
//显示派出所的详情数据
function showPoliceDetailData(schoolClockInList){
layuiObj.layuitable.render({
elem:'#workInclockTable',
data:schoolClockInList,
cols: [[
{field:'borough', width:"20%", title: '派出所'},
{field:'guardCount', width:"10%", title: '保安注册'},
{field:'policeCount', width:"10%", title: '民警注册'},
{field:'teacherCount', width:"10%", title: '老师注册'},
{field:'volunteerCount', width:"10%", title: '志愿者注册'},
{field:'guardSignCount', width:"10%", title: '保安打卡'},
{field:'policeSignCount', width:"10%", title: '民警打卡'},
{field:'teacherSignCount', width:"10%", title: '老师打卡'},
{field:'volunteerSignCount', width:"10%", title: '志愿者打卡'},
]],
limit:Number.MAX_VALUE // 数据表格默认全部显示
});
}
function drawEchartjs(item){
var guardCount=item["guardCount"];
var policeCount=item["policeCount"];
var teacherCount=item["teacherCount"];
var volunteerCount=item["volunteerCount"];
var guardSignCount=item["guardSignCount"];
var policeSignCount=item["policeSignCount"];
var teacherSignCount=item["teacherSignCount"];
var volunteerSignCount=item["volunteerSignCount"];
var stationClockCount=item["stationClockCount"];
var stationNoClockCount=item["stationNoClockCount"];
var gurardName="保安";
var policeName="民警";
var teacherName="老师";
var volunteerName="志愿者";
var registerEchartData=[
{
"name":gurardName,
"value":guardCount,
},
{
"name":policeName,
"value":policeCount,
},
{
"name":teacherName,
"value":teacherCount,
},
{
"name":volunteerName,
"value":volunteerCount,
}
]
var clockEchartData=[
{
"name":gurardName,
"value":guardSignCount,
},
{
"name":policeName,
"value":policeSignCount,
},
{
"name":teacherName,
"value":teacherSignCount,
},
{
"name":volunteerName,
"value":volunteerSignCount,
},
]
var stationEchartData=[
{
"name":"打卡",
"value":stationClockCount,
},
{
"name":"未打卡",
"value":stationNoClockCount,
}
]
var signPersonEchart = echarts.init(document.querySelector(".signPersonEchart"))
signPersonEchart.setOption(drawInformationEchart(registerEchartData,"注册","人数","10%"));
var clockPersonEchart = echarts.init(document.querySelector(".clockPersonEchart"))
clockPersonEchart.setOption(drawInformationEchart(clockEchartData,"打卡","人数","10%"));
var clockStationEchart=echarts.init(document.querySelector(".clockStationEchart"))
clockStationEchart.setOption(drawInformationEchart(stationEchartData,"学校","打卡","32%"));
}
export {
showSchoolPolicemanSummaryInfo,
showPoliceTotalData
}