import { stationurl,brigade } from "../../../../public/js/url.js"; import { getCurrData } from "../../../../public/js/timestamp.js"; import { layuiObj } from "../index.js"; import {openEventHandle} from "../popEventHandle.js"; import { alarmManageInfo } from "../popEventHandle.js"; import { openMoveDeviceVideo } from "../openMoveDeviceVideo.js"; import { deviceHash } from "../../api/moveDeviceWebsocket.js"; var alarmEventList=[]; function getAlarmEventList(){ var data={ "brigade":brigade, "pagesize":2000, "pageindex":0, "start":getCurrData()+" 00:00:00", "end":getCurrData()+" 23:59:59", "state":"close" } var loginurl=stationurl+"/firectrl/client/sensor/alarm_event/getlist_diff"; return axios({ method: 'post', url:loginurl, data: data }) } function showAlarmEventList(){ alarmEventList=[]; getAlarmEventList().then(res=>{ var code=res.data.code; if(code==0){ var data=res.data.data; for(var i=0;i` }}, {field:'opear', width:"20%", title: '操作',toolbar: '#eventUploadScript'}, ]], limit:Number.MAX_VALUE // 数据表格默认全部显示 }); //监听行工具事件 layuiObj.layuitable.on('tool(eventUpload)',function(obj){ var data=obj["data"]; showAlarmEventImg(data) }) } var alarmEventIndex=null; var currentEventData=null; function showAlarmEventImg(data){ currentEventData=data; var eventDataJson=data.eventData; var eventData=JSON.parse(eventDataJson); var pic=eventData["pic"]; alarmEventIndex=layuiObj.layer.open({ type: 1, title: '事件照片', //不显示标题栏 offset: 'auto', shade: 0.6, id:new Date().getTime(), //设定一个id,防止重复弹出 btnAlign: 'c', moveType: 1, //拖拽模式,0或者1 content: `

报警信息

预警点:${data["station"]}

预警类型:${data["alarmType"]}

预警时间:${data["timestamp"]}

`, success: function(layero){ eventHandlePage(); } }); } function closeAlarmEvent(){ layuiObj.layer.close(alarmEventIndex); alarmEventIndex=null; } function eventHandlePage(){ $(".alarmHandleBtn").on('click',function(){ handleIotHandle(); //打开视频 createMoveDeviceVideoData(); //更新任务状态 crateUpdateEventAlarmData("processing"); }) $(".alarmHandleEndBtn").on('click',function(){ crateUpdateEventAlarmData("processed") }) $(".alarmHandleCloseBtn").on('click',function(){ crateUpdateEventAlarmData("close") }) } function crateUpdateEventAlarmData(state){ updateEventAlarmState(state).then(res=>{ var code=res.data.code; if(code==0){//再去刷新table showAlarmEventList(); } }) closeAlarmEvent(); } function updateEventAlarmState(state){ var data={ "eventId":currentEventData["eventId"], "newState":state } var loginurl=stationurl+"/firectrl/client/sensor/alarm_event/update"; return axios({ method: 'post', url:loginurl, data: data }) } function createMoveDeviceVideoData(){ var station=currentEventData["station"]; var temp=[]; for(var d in deviceHash){ if(deviceHash[d]["station"]==station){ temp.push(deviceHash[d]); } } openMoveDeviceVideo(temp); } function handleIotHandle(){ alarmManageInfo["longitude"]=currentEventData["longitude"]; alarmManageInfo["latitude"]=currentEventData["latitude"]; alarmManageInfo["deviceid"]=currentEventData["deviceid"]; alarmManageInfo["showname"]=currentEventData["address"]; alarmManageInfo["alarminfo"]=currentEventData openEventHandle(); } export { showAlarmEventList, alarmEventListTable, alarmEventList, currentEventData }