function viewModel() { this.ID = ""; this.init = function () { //预警处理 $('#Handle').click(function () { var row = $('#treegrid').datagrid('getSelected'); if (row != null) { if (row.预警状态显示 === "已处理") { top.ZLPMS.Msg("当前预警已经处理完成", 0); return; } top.ZLPMS.OpenWindowSuccess({ title: '预警处理', url: '/CloudMonitor/WarningProcessing', area: ['1000px', '570px'], success: function (layero) { var iframeWin = ZLPMS.GetChildFrame(layero);//得到iframe页的窗口对象,执行iframe页的方法: iframeWin.InitPage(row); }, yes: function (index, layero) { //提交表单 Forms.Submit(index, layero); } }); } else { top.ZLPMS.Msg("请选择一行记录后执行操作", 0); } }); //批量预警处理 $('#HandleAll').click(function () { top.ZLPMS.OpenWindowSuccess({ title: '批量处理', url: '/CloudMonitor/BatchWarningProcessing?ProId=' + (window.proId||""), area: ['1000px', '570px'], success: function (layero) { var iframeWin = ZLPMS.GetChildFrame(layero);//得到iframe页的窗口对象,执行iframe页的方法: iframeWin.InitPage(); }, yes: function (index, layero) { //提交表单 Forms.Submit(index, layero); } }); }); /**查看服务器 */ $('#ViewServer').click(function () { var row = $('#treegrid').datagrid('getSelected'); if (row != null) { if (row.服务器ID == null) { return; } top.ZLPMS.OpenWindowSuccess({ title: '预警处理', url: '/CloudMonitor/ServerInfo?serverId='+row.服务器ID, area: ['1500px', '650px'], success: function (layero) { }, yes: function (index, layero) { } }); } else { top.ZLPMS.Msg("请选择一行记录后执行操作", 0); } }); //更多条件 $("#btn-more").bind("click", function () { var that = this; //多窗口模式,层叠置顶 index = layer.open({ type: 1 , id: "one" , title: '条件' , area: ['800px', '250px'] , shade: 0 , anim: 1 , shadeClose: true , maxmin: true , shade: 0.3 , offset: '50px' , content: $("#inteform") , btn: ['确认', '关闭'] , yes: function () { InitTable(); layer.close(index); } , btn2: function () { layer.close(index); } , zIndex: 1 //重点1 }); }) //未及时处理预警 $("#notTimely").bind("click", function () { top.ZLPMS.OpenWindowSuccess({ title: '未及时处理预警查看', url: '/CloudMonitor/UnprocessedEarlyWarningManagementIndex', area: ['90vw', '90vh'], success: function (layero) { var iframeWin = ZLPMS.GetChildFrame(layero);//得到iframe页的窗口对象,执行iframe页的方法: }, yes: function (index, layero) { } }); }) //渠道 $("#QDID").combobox({ url: '/Problem/GetChannelByAuth', valueField: 'ID', textField: '名称', limitToList: true, onChange: function (value) { $("#XMID").combobox({ url: '/PersonManager/GetProject?id=' + value, valueField: 'ID', textField: '名称', limitToList: true, }) } }) //项目 $("#XMID").combobox({ url: '/Problem/GetProjectByInfo', valueField: 'ID', textField: '名称', limitToList: true, }) //预警类型 $("#YJLXID").combobox({ url: '/ProManager/GetEarlyWarningType', valueField: 'ID', textField: '显示名', limitToList: true }) //状态 $("#ZT").combobox({ url: '/ProManager/GetWarningProcessingStatu', valueField: 'ID', textField: '显示名', limitToList: true, value:1 }) //处理详情点击 $("#timeline").on("click", ".timelineDetail", function () { let Id = $(this).attr("data-Id"); var row = $('#treegrid').datagrid('getSelected'); let timelineRow = timeline.find(o => o.ID == Id); top.ZLPMS.OpenWindowSuccess({ title: '预警处理情况', url: '/CloudMonitor/WarningProcessing', area: ['1000px', '570px'], success: function (layero) { var iframeWin = ZLPMS.GetChildFrame(layero);//得到iframe页的窗口对象,执行iframe页的方法: iframeWin.InitPage(row, timelineRow); }, yes: function (index, layero) { top.ZLPMS.CloseWindow(index); } }); }) InitTable(); } }; let timeline = []; function InitTable(notTimely = false) { var params = ZLPMS.FormToObject('inteform'); if (notTimely) { params.WCLZT = "红色,橙色"; } if (window.proId != null && window.proId != 'null') { params.XMID = window.proId; //处理界面显示 $("#userAccount").remove(); $("#btn-more").css("display", "none"); $("#notTimely").css("display", "none"); } else { params.CONTENT = $("#userAccount").val(); } //初始化树形表格 $("#treegrid").datagrid({ url: '/CloudMonitor/GetServerAlertBySearch', idField: 'ID', queryParams: params, //data: data, method: 'POST', fit: true, pageSize: 0, toolbar: window.proId != null ? "" : "#Channeltb", rownumbers: true, //底部显示分页工具栏 pagination: false, //列名称 columns: [[ { field: '项目名称', title: '项目', width: 100 }, { field: '渠道名称', title: '渠道', width: 100 }, { field: '预警类型显示', title: '预警类型', width: 120, align: 'center' }, { field: '异常说明', title: '异常说明', width: 350, align: 'left' }, { field: '创建时间', title: '初次预警时间', width: 150, align: 'center', formatter: ZLPMS.formatterData }, { field: '最后上报时间', title: '最后上报时间', width: 150, align: 'center', formatter: ZLPMS.formatterData }, { field: '预警次数', title: '预警次数', width: 100, align: 'center' }, { field: '服务器IP', title: 'IP', width: 100, align: 'center' }, { field: '服务器类型显示', title: '服务器类型', width: 100, align: 'center' }, { field: '负责人', title: '负责人', width: 100, align: 'center' }, { field: '预警等级显示', title: '预警等级', width: 100, align: 'center', formatter: function (value, rowData, index) { let className = ""; if (rowData.预警状态显示 == "已处理") { className = "Normal"; } else { switch (rowData.预警等级显示) { case "橙色预警": { className = "Warning"; break } case "红色预警": { className = "Serious"; break } } } return `
${value}
`; } }, { field: '预警状态显示', title: '状态', width: 100, align: 'center', formatter: function (value, rowData, index) { return `
${value}
`; } }, { field: '处理时间', title: '处理时间', width: 150, align: 'center', formatter: ZLPMS.formatterData } ]], singleSelect: true, onClickRow: function (index, row) { if (row.预警状态 !=1) Loading(row.ID); }, onSelectAll: function (rows) { } }); } //提交表单信息 var Forms = { Submit: function (index, layero) { var iframeWin = ZLPMS.GetChildFrame(layero);//得到iframe页的窗口对象,执行iframe页的方法: //调用子页面的方法,得到子页面返回的ids var param = iframeWin.GetData(); if (!param) return; if (param != null) { if (param.创建时间 == "") { top.ZLPMS.Msg("请填写处理时间"); return; } if (param.处理人 == "") { top.ZLPMS.Msg("请填写处理人"); return; } if (param.处理状态 == "") { top.ZLPMS.Msg("请选择处理状态"); return; } //提交表单信息到具体得页面 var url = '/CloudMonitor/InsertServerAlertProcess'; $.post(url, param, function (data) { if (data == "1") { top.ZLPMS.CloseWindow(index); top.ZLPMS.Msg("保存成功"); //刷新页面 List.Reload(); } else { ZLPMS.Msg(data.msg, 2); } }); } } }; //重新刷新页面 7 var List = { //重新加载页面所有信息 Reload: function () { $('#treegrid').datagrid('reload'); } }; //删除 var Doajax = function (data) { $.ajax({ url: `/CloudMonitor/DeleteCustomAlertById?id=${data.ID}`, method: 'GET', success: function (data) { if (data == "1") { top.ZLPMS.Msg("删除成功"); //刷新页面 List.Reload(); } else { top.ZLPMS.Msg("删除失败"); List.Reload(); } } }); } //加载时间轴 function Loading(alertId) { if (!alertId) { return; } if ($("#processPanel").css("display") !="block") $(".panel-header").click() timeline = ZLPMS.GetAPi(`/CloudMonitor/GetServerAlertProcessByAlertId?alertId=${alertId}`); $("#timeline").html(""); let html = ""; for (var i = 0; i < timeline.length; i++) { let d = timeline[i]; html += "
  • " + (d.处理人 == null ? "" : d.处理人) + "" + d.处理状态显示 + "" + d.创建时间 + "


    " + (d.处理说明 == null ? "" : d.处理说明) + "

  • "; } $("#timeline").html(html); } //回车提交查询 function Enter_Submit() { InitTable(); }