From fcca6142dffaaad7e39a35c73b58944f9b83e7ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=B4=AA=E6=B4=AA?= <2498601771@qq.com> Date: Sun, 25 Jun 2023 10:33:57 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=9E=E4=BD=93=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E6=95=B0=E5=AD=97=E8=BF=87=E5=A4=A7=E8=BF=9B=E8=A1=8C=E9=80=97?= =?UTF-8?q?=E5=8F=B7=E5=88=86=E9=9A=94=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/tools.js | 13 +++++++++++++ src/views/entityExplorer/EntityExplorer.vue | 21 +++++++++++---------- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/src/utils/tools.js b/src/utils/tools.js index 384f6b2c..ec5097cf 100644 --- a/src/utils/tools.js +++ b/src/utils/tools.js @@ -1283,3 +1283,16 @@ export function toUpperCaseByString (str) { } return str } +/** + * 数字满1000逗号分隔,如99999转变为99,999 + * 小数点后保留原状,不做逗号分隔,也不进行四舍五入 + * @param num + * @returns {string} + */ +export function numberWithCommas (num) { + if (typeof num === 'number') { + return num.toString().replace(/\B(? - {{entityAppTotal}} + {{ numberWithCommas(entityAppTotal) }} APP @@ -73,7 +73,7 @@
New
-
{{entityAppNew}}
+
{{ numberWithCommas(entityAppNew) }}
@@ -81,7 +81,7 @@
Active
-
{{entityAppActive}}
+
{{ numberWithCommas(entityAppActive) }}
@@ -91,7 +91,7 @@
- {{entityDomainTotal}} + {{ numberWithCommas(entityDomainTotal) }} DOMAIN
@@ -101,7 +101,7 @@
New
-
{{entityDomainNew}}
+
{{ numberWithCommas(entityDomainNew) }}
@@ -109,7 +109,7 @@
Active
-
{{entityDomainActive}}
+
{{ numberWithCommas(entityDomainActive) }}
@@ -119,7 +119,7 @@
- {{entityIpTotal}} + {{ numberWithCommas(entityIpTotal) }} IP
@@ -129,7 +129,7 @@
New
-
{{entityIpNew}}
+
{{ numberWithCommas(entityIpNew) }}
@@ -137,7 +137,7 @@
Active
-
{{entityIpActive}}
+
{{ numberWithCommas(entityIpActive) }}
@@ -161,7 +161,7 @@ import { getNowTime, getSecond } from '@/utils/date-util' import { ref } from 'vue' import _ from 'lodash' import Loading from '@/components/common/Loading' -import { overwriteUrl, urlParamsHandler } from '@/utils/tools' +import { overwriteUrl, urlParamsHandler, numberWithCommas } from '@/utils/tools' import Parser from '@/components/advancedSearch/meta/parser' import { handleErrorTip } from '@/components/advancedSearch/meta/error' import { columnList } from '@/utils/static-data' @@ -371,6 +371,7 @@ export default { } }, methods: { + numberWithCommas, timeRefreshChange () { if (!this.$refs.dateTimeRange.isCustom) { const value = this.timeFilter.dateRangeValue