";
var tbody = "";
if (data != null && data.length > 0) {
$.each(data, function (index, item) {
tbody += "
" + item.sn + "
";
tbody += "
" + item.id + "
";
tbody += "
" + item.name + "
";
tbody += "
" + timeStr(item.time) + "
";
tbody += "
" + item.msg + "
";
tbody += "
" + (item.flag == 0 ? "未处理": "已处理") + "
";
tbody += "
" + timeStr(item.processTime) + "
";
tbody += "
" + item.note + "
";
});
}else {
tbody += '
暂未查到数据
';
}
var html = thead + tbody;
return html;
}
function tableToExcel(html) {
var name = "告警记录";
var uri = 'data:application/vnd.ms-excel;base64,';
var template = '
{table}
';
if(!html){
layer.msg("没有获取到要导出的内容!");
}
var ctx = {worksheet: name || 'Worksheet', table: html};
window.location.href = uri + base64(format(template, ctx))
}
function format(s, c) {
return s.replace(/{(\w+)}/g,function(m, p) { return c[p]; });
}
function base64(s) {
return window.btoa(unescape(encodeURIComponent(s)))
};
/*------------------ tableToExcel导出模块-end ----------------- */
function listSetMap(list) {
$.each(list,function (index,data) {
warnMap[data.sn] = data;
})
}
//批处理
function batchHandle() {
$("#batch_processTime").attr("readOnly","readOnly");
$("#batch_processTime").val(new Date().Format("yyyy-MM-dd hh:mm:ss"));
var paramWH = getWH("batchHandle");
layer.open({
skin: 'mypop',
type: 1,
// title: '警报信息',
title: false,
// area: ['50%', '35%'],
area: [paramWH.w, paramWH.h],
closeBtn: 0,
shade: 0,
scrollbar: false,
content: $('#batchWarnDom')
});
}
function allCheckbox() {
var b = $("#all").is(":checked");
$(".ckeck").prop('checked', b);
}
//批量修改警报状态
function warnUpdateBatch() {
//同步进行
$.ajaxSettings.async = false;
var param = {};
var note = $("#batch_note").val();
var processTime = $("#batch_processTime").val();
var sns = "";
var ids = "";
if(note){
param = {
// "sn": sns,
"note": note,
"processTime": timeStr1(processTime)
};
$.post("./cgi-bin/warn-list/update-all", JSON.stringify(param), function (data, status) {
if ("success" == status) {
//关闭弹窗
closepopBtn();
//重新刷新此页面数据
queryWarn();
} else {
window.parent.notify("处理失败,请重新操作!");
}
}, "json");
}else{
layer.msg("处理说明不能为空!");
console.log("处理说明不能为空!");
}
}
function renderParamBtn() {
if(screen.width==1920 && screen.height==1080){
// $("#param-btn").addClass("layui-col-md6");
$("#param-btn").removeClass("layui-col-md6");
}else if(screen.width==1280 && screen.height==1024){
// $("#param-btn").addClass("layui-col-md4");
$("#param-btn").removeClass("layui-col-md4");
}else if(screen.width==1280 && screen.height==800){
// $("#param-btn").addClass("layui-col-md4");
$("#param-btn").removeClass("layui-col-md4");
}else{
// $("#param-btn").addClass("layui-col-md6");
$("#param-btn").removeClass("layui-col-md6");
}
$("#param-btn").show();
}
function getWH(tag) {
var res = {
w:"50%",
h:"64%"
};
if(screen.width==1920 && screen.height==1080){
res = {w:"80%",h:"64%"};
if(tag == "batchHandle"){
res = {w:"80%",h:"64%"};
}
}else if(screen.width==1280 && screen.height==1024){
res = {w:"80%",h:"64%"};
if(tag == "detail"){
res = {w:"80%",h:"95%"};
}
if(tag == "batchHandle"){
res = {w:"80%",h:"64%"};
}
}else if(screen.width==1280 && screen.height==800){
res = {w:"80%",h:"64%"};
if(tag == "detail"){
res = {w:"80%",h:"95%"};
}
if(tag == "batchHandle"){
res = {w:"80%",h:"64%"};
}
}
return res;
}