143 lines
5.0 KiB
JavaScript
143 lines
5.0 KiB
JavaScript
|
import { stationurl,brigade } from "../../public/js/url.js";
|
|||
|
import { layuiObj} from "../../pages/cmddispatch/js/index.js"
|
|||
|
import {getCurrData} from "../../public/js/timestamp.js";
|
|||
|
import {getSchoolOptions} from "../cmddispatch/js/tree.js"
|
|||
|
import {openClockInfo} from "../cmddispatch/js/orgApi/getEntranceStaffSign.js"
|
|||
|
|
|||
|
function getEntranceStaffSignHistory(obj){
|
|||
|
var loginurl=stationurl+"/firectrl/client/sensor/entrance/staff_sign_list";
|
|||
|
return axios({
|
|||
|
method: 'post',
|
|||
|
url:loginurl,
|
|||
|
data: obj
|
|||
|
})
|
|||
|
}
|
|||
|
|
|||
|
function showStaffSignHistory(){
|
|||
|
layuiObj.layer.open({
|
|||
|
type: 1,
|
|||
|
title: '护校考勤', //不显示标题栏
|
|||
|
area: ['1000px', '580px'],
|
|||
|
shade: 0.6,
|
|||
|
id:new Date().getTime(), //设定一个id,防止重复弹出
|
|||
|
btnAlign: 'c',
|
|||
|
moveType: 1, //拖拽模式,0或者1
|
|||
|
content: `<div style="padding:10px;color:#fff;background:#032357;height:calc(100% - 20px);overflow-y:auto;">
|
|||
|
<div class="staffSignSelectInfo">
|
|||
|
<form class="layui-form" action="" id="staffSignHistoryForm" lay-filter="staffSignHistoryForm" >
|
|||
|
<div class="layui-input-inline">
|
|||
|
<select name="interest" lay-filter="staffSignHistorySelect" id="staffSignHistorySelect" lay-search></select>
|
|||
|
</div>
|
|||
|
<div class="layui-input-inline">
|
|||
|
<input type="text" class="layui-input" id="staffSignHistoryStart" placeholder="请输入开始时间" value='${getCurrData()} 00:00:00'>
|
|||
|
</div>
|
|||
|
<div class="layui-input-inline">
|
|||
|
<input type="text" class="layui-input" id="staffSignHistoryEnd" placeholder="请输入结束时间" value='${getCurrData()} 23:59:59'>
|
|||
|
</div>
|
|||
|
<div class="layui-input-inline">
|
|||
|
<button class="layui-btn" id="staffSignHistoryBtn" style="height:38px !important;line-height:38px !important;">查询</button>
|
|||
|
</div>
|
|||
|
</form>
|
|||
|
</div>
|
|||
|
<div class="staffSignSelectContent">
|
|||
|
<table class="layui-hide" id="staffSignHistoryTable" lay-filter="staffSignHistoryTable"></table>
|
|||
|
</div>
|
|||
|
</div>`,
|
|||
|
success: function(layero){
|
|||
|
staffSignFromRender();
|
|||
|
showstaffSignHistoryContent([])
|
|||
|
}
|
|||
|
});
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
function staffSignFromRender(){
|
|||
|
$("#staffSignHistorySelect").html(getSchoolOptions());
|
|||
|
layuiObj.layuiForm.render("select","staffSignHistoryForm");
|
|||
|
|
|||
|
layuiObj.laydate.render({
|
|||
|
elem: '#staffSignHistoryStart',
|
|||
|
type: 'datetime',
|
|||
|
});
|
|||
|
layuiObj.laydate.render({
|
|||
|
elem: '#staffSignHistoryEnd',
|
|||
|
type: 'datetime',
|
|||
|
});
|
|||
|
|
|||
|
$("#staffSignHistoryBtn").on('click',function(e){
|
|||
|
e.preventDefault();
|
|||
|
var station=$("#staffSignHistorySelect").find("option:selected").val();
|
|||
|
var signobj={
|
|||
|
"brigade":brigade,
|
|||
|
"start":$("#staffSignHistoryStart").val(),
|
|||
|
"end":$("#staffSignHistoryEnd").val(),
|
|||
|
}
|
|||
|
if(station!="000"){
|
|||
|
signobj["station"]=station
|
|||
|
}
|
|||
|
|
|||
|
getEntranceStaffSignHistory(signobj).then(res=>{
|
|||
|
var code=res["data"]["code"];
|
|||
|
if(code==0){
|
|||
|
var data=res["data"]["data"];
|
|||
|
if(data.length==0){
|
|||
|
layuiObj.layer.msg("无数据")
|
|||
|
showstaffSignHistoryContent([])
|
|||
|
}else{
|
|||
|
showstaffSignHistoryContent(data)
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
})
|
|||
|
|
|||
|
|
|||
|
})
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
function showstaffSignHistoryContent(data){
|
|||
|
var tempData=[];
|
|||
|
var tempObj={};
|
|||
|
for(var i=0;i<data.length;i++){
|
|||
|
var personId=data[i]["personId"];
|
|||
|
if(!(personId in tempObj)){
|
|||
|
tempObj[personId]=[];
|
|||
|
}
|
|||
|
data[i]["post"]="保安"
|
|||
|
tempObj[personId].push(data[i]);
|
|||
|
}
|
|||
|
|
|||
|
for(var j in tempObj){
|
|||
|
var thisTemp=tempObj[j];
|
|||
|
var obj=JSON.parse(JSON.stringify(thisTemp[thisTemp.length-1]));
|
|||
|
obj["clockInfo"]=thisTemp;
|
|||
|
obj["post"]="保安"
|
|||
|
tempData.push(obj)
|
|||
|
}
|
|||
|
layuiObj.layuitable.render({
|
|||
|
elem:'#staffSignHistoryTable',
|
|||
|
data:tempData,
|
|||
|
cols: [[
|
|||
|
{field:'persionName', width:"19%", title: '姓名'},
|
|||
|
{field:'post', width:"19%", title: '职务'},
|
|||
|
{field:'clockInfo', width:"22%", title: '打卡次数',templet : function(data) {// 替换数据
|
|||
|
var clockInfo=data["clockInfo"];
|
|||
|
return clockInfo.length;
|
|||
|
},sort: true},
|
|||
|
{field:'time', width:"38%", title: '打卡时间'},
|
|||
|
]],
|
|||
|
limit:Number.MAX_VALUE // 数据表格默认全部显示
|
|||
|
});
|
|||
|
|
|||
|
//监听行工具事件
|
|||
|
layuiObj.layuitable.on('row(staffSignHistoryTable)',function(obj){
|
|||
|
var clockInfo=obj["data"]["clockInfo"]
|
|||
|
openClockInfo(clockInfo);
|
|||
|
})
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
export {showStaffSignHistory}
|