163 lines
5.4 KiB
JavaScript
163 lines
5.4 KiB
JavaScript
|
import {eventMap} from "../index.js";
|
|||
|
import { timestampFormatTime } from "../../../../public/js/timestamp.js";
|
|||
|
import { setFaceAlarmRead } from "../../api/setFaceAlarmRead.js";
|
|||
|
import { emptyPoygon } from "../showPoliceAlarm.js";
|
|||
|
import { showPoliceAlarm } from "../showPoliceAlarm.js";
|
|||
|
var schoolSignMarkers_cus=null;
|
|||
|
var personSignMarkers_cus=null;
|
|||
|
var clockMarkerHash={};
|
|||
|
function addClockMarkerHash(eventId,marker){
|
|||
|
clockMarkerHash[eventId]=marker;
|
|||
|
}
|
|||
|
|
|||
|
function initSchoolClockCus(){
|
|||
|
schoolSignMarkers_cus = L.markerClusterGroup({iconCreateFunction: function(cluster) {
|
|||
|
return L.divIcon({ html: `<div class="polyMarker-cusmarker">
|
|||
|
<img src="./image/wb_ipc.png">
|
|||
|
<span> ${cluster.getChildCount()}</span>
|
|||
|
</div>` });
|
|||
|
}});
|
|||
|
|
|||
|
personSignMarkers_cus = L.markerClusterGroup({iconCreateFunction: function(cluster) {
|
|||
|
return L.divIcon({ html: `<div class="polyMarker-cusmarker">
|
|||
|
<img src="./image/wb_baoan.png">
|
|||
|
<span> ${cluster.getChildCount()}</span>
|
|||
|
</div>` });
|
|||
|
}});
|
|||
|
}
|
|||
|
|
|||
|
function emptySignMarkers_cus(){
|
|||
|
if(schoolSignMarkers_cus!=null){
|
|||
|
schoolSignMarkers_cus.clearLayers();
|
|||
|
schoolSignMarkers_cus=null;
|
|||
|
}
|
|||
|
if(personSignMarkers_cus!=null){
|
|||
|
personSignMarkers_cus.clearLayers();
|
|||
|
personSignMarkers_cus=null;
|
|||
|
}
|
|||
|
for(var eventId in clockMarkerHash){
|
|||
|
eventMap.removeLayer(clockMarkerHash[eventId]);
|
|||
|
delete clockMarkerHash[eventId];
|
|||
|
}
|
|||
|
initSchoolClockCus()
|
|||
|
}
|
|||
|
function drawAlarmEventMarker(eventArr){
|
|||
|
emptySignMarkers_cus();
|
|||
|
eventArr.forEach(item => {
|
|||
|
let longitude=item["longitude"];
|
|||
|
let latitude=item["latitude"];
|
|||
|
let alarmId=item["alarmId"];
|
|||
|
let cameraName=item["cameraName"];
|
|||
|
var iconObj=L.icon({
|
|||
|
iconUrl:"./image/wb_ipc.png",//图片路径
|
|||
|
iconSize: [24, 24]//图片大小设置
|
|||
|
});
|
|||
|
let marker=L.marker([latitude,longitude],{
|
|||
|
icon: iconObj,//将marker设置为上面引用的图形
|
|||
|
});
|
|||
|
marker.bindTooltip(cameraName).openTooltip();
|
|||
|
marker.on('click',function(e){
|
|||
|
showSchoolBaseInfo(item);
|
|||
|
})
|
|||
|
addClockMarkerHash(alarmId,marker);
|
|||
|
schoolSignMarkers_cus.addLayer(marker);
|
|||
|
});
|
|||
|
eventMap.addLayer(schoolSignMarkers_cus);
|
|||
|
eventMap.setView([eventArr[0]["latitude"],eventArr[0]["longitude"]], 18);
|
|||
|
}
|
|||
|
|
|||
|
function drawPersonEventMarker(eventArr){
|
|||
|
emptySignMarkers_cus();
|
|||
|
eventArr.forEach(item => {
|
|||
|
let longitude=item["longitude"];
|
|||
|
let latitude=item["latitude"];
|
|||
|
let alarmId=item["alarmId"];
|
|||
|
let cameraName=item["cameraName"];
|
|||
|
var iconObj=L.icon({
|
|||
|
iconUrl:"./image/wb_baoan.png",//图片路径
|
|||
|
iconSize: [24, 24]//图片大小设置
|
|||
|
});
|
|||
|
let marker=L.marker([latitude,longitude],{
|
|||
|
icon: iconObj,//将marker设置为上面引用的图形
|
|||
|
});
|
|||
|
marker.bindTooltip(cameraName).openTooltip();
|
|||
|
marker.on('click',function(e){
|
|||
|
showSchoolBaseInfo(item);
|
|||
|
})
|
|||
|
addClockMarkerHash(alarmId,marker);
|
|||
|
personSignMarkers_cus.addLayer(marker);
|
|||
|
});
|
|||
|
eventMap.addLayer(personSignMarkers_cus);
|
|||
|
eventMap.setView([eventArr[0]["latitude"],eventArr[0]["longitude"]], 18);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
window.ipcAlarmSetRead=function(that){
|
|||
|
|
|||
|
var alarmId=$(that).parent().attr("alarmId");
|
|||
|
|
|||
|
setFaceAlarmRead(alarmId).then(res=>{
|
|||
|
var code=res["data"]["code"];
|
|||
|
if(code==0){
|
|||
|
layer.msg('请求成功')
|
|||
|
resetAlarmEventMap(alarmId);
|
|||
|
}else{
|
|||
|
layer.msg('请求失败')
|
|||
|
}
|
|||
|
})
|
|||
|
}
|
|||
|
|
|||
|
function resetAlarmEventMap(alarmId){
|
|||
|
emptySignMarkers_cus();
|
|||
|
emptyPoygon();
|
|||
|
showPoliceAlarm();
|
|||
|
$(".schoolInfoBox").html("");
|
|||
|
$(".currentSchoolAlarmListAllBox").html("");
|
|||
|
$(".schoolAlarmInfo .titleBg").html("预警信息")
|
|||
|
}
|
|||
|
|
|||
|
function showSchoolBaseInfo(item){
|
|||
|
var alarmCode=item["personLibName"];
|
|||
|
var station=item["station"];
|
|||
|
var alarmTime=timestampFormatTime(new Date(item["alarmTime"]).getTime());
|
|||
|
var address=item["cameraName"];
|
|||
|
var eventId=item["alarmId"];
|
|||
|
var pic=item["snappedPicUrl"]
|
|||
|
var blackType=item["certificateTypeName"]
|
|||
|
var idNumber=item["certificateNumber"];
|
|||
|
var blackName=item["personName"];
|
|||
|
var groupType=item["groupType"];
|
|||
|
clockMarkerHash[eventId].unbindPopup();
|
|||
|
clockMarkerHash[eventId].bindPopup(
|
|||
|
` <p><span style="color:#E7B554;">[${alarmCode}]</span>${address}</p>
|
|||
|
<div class="warnEventInfoWindow">
|
|||
|
<p>
|
|||
|
<img src="${pic}">
|
|||
|
<span>【${groupType == null?" ":groupType}】</span>
|
|||
|
</p>
|
|||
|
<div>
|
|||
|
<p>
|
|||
|
<span>${blackType}:</span>
|
|||
|
<span>${blackName}/${idNumber}</span>
|
|||
|
</p>
|
|||
|
<p>
|
|||
|
<span>学校名称:</span>
|
|||
|
<span>${station}</span>
|
|||
|
</p>
|
|||
|
<p>
|
|||
|
<span>时间:${alarmTime}</span>
|
|||
|
</p>
|
|||
|
<p alarmId="${eventId}">
|
|||
|
<button type="button" class="layui-btn" onclick='ipcAlarmSetRead(this)'>解除</button>
|
|||
|
</p>
|
|||
|
</div>
|
|||
|
</div>`,
|
|||
|
).openPopup();
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
export {
|
|||
|
drawAlarmEventMarker,
|
|||
|
drawPersonEventMarker
|
|||
|
}
|