From edd386509403d7c17909d3273275217f2d538253 Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Fri, 4 Jul 2025 15:14:13 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=E5=BF=AB=E6=8D=B7=E9=80=89=E6=8B=A9=E5=8A=9F=E8=83=BD=E5=B9=B6?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=A4=9A=E4=B8=AA=E7=BB=84=E4=BB=B6=E4=BB=A5?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E6=96=B0=E9=80=89=E6=8B=A9=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/useRangePicker.ts | 47 ++++++++++++++++++++++ src/views/dashboard/imsCDR/index.vue | 18 +-------- src/views/dashboard/sgwcCDR/index.vue | 18 +-------- src/views/dashboard/smfCDR/index.vue | 34 +++++++--------- src/views/dashboard/smfCDRByIMSI/index.vue | 18 +-------- src/views/dashboard/smscCDR/index.vue | 18 +-------- 6 files changed, 69 insertions(+), 84 deletions(-) create mode 100644 src/hooks/useRangePicker.ts diff --git a/src/hooks/useRangePicker.ts b/src/hooks/useRangePicker.ts new file mode 100644 index 00000000..61190722 --- /dev/null +++ b/src/hooks/useRangePicker.ts @@ -0,0 +1,47 @@ +import dayjs from 'dayjs'; + +/**日期快捷选择 */ +export function dayjsRanges() { + return [ + { + label: 'Today', + value: [dayjs().startOf('day'), dayjs()], + }, + { + label: 'Last 1 hour', + value: [ + dayjs().subtract(1, 'hour').startOf('hour'), + dayjs().subtract(1, 'hour').endOf('hour'), + ], + }, + // { + // label: 'Last 3 hour', + // value: [dayjs().subtract(3, 'hours'), dayjs()], + // }, + // { + // label: 'Last 6 hour', + // value: [dayjs().subtract(6, 'hours'), dayjs()], + // }, + { + label: 'Last 1 day', + value: [ + dayjs().subtract(1, 'day').startOf('day'), + dayjs().subtract(1, 'day').endOf('day'), + ], + }, + { + label: 'Last 7 day', + value: [ + dayjs().subtract(7, 'day').startOf('day'), + dayjs().subtract(1, 'day').endOf('day'), + ], + }, + { + label: 'Last 15 day', + value: [ + dayjs().subtract(15, 'day').startOf('day'), + dayjs().subtract(1, 'day').endOf('day'), + ], + }, + ]; +} diff --git a/src/views/dashboard/imsCDR/index.vue b/src/views/dashboard/imsCDR/index.vue index 12230357..6b7b9a0c 100644 --- a/src/views/dashboard/imsCDR/index.vue +++ b/src/views/dashboard/imsCDR/index.vue @@ -24,6 +24,7 @@ import PQueue from 'p-queue'; import { listTenant } from '@/api/system/tenant'; import { useClipboard } from '@vueuse/core'; import dayjs, { type Dayjs } from 'dayjs'; +import { dayjsRanges } from '@/hooks/useRangePicker'; const { copy } = useClipboard({ legacy: true }); const { t } = useI18n(); const { getDict } = useDictStore(); @@ -52,21 +53,6 @@ let queryRangePicker = ref<[Dayjs, Dayjs] | undefined>([ dayjs().startOf('hour'), dayjs().endOf('hour'), ]); -/**时间范围 */ -let rangePickerPresets = ref([ - { - label: 'Now hour', - value: [dayjs().startOf('hour'), dayjs().endOf('hour')], - }, - { label: 'Today', value: [dayjs().startOf('day'), dayjs().endOf('day')] }, - { - label: 'Yesterday', - value: [ - dayjs().subtract(1, 'day').startOf('day'), - dayjs().subtract(1, 'day').endOf('day'), - ], - }, -]); /**查询参数 */ let queryParams = reactive({ @@ -648,7 +634,7 @@ onBeforeUnmount(() => { > ([ dayjs().startOf('hour'), dayjs().endOf('hour'), ]); -/**时间范围 */ -let rangePickerPresets = ref([ - { - label: 'Now hour', - value: [dayjs().startOf('hour'), dayjs().endOf('hour')], - }, - { label: 'Today', value: [dayjs().startOf('day'), dayjs().endOf('day')] }, - { - label: 'Yesterday', - value: [ - dayjs().subtract(1, 'day').startOf('day'), - dayjs().subtract(1, 'day').endOf('day'), - ], - }, -]); /**查询参数 */ let queryParams = reactive({ @@ -579,7 +565,7 @@ onBeforeUnmount(() => { > ([ dayjs().startOf('hour'), dayjs().endOf('hour'), ]); -/**时间范围 */ -let rangePickerPresets = ref([ - { - label: 'Now hour', - value: [dayjs().startOf('hour'), dayjs().endOf('hour')], - }, - { label: 'Today', value: [dayjs().startOf('day'), dayjs().endOf('day')] }, - { - label: 'Yesterday', - value: [ - dayjs().subtract(1, 'day').startOf('day'), - dayjs().subtract(1, 'day').endOf('day'), - ], - }, -]); /**查询参数 */ let queryParams = reactive({ @@ -612,7 +598,7 @@ onBeforeUnmount(() => { > {
{{ t('views.dashboard.cdr.time') }}: - {{ parseDateToStr(record.cdrJSON.invocationTimestamp) }} + {{ + parseDateToStr(record.cdrJSON.invocationTimestamp) + }}
{{ t('views.dashboard.cdr.rowInfo') }} @@ -858,15 +846,21 @@ onBeforeUnmount(() => {
Data Volume Uplink: - {{ parseSizeFromByte(udata.dataVolumeUplink, 'MB') }} + {{ + parseSizeFromByte(udata.dataVolumeUplink, 'MB') + }}
Data Volume Downlink: - {{ parseSizeFromByte(udata.dataVolumeDownlink, 'MB') }} + {{ + parseSizeFromByte(udata.dataVolumeDownlink, 'MB') + }}
Data Total Volume: - {{ parseSizeFromByte(udata.dataTotalVolume, 'MB') }} + {{ + parseSizeFromByte(udata.dataTotalVolume, 'MB') + }}