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:`
`, 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 ``; }}, ]], 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 ``; }}, ]], limit:Number.MAX_VALUE // 数据表格默认全部显示 }); } export {openAlarmHistory}