100 lines
3.3 KiB
JavaScript
100 lines
3.3 KiB
JavaScript
|
import { layuiObj } from "../index.js";
|
|||
|
import { stationurl } from "../../../../public/js/url.js";
|
|||
|
import {getCurrData} from "../../../../public/js/timestamp.js"
|
|||
|
function getEntranceStaffSign(data){
|
|||
|
var obj={
|
|||
|
"brigade":data["brigade"],
|
|||
|
"borough":data["borough"],
|
|||
|
"detachment":data["detachment"],
|
|||
|
"station":data["name"],
|
|||
|
"start":getCurrData()+" 00:00:00",
|
|||
|
"end":getCurrData()+" 23:59:59",
|
|||
|
}
|
|||
|
var loginurl=stationurl+"/firectrl/client/sensor/entrance/staff_sign_list";
|
|||
|
return axios({
|
|||
|
method: 'post',
|
|||
|
url:loginurl,
|
|||
|
data: obj
|
|||
|
})
|
|||
|
}
|
|||
|
|
|||
|
function showEntranceStaffSign(data){
|
|||
|
var tempData=[];
|
|||
|
var tempObj={};
|
|||
|
if(data!=null){
|
|||
|
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:'#policeInfoTable',
|
|||
|
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(policeInfoTable)',function(obj){
|
|||
|
var clockInfo=obj["data"]["clockInfo"]
|
|||
|
openClockInfo(clockInfo);
|
|||
|
})
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
var clockInfoIndex=null;
|
|||
|
function openClockInfo(clockInfo){
|
|||
|
clockInfoIndex=layuiObj.layer.open({
|
|||
|
type: 1,
|
|||
|
title: '打卡信息', //不显示标题栏
|
|||
|
offset: 'auto',
|
|||
|
area: ['540px', '480px'],
|
|||
|
shade: 0.6,
|
|||
|
id:new Date().getTime(), //设定一个id,防止重复弹出
|
|||
|
btnAlign: 'c',
|
|||
|
moveType: 1, //拖拽模式,0或者1
|
|||
|
content: `
|
|||
|
<div style="padding:10px;color:#000;background:#032357;height:418px;overflow-y:auto;">
|
|||
|
<table class="layui-hide" id="clockInfTable" lay-filter="clockInfTable"></table>
|
|||
|
</div>`,
|
|||
|
success: function(layero){
|
|||
|
layuiObj.layuitable.render({
|
|||
|
elem:'#clockInfTable',
|
|||
|
data:clockInfo,
|
|||
|
cols: [[
|
|||
|
{field:'persionName', width:"24%", title: '姓名'},
|
|||
|
{field:'post', width:"24%", title: '职务'},
|
|||
|
{field:'time', width:"50%", title: '打卡时间'},
|
|||
|
]],
|
|||
|
limit:Number.MAX_VALUE // 数据表格默认全部显示
|
|||
|
});
|
|||
|
}
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
export {
|
|||
|
getEntranceStaffSign,
|
|||
|
showEntranceStaffSign,
|
|||
|
openClockInfo
|
|||
|
}
|