359 lines
9.7 KiB
JavaScript
359 lines
9.7 KiB
JavaScript
|
import { getFaceAlarmStationSummary } from "../api/getFaceAlarmStationSummary.js";
|
|||
|
import { getFaceAlarmBlacklistSummary } from "../api/getFaceAlarmBlacklistSummary.js";
|
|||
|
import { layuiObj,eventMap} from "./index.js";
|
|||
|
import {drawAlarmEventMarker} from "./marker/schoolMarker.js";
|
|||
|
import { brigade } from "../../../public/js/url.js";
|
|||
|
import { getPoliceAlarm } from "../api/getPoliceAlarm.js";
|
|||
|
import { getPersonBlackList } from "../api/getPersonInfo.js";
|
|||
|
import { getTime } from "./time.js";
|
|||
|
import { timestampFormatTime } from "../../../public/js/timestamp.js";
|
|||
|
import { stationurl } from "../../../public/js/url.js";
|
|||
|
|
|||
|
let policeAlarmList=[];
|
|||
|
let policeAlarmItemList=[];//保存的是每一条记录
|
|||
|
var currentStation="";
|
|||
|
var polygonArr=[];
|
|||
|
|
|||
|
//按照学校统计天网的告警
|
|||
|
function showPoliceAlarm(){
|
|||
|
var reqdata={
|
|||
|
brigade,
|
|||
|
pageindex: 0,
|
|||
|
pagesize: 2000,
|
|||
|
year:(new Date().getFullYear()).toString(),
|
|||
|
month:(new Date().getMonth()+1).toString(),
|
|||
|
day:(new Date().getDate()).toString()
|
|||
|
}
|
|||
|
getFaceAlarmStationSummary(reqdata).then(res=>{
|
|||
|
var code=res["data"]["code"];
|
|||
|
if(code==0){
|
|||
|
var data=res["data"]["data"];
|
|||
|
if(data!=null){
|
|||
|
policeAlarmList=data;
|
|||
|
policeAlarmList.reverse();
|
|||
|
}
|
|||
|
}
|
|||
|
showPoliceAlarmDiv();
|
|||
|
})
|
|||
|
}
|
|||
|
|
|||
|
//按照人员的统计
|
|||
|
|
|||
|
function showPersonPoliceAlarm(){
|
|||
|
var reqdata={
|
|||
|
brigade,
|
|||
|
pageindex: 0,
|
|||
|
pagesize: 2000,
|
|||
|
year:(new Date().getFullYear()).toString(),
|
|||
|
month:(new Date().getMonth()+1).toString(),
|
|||
|
day:(new Date().getDate()).toString()
|
|||
|
}
|
|||
|
getFaceAlarmBlacklistSummary(reqdata).then(res=>{
|
|||
|
var code=res["data"]["code"];
|
|||
|
if(code==0){
|
|||
|
var data=res["data"]["data"];
|
|||
|
if(data!=null){
|
|||
|
policeAlarmList=data;
|
|||
|
policeAlarmList.reverse();
|
|||
|
}
|
|||
|
}
|
|||
|
showPoliceAlarmDiv();
|
|||
|
})
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
function showPoliceAlarmDiv(){
|
|||
|
var div="";
|
|||
|
for(var i=0;i<policeAlarmList.length;i++){
|
|||
|
div+=getAlarmPersonInfoDiv(policeAlarmList[i],"broadCast");
|
|||
|
}
|
|||
|
$(".warnInfoListall").html(div);
|
|||
|
layuiObj["layuiForm"].render(null,"policeAlarmForm")
|
|||
|
addAlarmEventClick();
|
|||
|
}
|
|||
|
|
|||
|
function addAlarmEventClick(){
|
|||
|
$(".warnInfoListall>div").on('click',function(){
|
|||
|
var eventId=$(this).attr("eventId");
|
|||
|
var type=$(this).attr("type");
|
|||
|
currentStation=eventId
|
|||
|
if(type=="station"){
|
|||
|
var reqData={
|
|||
|
station:eventId,
|
|||
|
}
|
|||
|
}else{
|
|||
|
var reqData={
|
|||
|
certificateNumber:eventId,
|
|||
|
}
|
|||
|
}
|
|||
|
var time=getTime();
|
|||
|
reqData["pageindex"]=0;
|
|||
|
reqData["pagesize"]=2000
|
|||
|
reqData["start"]=time["startTime"]
|
|||
|
reqData["end"]=time["endTime"]
|
|||
|
getPoliceAlarm(reqData).then(res=>{
|
|||
|
console.log(res);
|
|||
|
var code=res["data"]["code"];
|
|||
|
if(code==0){
|
|||
|
var data=res["data"]["data"]
|
|||
|
if(data!=null){
|
|||
|
policeAlarmItemList=data;
|
|||
|
policeAlarmItemList.reverse();
|
|||
|
drawAlarmEventMarker(data);
|
|||
|
showSchoolInfoBox(data,type)
|
|||
|
}
|
|||
|
}
|
|||
|
})
|
|||
|
})
|
|||
|
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
function openPoliceAlarm(item){
|
|||
|
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 style="padding:10px;color:#fff;background:#032357;height:calc(100% - 20px);overflow-y:auto;" class="aIBehavioralPop">
|
|||
|
${showPoliceAlarmItemDetail(item)}
|
|||
|
</div>`,
|
|||
|
success: function(layero){
|
|||
|
console.log(item);
|
|||
|
}
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
//显示学校信息
|
|||
|
function showStationInfo(list){
|
|||
|
var item=list[0];
|
|||
|
return `
|
|||
|
<div>
|
|||
|
<p>
|
|||
|
<span>学校名称:</span>
|
|||
|
<span>${item["station"]}</span>
|
|||
|
</p>
|
|||
|
|
|||
|
</div>
|
|||
|
<div>
|
|||
|
<p>
|
|||
|
<span>派出所:</span>
|
|||
|
<span>${item["borough"]}</span>
|
|||
|
</p>
|
|||
|
<p>
|
|||
|
<span>警务区:</span>
|
|||
|
<span>${item["detachment"]}</span>
|
|||
|
</p>
|
|||
|
<p>
|
|||
|
<span>次数:</span>
|
|||
|
<span>${list.length}</span>
|
|||
|
</p>
|
|||
|
</div>`;
|
|||
|
}
|
|||
|
|
|||
|
//获取人员信息
|
|||
|
async function getPersonInfo(){
|
|||
|
var data={
|
|||
|
personId:currentStation
|
|||
|
}
|
|||
|
var personInfoReq= await getPersonBlackList(data)
|
|||
|
var imageUrl="";
|
|||
|
var groupType="";
|
|||
|
var genderName="";
|
|||
|
if(personInfoReq["data"]["data"].length>0){
|
|||
|
var personInfoObj=personInfoReq["data"]["data"][0];
|
|||
|
imageUrl=stationurl+personInfoObj["imageUrl"]
|
|||
|
groupType=personInfoObj["groupType"]
|
|||
|
genderName=personInfoObj["genderName"]
|
|||
|
}
|
|||
|
return {
|
|||
|
imageUrl,
|
|||
|
groupType,
|
|||
|
genderName
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
//显示人员信息
|
|||
|
async function showPersonInfo(list){
|
|||
|
getPersonInfo().then(res=>{
|
|||
|
console.log(res);
|
|||
|
var item=list[0];
|
|||
|
var blackType=item["certificateTypeName"]
|
|||
|
var idNumber=item["certificateNumber"];
|
|||
|
var blackName=item["personName"];
|
|||
|
var div=`
|
|||
|
<img src="${res["imageUrl"]}">
|
|||
|
<div>
|
|||
|
|
|||
|
<p>
|
|||
|
<span>${blackType}:</span>
|
|||
|
<span>${blackName}/${idNumber}</span>
|
|||
|
</p>
|
|||
|
<p>
|
|||
|
<span>性别:</span>
|
|||
|
<span>${res["genderName"]}</span>
|
|||
|
</p>
|
|||
|
<p>
|
|||
|
<span>类型:</span>
|
|||
|
<span>${res["groupType"]}</span>
|
|||
|
</p>
|
|||
|
<p>
|
|||
|
<span>出现次数:</span>
|
|||
|
<span>${list.length}</span>
|
|||
|
</p>
|
|||
|
</div>`;
|
|||
|
$(".schoolInfoBox").html(div)
|
|||
|
})
|
|||
|
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
function showSchoolInfoBox(list,type){
|
|||
|
if(type=="station"){
|
|||
|
$(".mainContentR_top>p:nth-child(1)").html("学校信息:"+currentStation)
|
|||
|
var div=showStationInfo(list);
|
|||
|
$(".schoolInfoBox").html(div)
|
|||
|
}else if(type=="person"){
|
|||
|
$(".mainContentR_top>p:nth-child(1)").html("人员信息:"+currentStation)
|
|||
|
showPersonInfo(list)
|
|||
|
}
|
|||
|
|
|||
|
showSchoolWarnAlarmInfo(list);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
function getAlarmPersonInfoDiv(item,type){
|
|||
|
var alarmCount=item["alarmCount"];
|
|||
|
if("personId" in item){
|
|||
|
var text=item["personId"]
|
|||
|
var type="person";
|
|||
|
}
|
|||
|
if("station" in item){
|
|||
|
var text=item["station"];
|
|||
|
var type="station";
|
|||
|
}
|
|||
|
var lastPicUrl=item["lastPicUrl"];
|
|||
|
var lastTimestamp=item["lastTimestamp"];
|
|||
|
var div="";
|
|||
|
div+=`<div eventId="${text}" type="${type}">
|
|||
|
<p>
|
|||
|
<img src="${lastPicUrl}" alt="">
|
|||
|
</p>
|
|||
|
<div>
|
|||
|
<p>
|
|||
|
<span>[${text}]</span>
|
|||
|
<span>【${alarmCount}】</span>
|
|||
|
</p>
|
|||
|
<p>
|
|||
|
<span>最后一次时间:</span>
|
|||
|
<span>${lastTimestamp}</span>
|
|||
|
</p>
|
|||
|
</div>
|
|||
|
</div>`;
|
|||
|
return div;
|
|||
|
}
|
|||
|
|
|||
|
function showSchoolWarnAlarmInfo(arr){
|
|||
|
var div="";
|
|||
|
for(var i=0;i<arr.length;i++){
|
|||
|
div+=showPoliceAlarmItem(arr[i],"");
|
|||
|
}
|
|||
|
$(".currentSchoolAlarmListAllBox").html(div);
|
|||
|
addPoliceAlarmItemEvent();
|
|||
|
}
|
|||
|
|
|||
|
//显示每一条记录
|
|||
|
function showPoliceAlarmItem(item){
|
|||
|
var personLibName=item["personLibName"];
|
|||
|
var alarmTime=timestampFormatTime(new Date(item["alarmTime"]).getTime());
|
|||
|
var address=item["cameraName"];
|
|||
|
var alarmId=item["alarmId"];
|
|||
|
var pic=item["snappedPicUrl"]
|
|||
|
return `
|
|||
|
<div alarmId='${alarmId}'>
|
|||
|
<p>
|
|||
|
<img src="${pic}" alt="">
|
|||
|
</p>
|
|||
|
<div>
|
|||
|
<p>
|
|||
|
<span>[${personLibName}]</span>
|
|||
|
<span></span>
|
|||
|
</p>
|
|||
|
<p>
|
|||
|
<span>告警时间:</span>
|
|||
|
<span>${alarmTime}</span>
|
|||
|
</p>
|
|||
|
<p>
|
|||
|
<span>位置:</span>
|
|||
|
<span>${address}</span>
|
|||
|
</p>
|
|||
|
<p>
|
|||
|
<button class="layui-btn layui-btn-normal policeDetailBtn">详情</button>
|
|||
|
</p>
|
|||
|
</div>
|
|||
|
</div>`;
|
|||
|
}
|
|||
|
|
|||
|
function addPoliceAlarmItemEvent(){
|
|||
|
$(".policeDetailBtn").on('click',function(){
|
|||
|
var alarmId=$(this).parent().parent().parent().attr("alarmId");
|
|||
|
for(var i=0;i<policeAlarmItemList.length;i++){
|
|||
|
if(alarmId==policeAlarmItemList[i]["alarmId"]){
|
|||
|
openPoliceAlarm(policeAlarmItemList[i]);
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
})
|
|||
|
}
|
|||
|
|
|||
|
function showPoliceAlarmItemDetail(item){
|
|||
|
var personLibName=item["personLibName"];
|
|||
|
var alarmTime=timestampFormatTime(new Date(item["alarmTime"]).getTime());
|
|||
|
var address=item["cameraName"];
|
|||
|
var alarmId=item["alarmId"];
|
|||
|
var pic=item["snappedPicUrl"]
|
|||
|
return `
|
|||
|
<div alarmId='${alarmId}'>
|
|||
|
<p>
|
|||
|
<img src="${pic}" alt="">
|
|||
|
</p>
|
|||
|
<div>
|
|||
|
<p>
|
|||
|
<span>[${personLibName}]</span>
|
|||
|
<span></span>
|
|||
|
</p>
|
|||
|
<p>
|
|||
|
<span>告警时间:</span>
|
|||
|
<span>${alarmTime}</span>
|
|||
|
</p>
|
|||
|
<p>
|
|||
|
<span>位置:</span>
|
|||
|
<span>${address}</span>
|
|||
|
</p>
|
|||
|
</div>
|
|||
|
</div>`;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
function emptyPoygon(){
|
|||
|
for(var i=0;i<polygonArr.length;i++){
|
|||
|
eventMap.removeLayer(polygonArr[i])
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
export {
|
|||
|
showPoliceAlarm,
|
|||
|
showPersonPoliceAlarm,
|
|||
|
policeAlarmList,
|
|||
|
emptyPoygon
|
|||
|
}
|