import {layuiObj} from "./index.js";
import {getCurrData} from "../../../public/js/timestamp.js";
import {getSchoolOptions} from "./schoolSearch.js"
import {signEventlist,getPersonClockType} from "./marker/schoolMarker.js";
import {brigade,stationurl} from "../../../public/js/url.js";
$("#clockInfoCount>div:nth-child(2)").on('click',function(){
showSignListPage();
})
var clockHistoryList=[];
function showSignListPage(){
layuiObj["layer"].open({
type: 1,
title: "打卡记录", //不显示标题栏
// closeBtn: false,
area: ['1000px', '530px'],
id: new Date().getTime(), //设定一个id,防止重复弹出
btnAlign: 'c',
resize:false,
// moveType: 0, //拖拽模式,0或者1
content:`
`,
success:function(){
renderClockFrom();
clockSelectEvent();
}
})
}
function renderClockFrom(){
$("#clockHistorySelect").html(getSchoolOptions());
layuiObj.layuiForm.render("select","clockHistoryForm");
$("#clockHistorySelect").siblings("div.layui-form-select").find("div.layui-select-title").find("input").attr("onfocus","this.select()");
layuiObj.laydate.render({
elem: '#clockHistoryStart',
type: 'datetime',
});
layuiObj.laydate.render({
elem: '#clockHistoryEnd',
type: 'datetime',
});
}
function clockSelectEvent(){
var obj={
"start":getCurrData()+" 00:00:00",
"end":getCurrData()+" 23:59:59",
}
initClockSignData(obj);
$("#clockHistoryBtn").on('click',(e)=>{
var data=createSelectClockData()
initClockSignData(data)
})
$("#clockHistoryKeyPointBtn").on('click',(e)=>{
var data=createSelectClockData();
data["level"]=30;
if("station" in data){
delete data["station"];
}
initClockSignData(data)
})
}
//查询重点单位
function createSelectClockData(){
var start=$("#clockHistoryStart").val();
var end=$("#clockHistoryEnd").val();
var station=$("#clockHistorySelect").find("option:selected").val();
var data={
"start":start,
"end":end
}
if(station!="000"){
data["station"]=station
}
return data;
}
function initClockSignData(obj){
var data={
"brigade":brigade,
"year":-1,
"month":-1,
"day":-1,
...obj
}
signEventlist(data).then(res=>{
clockHistoryList=[];
var code=res["data"]["code"];
if(code==0){
var data=res["data"]["data"];
clockHistoryList=data;
}
showClockTable();
})
}
function showClockTable(){
layuiObj.layuitable.render({
elem:'#clockSignTable',
data:clockHistoryList,
toolbar: '#toolbarDemo', // 重点,可默认,也可自己设置按钮
defaultToolbar: ['filter', 'exports'], // exports为导出按钮
cols: [[
{field:'borough', width:"15%", title: '派出所'},
{field:'detachment', width:"15%", title: '警务区'},
{field:'station', width:"20%", title: '学校名称'},
{field:'personName', width:"10%", title: '打卡人员'},
{field:'personType', width:"10%", title: '人员类型',templet : function(data) {
return getPersonClockType(data["personType"]);
}},
{field:'signTimestamp', width:"20%", title: '打卡时间'},
{field:'detail', width:"10%", title: '详情',event:'detail',templet : function(data) {
return ``
}},
]],
limit:Number.MAX_VALUE // 数据表格默认全部显示
});
layuiObj.layuitable.on('tool(clockSignTable)', function (obj) {
var obj=obj["data"];
showSchoolClockInfo(obj)
})
}
function showSchoolClockInfo(item){
var imgs="";
var div="";
var imgUrlArr=[];
var borough=item["borough"]
var detachment=item["detachment"]
var station=item["station"];
var personName=item["personName"];
var personType=getPersonClockType(item["personType"]);
var signTimestamp=item["signTimestamp"];
div+=`
派出所: ${borough}
警务区: ${detachment}
学校名称: ${station}
打卡人员: ${personName}
人员类型: ${personType}
打卡时间: ${signTimestamp}
`
if(item["imageUrls"]!=null&&item["imageUrls"].length>0){
var imgUrl=JSON.parse(item["imageUrls"]);
for(var i=0;i`
}
}else{
imgs+=``
}
div+=imgs;
popSchoolClockDetail(div,imgUrlArr)
}
function popSchoolClockDetail(div,imgUrlArr){
layuiObj.layer.open({
type: 1,
title: "详情", //不显示标题栏
area: ['auto', 'auto'],
shade: 0.6,
id:new Date().getTime(), //设定一个id,防止重复弹出
btnAlign: 'c',
moveType: 1, //拖拽模式,0或者1
content: `
${div}
`,
success: function(layero){
for(var i=0;i