|
@@ -1,195 +1,87 @@
|
|
|
function viewModel() {
|
|
|
this.ID = "";
|
|
|
this.init = function () {
|
|
|
+ InitTable();
|
|
|
+ }
|
|
|
+};
|
|
|
|
|
|
- //预警处理
|
|
|
- $('#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);
|
|
|
- }
|
|
|
- });
|
|
|
+function InitTable() {
|
|
|
+ var params = {};
|
|
|
+ params.WCLZT = "红色,橙色";
|
|
|
+ params.ZT = 1;
|
|
|
+
|
|
|
+ //提交表单信息到具体得页面
|
|
|
+ var url = '/CloudMonitor/GetServerAlertBySearch';
|
|
|
+ $.post(url, params, function (data) {
|
|
|
+ const result = separateByWorkHours(data);
|
|
|
+ LoadTable($("#treegrid1"), result.workHoursData.sort((a, b) => {
|
|
|
+ // 将时间字符串转换为 Date 对象
|
|
|
+ const dateA = new Date(a["创建时间"]);
|
|
|
+ const dateB = new Date(b["创建时间"]);
|
|
|
+
|
|
|
+ // 进行倒序排序
|
|
|
+ return dateB - dateA;
|
|
|
+ }));
|
|
|
+ LoadTable($("#treegrid2"), result.offWorkHoursData.sort((a, b) => {
|
|
|
+ // 将时间字符串转换为 Date 对象
|
|
|
+ const dateA = new Date(a["创建时间"]);
|
|
|
+ const dateB = new Date(b["创建时间"]);
|
|
|
+
|
|
|
+ // 进行倒序排序
|
|
|
+ return dateB - dateA;
|
|
|
+ }));
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
|
|
|
- //更多条件
|
|
|
- $("#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
|
|
|
- });
|
|
|
- })
|
|
|
+function gethours(dateStr) {
|
|
|
+ // 以 "HH:MM:SS" 格式处理时间字符串
|
|
|
+ const [hours, minutes, seconds] = dateStr.split(':').map(Number);
|
|
|
+ return hours;
|
|
|
+}
|
|
|
|
|
|
- //未及时处理预警
|
|
|
- $("#notTimely").bind("click", function () {
|
|
|
- InitTable(true);
|
|
|
- })
|
|
|
+function isWithinWorkHours(dateStr, workStartHour, workEndHour) {
|
|
|
+ const date = new Date(dateStr);
|
|
|
+ const hours = date.getHours();
|
|
|
+ // 判断时间是否在工作时间内
|
|
|
+ return (hours > workStartHour && hours < workEndHour);
|
|
|
+}
|
|
|
|
|
|
- //渠道
|
|
|
- $("#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,
|
|
|
- })
|
|
|
+function separateByWorkHours(data) {
|
|
|
+ const workHoursData = [];
|
|
|
+ const offWorkHoursData = [];
|
|
|
+ try {
|
|
|
+ // 定义工作时间的开始和结束时间
|
|
|
+ const workStartHour = gethours(window.starTime);
|
|
|
+ const workEndHour = gethours(window.endTime);
|
|
|
+ data.forEach(item => {
|
|
|
+ if (isWithinWorkHours(item["创建时间"], workStartHour, workEndHour)) {
|
|
|
+ workHoursData.push(item);
|
|
|
+ } else {
|
|
|
+ offWorkHoursData.push(item);
|
|
|
}
|
|
|
- })
|
|
|
-
|
|
|
- //项目
|
|
|
- $("#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();
|
|
|
+ return {
|
|
|
+ workHoursData,
|
|
|
+ offWorkHoursData
|
|
|
+ };
|
|
|
+ } catch (e) {
|
|
|
+ top.ZLPMS.Msg("当前工作时间定义获取失败");
|
|
|
+ return {
|
|
|
+ workHoursData:[],
|
|
|
+ offWorkHoursData: []
|
|
|
+ };
|
|
|
}
|
|
|
-};
|
|
|
+}
|
|
|
|
|
|
-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();
|
|
|
- }
|
|
|
+function LoadTable(ele, data) {
|
|
|
//初始化树形表格
|
|
|
- $("#treegrid").datagrid({
|
|
|
- url: '/CloudMonitor/GetServerAlertBySearch',
|
|
|
+ ele.datagrid({
|
|
|
idField: 'ID',
|
|
|
- queryParams: params,
|
|
|
- //data: data,
|
|
|
- method: 'POST',
|
|
|
+ data: data,
|
|
|
fit: true,
|
|
|
pageSize: 0,
|
|
|
toolbar: window.proId != null ? "" : "#Channeltb",
|
|
@@ -232,13 +124,13 @@ function InitTable(notTimely = false) {
|
|
|
}
|
|
|
}
|
|
|
return `<div class="${className}">${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) {
|
|
|
}
|
|
@@ -310,27 +202,6 @@ var Doajax = function (data) {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-//加载时间轴
|
|
|
-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() {
|