From abc0dffa511e6a7f78aac8872f6e52404a6eaf8f Mon Sep 17 00:00:00 2001 From: wenlele Date: Tue, 5 Sep 2023 16:07:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A7=E5=B1=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/project/group.js | 2 +- .../projectGroup/containers/statistic.jsx | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/api/app/lib/controllers/project/group.js b/api/app/lib/controllers/project/group.js index d358602..02fd38d 100644 --- a/api/app/lib/controllers/project/group.js +++ b/api/app/lib/controllers/project/group.js @@ -336,7 +336,7 @@ async function groupStatisticOnline (ctx) { { "range": { "collect_time": { - "gte": `${moment().subtract(24, 'hours').format('YYYY-MM-DDTHH:mm:ss.SSS')}Z`, + "gte": `${moment().subtract(32, 'hours').format('YYYY-MM-DDTHH:mm:ss.SSS')}Z`, // "gte": "2023-08-24T08:00:00.000Z", } } diff --git a/web/client/src/sections/projectGroup/containers/statistic.jsx b/web/client/src/sections/projectGroup/containers/statistic.jsx index 421bf17..214f159 100644 --- a/web/client/src/sections/projectGroup/containers/statistic.jsx +++ b/web/client/src/sections/projectGroup/containers/statistic.jsx @@ -69,6 +69,27 @@ const Statistic = ({ dispatch, actions, user, history, loading, groupStatistic, title: '中断时长', dataIndex: "maxOffLineTime", key: 'maxOffLineTime', + render: (text, row) => { + let title + if (text) { + if (text >= 1440 && Math.floor(text / 1440)) title = Math.floor(text / 1440) + "天" + if ((text % 1440) >= 60 && Math.floor(text % 1440 / 60)) { + if (title) { + title = title + Math.floor(text % 1440 / 60) + "时" + } else { + title = Math.floor(text % 1440 / 60) + "时" + } + } + if (text % 1440 % 60) { + if (title) { + title = title + text % 1440 % 60 + "分" + } else { + title = text % 1440 % 60 + "分" + } + } + } + return title || "--" + } }, { title: '今日告警个数', dataIndex: "todayAlarms",