From bc3940016a540b18a46382e3aa873d182c646534 Mon Sep 17 00:00:00 2001
From: TsMask <340112800@qq.com>
Date: Tue, 30 Jul 2024 18:22:32 +0800
Subject: [PATCH] =?UTF-8?q?perf:=20=E7=BD=91=E5=85=83=E5=85=AC=E5=85=B1?=
=?UTF-8?q?=E5=8F=82=E6=95=B0=E5=90=88=E5=B9=B6=E5=88=B0=E7=BD=91=E5=85=83?=
=?UTF-8?q?=E5=BF=AB=E9=80=9F=E5=AE=89=E8=A3=85=EF=BC=8C=E7=A7=BB=E9=99=A4?=
=?UTF-8?q?=E7=9B=B8=E5=85=B3=E5=A4=9A=E8=AF=AD=E8=A8=80=E7=BF=BB=E8=AF=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/i18n/locales/en-US.ts | 13 +-
src/i18n/locales/zh-CN.ts | 13 +-
src/views/ne/neConfPara5G/index.vue | 296 ------------------
.../components/Para5GForm.vue | 12 +-
src/views/ne/neQuickSetup/hooks/usePara5G.ts | 139 ++++++++
src/views/ne/neQuickSetup/hooks/useStep.ts | 31 +-
src/views/ne/neQuickSetup/index.vue | 59 ++--
.../components/NeInfoConfigPara5G.vue | 4 +-
8 files changed, 216 insertions(+), 351 deletions(-)
delete mode 100644 src/views/ne/neConfPara5G/index.vue
rename src/views/ne/{neConfPara5G => neQuickSetup}/components/Para5GForm.vue (98%)
create mode 100644 src/views/ne/neQuickSetup/hooks/usePara5G.ts
diff --git a/src/i18n/locales/en-US.ts b/src/i18n/locales/en-US.ts
index 52fd7648..3ebe951c 100644
--- a/src/i18n/locales/en-US.ts
+++ b/src/i18n/locales/en-US.ts
@@ -769,23 +769,13 @@ export default {
uploadChangeOk: 'Network Element renewed license successfully and is being calibrated in the background!',
uploadChangeFail: "Some network elements failed to update the license, please check whether the service terminal environment is available!",
},
- neConfPara5G: {
- headerTip: 'Check and save the public parameter properties of the network element before performing the installation of the network element, and make sure that the latest parameter properties are applied.',
- headerTipToPage: 'Jump Installation',
- save: 'Save',
- reload: 'Reload',
- title: 'Save Info',
- sync: 'Sync to NE',
- syncNe: 'Select NE',
- syncNeDone: 'Synchronization to network element terminals complete',
- saveOk: 'Save Success!',
- },
neConfigBackup: {
name: "Name",
downTip: 'Confirmed to download the backup file [{txt}]?',
title: "Modify Backup {txt}",
},
neQuickSetup: {
+ reloadPara5G: 'Reload',
stepPrev: 'Previous',
stepPrevTip: 'Confirm that you want to abandon the current change and return to the previous step?',
stepNext: 'Next',
@@ -1952,6 +1942,7 @@ export default {
stepNeInfoStepNext: 'Confirm that you want to proceed to the next step to configure the parameters of the network element?',
stepPara5GTitle: "Configuration Parameter",
stepPara5GDesc: "Setting network element global parameter information",
+ savePara5GOk: 'Save Success!',
stepPara5GStepPrev: 'Confirm that you want to abandon the current change and return to the previous step?',
stepPara5GStepNext: 'Confirm that you want to proceed to the next step for the network element service installation?',
stepInstallTitle: "Service Install",
diff --git a/src/i18n/locales/zh-CN.ts b/src/i18n/locales/zh-CN.ts
index 8a54c3e8..32e76e82 100644
--- a/src/i18n/locales/zh-CN.ts
+++ b/src/i18n/locales/zh-CN.ts
@@ -769,23 +769,13 @@ export default {
uploadChangeOk: '网元更新许可证成功,正在后台校验!',
uploadChangeFail: "部分网元更新许可证失败,请检查服务终端环境是否可用!",
},
- neConfPara5G: {
- headerTip: '进行网元安装前检查并保存网元公共参数属性,确认应用为最新参数属性',
- headerTipToPage: '跳转安装',
- save: '保存',
- reload: '刷新',
- title: '保存信息',
- sync: '同步到网元',
- syncNe: '选择网元',
- syncNeDone: '同步到网元终端完成',
- saveOk: '保存成功!',
- },
neConfigBackup: {
name: "名称",
downTip: '确认要下载备份文件【{txt}】吗?',
title: "修改备份信息 {txt}",
},
neQuickSetup: {
+ reloadPara5G: '刷新',
stepPrev: '上一步',
stepPrevTip: '确认要放弃当前变更返回上一步吗?',
stepNext: '下一步',
@@ -1952,6 +1942,7 @@ export default {
stepNeInfoStepNext: '确认要下一步进行网元配置参数?',
stepPara5GTitle: "网元配置参数",
stepPara5GDesc: "设置网元全局参数信息",
+ savePara5GOk: '保存成功!',
stepPara5GStepPrev: '确认要放弃当前变更返回上一步吗?',
stepPara5GStepNext: '确认要下一步进行网元服务安装吗?',
stepInstallTitle: "网元服务安装",
diff --git a/src/views/ne/neConfPara5G/index.vue b/src/views/ne/neConfPara5G/index.vue
deleted file mode 100644
index 58d4efae..00000000
--- a/src/views/ne/neConfPara5G/index.vue
+++ /dev/null
@@ -1,296 +0,0 @@
-
-
-
-
-
- {{ t('views.ne.neConfPara5G.headerTip') }}
-
- {{ t('views.ne.neConfPara5G.headerTipToPage') }}
-
-
-
-
-
-
-
-
-
-
-
- {{ t('views.ne.neConfPara5G.save') }}
-
-
-
- {{ t('views.ne.neConfPara5G.reload') }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- + {{ omittedValues.length }} ...
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/views/ne/neConfPara5G/components/Para5GForm.vue b/src/views/ne/neQuickSetup/components/Para5GForm.vue
similarity index 98%
rename from src/views/ne/neConfPara5G/components/Para5GForm.vue
rename to src/views/ne/neQuickSetup/components/Para5GForm.vue
index 66ba7738..3189365f 100644
--- a/src/views/ne/neConfPara5G/components/Para5GForm.vue
+++ b/src/views/ne/neQuickSetup/components/Para5GForm.vue
@@ -1,5 +1,5 @@
diff --git a/src/views/ne/neQuickSetup/hooks/usePara5G.ts b/src/views/ne/neQuickSetup/hooks/usePara5G.ts
new file mode 100644
index 00000000..9e3bc050
--- /dev/null
+++ b/src/views/ne/neQuickSetup/hooks/usePara5G.ts
@@ -0,0 +1,139 @@
+import { onMounted, reactive, toRaw } from 'vue';
+import { getPara5GFilee, savePara5GFile, updateNeInfo } from '@/api/ne/neInfo';
+import useNeInfoStore from '@/store/modules/neinfo';
+import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
+
+/**对象信息信息状态类型 */
+type StateType = {
+ /**表单数据 */
+ from: Record;
+ /**OMC信息,需修改当前的IP */
+ omcInfo: Record;
+ /**根据网元显示配置项 */
+ hasNE: {
+ amf: boolean;
+ upf: boolean;
+ ims: boolean;
+ mme: boolean;
+ };
+ /**确定按钮 loading */
+ confirmLoading: boolean;
+};
+
+export function usePara5G({ t }: any) {
+ /**对象信息状态 */
+ let state: StateType = reactive({
+ from: {},
+ omcInfo: {},
+ hasNE: {
+ amf: false,
+ upf: false,
+ ims: false,
+ mme: false,
+ },
+ confirmLoading: false,
+ });
+
+ /**载入数据*/
+ function fnReloadData() {
+ state.confirmLoading = true;
+ Promise.all([getPara5GFilee(), useNeInfoStore().fnRefreshNelist()]).then(
+ resArr => {
+ // 已保存的配置
+ if (resArr[0].code === RESULT_CODE_SUCCESS) {
+ Object.assign(state.from, resArr[0].data);
+ }
+ // 填充固定网元类型的ip
+ if (
+ resArr[1].code === RESULT_CODE_SUCCESS &&
+ Array.isArray(resArr[1].data)
+ ) {
+ for (const item of resArr[1].data) {
+ // 公共配置文件sbi的各网元IP
+ switch (item.neType) {
+ case 'OMC':
+ // state.from.sbi.omc_ip = item.ip;
+ Object.assign(state.omcInfo, item); // 主动改OMC_IP
+ break;
+ case 'IMS':
+ state.from.sbi.ims_ip = item.ip;
+ state.hasNE.ims = true;
+ break;
+ case 'AMF':
+ state.from.sbi.amf_ip = item.ip;
+ state.hasNE.amf = true;
+ break;
+ case 'AUSF':
+ state.from.sbi.ausf_ip = item.ip;
+ break;
+ case 'UDM':
+ state.from.sbi.udm_ip = item.ip;
+ state.from.sbi.db_ip = '0.0.0.0';
+ break;
+ case 'SMF':
+ state.from.sbi.smf_ip = item.ip;
+ break;
+ case 'PCF':
+ state.from.sbi.pcf_ip = item.ip;
+ break;
+ case 'NSSF':
+ state.from.sbi.nssf_ip = item.ip;
+ break;
+ case 'NRF':
+ state.from.sbi.nrf_ip = item.ip;
+ break;
+ case 'UPF':
+ state.from.sbi.upf_ip = item.ip;
+ state.hasNE.upf = true;
+ break;
+ case 'LMF':
+ state.from.sbi.lmf_ip = item.ip;
+ break;
+ case 'NEF':
+ state.from.sbi.nef_ip = item.ip;
+ break;
+ case 'MME':
+ state.from.sbi.mme_ip = item.ip;
+ if (item.ip.includes('.')) {
+ state.from.external.mmes11_ip = item.ip + '/24';
+ }
+ state.hasNE.mme = true;
+ break;
+ case 'N3IWF':
+ state.from.sbi.n3iwf_ip = item.ip;
+ break;
+ }
+ }
+ }
+ state.confirmLoading = false;
+ }
+ );
+ }
+
+ /**保存数据 */
+ async function fnSaveData() {
+ if (state.confirmLoading) return;
+ state.confirmLoading = true;
+ const res = await savePara5GFile({
+ content: toRaw(state.from),
+ syncNe: [],
+ });
+ if (res.code === RESULT_CODE_SUCCESS) {
+ // 更新omc_ip
+ state.omcInfo.ip = state.from.sbi.omc_ip;
+ await updateNeInfo(toRaw(state.omcInfo));
+ }
+ state.confirmLoading = false;
+ return res;
+ }
+
+ onMounted(() => {
+ fnReloadData();
+ });
+
+ return {
+ state,
+ fnReloadData,
+ fnSaveData,
+ };
+}
diff --git a/src/views/ne/neQuickSetup/hooks/useStep.ts b/src/views/ne/neQuickSetup/hooks/useStep.ts
index 210cf113..ec20e2b6 100644
--- a/src/views/ne/neQuickSetup/hooks/useStep.ts
+++ b/src/views/ne/neQuickSetup/hooks/useStep.ts
@@ -1,4 +1,10 @@
-import { reactive } from 'vue';
+import {
+ defineAsyncComponent,
+ onMounted,
+ reactive,
+ shallowRef,
+ watch,
+} from 'vue';
/**步骤信息状态类型 */
type StepStateType = {
@@ -80,3 +86,26 @@ export function fnToStepName(stepName: string) {
stepState.stepName = stepName;
}
+
+export function useStep({ t }: any) {
+ // 异步加载组件
+ const Start = defineAsyncComponent(() => import('../components/Start.vue'));
+
+ // 当前组件
+ const currentComponent = shallowRef(Start);
+
+ watch(
+ () => stepState.stepName,
+ v => {
+ const loadComponent = defineAsyncComponent(
+ () => import(`../components/${v}.vue`)
+ );
+ currentComponent.value = loadComponent;
+ }
+ );
+
+ onMounted(() => {
+ fnRestStepState(t);
+ });
+ return { currentComponent };
+}
diff --git a/src/views/ne/neQuickSetup/index.vue b/src/views/ne/neQuickSetup/index.vue
index 6dec407e..6bb2c66c 100644
--- a/src/views/ne/neQuickSetup/index.vue
+++ b/src/views/ne/neQuickSetup/index.vue
@@ -1,34 +1,27 @@
-
+
@@ -46,6 +39,30 @@ onMounted(() => {
+
+
+
+
+
+
+
+ {{ t('views.ne.neQuickSetup.stepNext') }}
+
+
+
+ {{ t('views.ne.neQuickSetup.reloadPara5G') }}
+
+
+
+
diff --git a/src/views/system/quick-start/components/NeInfoConfigPara5G.vue b/src/views/system/quick-start/components/NeInfoConfigPara5G.vue
index 9268d8dd..99364ae3 100644
--- a/src/views/system/quick-start/components/NeInfoConfigPara5G.vue
+++ b/src/views/system/quick-start/components/NeInfoConfigPara5G.vue
@@ -10,7 +10,7 @@ import {
updateNeInfo,
} from '@/api/ne/neInfo';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
-import Para5GForm from '@/views/ne/neConfPara5G/components/Para5GForm.vue';
+import Para5GForm from '@/views/ne/neQuickSetup/components/Para5GForm.vue';
const { t } = useI18n();
/**对象信息信息状态类型 */
@@ -60,7 +60,7 @@ function fnSave() {
})
.then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
- message.success(t('views.ne.neConfPara5G.saveOk'));
+ message.success(t('views.system.quickStart.savePara5GOk'));
state.saveFile = true;
// 更新omc_ip
state.omcInfo.ip = state.from.sbi.omc_ip;