From 233496e184e47be1b27f77c54189122e57340934 Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Fri, 7 Jun 2024 19:50:02 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=BD=91=E5=85=83=E6=95=B0=E6=8D=AECDR?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=AF=BC=E5=87=BA=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/neData/amf.ts | 28 +++++++--- src/api/neData/ims.ts | 28 +++++++--- src/i18n/locales/en-US.ts | 2 + src/i18n/locales/zh-CN.ts | 2 + src/views/dashboard/amfUE/index.vue | 74 ++++++++++++++++++++++++++- src/views/dashboard/imsCDR/index.vue | 76 +++++++++++++++++++++++++++- 6 files changed, 193 insertions(+), 17 deletions(-) diff --git a/src/api/neData/amf.ts b/src/api/neData/amf.ts index 97568b1d..2059e260 100644 --- a/src/api/neData/amf.ts +++ b/src/api/neData/amf.ts @@ -19,10 +19,24 @@ export function listAMFDataUE(query: Record) { * @returns object */ export function delAMFDataUE(ueIds: string | number) { - return request({ - url: `/neData/amf/ue/${ueIds}`, - method: 'delete', - timeout: 60_000, - }); - } - \ No newline at end of file + return request({ + url: `/neData/amf/ue/${ueIds}`, + method: 'delete', + timeout: 60_000, + }); +} + +/** + * AMF-UE会话列表导出 + * @param data 查询列表条件 + * @returns object + */ +export function exportAMFDataUE(data: Record) { + return request({ + url: '/neData/amf/ue/export', + method: 'post', + data, + responseType: 'blob', + timeout: 60_000, + }); +} diff --git a/src/api/neData/ims.ts b/src/api/neData/ims.ts index 9dea3073..1f1d67bc 100644 --- a/src/api/neData/ims.ts +++ b/src/api/neData/ims.ts @@ -19,10 +19,24 @@ export function listIMSDataCDR(query: Record) { * @returns object */ export function delIMSDataCDR(cdrIds: string | number) { - return request({ - url: `/neData/ims/cdr/${cdrIds}`, - method: 'delete', - timeout: 60_000, - }); - } - \ No newline at end of file + return request({ + url: `/neData/ims/cdr/${cdrIds}`, + method: 'delete', + timeout: 60_000, + }); +} + +/** + * IMS-CDR会话列表导出 + * @param data 查询列表条件 + * @returns object + */ +export function exportIMSDataCDR(data: Record) { + return request({ + url: '/neData/ims/cdr/export', + method: 'post', + data, + responseType: 'blob', + timeout: 60_000, + }); +} diff --git a/src/i18n/locales/en-US.ts b/src/i18n/locales/en-US.ts index c51ea671..ee5199c8 100644 --- a/src/i18n/locales/en-US.ts +++ b/src/i18n/locales/en-US.ts @@ -569,6 +569,7 @@ export default { called: "Called", result: "Result", delTip: "Confirm deletion of the data item numbered [{msg}]?", + exportTipIMS: "Do you confirm to export the current query conditions of the CDR data? (Maximum 10,000 items can be exported.)", }, ue: { eventType: "Event Type", @@ -582,6 +583,7 @@ export default { result: "Result", resultOk: "Successes", delTip: "Confirm deletion of the data item numbered [{msg}]?", + exportTipIMS: "Do you confirm to export the event data of the current query condition? (Maximum 10,000 items can be exported.)", }, }, ne: { diff --git a/src/i18n/locales/zh-CN.ts b/src/i18n/locales/zh-CN.ts index fa66272e..14f71e65 100644 --- a/src/i18n/locales/zh-CN.ts +++ b/src/i18n/locales/zh-CN.ts @@ -569,6 +569,7 @@ export default { called: "被叫", result: "结果", delTip: "确认删除编号为【{msg}】的数据项?", + exportTipIMS: "确认导出当前查询条件的话单数据吗?(导出最大支持一万条)", }, ue: { eventType: "事件类型", @@ -582,6 +583,7 @@ export default { result: "结果", resultOk: "成功", delTip: "确认删除编号为【{msg}】的数据项?", + exportTipIMS: "确认导出当前查询条件的事件数据吗?(导出最大支持一万条)", }, }, ne: { diff --git a/src/views/dashboard/amfUE/index.vue b/src/views/dashboard/amfUE/index.vue index 0a4f77aa..9d09de4d 100644 --- a/src/views/dashboard/amfUE/index.vue +++ b/src/views/dashboard/amfUE/index.vue @@ -11,8 +11,9 @@ import { RESULT_CODE_SUCCESS, } from '@/constants/result-constants'; import useDictStore from '@/store/modules/dict'; -import { listAMFDataUE, delAMFDataUE } from '@/api/neData/amf'; +import { listAMFDataUE, delAMFDataUE, exportAMFDataUE } from '@/api/neData/amf'; import { OptionsType, WS } from '@/plugins/ws-websocket'; +import saveAs from 'file-saver'; import PQueue from 'p-queue'; const { t } = useI18n(); const { getDict } = useDictStore(); @@ -33,6 +34,9 @@ let dict: { ueEventCmState: [], }); +/**开始结束时间 */ +let queryRangePicker = ref<[string, string]>(['', '']); + /**查询参数 */ let queryParams = reactive({ /**网元类型 */ @@ -42,6 +46,10 @@ let queryParams = reactive({ imsi: '', sortField: 'timestamp', sortOrder: 'desc', + /**开始时间 */ + startTime: '', + /**结束时间 */ + endTime: '', /**当前页数 */ pageNum: 1, /**每页条数 */ @@ -54,9 +62,12 @@ function fnQueryReset() { queryParams = Object.assign(queryParams, { eventType: 'auth-result', imsi: '', + startTime: '', + endTime: '', pageNum: 1, pageSize: 20, }); + queryRangePicker.value = ['', '']; tablePagination.current = 1; tablePagination.pageSize = 20; fnGetList(); @@ -241,6 +252,11 @@ function fnGetList(pageNum?: number) { if (pageNum) { queryParams.pageNum = pageNum; } + if (!queryRangePicker.value) { + queryRangePicker.value = ['', '']; + } + queryParams.startTime = queryRangePicker.value[0]; + queryParams.endTime = queryRangePicker.value[1]; listAMFDataUE(toRaw(queryParams)).then(res => { if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.rows)) { // 取消勾选 @@ -275,6 +291,39 @@ function fnGetList(pageNum?: number) { }); } +/**列表导出 */ +function fnExportList() { + if (modalState.confirmLoading) return; + Modal.confirm({ + title: t('common.tipTitle'), + content: t('views.dashboard.ue.exportTipAMF'), + onOk() { + const hide = message.loading(t('common.loading'), 0); + const querys = toRaw(queryParams); + querys.pageSize = 10000; + exportAMFDataUE(querys) + .then(res => { + if (res.code === RESULT_CODE_SUCCESS) { + message.success({ + content: t('common.operateOk'), + duration: 3, + }); + saveAs(res.data, `amf_ue_event_export_${Date.now()}.xlsx`); + } else { + message.error({ + content: `${res.msg}`, + duration: 3, + }); + } + }) + .finally(() => { + hide(); + modalState.confirmLoading = false; + }); + }, + }); +} + /**实时数据开关 */ const realTimeData = ref(false); @@ -399,7 +448,7 @@ onBeforeUnmount(() => { > - + { > + + + + + @@ -461,6 +526,11 @@ onBeforeUnmount(() => { {{ t('common.deleteText') }} + + + + {{ t('common.export') }} + diff --git a/src/views/dashboard/imsCDR/index.vue b/src/views/dashboard/imsCDR/index.vue index 57856434..796a487a 100644 --- a/src/views/dashboard/imsCDR/index.vue +++ b/src/views/dashboard/imsCDR/index.vue @@ -11,9 +11,14 @@ import { RESULT_CODE_SUCCESS, } from '@/constants/result-constants'; import useDictStore from '@/store/modules/dict'; -import { delIMSDataCDR, listIMSDataCDR } from '@/api/neData/ims'; +import { + delIMSDataCDR, + exportIMSDataCDR, + listIMSDataCDR, +} from '@/api/neData/ims'; import { parseDateToStr, parseDuration } from '@/utils/date-utils'; import { OptionsType, WS } from '@/plugins/ws-websocket'; +import saveAs from 'file-saver'; import PQueue from 'p-queue'; const { t } = useI18n(); const { getDict } = useDictStore(); @@ -31,6 +36,9 @@ let dict: { cdrCallType: [], }); +/**开始结束时间 */ +let queryRangePicker = ref<[string, string]>(['', '']); + /**查询参数 */ let queryParams = reactive({ /**网元类型 */ @@ -41,6 +49,10 @@ let queryParams = reactive({ calledParty: '', sortField: 'timestamp', sortOrder: 'desc', + /**开始时间 */ + startTime: '', + /**结束时间 */ + endTime: '', /**当前页数 */ pageNum: 1, /**每页条数 */ @@ -54,9 +66,12 @@ function fnQueryReset() { recordType: 'MOC', callerParty: '', calledParty: '', + startTime: '', + endTime: '', pageNum: 1, pageSize: 20, }); + queryRangePicker.value = ['', '']; tablePagination.current = 1; tablePagination.pageSize = 20; fnGetList(); @@ -279,6 +294,11 @@ function fnGetList(pageNum?: number) { if (pageNum) { queryParams.pageNum = pageNum; } + if (!queryRangePicker.value) { + queryRangePicker.value = ['', '']; + } + queryParams.startTime = queryRangePicker.value[0]; + queryParams.endTime = queryRangePicker.value[1]; listIMSDataCDR(toRaw(queryParams)).then(res => { if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.rows)) { // 取消勾选 @@ -313,6 +333,39 @@ function fnGetList(pageNum?: number) { }); } +/**列表导出 */ +function fnExportList() { + if (modalState.confirmLoading) return; + Modal.confirm({ + title: t('common.tipTitle'), + content: t('views.dashboard.cdr.exportTipIMS'), + onOk() { + const hide = message.loading(t('common.loading'), 0); + const querys = toRaw(queryParams); + querys.pageSize = 10000; + exportIMSDataCDR(querys) + .then(res => { + if (res.code === RESULT_CODE_SUCCESS) { + message.success({ + content: t('common.operateOk'), + duration: 3, + }); + saveAs(res.data, `ims_cdr_event_export_${Date.now()}.xlsx`); + } else { + message.error({ + content: `${res.msg}`, + duration: 3, + }); + } + }) + .finally(() => { + hide(); + modalState.confirmLoading = false; + }); + }, + }); +} + /**实时数据开关 */ const realTimeData = ref(false); @@ -455,6 +508,22 @@ onBeforeUnmount(() => { > + + + + + @@ -508,6 +577,11 @@ onBeforeUnmount(() => { {{ t('common.deleteText') }} + + + + {{ t('common.export') }} +