From 28213cde43815e647a0e5465fd1d5f473b41226f Mon Sep 17 00:00:00 2001
From: lai <371757574@qq.com>
Date: Thu, 4 Jul 2024 16:50:58 +0800
Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=97=B6=E8=8E=B7=E5=8F=9645G?=
=?UTF-8?q?=E5=9F=BA=E7=AB=99=E4=BF=A1=E6=81=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/index/moduleInfo.vue | 8 +-
src/views/neUser/base5G/index.vue | 140 +++++++++++++++++++++---------
src/views/tenant/base5G/index.vue | 131 ++++++++++++++++++++--------
3 files changed, 199 insertions(+), 80 deletions(-)
diff --git a/src/views/index/moduleInfo.vue b/src/views/index/moduleInfo.vue
index 6f9c987b..c61dc02d 100644
--- a/src/views/index/moduleInfo.vue
+++ b/src/views/index/moduleInfo.vue
@@ -171,7 +171,7 @@ onMounted(() => {
![]()
{
{{ skimState.gnbUeNum }}
@@ -209,7 +209,7 @@ onMounted(() => {
![]()
{
{{ skimState.enbUeNum }}
diff --git a/src/views/neUser/base5G/index.vue b/src/views/neUser/base5G/index.vue
index b7de92a9..cae995ad 100644
--- a/src/views/neUser/base5G/index.vue
+++ b/src/views/neUser/base5G/index.vue
@@ -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
[]>([]);
+let promises = ref([]);
+
/**查询参数 */
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();
});
});
@@ -253,9 +305,13 @@ onMounted(() => {
-
@@ -286,7 +342,7 @@ onMounted(() => {
-
+
{{ t('common.search') }}
@@ -319,7 +375,7 @@ onMounted(() => {
{{ t('common.reloadText') }}
-
+
diff --git a/src/views/tenant/base5G/index.vue b/src/views/tenant/base5G/index.vue
index 85417cec..6bd15619 100644
--- a/src/views/tenant/base5G/index.vue
+++ b/src/views/tenant/base5G/index.vue
@@ -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[]>([]);
+let promises = ref([]);
+
/**查询参数 */
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();
});
});
@@ -234,9 +293,13 @@ onMounted(() => {
-
@@ -251,7 +314,7 @@ onMounted(() => {
-
+
{{ t('common.search') }}
@@ -284,7 +347,7 @@ onMounted(() => {
{{ t('common.reloadText') }}
-
+