From e35196022936be40149907097072305c726f9a49 Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Wed, 24 Apr 2024 15:25:56 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=BD=91=E5=85=83=E5=85=AC=E5=85=B1?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E9=A1=B5=E9=9D=A2=E5=90=8C=E6=AD=A5=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E6=94=B9=E5=BC=B9=E5=87=BA=E7=AA=97=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ne/neConfPara5G/index.vue | 301 ++++++++++++++++------------ 1 file changed, 175 insertions(+), 126 deletions(-) diff --git a/src/views/ne/neConfPara5G/index.vue b/src/views/ne/neConfPara5G/index.vue index 3bdfd4db..8c8769dd 100644 --- a/src/views/ne/neConfPara5G/index.vue +++ b/src/views/ne/neConfPara5G/index.vue @@ -8,24 +8,29 @@ import { getPara5GFilee, savePara5GFile } from '@/api/ne/neInfo'; import useNeInfoStore from '@/store/modules/neinfo'; const { t } = useI18n(); -/**对话框对象信息状态类型 */ -type ModalStateType = { +/**对象信息信息状态类型 */ +type StateType = { + /**保存选择同步到网元窗 */ + visible: boolean; /**网元选择 */ neSelectOtions: any[]; /**同步到网元 */ sync: boolean; syncNe: string[]; + syncMsg: string; /**表单数据 */ from: Record; /**确定按钮 loading */ confirmLoading: boolean; }; -/**对话框对象信息状态 */ -let modalState: ModalStateType = reactive({ +/**对象信息状态 */ +let state: StateType = reactive({ + visible: false, neSelectOtions: [], sync: false, syncNe: [], + syncMsg: '', from: { basic: { dnn_data: 'internet', @@ -54,47 +59,51 @@ let modalState: ModalStateType = reactive({ confirmLoading: false, }); -/**获取文件数据*/ -function fnGetData() { - if (modalState.confirmLoading) return; - modalState.confirmLoading = true; - getPara5GFilee('yaml') +/**对话框弹出确认执行函数*/ +function fnModalOk() { + if (state.confirmLoading) return; + state.confirmLoading = true; + savePara5GFile({ + fileType: 'yaml', + content: toRaw(state.from), + syncNe: state.sync ? state.syncNe : [], + }) .then(res => { - if (res.code === RESULT_CODE_SUCCESS) { - Object.assign(modalState.from, res.data); + if (state.sync) { + state.syncMsg = res.msg; } else { - message.error({ - content: res.msg, - duration: 3, - }); + message.success('Save Success'); } }) .finally(() => { - modalState.confirmLoading = false; + state.confirmLoading = false; }); } +/**对话框弹出关闭执行函数*/ +function fnModalCancel() { + state.visible = false; + state.sync = false; + state.syncNe = []; +} + /**保存文件数据*/ function fnSaveData() { - if (modalState.confirmLoading) return; - modalState.confirmLoading = true; - savePara5GFile({ - fileType: 'yaml', - content: toRaw(modalState.from), - syncNe: modalState.sync ? modalState.syncNe : [], - }) + state.visible = true; +} + +/**获取文件数据*/ +function fnGetData() { + if (state.confirmLoading) return; + state.confirmLoading = true; + getPara5GFilee('yaml') .then(res => { - if (res.code === RESULT_CODE_SUCCESS) { - message.success('Save complete!'); - } else { - message.error({ - content: t('common.operateErr'), - duration: 3, - }); + if (typeof res.data === 'object') { + Object.assign(state.from, res.data); } }) .finally(() => { - modalState.confirmLoading = false; + state.confirmLoading = false; }); } @@ -104,8 +113,8 @@ onMounted(() => { .then(res => { if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) { for (const row of res.data) { - modalState.neSelectOtions.push({ - label: `${row.neType} : ${row.ip}`, + state.neSelectOtions.push({ + label: `[${row.neType} ${row.neId}] ${row.neName}`, value: `${row.neType}@${row.neId}`, }); } @@ -127,39 +136,14 @@ onMounted(() => { - +