150 lines
5.6 KiB
JavaScript
150 lines
5.6 KiB
JavaScript
import { stationurl,brigade } from "../../public/js/url.js";
|
||
import { layuiObj} from "../../pages/cmddispatch/js/index.js"
|
||
import {getCurrData} from "../../public/js/timestamp.js";
|
||
import {getSchoolOptions} from "../cmddispatch/js/tree.js";
|
||
import {showAlarmEventImg} from "../cmddispatch/js/orgApi/getAlarmEventList.js"
|
||
var faceWaringArr=[];
|
||
var faceWaringLoad=null;
|
||
function getFaceWarningEventList(data){
|
||
var loginurl=stationurl+"/firectrl/client/sensor/alarm_event/getlist_diff";
|
||
return axios({
|
||
method: 'post',
|
||
url:loginurl,
|
||
data: data
|
||
})
|
||
}
|
||
|
||
function load(){
|
||
faceWaringLoad= layuiObj.layer.load();
|
||
}
|
||
|
||
function closeLoad(){
|
||
layuiObj.layer.close(faceWaringLoad);
|
||
}
|
||
|
||
function showFaceWarning(){
|
||
layuiObj.layer.open({
|
||
type: 1,
|
||
title: '人脸预警', //不显示标题栏
|
||
area: ['1400px', '580px'],
|
||
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;">
|
||
<div class="staffSignSelectInfo">
|
||
<form class="layui-form" action="" id="faceWaringHistoryForm" lay-filter="faceWaringHistoryForm" >
|
||
<div class="layui-input-inline">
|
||
<select name="interest" lay-filter="faceWaringHistorySelect" id="faceWaringHistorySelect" lay-search></select>
|
||
</div>
|
||
<div class="layui-input-inline">
|
||
<input type="text" class="layui-input" id="faceWaringHistoryStart" placeholder="请输入开始时间" value='${getCurrData()} 00:00:00'>
|
||
</div>
|
||
<div class="layui-input-inline">
|
||
<input type="text" class="layui-input" id="faceWaringHistoryEnd" placeholder="请输入结束时间" value='${getCurrData()} 23:59:59'>
|
||
</div>
|
||
<div class="layui-input-inline">
|
||
<button class="layui-btn" id="faceWaringHistoryBtn" style="height:38px !important;line-height:38px !important;">查询</button>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
<div class="staffSignSelectContent">
|
||
<table class="layui-hide" id="faceWaringHistoryTable" lay-filter="faceWaringHistoryTable"></table>
|
||
<script type="text/html" id="faceWaringScript">
|
||
<a class="layui-btn " lay-event="handle">详情</a>
|
||
</script>
|
||
</div>
|
||
</div>`,
|
||
success: function(layero){
|
||
faceWaringFromRender();
|
||
showFaceWaringHistoryContent([])
|
||
}
|
||
});
|
||
|
||
|
||
}
|
||
|
||
|
||
function faceWaringFromRender(){
|
||
$("#faceWaringHistorySelect").html(getSchoolOptions());
|
||
layuiObj.layuiForm.render("select","faceWaringHistoryForm");
|
||
|
||
layuiObj.laydate.render({
|
||
elem: '#faceWaringHistoryStart',
|
||
type: 'datetime',
|
||
});
|
||
layuiObj.laydate.render({
|
||
elem: '#faceWaringHistoryEnd',
|
||
type: 'datetime',
|
||
});
|
||
|
||
$("#faceWaringHistoryBtn").on('click',function(e){
|
||
e.preventDefault();
|
||
var station=$("#faceWaringHistorySelect").find("option:selected").val();
|
||
var signobj={
|
||
"brigade":brigade,
|
||
"pagesize":2000,
|
||
"pageindex":0,
|
||
"start":$("#faceWaringHistoryStart").val(),
|
||
"end":$("#faceWaringHistoryEnd").val()
|
||
}
|
||
if(station!="000"){
|
||
signobj["station"]=station
|
||
}
|
||
load();
|
||
getFaceWarningEventList(signobj).then(res=>{
|
||
console.log(res)
|
||
faceWaringArr=[];
|
||
var code=res.data.code;
|
||
|
||
if(code==0){
|
||
var data=res.data.data;
|
||
for(var i=0;i<data.length;i++){
|
||
faceWaringArr.unshift(data[i])
|
||
}
|
||
}
|
||
showFaceWaringHistoryContent(faceWaringArr)
|
||
closeLoad();
|
||
})
|
||
})
|
||
}
|
||
|
||
function showFaceWaringHistoryContent(data){
|
||
layuiObj.layuitable.render({
|
||
elem:'#faceWaringHistoryTable',
|
||
data:data,
|
||
cols: [[
|
||
{field:'station', width:"15%", title: '预警点'},
|
||
{field:'alarmType', width:"15%", title: '预警类型'},
|
||
{field:'timestamp', width:"25%", title: '预警时间'},
|
||
{field:'state', width:"25%", title: '状态',templet : function(data) {// 替换数据
|
||
var state=data["state"];
|
||
switch(state){
|
||
case "new"://新事件
|
||
var src=`./pages/cmddispatch/image/alarmEventNew.png`;
|
||
break;
|
||
case "processing"://处置中
|
||
var src=`./pages/cmddispatch/image/alarmEventProcessing.png`;
|
||
break;
|
||
case "processed"://已关闭
|
||
var src=`./pages/cmddispatch/image/alarmEventProcessed.png`;
|
||
break;
|
||
default:
|
||
var src=`./pages/cmddispatch/image/alarmEventNew.png`;
|
||
break;
|
||
}
|
||
return `<img src=${src}>`
|
||
}},
|
||
{field:'opear', width:"20%", title: '操作',toolbar: '#faceWaringScript'},
|
||
]],
|
||
limit:Number.MAX_VALUE // 数据表格默认全部显示
|
||
});
|
||
|
||
//监听行工具事件
|
||
layuiObj.layuitable.on('tool(faceWaringHistoryTable)',function(obj){
|
||
var data=obj["data"];
|
||
showAlarmEventImg(data)
|
||
})
|
||
}
|
||
|
||
export {showFaceWarning} |