同时获取45G基站信息

This commit is contained in:
lai
2024-07-04 16:50:58 +08:00
parent c21af696fe
commit 28213cde43
3 changed files with 199 additions and 80 deletions

View File

@@ -171,7 +171,7 @@ onMounted(() => {
<div class="detailsLeft">
<div
class="number"
@click="fnToRouter('Base5G_2160', { neType: 'AMF' })"
@click="fnToRouter('Base5G_2160', { neType: '5g' })"
>
<img
:src="svgBasefff"
@@ -184,7 +184,7 @@ onMounted(() => {
<div class="details">
<div
class="number"
@click="fnToRouter('Base5G_2160', { neType: 'AMF' })"
@click="fnToRouter('Base5G_2160', { neType: '5g' })"
>
<UserOutlined class="spaceButton" />
{{ skimState.gnbUeNum }}
@@ -209,7 +209,7 @@ onMounted(() => {
<div class="detailsLeft">
<div
class="number"
@click="fnToRouter('Base5G_2160', { neType: 'MME' })"
@click="fnToRouter('Base5G_2160', { neType: '4g' })"
>
<img
:src="svgBasefff"
@@ -222,7 +222,7 @@ onMounted(() => {
<div class="details">
<div
class="number"
@click="fnToRouter('Base5G_2160', { neType: 'MME' })"
@click="fnToRouter('Base5G_2160', { neType: '4g' })"
>
<UserOutlined class="spaceButton" /> {{ skimState.enbUeNum }}
</div>

View File

@@ -11,7 +11,6 @@ import useNeInfoStore from '@/store/modules/neinfo';
import { useRoute } from 'vue-router';
import { ColumnsType } from 'ant-design-vue/lib/table';
import TableColumnsDnd from '@/components/TableColumnsDnd/index.vue';
import useUserStore from '@/store/modules/user';
const neInfoStore = useNeInfoStore();
const route = useRoute();
const { t } = useI18n();
@@ -19,8 +18,12 @@ const { t } = useI18n();
/**网元参数 */
let neCascaderOptions = ref<Record<string, any>[]>([]);
let promises = ref<any[]>([]);
/**查询参数 */
let queryParams = reactive({
/**45G类型 */
totalType: '',
/**网元ID */
neId: '',
/**网元类型 */
@@ -46,7 +49,7 @@ function fnQueryReset() {
});
tablePagination.current = 1;
tablePagination.pageSize = 20;
fnGetList();
fnGet45GList();
}
/**表格状态类型 */
@@ -136,7 +139,7 @@ let tablePagination = reactive({
tablePagination.pageSize = pageSize;
queryParams.pageNum = page;
queryParams.pageSize = pageSize;
fnGetList();
fnGet45GList();
},
});
@@ -186,6 +189,85 @@ function fnGetList(pageNum?: number) {
});
}
/**查询4G或者5G及45G列表, pageNum初始页数 */
function fnGet45GList(pageNum?: number) {
if (tableState.loading) return;
tableState.loading = true;
if (pageNum) {
queryParams.pageNum = pageNum;
}
const typeArr: any = [];
const typeMapping: any = {
'4g': ['MME'],
'5g': ['AMF'],
'45g': ['AMF', 'MME'],
};
typeArr.value = typeMapping[queryParams.totalType] || ['AMF', 'MME'];
neCascaderOptions.value = neInfoStore.getNeCascaderOptions.filter(
(item: any) => {
return typeArr.value.includes(item.value);
}
);
if (neCascaderOptions.value.length === 0) {
message.warning({
content: t('common.noData'),
duration: 2,
});
return;
}
tableState.data = [];
promises.value = [];
//同时获取45G基站信息 且在每条信息中添加45G字段(原始数据没有) 已经筛选后的
neCascaderOptions.value.map((item: any) => {
item.children.forEach((child: any) => {
promises.value.push(
listBase5G({
neId: child.neId,
neType: child.neType,
nbId: queryParams.id,
tenantName: queryParams.tenantName,
pageNum: queryParams.pageNum,
pageSize: 10000,
})
);
});
});
Promise.allSettled(promises.value).then(results => {
results.forEach(result => {
if (result.status === 'fulfilled') {
const allBaseData = result.value;
if (
allBaseData.code === RESULT_CODE_SUCCESS &&
Array.isArray(allBaseData.rows)
) {
// 处理成功结果
tablePagination.total += allBaseData.total;
tableState.data = [...tableState.data, ...allBaseData.rows];
if (
tablePagination.total <=
(queryParams.pageNum - 1) * tablePagination.pageSize &&
queryParams.pageNum !== 1
) {
tableState.loading = false;
fnGet45GList(queryParams.pageNum - 1);
}
} else {
//AMF返回404是代表没找到这个数据 GNB_NOT_FOUND
tablePagination.total = 0;
tableState.data = [];
}
tableState.loading = false;
}
});
});
}
onMounted(() => {
// 获取网元网元列表
neInfoStore
@@ -193,31 +275,8 @@ onMounted(() => {
.then(res => {
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) {
if (res.data.length > 0) {
// 过滤不可用的网元
neCascaderOptions.value = neInfoStore.getNeCascaderOptions.filter(
(item: any) => {
return ['AMF', 'MME'].includes(item.value);
}
);
if (neCascaderOptions.value.length === 0) {
message.warning({
content: t('common.noData'),
duration: 2,
});
return;
}
// 无查询参数neType时 默认选择AMF
const queryNeType = (route.query.neType as string) || 'AMF';
const item = neCascaderOptions.value.find(
s => s.value === queryNeType
);
if (item && item.children) {
const info = item.children[0];
queryParams.neType = [info.neType, info.neId];
} else {
const info = neCascaderOptions.value[0].children[0];
queryParams.neType = [info.neType, info.neId];
}
// 无查询参数neType时 默认选择AMF 监控页跳转时
queryParams.totalType = (route.query.neType as string) || '45g';
}
} else {
message.warning({
@@ -227,16 +286,9 @@ onMounted(() => {
}
})
.finally(() => {
if (useUserStore().roles.includes('tenant')) {
const operateColumnIndex = tableColumns.findIndex(
(column: any) => column.key === 'tenantName'
);
if (operateColumnIndex !== -1) {
tableColumns.splice(operateColumnIndex, 1);
}
}
// 获取列表数据
fnGetList();
// fnGetList();
fnGet45GList();
});
});
</script>
@@ -253,9 +305,13 @@ onMounted(() => {
<a-row :gutter="16">
<a-col :lg="6" :md="12" :xs="24">
<a-form-item name="neId" :label="t('views.neUser.base5G.neType')">
<a-cascader
v-model:value="queryParams.neType"
:options="neCascaderOptions"
<a-select
v-model:value="queryParams.totalType"
:options="[
{ label: '4G', value: '4g' },
{ label: '5G', value: '5g' },
{ label: '45G', value: '45g' },
]"
:allow-clear="false"
:placeholder="t('common.selectPlease')"
/>
@@ -286,7 +342,7 @@ onMounted(() => {
<a-col :lg="6" :md="12" :xs="24">
<a-form-item>
<a-space :size="8">
<a-button type="primary" @click.prevent="fnGetList(1)">
<a-button type="primary" @click.prevent="fnGet45GList(1)">
<template #icon><SearchOutlined /></template>
{{ t('common.search') }}
</a-button>
@@ -319,7 +375,7 @@ onMounted(() => {
</a-tooltip>
<a-tooltip>
<template #title>{{ t('common.reloadText') }}</template>
<a-button type="text" @click.prevent="fnGetList()">
<a-button type="text" @click.prevent="fnGet45GList()">
<template #icon><ReloadOutlined /></template>
</a-button>
</a-tooltip>

View File

@@ -11,7 +11,6 @@ import useNeInfoStore from '@/store/modules/neinfo';
import { useRoute } from 'vue-router';
import { ColumnsType } from 'ant-design-vue/lib/table';
import TableColumnsDnd from '@/components/TableColumnsDnd/index.vue';
import useUserStore from '@/store/modules/user';
const neInfoStore = useNeInfoStore();
const route = useRoute();
const { t } = useI18n();
@@ -19,8 +18,12 @@ const { t } = useI18n();
/**网元参数 */
let neCascaderOptions = ref<Record<string, any>[]>([]);
let promises = ref<any[]>([]);
/**查询参数 */
let queryParams = reactive({
/**45G类型 */
totalType: '',
/**网元ID */
neId: '',
/**网元类型 */
@@ -43,7 +46,7 @@ function fnQueryReset() {
});
tablePagination.current = 1;
tablePagination.pageSize = 20;
fnGetList();
fnGet45GList();
}
/**表格状态类型 */
@@ -126,7 +129,7 @@ let tablePagination = reactive({
tablePagination.pageSize = pageSize;
queryParams.pageNum = page;
queryParams.pageSize = pageSize;
fnGetList();
fnGet45GList();
},
});
@@ -175,6 +178,84 @@ function fnGetList(pageNum?: number) {
});
}
/**查询4G或者5G及45G列表, pageNum初始页数 */
function fnGet45GList(pageNum?: number) {
if (tableState.loading) return;
tableState.loading = true;
if (pageNum) {
queryParams.pageNum = pageNum;
}
const typeArr: any = [];
const typeMapping: any = {
'4g': ['MME'],
'5g': ['AMF'],
'45g': ['AMF', 'MME'],
};
typeArr.value = typeMapping[queryParams.totalType] || ['AMF', 'MME'];
neCascaderOptions.value = neInfoStore.getNeCascaderOptions.filter(
(item: any) => {
return typeArr.value.includes(item.value);
}
);
if (neCascaderOptions.value.length === 0) {
message.warning({
content: t('common.noData'),
duration: 2,
});
return;
}
tableState.data = [];
promises.value = [];
//同时获取45G基站信息 且在每条信息中添加45G字段(原始数据没有) 已经筛选后的
neCascaderOptions.value.map((item: any) => {
item.children.forEach((child: any) => {
promises.value.push(
listBase5G({
neId: child.neId,
neType: child.neType,
nbId: queryParams.id,
pageNum: queryParams.pageNum,
pageSize: 10000,
})
);
});
});
Promise.allSettled(promises.value).then(results => {
results.forEach(result => {
if (result.status === 'fulfilled') {
const allBaseData = result.value;
if (
allBaseData.code === RESULT_CODE_SUCCESS &&
Array.isArray(allBaseData.rows)
) {
// 处理成功结果
tablePagination.total += allBaseData.total;
tableState.data = [...tableState.data, ...allBaseData.rows];
if (
tablePagination.total <=
(queryParams.pageNum - 1) * tablePagination.pageSize &&
queryParams.pageNum !== 1
) {
tableState.loading = false;
fnGet45GList(queryParams.pageNum - 1);
}
} else {
//AMF返回404是代表没找到这个数据 GNB_NOT_FOUND
tablePagination.total = 0;
tableState.data = [];
}
tableState.loading = false;
}
});
});
}
onMounted(() => {
// 获取网元网元列表
neInfoStore
@@ -182,31 +263,8 @@ onMounted(() => {
.then(res => {
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) {
if (res.data.length > 0) {
// 过滤不可用的网元
neCascaderOptions.value = neInfoStore.getNeCascaderOptions.filter(
(item: any) => {
return ['AMF', 'MME'].includes(item.value);
}
);
if (neCascaderOptions.value.length === 0) {
message.warning({
content: t('common.noData'),
duration: 2,
});
return;
}
// 无查询参数neType时 默认选择AMF
const queryNeType = (route.query.neType as string) || 'AMF';
const item = neCascaderOptions.value.find(
s => s.value === queryNeType
);
if (item && item.children) {
const info = item.children[0];
queryParams.neType = [info.neType, info.neId];
} else {
const info = neCascaderOptions.value[0].children[0];
queryParams.neType = [info.neType, info.neId];
}
// 无查询参数neType时 默认选择AMF 监控页跳转时
queryParams.totalType = (route.query.neType as string) || '45g';
}
} else {
message.warning({
@@ -217,7 +275,8 @@ onMounted(() => {
})
.finally(() => {
// 获取列表数据
fnGetList();
// fnGetList();
fnGet45GList();
});
});
</script>
@@ -234,9 +293,13 @@ onMounted(() => {
<a-row :gutter="16">
<a-col :lg="6" :md="12" :xs="24">
<a-form-item name="neId" :label="t('views.neUser.base5G.neType')">
<a-cascader
v-model:value="queryParams.neType"
:options="neCascaderOptions"
<a-select
v-model:value="queryParams.totalType"
:options="[
{ label: '4G', value: '4g' },
{ label: '5G', value: '5g' },
{ label: '45G', value: '45g' },
]"
:allow-clear="false"
:placeholder="t('common.selectPlease')"
/>
@@ -251,7 +314,7 @@ onMounted(() => {
<a-col :lg="6" :md="12" :xs="24">
<a-form-item>
<a-space :size="8">
<a-button type="primary" @click.prevent="fnGetList(1)">
<a-button type="primary" @click.prevent="fnGet45GList(1)">
<template #icon><SearchOutlined /></template>
{{ t('common.search') }}
</a-button>
@@ -284,7 +347,7 @@ onMounted(() => {
</a-tooltip>
<a-tooltip>
<template #title>{{ t('common.reloadText') }}</template>
<a-button type="text" @click.prevent="fnGetList()">
<a-button type="text" @click.prevent="fnGet45GList()">
<template #icon><ReloadOutlined /></template>
</a-button>
</a-tooltip>