119 lines
4.1 KiB
JavaScript
119 lines
4.1 KiB
JavaScript
import { getBoroughInfo } from "../../js/orgApi/getBoroughInfo.js";
|
|
import { getSchoolCheckList } from "./orgApi/getSchoolCheckList.js";
|
|
import { getCurrData } from "../../../../public/js/timestamp.js";
|
|
import { showSchoolCheckList } from "./showSchoolCheckList.js";
|
|
import { addEvent } from "./event.js";
|
|
let layuiObj={};
|
|
let basicloginInfo={};
|
|
let boroughInfoArr=[];//派出所
|
|
let schoolCheckList=[];//打卡数据
|
|
let clockInStart=getCurrData()+" 00:00:00";
|
|
let clockInEnd=getCurrData()+" 23:59:59";
|
|
layui.use(['carousel','table','form','laydate','slider','element'],function() {
|
|
layuiObj["layer"] = layui.layer;
|
|
layuiObj["carousel"] = layui.carousel;
|
|
layuiObj["layuitable"] = layui.table;
|
|
layuiObj["rate"] = layui.rate;
|
|
layuiObj["layuiForm"] = layui.form;
|
|
layuiObj["laydate"] =layui.laydate;
|
|
layuiObj["slider"] =layui.slider;
|
|
layuiObj["element"] =layui.element;
|
|
var loginJson=sessionStorage.getItem("unameInfoStr");
|
|
basicloginInfo=JSON.parse(loginJson);
|
|
axios.defaults.headers.common['Authorization'] = basicloginInfo["session"];
|
|
initApi();
|
|
})
|
|
|
|
async function initApi(){
|
|
//获取派出所的信息
|
|
var boroughRes=await getBoroughInfo();
|
|
boroughInfoArr=boroughRes.data.data;
|
|
await selectSchoolCheckList({
|
|
start:clockInStart,
|
|
end:clockInEnd
|
|
});
|
|
initPoliceOption();
|
|
initClockInTime();
|
|
showSchoolCheckList();
|
|
addEvent();
|
|
}
|
|
//查询打卡注册的数据
|
|
async function selectSchoolCheckList(obj){
|
|
var index = layuiObj.layer.load('',{
|
|
shade: [0.2,'#000'],//0.1透明度的白色背景
|
|
content:'数据加载中...'
|
|
});
|
|
var policeSumRes=await getSchoolCheckList(obj)
|
|
schoolCheckList=policeSumRes.data.data;
|
|
formatSchoolCheckList()
|
|
layuiObj.layer.close(index)
|
|
}
|
|
|
|
//需要把数据除以10显示
|
|
function formatSchoolCheckList(){
|
|
for(var i=0;i<schoolCheckList.length;i++){
|
|
var obj=schoolCheckList[i];
|
|
obj["guarderCount"]=obj["guarderCount"]/10;
|
|
obj["guarderCert"]=obj["guarderCert"]/10;
|
|
obj["guarderOverAge"]=obj["guarderOverAge"]/10;
|
|
obj["peakGuarderArmed"]=obj["peakGuarderArmed"]/10;
|
|
obj["peakProtectScheme"]=obj["peakProtectScheme"]/10;
|
|
obj["peakStaff"]=obj["peakStaff"]/10;
|
|
obj["zoneClosed"]=obj["zoneClosed"]/10;
|
|
obj["equipCount"]=obj["equipCount"]/10;
|
|
obj["collision"]=obj["collision"]/10;
|
|
obj["ipcCover"]=obj["ipcCover"]/10;
|
|
obj["alarmSystem"]=obj["alarmSystem"]/10;
|
|
obj["ipcGate"]=obj["ipcGate"]/10;
|
|
obj["ipcRecord"]=obj["ipcRecord"]/10;
|
|
obj["lawEducation"]=obj["lawEducation"]/10;
|
|
obj["conflict"]=obj["conflict"]/10;
|
|
obj["guarderScheme"]=obj["guarderScheme"]/10;
|
|
obj["buildingScheme"]=obj["buildingScheme"]/10;
|
|
obj["fireScheme"]=obj["fireScheme"]/10;
|
|
obj["dangerousScheme"]=obj["dangerousScheme"]/10;
|
|
obj["conflictScheme"]=obj["conflictScheme"]/10;
|
|
obj["guarderPMIScheme"]=obj["guarderPMIScheme"]/10;
|
|
obj["securityServiceScheme"]=obj["securityServiceScheme"]/10;
|
|
obj["criminalCase"]=obj["criminalCase"]/10;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
//初始化派出所的options
|
|
function initPoliceOption(){
|
|
var options=`<option value="000">请选择派出所</option>`
|
|
for(var i=0;i<boroughInfoArr.length;i++){
|
|
var remark=boroughInfoArr[i]["remark"];
|
|
var borough=boroughInfoArr[i]["borough"];
|
|
options+=`<option value="${borough}">${remark}</option>`;
|
|
}
|
|
$("#mainContentC_boroughSelect").html(options);
|
|
layuiObj.layuiForm.render("select","mainContentC_schoolForm");
|
|
$("#mainContentC_boroughSelect").siblings("div.layui-form-select").find("div.layui-select-title").find("input").attr("onfocus","this.select()");
|
|
}
|
|
|
|
//初始化时间
|
|
function initClockInTime(){
|
|
layuiObj.laydate.render({
|
|
elem: '#clockHistoryStart',
|
|
type: 'datetime',
|
|
value:clockInStart
|
|
});
|
|
layuiObj.laydate.render({
|
|
elem: '#clockHistoryEnd',
|
|
type: 'datetime',
|
|
value:clockInEnd
|
|
});
|
|
}
|
|
export {
|
|
layuiObj,
|
|
boroughInfoArr,
|
|
schoolCheckList,
|
|
selectSchoolCheckList
|
|
}
|
|
|
|
|