anxiao_web/pages/poplayui/identityWarning.js

149 lines
5.7 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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 identityWaringArr=[];
var identityWaringLoad=null;
function getIdentityWaringEventList(data){
var loginurl=stationurl+"/firectrl/client/sensor/alarm_event/getlist_diff";
return axios({
method: 'post',
url:loginurl,
data: data
})
}
function load(){
identityWaringLoad= layuiObj.layer.load();
}
function closeLoad(){
layuiObj.layer.close(identityWaringLoad);
}
function showIdentityWaring(){
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="identityWaringHistoryForm" lay-filter="identityWaringHistoryForm" >
<div class="layui-input-inline">
<select name="interest" lay-filter="identityWaringHistorySelect" id="identityWaringHistorySelect" lay-search></select>
</div>
<div class="layui-input-inline">
<input type="text" class="layui-input" id="identityWaringHistoryStart" placeholder="请输入开始时间" value='${getCurrData()} 00:00:00'>
</div>
<div class="layui-input-inline">
<input type="text" class="layui-input" id="identityWaringHistoryEnd" placeholder="请输入结束时间" value='${getCurrData()} 23:59:59'>
</div>
<div class="layui-input-inline">
<button class="layui-btn" id="identityWaringHistoryBtn" style="height:38px !important;line-height:38px !important;">查询</button>
</div>
</form>
</div>
<div class="staffSignSelectContent">
<table class="layui-hide" id="identityWaringHistoryTable" lay-filter="identityWaringHistoryTable"></table>
<script type="text/html" id="identityWaringScript">
<a class="layui-btn " lay-event="handle">详情</a>
</script>
</div>
</div>`,
success: function(layero){
identityWaringFromRender();
showIdentityWaringHistoryContent([])
}
});
}
function identityWaringFromRender(){
$("#identityWaringHistorySelect").html(getSchoolOptions());
layuiObj.layuiForm.render("select","identityWaringHistoryForm");
layuiObj.laydate.render({
elem: '#identityWaringHistoryStart',
type: 'datetime',
});
layuiObj.laydate.render({
elem: '#identityWaringHistoryEnd',
type: 'datetime',
});
$("#identityWaringHistoryBtn").on('click',function(e){
e.preventDefault();
var station=$("#identityWaringHistorySelect").find("option:selected").val();
var signobj={
"brigade":brigade,
"pagesize":2000,
"pageindex":0,
"start":$("#identityWaringHistoryStart").val(),
"end":$("#identityWaringHistoryEnd").val()
}
if(station!="000"){
signobj["station"]=station
}
load();
getIdentityWaringEventList(signobj).then(res=>{
identityWaringArr=[];
var code=res.data.code;
if(code==0){
var data=res.data.data;
for(var i=0;i<data.length;i++){
identityWaringArr.unshift(data[i])
}
}
showIdentityWaringHistoryContent(identityWaringArr)
closeLoad();
})
})
}
function showIdentityWaringHistoryContent(data){
layuiObj.layuitable.render({
elem:'#identityWaringHistoryTable',
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: '#identityWaringScript'},
]],
limit:Number.MAX_VALUE // 数据表格默认全部显示
});
//监听行工具事件
layuiObj.layuitable.on('tool(identityWaringHistoryTable)',function(obj){
var data=obj["data"];
showAlarmEventImg(data)
})
}
export {showIdentityWaring}