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') }} +