112 lines
3.1 KiB
JavaScript
112 lines
3.1 KiB
JavaScript
import { getPushButtonList } from "../api/getPushButtonList.js";
|
||
import { getTime } from "./time.js";
|
||
import { brigade } from "../../../public/js/url.js";
|
||
import { layuiObj } from "./index.js";
|
||
let pushbuttonAlarmList=[];
|
||
function showPushbuttonAlarmList(){
|
||
var time=getTime();
|
||
var reqdata={
|
||
brigade,
|
||
pageindex: 0,
|
||
pagesize: 2000,
|
||
start:time["startTime"],
|
||
end:time["endTime"]
|
||
}
|
||
getPushButtonList(reqdata).then(res=>{
|
||
var code=res["data"]["code"];
|
||
if(code==0){
|
||
var data=res["data"]["data"];
|
||
if(data!=null){
|
||
pushbuttonAlarmList=data;
|
||
pushbuttonAlarmList.reverse();
|
||
}
|
||
}
|
||
showPushbuttonAlarmDiv();
|
||
})
|
||
}
|
||
|
||
function showPushbuttonAlarmDiv(){
|
||
var div="";
|
||
for(var i=0;i<pushbuttonAlarmList.length;i++){
|
||
div+=getPushbuttonInfoDiv(pushbuttonAlarmList[i]);
|
||
}
|
||
$(".warnInfoListall").html(div);
|
||
showPushbuttonEvent();
|
||
}
|
||
|
||
|
||
|
||
|
||
function getPushbuttonInfoDiv(item){
|
||
var alarmCode=item["alarmCode"];
|
||
var station=item["station"];
|
||
var timestamp=item["timestamp"];
|
||
var address=item["address"];
|
||
var eventId=item["eventId"];
|
||
var user1Name=item["user1Name"];
|
||
var user1Phone=item["user1Phone"];
|
||
var user2Name=item["user2Name"];
|
||
var user2Phone=item["user2Phone"];
|
||
var user3Name=item["user3Name"];
|
||
var user3Phone=item["user3Phone"];
|
||
var deviceId=item["deviceId"];
|
||
return`
|
||
<div eventId='${eventId}' class="pushButtonListInfo">
|
||
<div>
|
||
<p>
|
||
<span>${station}</span>
|
||
<span>【${timestamp}】</span>
|
||
</p>
|
||
<p>
|
||
<span>位置:${address}</span>
|
||
</p>
|
||
<p>
|
||
<span>编号:${deviceId}</span>
|
||
</p>
|
||
<p>
|
||
<span>联系人1:${user1Name}/${user1Phone}</span>
|
||
</p>
|
||
<p>
|
||
<span>联系人2:${user2Name}/${user2Phone}</span>
|
||
</p>
|
||
<p>
|
||
<span>联系人3:${user3Name}/${user3Phone}</span>
|
||
</p>
|
||
</div>
|
||
</div>`;
|
||
}
|
||
|
||
|
||
function showPushbuttonEvent(){
|
||
$(".warnInfoListall>div").on('click',function(){
|
||
var eventId=$(this).attr("warnId")
|
||
var arr=pushbuttonAlarmList.filter((item=>{
|
||
return item["alarmId"]==eventId;
|
||
}))
|
||
openPushbuttonAlarm(arr[0])
|
||
})
|
||
}
|
||
|
||
function openPushbuttonAlarm(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">
|
||
${getPushbuttonInfoDiv(item)}
|
||
</div>`,
|
||
success: function(layero){
|
||
console.log(item);
|
||
}
|
||
});
|
||
}
|
||
|
||
|
||
export {
|
||
showPushbuttonAlarmList,
|
||
pushbuttonAlarmList
|
||
} |