import { mainMap } from "../index.js"; import { pushbuttonAlarmList,pushButtonAlarmResiveReq, showPushButtonEventPage} from "../showAlarmListTable.js"; import { alarmHandleCreateData } from "./moveDeviceMarker.js"; import { autoOpenRightSlide } from "../pageEventTool.js"; import { showStationIpcRightVideo } from "../schoolBaseInfo.js"; import {sosDeviceAlarmAccept, sosDeviceAlarmDone} from "../sosVideoAndAudio.js" import { closeSosAlarmVideo, openSosAlarmVideo } from "../popSosVideo.js"; import { getPushButtonInfoWindowDiv } from "./pushButtonMarker.js"; import { schoolPushButtonList } from "../showPushButtonInfo.js"; var eventMarkerHash={}; function delPushButtonEventMarker(eventId){ if(eventId in eventMarkerHash){ //把 Marker 添加到图层 mainMap.removeLayer(eventMarkerHash[eventId]); delete eventMarkerHash[eventId]; //先把当前的marker重置 var resivePushButtonData=pushButtonEventFindDeviceId(eventId) //取消报警器的告警 sosAsrAcceptAndDone(resivePushButtonData,"relieve"); } } //通过eventId查找设备Id function pushButtonEventFindDeviceId(eventId){ var list=pushbuttonAlarmList.filter(item=>{ return item["eventId"]==eventId }) return list[0]; } //通过设备的Id,查询设备信息 function pushButtonEventFindId(deviceId){ var list=schoolPushButtonList.filter(item=>{ return item["pointId"]==deviceId }) return list[0]; } //更新告警信息 function updatePushButtonEvent(item){ pushbuttonAlarmList.unshift(item); drawPushButtonEventMarker(item); showPushButtonEventPage(); } function drawPushButtonEventMarker(item){ addPushButtonEventMarker(item); if(pushbuttonAlarmList.length>0){ var longitude=pushbuttonAlarmList[0]['longitude'] var latitude=pushbuttonAlarmList[0]['latitude'] mainMap.setView([latitude,longitude], 18); } } function addPushButtonEventMarker(obj){ var eventId=obj['eventId']; var longitude=obj["longitude"]; var latitude=obj["latitude"]; var address=obj["address"]; var iconObj=getPushButtonAlarmIcon(obj) let marker=L.marker([latitude,longitude],{ icon: iconObj,//将marker设置为上面引用的图形 title:address, riseOnHover:false, zIndexOffset:1000 }) if(!(eventId in eventMarkerHash)){ eventMarkerHash[eventId]=marker } marker.bindTooltip(address).openTooltip(); marker.on('click',function(e){ showPushButtonInfoWindow(obj); }) //把 Marker 添加到图层 mainMap.addLayer(marker); //启动视频 startSosVideo(obj); } function showPushButtonInfoWindow(obj){ var eventId=obj["eventId"]; if(eventId in eventMarkerHash){ var eventObj=pushButtonEventFindDeviceId(eventId); var deviceObj=pushButtonEventFindId(eventObj["deviceId"]); eventMarkerHash[eventId].unbindPopup(); eventMarkerHash[eventId].bindPopup(`
学校:${obj["station"]}
地址:${obj["address"]}
时间:${obj["timestamp"]}