From 22e595131c2fb72602cdc8da5a341d30ea0e6476 Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Fri, 24 Jan 2025 09:38:55 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=9F=BA=E7=AB=99=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0MME4G=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/neData/mme.ts | 87 +++++++++++++++++++ .../ne-data/base-station/components/list.vue | 37 +++++--- .../base-station/components/topology.vue | 40 ++++++++- 3 files changed, 152 insertions(+), 12 deletions(-) diff --git a/src/api/neData/mme.ts b/src/api/neData/mme.ts index cc875983..4219eed7 100644 --- a/src/api/neData/mme.ts +++ b/src/api/neData/mme.ts @@ -41,3 +41,90 @@ export function exportMMEDataUE(data: Record) { timeout: 60_000, }); } + +/** + * MME-接入基站信息列表 + * @param query 查询参数 neId=001&id=1 + * @returns object + */ +export function listMMENblist(query: Record) { + return request({ + url: '/neData/mme/nb/list', + method: 'get', + params: query, + timeout: 60_000, + }); +} + +/** + * MME-接入基站状态信息列表 + * @param query 查询参数 neId=001&state=1 + * @returns object + */ +export function listMMENbStatelist(query: Record) { + return request({ + url: '/neData/mme/nb/list-cfg', + method: 'get', + params: query, + timeout: 60_000, + }); +} + +/** + * MME-接入基站状态信息新增 + * @param neId 网元ID + * @param data 数据 { "index": 1, "name": "Enb", "address": "192.168.8.1", "position": "Area-B" } + * @returns object + */ +export function addMMENbState(neId: string, data: Record) { + return request({ + url: `/ne/config/data`, + method: 'post', + data: { + neType: 'MME', + neId: neId, + paramName: 'enbList', + paramData: data, + loc: `${data.index}`, + }, + }); +} + +/** + * MME-接入基站状态信息修改 + * @param neId 网元ID + * @param data 数据 { "index": 1, "name": "Enb", "address": "192.168.8.1", "position": "Area-B" } + * @returns object + */ +export function editMMENbState(neId: string, data: Record) { + return request({ + url: `/ne/config/data`, + method: 'put', + data: { + neType: 'MME', + neId: neId, + paramName: 'enbList', + paramData: data, + loc: `${data.index}`, + }, + }); +} + +/** + * MME-接入基站状态信息删除 + * @param neId 网元ID + * @param index 数据index + * @returns object + */ +export function delMMENbState(neId: string, index: string | number) { + return request({ + url: `/ne/config/data`, + method: 'delete', + params: { + neType: 'MME', + neId: neId, + paramName: 'enbList', + loc: `${index}`, + }, + }); +} diff --git a/src/views/ne-data/base-station/components/list.vue b/src/views/ne-data/base-station/components/list.vue index 1d829638..ae646ed4 100644 --- a/src/views/ne-data/base-station/components/list.vue +++ b/src/views/ne-data/base-station/components/list.vue @@ -15,6 +15,12 @@ import { } from '@/api/neData/amf'; const { t } = useI18n(); import { useRoute } from 'vue-router'; +import { + addMMENbState, + delMMENbState, + editMMENbState, + listMMENbStatelist, +} from '@/api/neData/mme'; const route = useRoute(); const nbState = ref([ @@ -204,7 +210,7 @@ function fnRecordDelete(index: string) { } for (const v of tableState.selectedRowKeys) { if (neType === 'MME') { - // reqArr.push(delAMFNbState(neId, v)); + reqArr.push(delMMENbState(neId, v)); } if (neType === 'AMF') { reqArr.push(delAMFNbState(neId, v)); @@ -212,7 +218,7 @@ function fnRecordDelete(index: string) { } } else { if (neType === 'MME') { - // reqArr.push(delAMFNbState(neId, index)); + reqArr.push(delMMENbState(neId, index)); } if (neType === 'AMF') { reqArr.push(delAMFNbState(neId, index)); @@ -247,9 +253,9 @@ function fnGetList() { const [neType, neId] = neTypeAndId.value; queryParams.neId = neId; let req = null; - // if (neType === 'MME') { - // req = listAMFNbStatelist(toRaw(queryParams)); - // } + if (neType === 'MME') { + req = listMMENbStatelist(toRaw(queryParams)); + } if (neType === 'AMF') { req = listAMFNbStatelist(toRaw(queryParams)); } @@ -368,17 +374,28 @@ function fnModalVisibleByEdit(edit?: string | number) { * 进行表达规则校验 */ function fnModalOk() { - const neID = queryParams.neId; - if (!neID) return; + const [neType, neId] = neTypeAndId.value; + if (!neId) return; const from = JSON.parse(JSON.stringify(modalState.from)); modalStateFrom .validate() .then(e => { modalState.confirmLoading = true; const hide = message.loading(t('common.loading'), 0); - let result: any = from.state - ? editAMFNbState(neID, from) - : addAMFNbState(neID, from); + let result: any = null; + if (neType === 'MME') { + result = from.state + ? editMMENbState(neId, from) + : addMMENbState(neId, from); + } + if (neType === 'AMF') { + result = from.state + ? editAMFNbState(neId, from) + : addAMFNbState(neId, from); + } + if (result === null) { + return; + } result .then((res: any) => { if (res.code === RESULT_CODE_SUCCESS) { diff --git a/src/views/ne-data/base-station/components/topology.vue b/src/views/ne-data/base-station/components/topology.vue index c25f2de8..03a178e8 100644 --- a/src/views/ne-data/base-station/components/topology.vue +++ b/src/views/ne-data/base-station/components/topology.vue @@ -11,6 +11,7 @@ import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; import { stateNeInfo } from '@/api/ne/neInfo'; import { parseDateToStr } from '@/utils/date-utils'; import { useFullscreen } from '@vueuse/core'; +import { listMMENbStatelist } from '@/api/neData/mme'; const { t } = useI18n(); /**图DOM节点实例对象 */ @@ -399,8 +400,7 @@ async function fnGraphDataBase() { data.nodes?.push(node); continue; } - // if (['AMF', 'MME'].includes(item.value)) { - if (['AMF'].includes(item.value)) { + if (['AMF', 'MME'].includes(item.value)) { if (item.children?.length === 0) continue; for (const child of item.children) { const id = `${child.neType}_${child.neId}`; @@ -452,6 +452,25 @@ async function fnGraphDataNb(data: GraphData) { } } if (item.nType === 'MME') { + const neId = (item.nInfo as any).neId; + const res = await listMMENbStatelist({ neId }); + if (res.code !== RESULT_CODE_SUCCESS || !Array.isArray(res.data)) { + continue; + } + for (const nb of res.data) { + const id = `${item.id}_${nb.index}`; + data.nodes?.push({ + id: id, + label: fittingString(`${nb.name}`, 80, 14), + img: parseBasePath('/svg/base4G.svg'), + nInfo: nb, + nType: 'ENB', + }); + data.edges?.push({ + source: item.id, + target: id, + }); + } } } return data; @@ -514,6 +533,23 @@ async function fnGraphState(reload: boolean = false) { } } if (reload && nInfo.neType === 'MME') { + const res = await listMMENbStatelist({ neId: nInfo.neId }); + if (res.code == RESULT_CODE_SUCCESS && Array.isArray(res.data)) { + for (const nb of res.data) { + const nbItem = graphData.nodes.find( + (v: any) => v.id === `${id}_${nb.index}` + ); + if (nbItem) { + Object.assign(nbItem.nInfo, nb); + const stateColor = nb.state === 'ON' ? '#52c41a' : '#f5222d'; // 状态颜色 + graphG6.value.setItemState( + nbItem.id, + 'top-right-dot', + stateColor + ); + } + } + } } });