From 4e7fb90544af382470ac58cecef4acd24fb74a7e Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Fri, 12 Apr 2024 20:18:01 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=BD=91=E5=85=83=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/ne/neInfo.ts | 13 ++++++++ src/views/ne/neInfo/hooks/useNeOptions.ts | 39 +++++++++++++++++++---- src/views/ne/neInfo/index.vue | 15 +++------ 3 files changed, 50 insertions(+), 17 deletions(-) diff --git a/src/api/ne/neInfo.ts b/src/api/ne/neInfo.ts index c998a8ac..23f17931 100644 --- a/src/api/ne/neInfo.ts +++ b/src/api/ne/neInfo.ts @@ -140,3 +140,16 @@ export function saveConfigFile(data: Record) { data: data, }); } + +/** + * 网元服务操作 + * @param data 对象 {neType,neId,action} + * @returns object + */ +export function serviceNeAction(data: Record) { + return request({ + url: `/ne/action/service`, + method: 'put', + data: data, + }); +} diff --git a/src/views/ne/neInfo/hooks/useNeOptions.ts b/src/views/ne/neInfo/hooks/useNeOptions.ts index 1c94f627..307df2cc 100644 --- a/src/views/ne/neInfo/hooks/useNeOptions.ts +++ b/src/views/ne/neInfo/hooks/useNeOptions.ts @@ -4,10 +4,13 @@ import { Modal, message } from 'ant-design-vue/lib'; import useI18n from '@/hooks/useI18n'; import { useRouter } from 'vue-router'; import { updateNeConfigReload } from '@/api/configManage/configParam'; +import { serviceNeAction } from '@/api/ne/neInfo'; +import useLockedStore from '@/store/modules/locked'; export default function useNeOptions() { const router = useRouter(); const { t } = useI18n(); + const lockedStore = useLockedStore(); /** * 网元启动 @@ -21,9 +24,13 @@ export default function useNeOptions() { oper: t('views.configManage.neManage.start'), }), onOk() { - const key = 'startNf'; + const key = 'start'; message.loading({ content: t('common.loading'), key }); - startNf(row).then(res => { + serviceNeAction({ + neType: row.neType, + neId: row.neId, + action: 'start', + }).then(res => { if (res.code === RESULT_CODE_SUCCESS) { message.success({ content: t('common.msgSuccess', { @@ -56,10 +63,26 @@ export default function useNeOptions() { oper: t('views.configManage.neManage.restart'), }), onOk() { - const key = 'restartNf'; + const key = 'restart'; message.loading({ content: t('common.loading'), key }); - restartNf(row).then(res => { + serviceNeAction({ + neType: row.neType, + neId: row.neId, + action: 'restart', + }).then(res => { if (res.code === RESULT_CODE_SUCCESS) { + // OMC自升级 + if (row.neType.toUpperCase() === 'OMC') { + if (res.code === RESULT_CODE_SUCCESS) { + lockedStore.fnLock('reload'); + } else { + message.error({ + content: `${res.msg}`, + duration: 3, + }); + } + return; + } message.success({ content: t('common.msgSuccess', { msg: t('views.configManage.neManage.restart'), @@ -91,9 +114,13 @@ export default function useNeOptions() { oper: t('views.configManage.neManage.stop'), }), onOk() { - const key = 'restartNf'; + const key = 'stop'; message.loading({ content: t('common.loading'), key }); - stopNf(row).then(res => { + serviceNeAction({ + neType: row.neType, + neId: row.neId, + action: 'stop', + }).then(res => { if (res.code === RESULT_CODE_SUCCESS) { message.success({ content: t('common.msgSuccess', { diff --git a/src/views/ne/neInfo/index.vue b/src/views/ne/neInfo/index.vue index 429a452f..74857cb0 100644 --- a/src/views/ne/neInfo/index.vue +++ b/src/views/ne/neInfo/index.vue @@ -554,17 +554,6 @@ onMounted(() => { - - - - - - @@ -581,6 +570,10 @@ onMounted(() => { {{ t('views.configManage.neManage.start') }} + + + {{ t('views.configManage.neManage.stop') }} +