From 1b41e245a2a6d975a934b7aae432358811a68f3b Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Wed, 31 Jan 2024 12:09:46 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20ims/smf=E6=8E=A5=E5=8F=A3=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/neUser/ims.ts | 24 +++++++++++++++++++++++- src/api/neUser/{ue.ts => smf.ts} | 13 ++++++++----- src/views/neUser/ims/index.vue | 10 +++++++--- src/views/neUser/ue/index.vue | 11 +++++++---- 4 files changed, 45 insertions(+), 13 deletions(-) rename src/api/neUser/{ue.ts => smf.ts} (88%) diff --git a/src/api/neUser/ims.ts b/src/api/neUser/ims.ts index 6d9efc05..71c5bf2c 100644 --- a/src/api/neUser/ims.ts +++ b/src/api/neUser/ims.ts @@ -7,7 +7,7 @@ import { parseObjLineToHump } from '@/utils/parse-utils'; * @param query 查询参数 * @returns object */ -export async function listIMS(query: Record) { +export async function listUEInfoByIMS(query: Record) { query.nbId = query.id; const result = await request({ url: '/api/rest/ueManagement/v1/elementType/ims/objectType/ueInfo', @@ -40,3 +40,25 @@ export async function listIMS(query: Record) { // ]; return data; } + +/** + * 首页查询IMS在线用户数 + * @param query 查询参数 + * @returns neId + */ +export async function listUENumByIMS(neId: String) { + const result = await request({ + url: `/api/rest/ueManagement/v1/elementType/ims/objectType/ueNum?neId=${neId}`, + method: 'get', + }); + if (result.code === RESULT_CODE_SUCCESS) { + return Object.assign(result, { + data: result.data['ueNum'], + }); + } + + // 模拟数据 + // { "ueNum": 0 } + // result.data = 0 + return result; +} diff --git a/src/api/neUser/ue.ts b/src/api/neUser/smf.ts similarity index 88% rename from src/api/neUser/ue.ts rename to src/api/neUser/smf.ts index 46755e46..2bcfbd54 100644 --- a/src/api/neUser/ue.ts +++ b/src/api/neUser/smf.ts @@ -7,7 +7,7 @@ import { parseObjLineToHump } from '@/utils/parse-utils'; * @param query 查询参数 * @returns object */ -export async function listUE(query: Record) { +export async function listUEInfoBySMF(query: Record) { query.nbId = query.id; const result = await request({ url: '/api/rest/ueManagement/v1/elementType/smf/objectType/ueInfo', @@ -62,21 +62,24 @@ export async function listUE(query: Record) { return data; } -// /** * 首页查询SMF在线用户数 * @param query 查询参数 * @returns neId */ -export async function listUENum(neId: String) { +export async function listUENumBySMF(neId: String) { const result = await request({ url: `/api/rest/ueManagement/v1/elementType/smf/objectType/ueNum?neId=${neId}`, method: 'get', }); if (result.code === RESULT_CODE_SUCCESS) { - let data = result.data.data; return Object.assign(result, { - data: parseObjLineToHump(data['ueNum']), + data: result.data.data['ueNum'], }); } + + // 模拟数据 + // { "data": { "ueNum": 0 } } + // result.data = 0 + return result; } diff --git a/src/views/neUser/ims/index.vue b/src/views/neUser/ims/index.vue index c33ec0b1..3a3e2377 100644 --- a/src/views/neUser/ims/index.vue +++ b/src/views/neUser/ims/index.vue @@ -5,7 +5,7 @@ import { 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 { listIMS } from '@/api/neUser/ims'; +import { listUEInfoByIMS } from '@/api/neUser/ims'; import useNeInfoStore from '@/store/modules/neinfo'; import useI18n from '@/hooks/useI18n'; import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; @@ -154,7 +154,7 @@ function fnGetList(pageNum?: number) { if (pageNum) { queryParams.pageNum = pageNum; } - listIMS(toRaw(queryParams)).then(res => { + listUEInfoByIMS(toRaw(queryParams)).then(res => { if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.rows)) { // 取消勾选 if (tableState.selectedRowKeys.length > 0) { @@ -162,7 +162,11 @@ function fnGetList(pageNum?: number) { } tablePagination.total = res.total; tableState.data = res.rows; - if (tablePagination.total <=(queryParams.pageNum - 1) * tablePagination.pageSize &&queryParams.pageNum !== 1) { + if ( + tablePagination.total <= + (queryParams.pageNum - 1) * tablePagination.pageSize && + queryParams.pageNum !== 1 + ) { tableState.loading = false; fnGetList(queryParams.pageNum - 1); } diff --git a/src/views/neUser/ue/index.vue b/src/views/neUser/ue/index.vue index b41f9377..6513a520 100644 --- a/src/views/neUser/ue/index.vue +++ b/src/views/neUser/ue/index.vue @@ -5,7 +5,7 @@ import { 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 { listUE } from '@/api/neUser/ue'; +import { listUEInfoBySMF } from '@/api/neUser/smf'; import useNeInfoStore from '@/store/modules/neinfo'; import useI18n from '@/hooks/useI18n'; import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; @@ -82,7 +82,6 @@ let tableColumns: ColumnsType = [ return opt.value; }, width: 150, - }, { title: 'MSISDN', @@ -233,7 +232,7 @@ function fnGetList(pageNum?: number) { if (pageNum) { queryParams.pageNum = pageNum; } - listUE(toRaw(queryParams)).then(res => { + listUEInfoBySMF(toRaw(queryParams)).then(res => { if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.rows)) { // 取消勾选 if (tableState.selectedRowKeys.length > 0) { @@ -241,7 +240,11 @@ function fnGetList(pageNum?: number) { } tablePagination.total = res.total; tableState.data = res.rows; - if (tablePagination.total <=(queryParams.pageNum - 1) * tablePagination.pageSize &&queryParams.pageNum !== 1) { + if ( + tablePagination.total <= + (queryParams.pageNum - 1) * tablePagination.pageSize && + queryParams.pageNum !== 1 + ) { tableState.loading = false; fnGetList(queryParams.pageNum - 1); } From f8e6d6060c186b57559012a3f015f89f89c901cf Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Wed, 31 Jan 2024 12:11:20 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat:=20=E7=9C=8B=E6=9D=BFIMS=E4=BC=9A?= =?UTF-8?q?=E8=AF=9D=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dashboard/overview/hooks/useTopology.ts | 6 ++ src/views/dashboard/overview/index.vue | 58 ++++++++++++------- 2 files changed, 44 insertions(+), 20 deletions(-) diff --git a/src/views/dashboard/overview/hooks/useTopology.ts b/src/views/dashboard/overview/hooks/useTopology.ts index 7610f561..63a5ffd4 100644 --- a/src/views/dashboard/overview/hooks/useTopology.ts +++ b/src/views/dashboard/overview/hooks/useTopology.ts @@ -64,6 +64,9 @@ export const graphNodeStateNum = computed(() => { return [normal, abnormal]; }); +/**网元状态请求标记 */ +export const neStateRequestMap = ref>(new Map()); + /**neStateParse 网元状态 数据解析 */ export function neStateParse(neType: string, data: Record) { const { combos, edges, nodes } = graphState.data; @@ -151,4 +154,7 @@ export function neStateParse(neType: string, data: Record) { graphG6.value.setItemState(edge.id, 'line-path', neT.neState.online); } } + + // 请求标记复位 + neStateRequestMap.value.set(neType, false); } diff --git a/src/views/dashboard/overview/index.vue b/src/views/dashboard/overview/index.vue index 555f998f..474a2d65 100644 --- a/src/views/dashboard/overview/index.vue +++ b/src/views/dashboard/overview/index.vue @@ -7,7 +7,8 @@ import UserActivity from './components/UserActivity/index.vue'; import AlarnTypeBar from './components/AlarnTypeBar/index.vue'; import UPFFlow from './components/UPFFlow/index.vue'; import { listSub } from '@/api/neUser/sub'; -import { listUENum } from '@/api/neUser/ue'; +import { listUENumBySMF } from '@/api/neUser/smf'; +import { listUENumByIMS } from '@/api/neUser/ims'; import { listBase5G } from '@/api/neUser/base5G'; import { @@ -15,12 +16,14 @@ import { graphState, notNeNodes, graphNodeStateNum, + neStateRequestMap, } from './hooks/useTopology'; import { upfTotalFlow, upfTFActive } from './hooks/useUPFTotalFlow'; import { useFullscreen } from '@vueuse/core'; import useWS from './hooks/useWS'; import useAppStore from '@/store/modules/app'; import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; + const appStore = useAppStore(); const { t } = useI18n(); const { wsSend, cdrEventSend, ueEventSend, upfTFSend } = useWS(); @@ -29,15 +32,18 @@ const { wsSend, cdrEventSend, ueEventSend, upfTFSend } = useWS(); let onlineInfo: { /**签约用户数量 */ subNum: number; - /**在线用户数 */ - ueNum: any; + /**SMF在线用户数 */ + smfUeNum: number; + /**IMS在线用户数 */ + imsUeNum: number; /**基站数量 */ nbNum: number; /**原始严重程度 */ activeAlarmSeverity: DictType[]; } = reactive({ subNum: 0, - ueNum: 0, + smfUeNum: 0, + imsUeNum: 0, nbNum: 0, activeAlarmSeverity: [], }); @@ -53,13 +59,17 @@ const stateInterval = ref(null); const stateTimeout = ref(null); /**查询网元状态 */ -async function fnGetState() { +function fnGetState() { clearTimeout(stateTimeout.value); // 获取节点状态 for (const node of graphState.data.nodes) { if (notNeNodes.includes(node.id)) continue; const { neType, neId } = node.neInfo; if (!neType || !neId) continue; + // 请求标记检查避免重复发送 + if (neStateRequestMap.value.get(neType)) continue; + neStateRequestMap.value.set(neType, true); + wsSend({ requestId: `neState_${neType}_${neId}`, type: 'ne_state', @@ -70,7 +80,7 @@ async function fnGetState() { }); } - // stateTimeout.value = setTimeout(() => fnGetState(), 5_000); + stateTimeout.value = setTimeout(() => fnGetState(), 5_000); } /**初始数据函数 */ @@ -110,7 +120,8 @@ onMounted(() => { /**每页条数 */ pageSize: 20, }), - listUENum('001'), + listUENumBySMF('001'), + listUENumByIMS('001'), ]) .then(resArr => { if (resArr[0].status === 'fulfilled') { @@ -125,11 +136,18 @@ onMounted(() => { onlineInfo.nbNum = resArr[1].value.rows.length; } - if ( - resArr[2].status === 'fulfilled' && - resArr[2].value?.code === RESULT_CODE_SUCCESS - ) { - onlineInfo.ueNum = resArr[2].value?.data; + if (resArr[2].status === 'fulfilled') { + const res = resArr[2].value; + if (res.code === RESULT_CODE_SUCCESS) { + onlineInfo.smfUeNum = res.data; + } + } + + if (resArr[3].status === 'fulfilled') { + const res = resArr[3].value; + if (res.code === RESULT_CODE_SUCCESS) { + onlineInfo.imsUeNum = res.data; + } } }) .finally(() => { @@ -177,19 +195,19 @@ onBeforeUnmount(() => {
-

{{ onlineInfo.ueNum }}

- - - Data {{ t('views.dashboard.overview.skim.session') }} - -
-
-

0

+

{{ onlineInfo.imsUeNum }}

IMS {{ t('views.dashboard.overview.skim.session') }}
+
+

{{ onlineInfo.smfUeNum }}

+ + + Data {{ t('views.dashboard.overview.skim.session') }} + +
From 7dc58482818c2f574bfbb018e9e09cb125deb272 Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Wed, 31 Jan 2024 14:20:54 +0800 Subject: [PATCH 3/3] =?UTF-8?q?feat:=20=E7=9C=8B=E6=9D=BF=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1UPF=E6=80=BB=E9=87=8F10s/=E9=81=BF=E5=85=8D=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../overview/hooks/useUPFTotalFlow.ts | 5 +++ src/views/dashboard/overview/hooks/useWS.ts | 17 +++++++ src/views/dashboard/overview/index.vue | 45 ++++++++++--------- 3 files changed, 45 insertions(+), 22 deletions(-) diff --git a/src/views/dashboard/overview/hooks/useUPFTotalFlow.ts b/src/views/dashboard/overview/hooks/useUPFTotalFlow.ts index bcc22eeb..e0da6a4b 100644 --- a/src/views/dashboard/overview/hooks/useUPFTotalFlow.ts +++ b/src/views/dashboard/overview/hooks/useUPFTotalFlow.ts @@ -6,6 +6,8 @@ type TFType = { up: string; /**下行 N6 */ down: string; + /**请求标记 */ + requestFlag: boolean; }; /**UPF-总流量数 */ @@ -14,14 +16,17 @@ export const upfTotalFlow = ref([ { up: '0 B', down: '0 B', + requestFlag: false, }, { up: '0 B', down: '0 B', + requestFlag: false, }, { up: '0 B', down: '0 B', + requestFlag: false, }, ]); diff --git a/src/views/dashboard/overview/hooks/useWS.ts b/src/views/dashboard/overview/hooks/useWS.ts index 073594ee..aeeb2825 100644 --- a/src/views/dashboard/overview/hooks/useWS.ts +++ b/src/views/dashboard/overview/hooks/useWS.ts @@ -75,16 +75,19 @@ export default function useWS() { 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': 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': const v30 = upfTFParse(data); upfTotalFlow.value[2].up = v30.up; upfTotalFlow.value[2].down = v30.down; + upfTotalFlow.value[2].requestFlag = false; break; } @@ -126,6 +129,20 @@ export default function useWS() { /**UPF-总流量数 发消息*/ function upfTFSend(day: 0 | 7 | 30) { + // 请求标记检查避免重复发送 + let index = 0; + if (day === 0) { + index = 0; + } else if (day === 7) { + index = 1; + } else if (day === 30) { + index = 2; + } + if (upfTotalFlow.value[index].requestFlag) { + return; + } + upfTotalFlow.value[index].requestFlag = true; + ws.send({ requestId: `1030_${day}`, type: 'upf_tf', diff --git a/src/views/dashboard/overview/index.vue b/src/views/dashboard/overview/index.vue index 474a2d65..7a53fa95 100644 --- a/src/views/dashboard/overview/index.vue +++ b/src/views/dashboard/overview/index.vue @@ -28,24 +28,24 @@ const appStore = useAppStore(); const { t } = useI18n(); const { wsSend, cdrEventSend, ueEventSend, upfTFSend } = useWS(); -/**用户在线信息 */ -let onlineInfo: { - /**签约用户数量 */ - subNum: number; +/**概览状态类型 */ +type SkimStateType = { + /**UDM签约用户数量 */ + udmSubNum: number; /**SMF在线用户数 */ smfUeNum: number; /**IMS在线用户数 */ imsUeNum: number; /**基站数量 */ nbNum: number; - /**原始严重程度 */ - activeAlarmSeverity: DictType[]; -} = reactive({ - subNum: 0, +}; + +/**概览状态信息 */ +let skimState: SkimStateType = reactive({ + udmSubNum: 0, smfUeNum: 0, imsUeNum: 0, nbNum: 0, - activeAlarmSeverity: [], }); /**总览节点 */ @@ -107,11 +107,9 @@ function InitData() { onMounted(() => { Promise.allSettled([ listSub({ - neid: '003', - sortField: 'imsi', - sortOrder: 'asc', - pageNum: '1', - pageSize: '20', + neid: '001', + pageNum: 1, + pageSize: 1, }), listBase5G({ neType: ['AMF', '001'], @@ -125,7 +123,10 @@ onMounted(() => { ]) .then(resArr => { if (resArr[0].status === 'fulfilled') { - onlineInfo.subNum = resArr[0].value.total; + const res = resArr[0].value; + if (res.code === RESULT_CODE_SUCCESS) { + skimState.udmSubNum = res.total; + } } if ( @@ -133,20 +134,20 @@ onMounted(() => { resArr[1].value.code === RESULT_CODE_SUCCESS && Array.isArray(resArr[1].value.rows) ) { - onlineInfo.nbNum = resArr[1].value.rows.length; + skimState.nbNum = resArr[1].value.rows.length; } if (resArr[2].status === 'fulfilled') { const res = resArr[2].value; if (res.code === RESULT_CODE_SUCCESS) { - onlineInfo.smfUeNum = res.data; + skimState.smfUeNum = res.data; } } if (resArr[3].status === 'fulfilled') { const res = resArr[3].value; if (res.code === RESULT_CODE_SUCCESS) { - onlineInfo.imsUeNum = res.data; + skimState.imsUeNum = res.data; } } }) @@ -181,28 +182,28 @@ onBeforeUnmount(() => {
-

{{ onlineInfo.subNum }}

+

{{ skimState.udmSubNum }}

{{ t('views.dashboard.overview.skim.users') }}
-

{{ onlineInfo.nbNum }}

+

{{ skimState.nbNum }}

{{ t('views.dashboard.overview.skim.base') }}
-

{{ onlineInfo.imsUeNum }}

+

{{ skimState.imsUeNum }}

IMS {{ t('views.dashboard.overview.skim.session') }}
-

{{ onlineInfo.smfUeNum }}

+

{{ skimState.smfUeNum }}

Data {{ t('views.dashboard.overview.skim.session') }}