diff --git a/src/store/modules/neinfo.ts b/src/store/modules/neinfo.ts index 30d67b3c..7c268afb 100644 --- a/src/store/modules/neinfo.ts +++ b/src/store/modules/neinfo.ts @@ -10,7 +10,7 @@ type NeInfo = { /**网元列表 */ neList: Record[]; /**级联options树结构 */ - neCascaderOtions: Record[]; + neCascaderOptions: Record[]; /**选择器单级父类型 */ neSelectOtions: Record[]; /**跟踪接口列表 */ @@ -22,7 +22,7 @@ type NeInfo = { const useNeInfoStore = defineStore('neinfo', { state: (): NeInfo => ({ neList: [], - neCascaderOtions: [], + neCascaderOptions: [], neSelectOtions: [], traceInterfaceList: [], perMeasurementList: [], @@ -33,8 +33,8 @@ const useNeInfoStore = defineStore('neinfo', { * @param state 内部属性不用传入 * @returns 级联options */ - getNeCascaderOtions(state) { - return state.neCascaderOtions; + getNeCascaderOptions(state) { + return state.neCascaderOptions; }, /** * 选择器单级父类型 @@ -70,7 +70,7 @@ const useNeInfoStore = defineStore('neinfo', { 'neName', 'neId' ); - this.neCascaderOtions = options; + this.neCascaderOptions = options; // 转选择器单级父类型 this.neSelectOtions = options.map(item => item); diff --git a/src/views/configManage/configParam/index.vue b/src/views/configManage/configParam/index.vue index 99dfe4df..d9e87168 100644 --- a/src/views/configManage/configParam/index.vue +++ b/src/views/configManage/configParam/index.vue @@ -20,7 +20,7 @@ import { regExpIPv4, regExpIPv6 } from '@/utils/regular-utils'; const { t } = useI18n(); /**网元参数 */ -let neCascaderOtions = ref[]>([]); +let neCascaderOptions = ref[]>([]); /**网元类型选择 type,id */ let neTypeSelect = ref(['', '']); @@ -1068,18 +1068,25 @@ onMounted(() => { if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) { if (res.data.length > 0) { // 过滤不可用的网元 - neCascaderOtions.value = useNeInfoStore().getNeCascaderOtions.filter( + neCascaderOptions.value = useNeInfoStore().getNeCascaderOptions.filter( (item: any) => { return !['OMC'].includes(item.value); } ); + if (neCascaderOptions.value.length === 0) { + message.warning({ + content: t('common.noData'), + duration: 2, + }); + return; + } // 默认选择AMF - const item = neCascaderOtions.value.find(s => s.value === 'AMF'); + const item = neCascaderOptions.value.find(s => s.value === 'AMF'); if (item && item.children) { const info = item.children[0]; neTypeSelect.value = [info.neType, info.neId]; } else { - const info = neCascaderOtions.value[0].children[0]; + const info = neCascaderOptions.value[0]?.children[0]; neTypeSelect.value = [info.neType, info.neId]; } fnGetParamConfigTopTab(); @@ -1110,7 +1117,7 @@ onMounted(() => { > diff --git a/src/views/configManage/configParamForm/index.vue b/src/views/configManage/configParamForm/index.vue index b3f248c8..d79fbe2e 100644 --- a/src/views/configManage/configParamForm/index.vue +++ b/src/views/configManage/configParamForm/index.vue @@ -989,7 +989,7 @@ onMounted(() => { if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) { if (res.data.length > 0) { // 过滤不可用的网元 - neCascaderOtions.value = useNeInfoStore().getNeCascaderOtions.filter( + neCascaderOtions.value = useNeInfoStore().getNeCascaderOptions.filter( (item: any) => { return !['OMC'].includes(item.value); } diff --git a/src/views/configManage/configParamTree/index.vue b/src/views/configManage/configParamTree/index.vue index 5a576ec7..51e71087 100644 --- a/src/views/configManage/configParamTree/index.vue +++ b/src/views/configManage/configParamTree/index.vue @@ -16,10 +16,11 @@ import { toRaw } from 'vue'; import { regExpIPv4, regExpIPv6 } from '@/utils/regular-utils'; import { SizeType } from 'ant-design-vue/lib/config-provider'; import { DataNode } from 'ant-design-vue/lib/tree'; +const neInfoStore = useNeInfoStore(); const { t } = useI18n(); /**网元参数 */ -let neCascaderOtions = ref[]>([]); +let neCascaderOptions = ref[]>([]); /**网元类型选择 type,id */ let neTypeSelect = ref(['', '']); @@ -1011,35 +1012,40 @@ function fnModalCancel() { onMounted(() => { // 获取网元网元列表 - useNeInfoStore() - .fnNelist() - .then(res => { - if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) { - if (res.data.length > 0) { - // 过滤不可用的网元 - neCascaderOtions.value = useNeInfoStore().getNeCascaderOtions.filter( - (item: any) => { - return !['OMC'].includes(item.value); - } - ); - // 默认选择AMF - const item = neCascaderOtions.value.find(s => s.value === 'AMF'); - if (item && item.children) { - const info = item.children[0]; - neTypeSelect.value = [info.neType, info.neId]; - } else { - const info = neCascaderOtions.value[0].children[0]; - neTypeSelect.value = [info.neType, info.neId]; + neInfoStore.fnNelist().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 !['OMC'].includes(item.value); } - fnGetParamConfigTopTab(); + ); + if (neCascaderOptions.value.length === 0) { + message.warning({ + content: t('common.noData'), + duration: 2, + }); + return; } - } else { - message.warning({ - content: t('common.noData'), - duration: 2, - }); + // 默认选择AMF + const item = neCascaderOptions.value.find(s => s.value === 'AMF'); + if (item && item.children) { + const info = item.children[0]; + neTypeSelect.value = [info.neType, info.neId]; + } else { + const info = neCascaderOptions.value[0].children[0]; + neTypeSelect.value = [info.neType, info.neId]; + } + fnGetParamConfigTopTab(); } - }); + } else { + message.warning({ + content: t('common.noData'), + duration: 2, + }); + } + }); }); @@ -1058,7 +1064,7 @@ onMounted(() => { diff --git a/src/views/configManage/configParamTreeTable/index.vue b/src/views/configManage/configParamTreeTable/index.vue index bb96e092..18dcb230 100644 --- a/src/views/configManage/configParamTreeTable/index.vue +++ b/src/views/configManage/configParamTreeTable/index.vue @@ -16,10 +16,11 @@ import useNeInfoStore from '@/store/modules/neinfo'; import { regExpIPv4, regExpIPv6 } from '@/utils/regular-utils'; import { SizeType } from 'ant-design-vue/lib/config-provider'; import { DataNode } from 'ant-design-vue/lib/tree'; +const neInfoStore = useNeInfoStore(); const { t } = useI18n(); /**网元参数 */ -let neCascaderOtions = ref[]>([]); +let neCascaderOptions = ref[]>([]); /**网元类型选择 type,id */ let neTypeSelect = ref(['', '']); @@ -1052,24 +1053,31 @@ function fnModalCancel() { onMounted(() => { // 获取网元网元列表 - useNeInfoStore() + neInfoStore .fnNelist() .then(res => { if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) { if (res.data.length > 0) { // 过滤不可用的网元 - neCascaderOtions.value = useNeInfoStore().getNeCascaderOtions.filter( + neCascaderOptions.value = neInfoStore.getNeCascaderOptions.filter( (item: any) => { return !['OMC'].includes(item.value); } ); + if (neCascaderOptions.value.length === 0) { + message.warning({ + content: t('common.noData'), + duration: 2, + }); + return; + } // 默认选择AMF - const item = neCascaderOtions.value.find(s => s.value === 'UPF'); + const item = neCascaderOptions.value.find(s => s.value === 'UPF'); if (item && item.children) { const info = item.children[0]; neTypeSelect.value = [info.neType, info.neId]; } else { - const info = neCascaderOtions.value[0].children[0]; + const info = neCascaderOptions.value[0].children[0]; neTypeSelect.value = [info.neType, info.neId]; } fnGetParamConfigTopTab(); @@ -1099,7 +1107,7 @@ onMounted(() => { diff --git a/src/views/configManage/license/index.vue b/src/views/configManage/license/index.vue index 5128fa46..79efb5b6 100644 --- a/src/views/configManage/license/index.vue +++ b/src/views/configManage/license/index.vue @@ -11,6 +11,7 @@ import useI18n from '@/hooks/useI18n'; import useNeInfoStore from '@/store/modules/neinfo'; import { FileType } from 'ant-design-vue/lib/upload/interface'; import { UploadRequestOption } from 'ant-design-vue/lib/vc-upload/interface'; +const neInfoStore = useNeInfoStore(); const { t } = useI18n(); /**查询参数 */ @@ -129,7 +130,7 @@ function fnTableSize({ key }: MenuInfo) { function fnGetList(pageNum?: number) { if (tableState.loading) return; tableState.loading = true; - if(pageNum){ + if (pageNum) { queryParams.pageNum = pageNum; } listLicense(toRaw(queryParams)).then(res => { @@ -267,7 +268,10 @@ function fnBeforeUploadFile(file: FileType) { const fileName = file.name; const suff = fileName.substring(fileName.lastIndexOf('.')); if (!['.ini'].includes(suff)) { - message.error(t('views.configManage.softwareManage.onlyAble',{fileText:'(.ini)'}), 3); + message.error( + t('views.configManage.softwareManage.onlyAble', { fileText: '(.ini)' }), + 3 + ); return false; } @@ -287,19 +291,17 @@ function fnUploadFile(up: UploadRequestOption) { onMounted(() => { // 获取网元网元列表 - useNeInfoStore() - .fnNelist() - .then(res => { - if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) { - // 获取列表数据 - fnGetList(); - } else { - message.warning({ - content: t('views.configManage.softwareManage.nullData'), - duration: 2, - }); - } - }); + neInfoStore.fnNelist().then(res => { + if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) { + // 获取列表数据 + fnGetList(); + } else { + message.warning({ + content: t('views.configManage.softwareManage.nullData'), + duration: 2, + }); + } + }); }); @@ -320,7 +322,7 @@ onMounted(() => { > @@ -425,10 +427,7 @@ onMounted(() => { @ok="fnModalOk" @cancel="fnModalCancel" > - + { > diff --git a/src/views/mmlManage/neOperate/index.vue b/src/views/mmlManage/neOperate/index.vue index 3f13b2b2..ba45bc9e 100644 --- a/src/views/mmlManage/neOperate/index.vue +++ b/src/views/mmlManage/neOperate/index.vue @@ -10,6 +10,7 @@ import useI18n from '@/hooks/useI18n'; import { getMMLByNE, sendMMlByNE } from '@/api/mmlManage/neOperate'; import { uploadFileToNE } from '@/api/tool/file'; import { UploadRequestOption } from 'ant-design-vue/lib/vc-upload/interface'; +const neInfoStore = useNeInfoStore(); const { t } = useI18n(); /**网元参数 */ @@ -455,35 +456,40 @@ function fnAutoCompleteChange(value: any, _: any) { onMounted(() => { // 获取网元网元列表 - useNeInfoStore() - .fnNelist() - .then(res => { - if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) { - if (res.data.length > 0) { - // 过滤不可用的网元 - neCascaderOptions.value = useNeInfoStore().getNeCascaderOtions.filter( - (item: any) => { - return !['OMC'].includes(item.value); - } - ); - // 默认选择AMF - const item = neCascaderOptions.value.find(s => s.value === 'AMF'); - if (item && item.children) { - const info = item.children[0]; - state.neType = [info.neType, info.neId]; - } else { - const info = neCascaderOptions.value[0].children[0]; - state.neType = [info.neType, info.neId]; + neInfoStore.fnNelist().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 !['OMC'].includes(item.value); } - fnGetList(); + ); + if (neCascaderOptions.value.length === 0) { + message.warning({ + content: t('common.noData'), + duration: 2, + }); + return; } - } else { - message.warning({ - content: t('common.noData'), - duration: 2, - }); + // 默认选择AMF + const item = neCascaderOptions.value.find(s => s.value === 'AMF'); + if (item && item.children) { + const info = item.children[0]; + state.neType = [info.neType, info.neId]; + } else { + const info = neCascaderOptions.value[0].children[0]; + state.neType = [info.neType, info.neId]; + } + fnGetList(); } - }); + } else { + message.warning({ + content: t('common.noData'), + duration: 2, + }); + } + }); }); diff --git a/src/views/perfManage/goldTarget/index.vue b/src/views/perfManage/goldTarget/index.vue index 90d2645d..56283614 100644 --- a/src/views/perfManage/goldTarget/index.vue +++ b/src/views/perfManage/goldTarget/index.vue @@ -12,7 +12,7 @@ import useNeInfoStore from '@/store/modules/neinfo'; import useI18n from '@/hooks/useI18n'; import { getGoldTitleByNE, goldData } from '@/api/perfManage/goldTarget'; import { parseDateToStr } from '@/utils/date-utils'; - +const neInfoStore = useNeInfoStore(); const { t, currentLocale } = useI18n(); /**网元参数 */ @@ -284,17 +284,24 @@ function fnDesign() { onMounted(() => { // 获取网元网元列表 - useNeInfoStore() + neInfoStore .fnNelist() .then(res => { if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) { if (res.data.length > 0) { // 过滤不可用的网元 - neCascaderOptions.value = useNeInfoStore().getNeCascaderOtions.filter( + neCascaderOptions.value = neInfoStore.getNeCascaderOptions.filter( (item: any) => { return !['OMC'].includes(item.value); } ); + if (neCascaderOptions.value.length === 0) { + message.warning({ + content: t('common.noData'), + duration: 2, + }); + return; + } // 默认选择AMF const item = neCascaderOptions.value.find(s => s.value === 'UPF'); if (item && item.children) { diff --git a/src/views/perfManage/taskManage/index.vue b/src/views/perfManage/taskManage/index.vue index 8089d9a7..50f108fc 100644 --- a/src/views/perfManage/taskManage/index.vue +++ b/src/views/perfManage/taskManage/index.vue @@ -19,6 +19,7 @@ import { taskStop, taskRun, } from '@/api/perfManage/taskManage'; +const neInfoStore = useNeInfoStore(); const { t, currentLocale } = useI18n(); const generateOptions = (start: any, end: any) => { @@ -378,7 +379,7 @@ function fnSelectPer(s: any, option: any) { /**性能测量数据集选择初始 */ function fnSelectPerformanceInit(neType: string) { //console.logg(currentLocale.value); //当前语言 - const performance = useNeInfoStore().perMeasurementList.filter( + const performance = neInfoStore.perMeasurementList.filter( i => i.neType === neType ); //进行分组选择 @@ -692,9 +693,9 @@ onMounted(() => { Promise.allSettled([ // 获取网元网元列表 - useNeInfoStore().fnNelist(), + neInfoStore.fnNelist(), // 获取性能测量集列表 - useNeInfoStore().fnNeTaskPerformance(), + neInfoStore.fnNeTaskPerformance(), ]).finally(() => { // 获取列表数据 fnGetList(); @@ -719,7 +720,7 @@ onMounted(() => { > @@ -887,7 +888,7 @@ onMounted(() => { > @@ -1002,7 +1003,7 @@ onMounted(() => { > { > i.neType === neType) .map(i => { @@ -535,9 +536,9 @@ onMounted(() => { }); Promise.allSettled([ // 获取网元网元列表 - useNeInfoStore().fnNelist(), + neInfoStore.fnNelist(), // 获取跟踪接口列表 - useNeInfoStore().fnNeTraceInterface(), + neInfoStore.fnNeTraceInterface(), ]).finally(() => { // 获取列表数据 fnGetList(); @@ -562,7 +563,7 @@ onMounted(() => { > @@ -748,7 +749,7 @@ onMounted(() => { > @@ -866,7 +867,7 @@ onMounted(() => { >