417 lines
15 KiB
JavaScript
417 lines
15 KiB
JavaScript
let layer,table,form,laydate;
|
|
const bidCode = parent.$('#bidPro').val();
|
|
layui.use(['layer','table','form','laydate'], function () {
|
|
layer = layui.layer;
|
|
table = layui.table;
|
|
form = layui.form;
|
|
laydate = layui.laydate;
|
|
|
|
//时间范围设置
|
|
laydate.render({
|
|
elem: '#date1',
|
|
range: true,
|
|
type: 'datetime',
|
|
range: '~',
|
|
change: function(value, date, endDate){
|
|
|
|
}
|
|
});
|
|
|
|
//时间范围设置
|
|
laydate.render({
|
|
elem: '#date2',
|
|
range: true,
|
|
type: 'datetime',
|
|
range: '~',
|
|
change: function(value, date, endDate){
|
|
|
|
}
|
|
});
|
|
|
|
//今日、当月车辆出入场统计
|
|
getVehicleStatistics();
|
|
|
|
// //今日、当月车辆出入场统计图片
|
|
getVehicleStatisticsPhoto("1","1");
|
|
|
|
// //今日、当月车辆出入场统计列表
|
|
getVehicleStatisticsList(bidCode);
|
|
|
|
// //今日、当月人员出入场统计
|
|
getPerStatistics();
|
|
|
|
// //今日、当月人员出入场统计图片
|
|
getPerStatisticsPhoto("1","1");
|
|
|
|
// //今日、当月人员出入场统计列表
|
|
getPerStatisticsList(bidCode);
|
|
});
|
|
|
|
function getVehicleStatistics(){
|
|
let paramData = 'bidCode=' + bidCode + '&roleCode=' + roleCode + '&orgId=' + orgId + '&userId=' + userId;
|
|
let montageParam = aqEnnable ? encryptCBC(paramData) : ' &' + encryptCBC(paramData);
|
|
const url = commonUrl + "screen/largeScreen/accessMge/getVehicleStatistics?params="+montageParam; // url
|
|
ajaxRequestGet(url, "GET", true, function () {
|
|
}, function (result) {
|
|
if (result.code === 200) {
|
|
if (result.data && result.data.length > 0) {
|
|
//今日、当月车辆出入场统计
|
|
getStatistics(result.data)
|
|
}else{
|
|
//今日、当月车辆出入场统计
|
|
getStatistics("")
|
|
}
|
|
} else if (result.code === 500) {
|
|
layer.msg(result.msg, { icon: 2 });
|
|
}
|
|
}, function (xhr, status, error) {
|
|
error(xhr, status, error)
|
|
}, aqEnnable);
|
|
}
|
|
|
|
function getStatistics(data){
|
|
if(data!=""){
|
|
var jtrNum = data[0].jtrNum;
|
|
var jrcNum = data[0].jrcNum;
|
|
var dyrNum = data[0].dyrNum;
|
|
var dycNum = data[0].dycNum;
|
|
}else{
|
|
var jtrNum = "000";
|
|
var jrcNum = "000";
|
|
var dyrNum = "0000";
|
|
var dycNum = "0000";
|
|
}
|
|
const jtrNums = jtrNum.split("").map(Number);
|
|
document.getElementById("oner").textContent=jtrNums[0];
|
|
document.getElementById("twor").textContent=jtrNums[1];
|
|
document.getElementById("threer").textContent=jtrNums[2];
|
|
|
|
const jrcNums = jrcNum.split("").map(Number);
|
|
document.getElementById("onec").textContent=jrcNums[0];
|
|
document.getElementById("twoc").textContent=jrcNums[1];
|
|
document.getElementById("threec").textContent=jrcNums[2];
|
|
|
|
const dyrNums = dyrNum.split("").map(Number);
|
|
document.getElementById("onesr").textContent=dyrNums[0];
|
|
document.getElementById("twosr").textContent=dyrNums[1];
|
|
document.getElementById("threesr").textContent=dyrNums[2];
|
|
document.getElementById("foursr").textContent=dyrNums[3];
|
|
|
|
const dycNums = dycNum.split("").map(Number);
|
|
document.getElementById("onesc").textContent=dycNums[0];
|
|
document.getElementById("twosc").textContent=dycNums[1];
|
|
document.getElementById("threesc").textContent=dycNums[2];
|
|
document.getElementById("foursc").textContent=dycNums[3];
|
|
|
|
var s = "../../img/video/voi_photo4.png";
|
|
var htmls = '<img src ="'+s+'" alt="" style="height:100%;width:100%; margin-top:5%" />';
|
|
$('#photo').empty().append(htmls);
|
|
|
|
}
|
|
|
|
function getVehicleStatisticsPhoto(accessType,timeType){
|
|
let paramData = 'bidCode=' + bidCode + '&roleCode=' + roleCode + '&orgId=' + orgId + '&userId=' + userId + '&accessType=' + accessType + '&timeType=' + timeType;
|
|
let montageParam = aqEnnable ? encryptCBC(paramData) : ' &' + encryptCBC(paramData);
|
|
const url = commonUrl + "screen/largeScreen/accessMge/getVehicleStatisticsPhoto?params="+montageParam; // url
|
|
ajaxRequestGet(url, "GET", true, function () {
|
|
}, function (result) {
|
|
let html = '';
|
|
if (result.code === 200) {
|
|
if (result.data && result.data.length > 0) {
|
|
var s = "https://unpkg.com/outeres/demo/carousel/720x360-1.jpg";
|
|
var a = "sss";
|
|
$.each(result.data, function (index, item) {
|
|
html +='<div class="abnormalAlarmImg">';
|
|
html +='<img src ="'+s+'" alt="" style="height:100%;width:100%; margin-top:5%" />';
|
|
html +='<span>'+ a +'</span>';
|
|
html +='</div>';
|
|
})
|
|
}else{
|
|
// html += '<div style="color:#71757B;">无数据</div>'
|
|
|
|
html +='<div class="abnormalAlarmImg">';
|
|
html +='<img src ="../../img/video/voi_photo.png" alt="" style="height:85%;width:100%; margin-top:5%" />';
|
|
html +='<span>告警1</span>';
|
|
html +='</div>';
|
|
|
|
html +='<div class="abnormalAlarmImg">';
|
|
html +='<img src ="../../img/video/voi_photo2.png" alt="" style="height:85%;width:100%; margin-top:5%" />';
|
|
html +='<span>告警2</span>';
|
|
html +='</div>';
|
|
|
|
html +='<div class="abnormalAlarmImg">';
|
|
html +='<img src ="../../img/video/voi_photo3.png" alt="" style="height:85%;width:100%; margin-top:5%" />';
|
|
html +='<span>告警3</span>';
|
|
html +='</div>';
|
|
|
|
html +='<div class="abnormalAlarmImg">';
|
|
html +='<img src ="../../img/video/voi_photo4.png" alt="" style="height:85%;width:100%; margin-top:5%" />';
|
|
html +='<span>告警4</span>';
|
|
html +='</div>';
|
|
}
|
|
} else if (result.code === 500) {
|
|
layer.msg(result.msg, { icon: 2 });
|
|
}
|
|
$('#abnormalAlarm').empty().append(html);
|
|
}, function (xhr, status, error) {
|
|
error(xhr, status, error)
|
|
}, aqEnnable);
|
|
}
|
|
|
|
function getVehicleStatisticsList(bidCode){
|
|
const url = commonUrl + "screen/largeScreen/accessMge/getVehicleStatisticsList"; // url
|
|
table.render({
|
|
elem: '#demo1',
|
|
url: url,
|
|
skin: 'line',
|
|
page: true,
|
|
headers:{
|
|
decrypt:"decrypt",
|
|
"Authorization":token
|
|
},
|
|
where: {
|
|
bidCode:bidCode,
|
|
proName:$('#proName1').val(),
|
|
carNum:$('#carNum1').val(),
|
|
date:$('#date1').val()
|
|
},
|
|
cols: [[
|
|
{type: 'numbers', title: '序号'}, // 添加序号列
|
|
{field: 'proName', title: '工程名称',align:'center'},
|
|
{field: 'carNum', title: '车牌号',align:'center'},
|
|
{field: 'userName', title: '司机',align:'center'},
|
|
{field: 'phone', title: '司机电话',align:'center'},
|
|
{field: 'accessType', title: '状态',align:'center'},
|
|
{field: 'accesssTime', title: '时间',align:'center'}
|
|
]],
|
|
initComplete: function () {
|
|
// 在表格渲染完成后,重新渲染序号列
|
|
var that = this.elem.next();
|
|
var tool = that.children('.layui-table-box').children('.layui-table-fixed').children('.layui-table-body').children('.layui-table');
|
|
tool.find("tr").each(function (index, item) {
|
|
$(this).find('td[data-field="LAY_TABLE_INDEX"]').text(index + 1);
|
|
});
|
|
},
|
|
done:function(res, curr, count, origin){
|
|
console.log(res);
|
|
}
|
|
})
|
|
}
|
|
|
|
function getPerStatistics(){
|
|
let paramData = 'bidCode=' + bidCode + '&roleCode=' + roleCode + '&orgId=' + orgId + '&userId=' + userId;
|
|
let montageParam = aqEnnable ? encryptCBC(paramData) : ' &' + encryptCBC(paramData);
|
|
const url = commonUrl + "screen/largeScreen/accessMge/getPerStatistics?params="+montageParam; // url
|
|
|
|
ajaxRequestGet(url, "GET", true, function () {
|
|
}, function (result) {
|
|
if (result.code === 200) {
|
|
if (result.data && result.data.length > 1) {
|
|
getStatisticsPer(result.data)
|
|
}else{
|
|
getStatisticsPer("")
|
|
}
|
|
} else if (result.code === 500) {
|
|
layer.msg(result.msg, { icon: 2 });
|
|
}
|
|
}, function (xhr, status, error) {
|
|
error(xhr, status, error)
|
|
setData(null);
|
|
}, aqEnnable);
|
|
}
|
|
|
|
function getStatisticsPer(data){
|
|
if(data!=""){
|
|
var jtrNum = data[0].jtrNum;
|
|
var jrcNum = data[0].jrcNum;
|
|
var dyrNum = data[0].dyrNum;
|
|
var dycNum = data[0].dycNum;
|
|
}else{
|
|
var jtrNum = "000";
|
|
var jrcNum = "000";
|
|
var dyrNum = "0000";
|
|
var dycNum = "0000";
|
|
}
|
|
|
|
const jtrNums = jtrNum.split("").map(Number);
|
|
document.getElementById("onerPer").textContent=jtrNums[0];
|
|
document.getElementById("tworPer").textContent=jtrNums[1];
|
|
document.getElementById("threerPer").textContent=jtrNums[2];
|
|
|
|
const jrcNums = jrcNum.split("").map(Number);
|
|
document.getElementById("onecPer").textContent=jrcNums[0];
|
|
document.getElementById("twocPer").textContent=jrcNums[1];
|
|
document.getElementById("threecPer").textContent=jrcNums[2];
|
|
|
|
const dyrNums = dyrNum.split("").map(Number);
|
|
document.getElementById("onesrPer").textContent=dyrNums[0];
|
|
document.getElementById("twosrPer").textContent=dyrNums[1];
|
|
document.getElementById("threesrPer").textContent=dyrNums[2];
|
|
document.getElementById("foursrPer").textContent=dyrNums[3];
|
|
|
|
const dycNums = dycNum.split("").map(Number);
|
|
document.getElementById("onescPer").textContent=dycNums[0];
|
|
document.getElementById("twoscPer").textContent=dycNums[1];
|
|
document.getElementById("threescPer").textContent=dycNums[2];
|
|
document.getElementById("fourscPer").textContent=dycNums[3];
|
|
|
|
var s = "../../img/video/voi_photo4.png";
|
|
var htmls = '<img src ="'+s+'" alt="" style="height:100%;width:100%; margin-top:5%" />';
|
|
$('#photos').empty().append(htmls);
|
|
}
|
|
|
|
function getPerStatisticsPhoto(accessType,timeType){
|
|
let paramData = 'bidCode=' + bidCode + '&roleCode=' + roleCode + '&orgId=' + orgId + '&userId=' + userId + '&accessType=' + accessType + '&timeType=' + timeType;
|
|
let montageParam = aqEnnable ? encryptCBC(paramData) : ' &' + encryptCBC(paramData);
|
|
const url = commonUrl + "screen/largeScreen/accessMge/getPerStatisticsPhoto?params="+montageParam; // url
|
|
ajaxRequestGet(url, "GET", true, function () {
|
|
}, function (result) {
|
|
let html = '';
|
|
if (result.code === 200) {
|
|
if (result.data && result.data.length > 0) {
|
|
var s = "https://unpkg.com/outeres/demo/carousel/720x360-1.jpg";
|
|
var a = "sss";
|
|
$.each(result.data, function (index, item) {
|
|
html +='<div class="abnormalAlarmImg">';
|
|
html +='<img src ="'+s+'" alt="" style="height:95%;width:100%; margin-top:5%" />';
|
|
html +='<span>'+ a +'</span>';
|
|
html +='</div>';
|
|
})
|
|
}else{
|
|
// html += '<div style="color:#71757B;">无数据</div>'
|
|
html +='<div class="abnormalAlarmImg">';
|
|
html +='<img src ="../../img/video/voi_photo.png" alt="" style="height:85%;width:100%; margin-top:5%" />';
|
|
html +='<span>告警1</span>';
|
|
html +='</div>';
|
|
|
|
html +='<div class="abnormalAlarmImg">';
|
|
html +='<img src ="../../img/video/voi_photo2.png" alt="" style="height:85%;width:100%; margin-top:5%" />';
|
|
html +='<span>告警2</span>';
|
|
html +='</div>';
|
|
|
|
html +='<div class="abnormalAlarmImg">';
|
|
html +='<img src ="../../img/video/voi_photo3.png" alt="" style="height:85%;width:100%; margin-top:5%" />';
|
|
html +='<span>告警3</span>';
|
|
html +='</div>';
|
|
|
|
html +='<div class="abnormalAlarmImg">';
|
|
html +='<img src ="../../img/video/voi_photo4.png" alt="" style="height:85%;width:100%; margin-top:5%" />';
|
|
html +='<span>告警4</span>';
|
|
html +='</div>';
|
|
}
|
|
} else if (result.code === 500) {
|
|
layer.msg(result.msg, { icon: 2 });
|
|
}
|
|
$('#abnormalAlarms').empty().append(html);
|
|
}, function (xhr, status, error) {
|
|
error(xhr, status, error)
|
|
}, aqEnnable);
|
|
}
|
|
|
|
function getPerStatisticsList(bidCode){
|
|
const url = commonUrl + "screen/largeScreen/accessMge/getPerStatisticsList"; // url
|
|
table.render({
|
|
elem: '#demo2',
|
|
url: url,
|
|
skin: 'line',
|
|
page: true,
|
|
headers:{
|
|
decrypt:"decrypt",
|
|
"Authorization":token
|
|
},
|
|
where: {
|
|
bidCode:bidCode,
|
|
proName:$('#proName2').val(),
|
|
userName:$('#userName').val(),
|
|
date:$('#date2').val()
|
|
},
|
|
cols: [[
|
|
{type: 'numbers', title: '序号'}, // 添加序号列
|
|
{field: 'proName', title: '工程名称',align:'center'},
|
|
{field: 'userName', title: '姓名',align:'center'},
|
|
{field: 'phone', title: '电话',align:'center'},
|
|
{field: 'accessType', title: '状态',align:'center'},
|
|
{field: 'accesssTime', title: '时间',align:'center'}
|
|
]],
|
|
initComplete: function () {
|
|
// 在表格渲染完成后,重新渲染序号列
|
|
var that = this.elem.next();
|
|
var tool = that.children('.layui-table-box').children('.layui-table-fixed').children('.layui-table-body').children('.layui-table');
|
|
tool.find("tr").each(function (index, item) {
|
|
$(this).find('td[data-field="LAY_TABLE_INDEX"]').text(index + 1);
|
|
});
|
|
},
|
|
done:function(res, curr, count, origin){
|
|
console.log(res);
|
|
}
|
|
})
|
|
}
|
|
|
|
function getQueryList(type){
|
|
if(type==1){
|
|
getVehicleStatisticsList(bidCode);
|
|
}else{
|
|
getPerStatisticsList(bidCode);
|
|
}
|
|
}
|
|
|
|
|
|
function exportVehicleData(){
|
|
let proName = $('#proName1').val();
|
|
let carNum = $('#carNum1').val();
|
|
let date = $('#date1').val();
|
|
let paramData = 'bidCode=' + bidCode + '&roleCode=' + roleCode + '&orgId=' + orgId + '&userId=' + userId + '&proName=' + proName + '&carNum=' + carNum + '&date=' + date;
|
|
let montageParam = aqEnnable ? encryptCBC(paramData) : ' &' + encryptCBC(paramData);
|
|
const url = commonUrl + "screen/largeScreen/accessMge/exportVehicleData?params=" + montageParam; // url
|
|
ajaxRequestGetExport(url, "GET", true, function () {
|
|
}, function (blob, status, xhr) {
|
|
// 创建一个 Blob 对象
|
|
var url = window.URL.createObjectURL(blob);
|
|
// 创建一个隐藏的 <a> 标签
|
|
var link = document.createElement('a');
|
|
link.href = url;
|
|
link.download = '今日、当月车辆出入场统计.xlsx'; // 设置下载文件的名称,假设是 Excel 文件
|
|
// 将 <a> 标签添加到文档中
|
|
document.body.appendChild(link);
|
|
// 触发 <a> 标签的 click 事件来下载文件
|
|
link.click();
|
|
// 释放 URL 对象
|
|
window.URL.revokeObjectURL(url);
|
|
// 移除 <a> 标签
|
|
document.body.removeChild(link);
|
|
}, function (xhr, status, error) {
|
|
error(xhr, status, error)
|
|
}, aqEnnable);
|
|
}
|
|
|
|
function exportPerData(){
|
|
let proName = $('#proName2').val();
|
|
let userName = $('#userName').val();
|
|
let date = $('#date2').val();
|
|
let paramData = 'bidCode=' + bidCode + '&roleCode=' + roleCode + '&orgId=' + orgId + '&userId=' + userId + '&proName=' + proName + '&userName=' + userName + '&date=' + date;
|
|
let montageParam = aqEnnable ? encryptCBC(paramData) : ' &' + encryptCBC(paramData);
|
|
const url = commonUrl + "screen/largeScreen/accessMge/exportPerData?params=" + montageParam; // url
|
|
ajaxRequestGetExport(url, "GET", true, function () {
|
|
}, function (blob, status, xhr) {
|
|
|
|
// 创建一个 Blob 对象
|
|
var url = window.URL.createObjectURL(blob);
|
|
// 创建一个隐藏的 <a> 标签
|
|
var link = document.createElement('a');
|
|
link.href = url;
|
|
link.download = '今日、当月人员出入场统计.xlsx'; // 设置下载文件的名称,假设是 Excel 文件
|
|
// 将 <a> 标签添加到文档中
|
|
document.body.appendChild(link);
|
|
|
|
// 触发 <a> 标签的 click 事件来下载文件
|
|
link.click();
|
|
|
|
// 释放 URL 对象
|
|
window.URL.revokeObjectURL(url);
|
|
|
|
// 移除 <a> 标签
|
|
document.body.removeChild(link);
|
|
}, function (xhr, status, error) {
|
|
error(xhr, status, error)
|
|
}, aqEnnable);
|
|
} |