From 7a787db45dd01e6948aa750b3fdd5667b8c0df04 Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Thu, 29 Feb 2024 20:56:41 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E7=BD=91=E5=85=83?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ne/neInfo/index.vue | 1200 +++++++++++++++++++++++++++ src/views/ne/neInfo/useNeOptions.ts | 161 ++++ 2 files changed, 1361 insertions(+) create mode 100644 src/views/ne/neInfo/index.vue create mode 100644 src/views/ne/neInfo/useNeOptions.ts diff --git a/src/views/ne/neInfo/index.vue b/src/views/ne/neInfo/index.vue new file mode 100644 index 00000000..03364c9d --- /dev/null +++ b/src/views/ne/neInfo/index.vue @@ -0,0 +1,1200 @@ + + + + + + + + + + + + + + + + + + + {{ t('common.search') }} + + + + {{ t('common.reset') }} + + + + + + + + + + + + + + + {{ t('common.addText') }} + + + + + + + + + {{ t('common.searchBarText') }} + + + + {{ t('common.reloadText') }} + + + + + + + + + + + + + + 加载更多 {{ infoState.total - infoState.data.length }} + + + + + + + + + + + + {{ item.serverState.online ? '正常' : '异常' }} + + + + + + + + + + {{ t('common.editText') }} + + + + + + + + {{ t('views.tool.terminal.more') }} + + + + + + + fnMoreMenu(key)"> + + + {{ t('views.configManage.neManage.export') }} + + + + {{ t('views.configManage.neManage.import') }} + + + + {{ t('views.configManage.neManage.start') }} + + + + {{ t('views.configManage.neManage.restart') }} + + + + {{ t('views.configManage.neManage.stop') }} + + + + {{ t('views.configManage.neManage.reload') }} + + + + {{ t('common.deleteText') }} + + + + + + + + + + + + 网元类型: + {{ item.neType }} + + + 网元标识: + {{ item.neId }} + + + 网元地址: + {{ `${item.ip}:${item.port}` }} + + + 唯一标识: + {{ item.rmUid }} + + + + + + 网元CPU: + + + + 系统CPU: + + + + 系统内存: + + + + 系统存储: + + + + + + + + + + + + + + + + + + + + + {{ + t('views.configManage.neManage.neTypeTip') + }} + + + + + + + + + + + PNF + + + VNF + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ t('views.configManage.neManage.portTip') }} + + + + + + + + + + + + + + + + + + + + + + {{ t('views.configManage.neManage.macTip') }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ t('views.configManage.neManage.fileSelect') }} + + + + + + + + + diff --git a/src/views/ne/neInfo/useNeOptions.ts b/src/views/ne/neInfo/useNeOptions.ts new file mode 100644 index 00000000..b89468d8 --- /dev/null +++ b/src/views/ne/neInfo/useNeOptions.ts @@ -0,0 +1,161 @@ +import { restartNf, startNf, stopNf } from '@/api/configManage/neManage'; +import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; +import { Modal, message } from 'ant-design-vue/lib'; +import useI18n from '@/hooks/useI18n'; +import { useRouter } from 'vue-router'; +import { updateNeConfigReload } from '@/api/configManage/configParam'; + +export default function useNeOptions() { + const router = useRouter(); + const { t } = useI18n(); + + /** + * 网元启动 + * @param row {neName,neType,neId} + */ + function fnRecordStart(row: Record) { + Modal.confirm({ + title: t('common.tipTitle'), + content: t('views.configManage.neManage.totalSure', { + msg: row.neName, + oper: t('views.configManage.neManage.start'), + }), + onOk() { + const key = 'startNf'; + message.loading({ content: t('common.loading'), key }); + startNf(row).then(res => { + if (res.code === RESULT_CODE_SUCCESS) { + message.success({ + content: t('common.msgSuccess', { + msg: t('views.configManage.neManage.start'), + }), + key, + duration: 2, + }); + } else { + message.error({ + content: `${res.msg}`, + key: key, + duration: 2, + }); + } + }); + }, + }); + } + + /** + * 网元重启 + * @param row {neName,neType,neId} + */ + function fnNeRestart(row: Record) { + Modal.confirm({ + title: t('common.tipTitle'), + content: t('views.configManage.neManage.totalSure', { + msg: row.neName, + oper: t('views.configManage.neManage.restart'), + }), + onOk() { + const key = 'restartNf'; + message.loading({ content: t('common.loading'), key }); + restartNf(row).then(res => { + if (res.code === RESULT_CODE_SUCCESS) { + message.success({ + content: t('common.msgSuccess', { + msg: t('views.configManage.neManage.restart'), + }), + key, + duration: 3, + }); + } else { + message.error({ + content: `${res.msg}`, + key: key, + duration: 3, + }); + } + }); + }, + }); + } + + /** + * 网元停止 + * @param row {neName,neType,neId} + */ + function fnNeStop(row: Record) { + Modal.confirm({ + title: t('common.tipTitle'), + content: t('views.configManage.neManage.totalSure', { + msg: row.neName, + oper: t('views.configManage.neManage.stop'), + }), + onOk() { + const key = 'restartNf'; + message.loading({ content: t('common.loading'), key }); + stopNf(row).then(res => { + if (res.code === RESULT_CODE_SUCCESS) { + message.success({ + content: t('common.msgSuccess', { + msg: t('views.configManage.neManage.stop'), + }), + key: key, + duration: 3, + }); + } else { + message.error({ + content: `${res.msg}`, + key: key, + duration: 3, + }); + } + }); + }, + }); + } + + /** + * 网元重新加载 + * @param row {neName,neType,neId} + */ + function fnNeReload(row: Record) { + Modal.confirm({ + title: t('common.tipTitle'), + content: t('views.configManage.neManage.totalSure', { + msg: row.neName, + oper: t('views.configManage.neManage.reload'), + }), + onOk() { + const key = 'stopNf'; + message.loading({ content: t('common.loading'), key }); + updateNeConfigReload(row.neType, row.neId).then(res => { + if (res.code === RESULT_CODE_SUCCESS) { + message.success({ + content: t('common.msgSuccess', { + msg: t('views.configManage.neManage.reload'), + }), + key, + duration: 2, + }); + } else { + message.error({ + content: `${res.msg}`, + key: key, + duration: 2, + }); + } + }); + }, + }); + } + + /** + * 跳转网元日志文件页面 + * @param row {neType,neId} + */ + function fnNeLogFile(row: Record) { + router.push(`/logManage/neFile?neType=${row.neType}&neId=${row.neId}`); + } + + return { fnNeRestart, fnNeStop, fnNeLogFile }; +}