diff --git a/src/utils/parse-utils.ts b/src/utils/parse-utils.ts index e091aa8e..49a89ddd 100644 --- a/src/utils/parse-utils.ts +++ b/src/utils/parse-utils.ts @@ -171,8 +171,8 @@ export function parseSizeFromKbs(sizeByte: number, timeInterval: number): any { } /** - * 字节数转换单位 - * @param bits 字节Bit大小 64009540 = 512.08 MB + * 位数据转换单位 + * @param bits 位Bit大小 64009540 = 512.08 MB * @returns xx B / KB / MB / GB / TB / PB / EB / ZB / YB */ export function parseSizeFromBits(bits: number | string): string { @@ -181,7 +181,28 @@ export function parseSizeFromBits(bits: number | string): string { bits = bits * 8; const units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; const unitIndex = Math.floor(Math.log2(bits) / 10); - const value = (bits / Math.pow(1000, unitIndex)).toFixed(2); + const value = bits / Math.pow(1000, unitIndex); const unti = units[unitIndex]; + if (unitIndex > 0) { + return `${value.toFixed(2)} ${unti}`; + } + return `${value} ${unti}`; +} + +/** + * 字节数转换单位 + * @param byte 字节Byte大小 64009540 = 512.08 MB + * @returns xx B / KB / MB / GB / TB / PB / EB / ZB / YB + */ +export function parseSizeFromByte(byte: number | string): string { + byte = Number(byte) || 0; + if (byte <= 0) return '0 B'; + const units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; + const unitIndex = Math.floor(Math.log2(byte) / 10); + const unti = units[unitIndex]; + const value = byte / Math.pow(1000, unitIndex); + if (unitIndex > 0) { + return `${value.toFixed(2)} ${unti}`; + } return `${value} ${unti}`; } diff --git a/src/views/dashboard/smfCDRByIMSI/index.vue b/src/views/dashboard/smfCDRByIMSI/index.vue new file mode 100644 index 00000000..976940e3 --- /dev/null +++ b/src/views/dashboard/smfCDRByIMSI/index.vue @@ -0,0 +1,664 @@ + + + + +