95 lines
2.7 KiB
JavaScript
95 lines
2.7 KiB
JavaScript
|
import { getaiBehavioralEventList } from "../api/getAiEventList.js";
|
|||
|
import { stationurl,brigade } from "../../../public/js/url.js";
|
|||
|
import { getCurrData } from "../../../public/js/timestamp.js";
|
|||
|
import { layuiObj } from "./index.js";
|
|||
|
let aiBehavioralEventList=[];
|
|||
|
function showAiAlarmList(){
|
|||
|
var reqdata={
|
|||
|
brigade,
|
|||
|
start:getCurrData()+" 00:00:00",
|
|||
|
end:getCurrData()+" 23:59:59",
|
|||
|
}
|
|||
|
getaiBehavioralEventList(reqdata).then(res=>{//查询AI盒子的固定报警
|
|||
|
var code=res["data"]["code"];
|
|||
|
if(code==0){
|
|||
|
var data=res["data"]["data"];
|
|||
|
if(data!=null){
|
|||
|
aiBehavioralEventList=data;
|
|||
|
aiBehavioralEventList.reverse();
|
|||
|
}
|
|||
|
}
|
|||
|
showAiAlarmDiv();
|
|||
|
})
|
|||
|
}
|
|||
|
|
|||
|
function showAiAlarmDiv(){
|
|||
|
var div="";
|
|||
|
for(var i=0;i<aiBehavioralEventList.length;i++){
|
|||
|
div+=showAIBehavioralPage(aiBehavioralEventList[i]);
|
|||
|
}
|
|||
|
$(".warnInfoListall").html(div);
|
|||
|
aIBehavioralEvent();
|
|||
|
}
|
|||
|
|
|||
|
function showAIBehavioralPage(item){
|
|||
|
var warnName=item["warnName"];
|
|||
|
var station=item["station"];
|
|||
|
var timestamp=item["receiveTime"];
|
|||
|
var channelName=item["channelName"];
|
|||
|
var deviceId=item["deviceId"];
|
|||
|
var pic=`${stationurl}${item["imageUrl"]}`;
|
|||
|
var warnId=item["warnId"];
|
|||
|
return `
|
|||
|
<div warnId='${warnId}'>
|
|||
|
<p>
|
|||
|
<img src="${pic}" alt="">
|
|||
|
</p>
|
|||
|
<div>
|
|||
|
<p>
|
|||
|
<span>【${channelName}】</span>
|
|||
|
<span>${station}</span>
|
|||
|
<span>${timestamp}</span>
|
|||
|
</p>
|
|||
|
<p>
|
|||
|
<span>行为:</span>
|
|||
|
<span>${warnName}</span>
|
|||
|
</p>
|
|||
|
<p>
|
|||
|
<span>设备ID:${deviceId}</span>
|
|||
|
</p>
|
|||
|
</div>
|
|||
|
</div>`;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
function aIBehavioralEvent(){
|
|||
|
$(".warnInfoListall>div").on('click',function(){
|
|||
|
var warnId=$(this).attr("warnId")
|
|||
|
for(var i=0;i<aiBehavioralEventList.length;i++){
|
|||
|
if(warnId==aiBehavioralEventList[i]["warnId"]){
|
|||
|
openAIBehavioral(aiBehavioralEventList[i])
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
})
|
|||
|
}
|
|||
|
|
|||
|
function openAIBehavioral(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">
|
|||
|
${showAIBehavioralPage(item)}
|
|||
|
</div>`,
|
|||
|
success: function(layero){
|
|||
|
console.log(item);
|
|||
|
}
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
export {showAiAlarmList}
|