anxiao_web/pages/intelligenceEarlyWarning/js/showAiAlarmList.js

95 lines
2.7 KiB
JavaScript
Raw Permalink Normal View History

2024-07-24 09:22:32 +08:00
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}