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