From 377ffc6e109abd09b9d250dea84b893f8681ef6b Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Tue, 6 Aug 2024 16:56:37 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20CDR/Event=E4=B8=8A=E6=8A=A5=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=AF=B9=E5=BA=94=E5=8F=91=E7=BD=91=E5=85=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/dashboard/imsCDR/index.vue | 126 +++++++++++++------- src/views/dashboard/mmeUE/index.vue | 65 ++++++++-- src/views/dashboard/overview/hooks/useWS.ts | 34 +++--- src/views/dashboard/smfCDR/index.vue | 51 +++++++- 4 files changed, 201 insertions(+), 75 deletions(-) diff --git a/src/views/dashboard/imsCDR/index.vue b/src/views/dashboard/imsCDR/index.vue index b4bbdef0..f808696a 100644 --- a/src/views/dashboard/imsCDR/index.vue +++ b/src/views/dashboard/imsCDR/index.vue @@ -11,6 +11,7 @@ import { RESULT_CODE_SUCCESS, } from '@/constants/result-constants'; import useDictStore from '@/store/modules/dict'; +import useNeInfoStore from '@/store/modules/neinfo'; import { delIMSDataCDR, exportIMSDataCDR, @@ -36,6 +37,9 @@ let dict: { cdrCallType: [], }); +/**网元可选 */ +let neOtions = ref[]>([]); + /**开始结束时间 */ let queryRangePicker = ref<[string, string]>(['', '']); @@ -375,6 +379,7 @@ const realTimeData = ref(false); function fnRealTime() { realTimeData.value = !realTimeData.value; if (realTimeData.value) { + tableState.seached = false // 建立链接 const options: OptionsType = { url: '/ws', @@ -383,7 +388,7 @@ function fnRealTime() { * * IMS_CDR会话事件(GroupID:1005) */ - subGroupID: '1005', + subGroupID: `1005_${queryParams.neId}`, }, onmessage: wsMessage, onerror: wsError, @@ -391,6 +396,8 @@ function fnRealTime() { ws.connect(options); } else { ws.close(); + tableState.seached = true + fnGetList(1); } } @@ -413,7 +420,7 @@ function wsMessage(res: Record) { return; } // cdrEvent CDR会话事件 - if (data.groupId === '1005') { + if (data.groupId === `1005_${queryParams.neId}`) { const cdrEvent = data.data; queue.add(async () => { modalState.maxId += 1; @@ -436,14 +443,39 @@ function wsMessage(res: Record) { onMounted(() => { // 初始字典数据 - Promise.allSettled([getDict('cdr_sip_code'), getDict('cdr_call_type')]) - .then(resArr => { + Promise.allSettled([getDict('cdr_sip_code'), getDict('cdr_call_type')]).then( + resArr => { if (resArr[0].status === 'fulfilled') { dict.cdrSipCode = resArr[0].value; } if (resArr[1].status === 'fulfilled') { dict.cdrCallType = resArr[1].value; } + } + ); + // 获取网元网元列表 + useNeInfoStore() + .fnNelist() + .then(res => { + if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) { + if (res.data.length > 0) { + let arr: Record[] = []; + res.data.forEach(i => { + if (i.neType === 'IMS') { + arr.push({ value: i.neId, label: i.neName }); + } + }); + neOtions.value = arr; + if (arr.length > 0) { + queryParams.neId = arr[0].value; + } + } + } else { + message.warning({ + content: t('common.noData'), + duration: 2, + }); + } }) .finally(() => { // 获取列表数据 @@ -468,6 +500,53 @@ onBeforeUnmount(() => { + + + + + + + + + + + + + + + + + + + + + {{ t('common.search') }} + + + + {{ t('common.reset') }} + + + + { > - - - - - - - - - - { > - - - - - - {{ t('common.search') }} - - - - {{ t('common.reset') }} - - - - @@ -595,6 +636,7 @@ onBeforeUnmount(() => { :checked-children="t('common.switch.show')" :un-checked-children="t('common.switch.hide')" size="small" + :disabled="realTimeData" /> diff --git a/src/views/dashboard/mmeUE/index.vue b/src/views/dashboard/mmeUE/index.vue index fb363262..62b5e812 100644 --- a/src/views/dashboard/mmeUE/index.vue +++ b/src/views/dashboard/mmeUE/index.vue @@ -11,6 +11,7 @@ import { RESULT_CODE_SUCCESS, } from '@/constants/result-constants'; import useDictStore from '@/store/modules/dict'; +import useNeInfoStore from '@/store/modules/neinfo'; import { listMMEDataUE, delMMEDataUE, exportMMEDataUE } from '@/api/neData/mme'; import { parseDateToStr } from '@/utils/date-utils'; import { OptionsType, WS } from '@/plugins/ws-websocket'; @@ -21,6 +22,9 @@ const { getDict } = useDictStore(); const ws = new WS(); const queue = new PQueue({ concurrency: 1, autoStart: true }); +/**网元可选 */ +let neOtions = ref[]>([]); + /**字典数据 */ let dict: { /**UE 事件认证代码类型 */ @@ -337,6 +341,7 @@ const realTimeData = ref(false); function fnRealTime() { realTimeData.value = !realTimeData.value; if (realTimeData.value) { + tableState.seached = false; // 建立链接 const options: OptionsType = { url: '/ws', @@ -345,7 +350,7 @@ function fnRealTime() { * * MME_UE会话事件(GroupID:1011) */ - subGroupID: '1011', + subGroupID: `1011_${queryParams.neId}`, }, onmessage: wsMessage, onerror: wsError, @@ -353,6 +358,8 @@ function fnRealTime() { ws.connect(options); } else { ws.close(); + tableState.seached = true; + fnGetList(1); } } @@ -375,7 +382,7 @@ function wsMessage(res: Record) { return; } // ueEvent MME_UE会话事件 - if (data.groupId === '1011') { + if (data.groupId === `1011_${queryParams.neId}`) { const ueEvent = data.data; queue.add(async () => { modalState.maxId += 1; @@ -403,16 +410,40 @@ onMounted(() => { getDict('ue_auth_code'), getDict('ue_event_type'), getDict('ue_event_cm_state'), - ]) - .then(resArr => { - if (resArr[0].status === 'fulfilled') { - dict.ueAauthCode = resArr[0].value; - } - if (resArr[1].status === 'fulfilled') { - dict.ueEventType = resArr[1].value; - } - if (resArr[2].status === 'fulfilled') { - dict.ueEventCmState = resArr[2].value; + ]).then(resArr => { + if (resArr[0].status === 'fulfilled') { + dict.ueAauthCode = resArr[0].value; + } + if (resArr[1].status === 'fulfilled') { + dict.ueEventType = resArr[1].value; + } + if (resArr[2].status === 'fulfilled') { + dict.ueEventCmState = resArr[2].value; + } + }); + + // 获取网元网元列表 + useNeInfoStore() + .fnNelist() + .then(res => { + if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) { + if (res.data.length > 0) { + let arr: Record[] = []; + res.data.forEach(i => { + if (i.neType === 'MME') { + arr.push({ value: i.neId, label: i.neName }); + } + }); + neOtions.value = arr; + if (arr.length > 0) { + queryParams.neId = arr[0].value; + } + } + } else { + message.warning({ + content: t('common.noData'), + duration: 2, + }); } }) .finally(() => { @@ -438,6 +469,15 @@ onBeforeUnmount(() => { + + + + + { :checked-children="t('common.switch.show')" :un-checked-children="t('common.switch.hide')" size="small" + :disabled="realTimeData" /> diff --git a/src/views/dashboard/overview/hooks/useWS.ts b/src/views/dashboard/overview/hooks/useWS.ts index ba193141..c9adfd26 100644 --- a/src/views/dashboard/overview/hooks/useWS.ts +++ b/src/views/dashboard/overview/hooks/useWS.ts @@ -50,37 +50,37 @@ export default function useWS() { // 普通信息 switch (requestId) { // AMF_UE会话事件 - case '1010': + case 'amf_1010_001': if (Array.isArray(data.rows)) { eventListParse('amf_ue', data); } break; // MME_UE会话事件 - case '1011': + case 'mme_1011_001': if (Array.isArray(data.rows)) { eventListParse('mme_ue', data); } break; // IMS_CDR会话事件 - case '1005': + case 'ims_1005_001': if (Array.isArray(data.rows)) { eventListParse('ims_cdr', data); } break; //UPF-总流量数 - case '1030_0': + case 'upf_001_0': const v0 = upfTFParse(data); upfTotalFlow.value[0].up = v0.up; upfTotalFlow.value[0].down = v0.down; upfTotalFlow.value[0].requestFlag = false; break; - case '1030_7': + case 'upf_001_7': const v7 = upfTFParse(data); upfTotalFlow.value[1].up = v7.up; upfTotalFlow.value[1].down = v7.down; upfTotalFlow.value[1].requestFlag = false; break; - case '1030_30': + case 'upf_001_30': const v30 = upfTFParse(data); upfTotalFlow.value[2].up = v30.up; upfTotalFlow.value[2].down = v30.down; @@ -100,19 +100,19 @@ export default function useWS() { } break; // AMF_UE会话事件 - case '1010': + case '1010_001': if (data.data) { queue.add(() => eventItemParseAndPush('amf_ue', data.data)); } break; // MME_UE会话事件 - case '1011': + case '1011_001': if (data.data) { queue.add(() => eventItemParseAndPush('mme_ue', data.data)); } break; // IMS_CDR会话事件 - case '1005': + case '1005_001': if (data.data) { queue.add(() => eventItemParseAndPush('ims_cdr', data.data)); } @@ -137,7 +137,7 @@ export default function useWS() { upfTotalFlow.value[index].requestFlag = true; ws.send({ - requestId: `1030_${day}`, + requestId: `upf_001_${day}`, type: 'upf_tf', data: { neType: 'UPF', @@ -151,7 +151,7 @@ export default function useWS() { function userActivitySend() { // AMF_UE会话事件 ws.send({ - requestId: '1010', + requestId: 'amf_1010_001', type: 'amf_ue', data: { neType: 'AMF', @@ -164,7 +164,7 @@ export default function useWS() { }); // MME_UE会话事件 ws.send({ - requestId: '1011', + requestId: 'mme_1011_001', type: 'mme_ue', data: { neType: 'MME', @@ -177,7 +177,7 @@ export default function useWS() { }); // IMS_CDR会话事件 ws.send({ - requestId: '1005', + requestId: 'ims_1005_001', type: 'ims_cdr', data: { neType: 'IMS', @@ -198,11 +198,11 @@ export default function useWS() { /**订阅通道组 * * 指标UPF (GroupID:12_neId) - * AMF_UE会话事件(GroupID:1010) - * MME_UE会话事件(GroupID:1011) - * IMS_CDR会话事件(GroupID:1005) + * AMF_UE会话事件(GroupID:1010_neId) + * MME_UE会话事件(GroupID:1011_neId) + * IMS_CDR会话事件(GroupID:1005_neId) */ - subGroupID: '12_001,1010,1011,1005', + subGroupID: '12_001,1010_001,1011_001,1005_001', }, onmessage: wsMessage, onerror: wsError, diff --git a/src/views/dashboard/smfCDR/index.vue b/src/views/dashboard/smfCDR/index.vue index 385a7b8e..c5e1023b 100644 --- a/src/views/dashboard/smfCDR/index.vue +++ b/src/views/dashboard/smfCDR/index.vue @@ -5,6 +5,7 @@ import { Modal, message } from 'ant-design-vue/lib'; import { SizeType } from 'ant-design-vue/lib/config-provider'; import { MenuInfo } from 'ant-design-vue/lib/menu/src/interface'; import { ColumnsType } from 'ant-design-vue/lib/table'; +import useNeInfoStore from '@/store/modules/neinfo'; import useI18n from '@/hooks/useI18n'; import { RESULT_CODE_ERROR, @@ -23,6 +24,9 @@ const { t } = useI18n(); const ws = new WS(); const queue = new PQueue({ concurrency: 1, autoStart: true }); +/**网元可选 */ +let neOtions = ref[]>([]); + /**开始结束时间 */ let queryRangePicker = ref<[string, string]>(['', '']); @@ -391,6 +395,7 @@ const realTimeData = ref(false); function fnRealTime() { realTimeData.value = !realTimeData.value; if (realTimeData.value) { + tableState.seached = false; // 建立链接 const options: OptionsType = { url: '/ws', @@ -399,7 +404,7 @@ function fnRealTime() { * * CDR会话事件-SMF (GroupID:1006) */ - subGroupID: '1006', + subGroupID: `1006_${queryParams.neId}`, }, onmessage: wsMessage, onerror: wsError, @@ -407,6 +412,8 @@ function fnRealTime() { ws.connect(options); } else { ws.close(); + tableState.seached = true; + fnGetList(1); } } @@ -429,7 +436,7 @@ function wsMessage(res: Record) { return; } // cdrEvent CDR会话事件 - if (data.groupId === '1006') { + if (data.groupId === `1006_${queryParams.neId}`) { const cdrEvent = data.data; queue.add(async () => { modalState.maxId += 1; @@ -451,8 +458,34 @@ function wsMessage(res: Record) { } onMounted(() => { - // 获取列表数据 - fnGetList(); + // 获取网元网元列表 + useNeInfoStore() + .fnNelist() + .then(res => { + if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) { + if (res.data.length > 0) { + let arr: Record[] = []; + res.data.forEach(i => { + if (i.neType === 'SMF') { + arr.push({ value: i.neId, label: i.neName }); + } + }); + neOtions.value = arr; + if (arr.length > 0) { + queryParams.neId = arr[0].value; + } + } + } else { + message.warning({ + content: t('common.noData'), + duration: 2, + }); + } + }) + .finally(() => { + // 获取列表数据 + fnGetList(); + }); }); onBeforeUnmount(() => { @@ -472,6 +505,15 @@ onBeforeUnmount(() => { + + + + + { :checked-children="t('common.switch.show')" :un-checked-children="t('common.switch.hide')" size="small" + :disabled="realTimeData" />