瀏覽代碼

显示优化处理

唐渝林 10 月之前
父節點
當前提交
383f24dbd5

+ 12 - 3
PMS.WebUI/ViewModels/UnprocessedEarlyWarningManagementIndex.js

@@ -13,6 +13,16 @@ function InitTable() {
     //提交表单信息到具体得页面
     var url = '/CloudMonitor/GetServerAlertBySearch';
     $.post(url, params, function (data) {
+        // 获取今天的日期
+        const today = new Date();
+
+        // 计算每个记录的 "创建时间" 距离今天的天数,并添加到新字段中
+        data.forEach(record => {
+            const creationDate = new Date(record["创建时间"]);
+            const diffTime = today - creationDate; // 计算时间差(毫秒)
+            const diffDays = Math.floor(diffTime / (1000 * 60 * 60 * 24)); // 转换为天数
+            record["距离今天的天数"] = diffDays + "天";
+        });
         const result = separateByWorkHours(data);
         LoadTable($("#treegrid1"), result.workHoursData.sort((a, b) => {
             // 将时间字符串转换为 Date 对象
@@ -90,14 +100,13 @@ function LoadTable(ele, data) {
         pagination: false,
         //列名称
         columns: [[
-            { field: '项目名称', title: '项目', width: 100 },
+            { field: '项目名称', title: '项目', width: 300 },
             { 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'
             },
@@ -126,7 +135,7 @@ function LoadTable(ele, data) {
                     return `<div class="${className}">${value}</div>`;
                 }
             },
-            { field: '处理时间', title: '处理时间', width: 150, align: 'center', formatter: ZLPMS.formatterData }
+            { field: '距离今天的天数', title: '未处理天数', width: 150, align: 'center'}
         ]],
         singleSelect: true,
         onClickRow: function (index, row) {

+ 2 - 2
PMS.WebUI/Views/CloudMonitor/UnprocessedEarlyWarningManagementIndex.cshtml

@@ -53,14 +53,14 @@
 </style>
 <div>
     <div id="mainLayout1" style="width:100%;height:450px;">
-        <div data-options="region:'center', title:'工作时间内'" style="height:45vh;">
+        <div data-options="region:'center', title:'工作时间内预警信息'" style="height:45vh;">
             <table id="treegrid1" data-options="fit:true">
                 <!-- 预警管理表格内容 -->
             </table>
         </div>
     </div>
     <div id="mainLayout2" style="width:100%;height:450px;">
-        <div data-options="region:'center', title:'工作时间外'" style="height:45vh;">
+        <div data-options="region:'center', title:'工作时间外预警信息'" style="height:45vh;">
             <table id="treegrid2" data-options="fit:true">
                 <!-- 预警管理表格内容 -->
             </table>