123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354 |
- 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 `<div class="${className}">${value}</div>`;
- }
- },
- {
- field: '预警状态显示', title: '状态', width: 100, align: 'center',
- formatter: function (value, rowData, index) {
- return `<div class="">${value}</div>`;
- } },
- { 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 += "<li class='layui-timeline-item timelineDetail' data-Id='" + d.ID + "'><i class='layui-icon layui-timeline-axis'></i><div class='layui-timeline-content layui-text'><h3 class='layui-timeline-title'> <span style='margin-right:15px'>"
- + (d.处理人 == null ? "" : d.处理人) + "</span><span style='margin-right:15px;color:#00b8ff'>"
- + d.处理状态显示 + "</span><span style='margin-right:15px;color:#a2a2a2'>"
- + d.创建时间 + "</span></h3><p style='font-size:15px;width:350px;word-break: break-word;color:#a2a2a2'><br>"
- + (d.处理说明 == null ? "" : d.处理说明) + "</p></div></li>";
- }
- $("#timeline").html(html);
- }
- //回车提交查询
- function Enter_Submit() {
- InitTable();
- }
|