anxiao_web/pages/information/nursingSchoolExamSituation/js/index.js

87 lines
2.8 KiB
JavaScript
Raw Permalink Normal View History

2024-07-24 09:22:32 +08:00
import {getBoroughInfo} from "../../js/orgApi/getBoroughInfo.js";
import { getSchoolPolicemanSummary } from "./orgApi/schoolPolicemanSummary.js";
import {getCurrData } from "../../../../public/js/timestamp.js";
import { showSchoolPolicemanSummaryInfo } from "./showPoliceSummary.js";
import { addEvent } from "./event.js";
let layuiObj={};
let basicloginInfo={};
let boroughInfoArr=[];//派出所
let schoolClockInList=[];//打卡数据
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 selectSchoolPolicemanSummary({
start:clockInStart,
end:clockInEnd
});
initPoliceOption();
initClockInTime();
showSchoolPolicemanSummaryInfo();
addEvent();
}
//查询打卡注册的数据
async function selectSchoolPolicemanSummary(obj){
var index = layuiObj.layer.load('',{
shade: [0.2,'#000'],//0.1透明度的白色背景
content:'数据加载中...'
});
var policeSumRes=await getSchoolPolicemanSummary(obj)
schoolClockInList=policeSumRes.data.data;
layuiObj.layer.close(index)
}
//初始化派出所的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,
schoolClockInList,
selectSchoolPolicemanSummary
}