220 lines
8.2 KiB
JavaScript
220 lines
8.2 KiB
JavaScript
|
import { layuiObj } from "./index.js";
|
|||
|
import { getCurrData,timestampFormatTime} from "../../../public/js/timestamp.js";
|
|||
|
import { getSchoolOptions } from "./schoolSearch.js";
|
|||
|
import { getPoliceAlarm } from "../api/getPoliceAlarm.js";
|
|||
|
import { getPushButtonList } from "../api/getPushButtonList.js";
|
|||
|
import { getaiBehavioralEventList } from "../api/getAiEventList.js";
|
|||
|
import { stationurl,brigade } from "../../../public/js/url.js";
|
|||
|
|
|||
|
let earlyWarningHistoryList=[];
|
|||
|
let pushButtonHistoryList=[];
|
|||
|
let aiHistoryList=[];
|
|||
|
function openAlarmHistory(){
|
|||
|
layuiObj["layer"].open({
|
|||
|
type: 1,
|
|||
|
title: "预警记录", //不显示标题栏
|
|||
|
// closeBtn: false,
|
|||
|
area: ['1000px', '560px'],
|
|||
|
id: new Date().getTime(), //设定一个id,防止重复弹出
|
|||
|
btnAlign: 'c',
|
|||
|
resize:false,
|
|||
|
// moveType: 0, //拖拽模式,0或者1
|
|||
|
content:`<div class="popintellEarlyWarningInfo popWindows">
|
|||
|
<div class="intellEarlyWarningInfo">
|
|||
|
<div class="intellEarlyWarningInfoContent">
|
|||
|
<form class="layui-form" action="" id="intellEarlyWarningHistoryForm" lay-filter="intellEarlyWarningHistoryForm" >
|
|||
|
|
|||
|
|
|||
|
<div class="layui-input-inline">
|
|||
|
<select name="interest" lay-filter="intellEarlyWarningType" id="intellEarlyWarningType" lay-search>
|
|||
|
<option value="1">天网</option>
|
|||
|
<option value="2">一键报警</option>
|
|||
|
<option value="3">身份证</option>
|
|||
|
<option value="4">行为预警</option>
|
|||
|
</select>
|
|||
|
</div>
|
|||
|
|
|||
|
<div class="layui-input-inline">
|
|||
|
<select name="interest" lay-filter="intellEarlyWarningSchoolSelect" id="intellEarlyWarningSchoolSelect" lay-search></select>
|
|||
|
</div>
|
|||
|
<div class="layui-input-inline">
|
|||
|
<input type="text" class="layui-input" id="intellEarlyWarningHistoryStart" placeholder="请输入开始时间" value='${getCurrData()} 00:00:00'>
|
|||
|
</div>
|
|||
|
<div class="layui-input-inline">
|
|||
|
<input type="text" class="layui-input" id="intellEarlyWarningHistoryEnd" placeholder="请输入结束时间" value='${getCurrData()} 23:59:59'>
|
|||
|
</div>
|
|||
|
<div class="layui-input-inline">
|
|||
|
<button type="button" class="layui-btn" id="intellEarlyWarningHistoryBtn" style="height:38px !important;line-height:38px !important;">查询</button>
|
|||
|
</div>
|
|||
|
</form>
|
|||
|
|
|||
|
<div class="intellEarlyWarningList">
|
|||
|
<table class="layui-hide" id="intellEarlyWarningTable" lay-filter="intellEarlyWarningTable"></table>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</div>`,
|
|||
|
success:function(){
|
|||
|
renderClockFrom();
|
|||
|
intellEarlyWarningSelectEvent();
|
|||
|
}
|
|||
|
})
|
|||
|
}
|
|||
|
|
|||
|
function renderClockFrom(){
|
|||
|
$("#intellEarlyWarningSchoolSelect").html(getSchoolOptions());
|
|||
|
layuiObj.layuiForm.render("select","intellEarlyWarningHistoryForm");
|
|||
|
$("#intellEarlyWarningSchoolSelect").siblings("div.layui-form-select").find("div.layui-select-title").find("input").attr("onfocus","this.select()");
|
|||
|
layuiObj.laydate.render({
|
|||
|
elem: '#intellEarlyWarningHistoryStart',
|
|||
|
type: 'datetime',
|
|||
|
});
|
|||
|
layuiObj.laydate.render({
|
|||
|
elem: '#intellEarlyWarningHistoryEnd',
|
|||
|
type: 'datetime',
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
function intellEarlyWarningSelectEvent(){
|
|||
|
$("#intellEarlyWarningHistoryBtn").off('')
|
|||
|
$("#intellEarlyWarningHistoryBtn").on('click',(e)=>{
|
|||
|
var start=$("#intellEarlyWarningHistoryStart").val();
|
|||
|
var end=$("#intellEarlyWarningHistoryEnd").val();
|
|||
|
var station=$("#intellEarlyWarningSchoolSelect").find("option:selected").val();
|
|||
|
var type=$("#intellEarlyWarningType").find("option:selected").val();
|
|||
|
var data={
|
|||
|
"brigade":brigade,
|
|||
|
"start":start,
|
|||
|
"end":end
|
|||
|
}
|
|||
|
if(station!="000"){
|
|||
|
data["station"]=station
|
|||
|
}
|
|||
|
|
|||
|
switch(type){
|
|||
|
case "1":
|
|||
|
showPoliceAlarmHistory(data)
|
|||
|
break;
|
|||
|
case "2":
|
|||
|
showPushButtonHistory(data)
|
|||
|
break;
|
|||
|
case "3":
|
|||
|
console.log("身份证")
|
|||
|
break;
|
|||
|
case "4":
|
|||
|
showAiHistory(data)
|
|||
|
break;
|
|||
|
default:
|
|||
|
break;
|
|||
|
}
|
|||
|
return false;
|
|||
|
})
|
|||
|
}
|
|||
|
|
|||
|
function showPoliceAlarmHistory(data){
|
|||
|
getPoliceAlarm(data).then(res=>{
|
|||
|
var code=res["data"]["code"];
|
|||
|
if(code==0){
|
|||
|
var data=res["data"]["data"];
|
|||
|
if(data!=null){
|
|||
|
earlyWarningHistoryList=data;
|
|||
|
earlyWarningHistoryList.reverse();
|
|||
|
}
|
|||
|
}
|
|||
|
showEarlyWarningTable();
|
|||
|
})
|
|||
|
}
|
|||
|
|
|||
|
function showPushButtonHistory(data){
|
|||
|
|
|||
|
|
|||
|
getPushButtonList(data).then(res=>{
|
|||
|
var code=res["data"]["code"];
|
|||
|
if(code==0){
|
|||
|
var data=res["data"]["data"];
|
|||
|
if(data!=null){
|
|||
|
pushButtonHistoryList=data;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
pushButtonHistoryList.reverse();
|
|||
|
}
|
|||
|
}
|
|||
|
showPushButtonTable();
|
|||
|
})
|
|||
|
}
|
|||
|
|
|||
|
function showAiHistory(data){
|
|||
|
getaiBehavioralEventList(data).then(res=>{
|
|||
|
var code=res["data"]["code"];
|
|||
|
if(code==0){
|
|||
|
var data=res["data"]["data"];
|
|||
|
if(data!=null){
|
|||
|
aiHistoryList=data;
|
|||
|
aiHistoryList.reverse();
|
|||
|
}
|
|||
|
}
|
|||
|
showAiTable();
|
|||
|
})
|
|||
|
}
|
|||
|
|
|||
|
function showEarlyWarningTable(){
|
|||
|
layuiObj.layuitable.render({
|
|||
|
elem:'#intellEarlyWarningTable',
|
|||
|
data:earlyWarningHistoryList,
|
|||
|
toolbar: '#toolbarDemo', // 重点,可默认,也可自己设置按钮
|
|||
|
defaultToolbar: ['filter', 'exports'], // exports为导出按钮
|
|||
|
cols: [[
|
|||
|
{field:'station', width:"20%", title: '学校名称'},
|
|||
|
{field:'cameraName', width:"20%", title: '地址'},
|
|||
|
{field:'personName', width:"20%", title: '姓名'},
|
|||
|
{field:'alarmTime', width:"20%", title: '时间',templet : function(data) {
|
|||
|
return `${timestampFormatTime(new Date(data["alarmTime"]).getTime())}`;
|
|||
|
}},
|
|||
|
{field:'', width:"20%", title: '图片',templet : function(data) {
|
|||
|
|
|||
|
return `<img src='${data["snappedPicUrl"]}'>`;
|
|||
|
}},
|
|||
|
]],
|
|||
|
limit:Number.MAX_VALUE // 数据表格默认全部显示
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
function showPushButtonTable(){
|
|||
|
layuiObj.layuitable.render({
|
|||
|
elem:'#intellEarlyWarningTable',
|
|||
|
data:pushButtonHistoryList,
|
|||
|
toolbar: '#toolbarDemo', // 重点,可默认,也可自己设置按钮
|
|||
|
defaultToolbar: ['filter', 'exports'], // exports为导出按钮
|
|||
|
cols: [[
|
|||
|
{field:'station', width:"25%", title: '学校名称'},
|
|||
|
{field:'subAddress', width:"25%", title: '设备名称'},
|
|||
|
{field:'address', width:"25%", title: '地址'},
|
|||
|
{field:'timestamp', width:"25%", title: '时间'}
|
|||
|
]],
|
|||
|
limit:Number.MAX_VALUE // 数据表格默认全部显示
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
function showAiTable(){
|
|||
|
layuiObj.layuitable.render({
|
|||
|
elem:'#intellEarlyWarningTable',
|
|||
|
data:aiHistoryList,
|
|||
|
toolbar: '#toolbarDemo', // 重点,可默认,也可自己设置按钮
|
|||
|
defaultToolbar: ['filter', 'exports'], // exports为导出按钮
|
|||
|
cols: [[
|
|||
|
{field:'station', width:"20%", title: '学校名称'},
|
|||
|
{field:'channelName', width:"20%", title: '通道名'},
|
|||
|
{field:'warnName', width:"20%", title: '行为'},
|
|||
|
{field:'receiveTime', width:"20%", title: '时间'},
|
|||
|
{field:'', width:"20%", title: '图片',templet : function(data) {
|
|||
|
var src=stationurl+data["imageUrl"]
|
|||
|
return `<img src='${src}'>`;
|
|||
|
}},
|
|||
|
]],
|
|||
|
limit:Number.MAX_VALUE // 数据表格默认全部显示
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
export {openAlarmHistory}
|