diff --git a/src/api/configManage/neManage.ts b/src/api/configManage/neManage.ts index c31228c0..9e80709f 100644 --- a/src/api/configManage/neManage.ts +++ b/src/api/configManage/neManage.ts @@ -140,3 +140,56 @@ export async function getNelistAll() { } return result; } + +/** + * 导出网元配置文件 + * @param + * @returns bolb + */ +export function exportSet(data: Record) { + return request({ + url: `/systemManagement/v1/elementType/${data.neType}/objectType/cm?ne_id=${data.neId}`, + method: 'get', + responseType: 'blob', + headers: { + 'Content-Type': 'application/octet-stream', + }, + }); +} + + +/** + * 启动网元 + * @param + * @returns bolb + */ +export function startNf(data: Record) { + return request({ + url: `/systemManagement/v1/elementType/${data.neType}/objectType/service/start?ne_id=${data.neId}`, + method: 'post', + }); +} + +/** + * 重启网元 + * @param + * @returns bolb + */ +export function restartNf(data: Record) { + return request({ + url: `/systemManagement/v1/elementType/${data.neType}/objectType/service/restart?ne_id=${data.neId}`, + method: 'post', + }); +} + +/** + * 停止网元 + * @param + * @returns bolb + */ +export function stopNf(data: Record) { + return request({ + url: `/systemManagement/v1/elementType/${data.neType}/objectType/service/stop?ne_id=${data.neId}`, + method: 'post', + }); +} \ No newline at end of file diff --git a/src/i18n/locales/en-US.ts b/src/i18n/locales/en-US.ts index ed2b0564..86f7c4cd 100644 --- a/src/i18n/locales/en-US.ts +++ b/src/i18n/locales/en-US.ts @@ -103,6 +103,13 @@ export default { tipBtn: 'Go to login', }, configManage: { + neManage: { + restart: 'Restart', + stop: 'Stop', + start: 'Start', + export: 'Export', + import: 'Import', + }, backupManage: { setBackupTask: 'Set automatic backup time', neTypePlease: 'Query network element type', diff --git a/src/i18n/locales/zh-CN.ts b/src/i18n/locales/zh-CN.ts index 5e0cb3b5..86711ff1 100644 --- a/src/i18n/locales/zh-CN.ts +++ b/src/i18n/locales/zh-CN.ts @@ -103,6 +103,13 @@ export default { tipBtn: '前往登录', }, configManage: { + neManage: { + restart: '重启', + stop: '停止', + start: '启动', + export: '导出', + import: '导入', + }, backupManage: { setBackupTask: '设置自动备份时间', neTypePlease: '查询网元类型', diff --git a/src/views/configManage/neManage/index.vue b/src/views/configManage/neManage/index.vue index d25c8884..a463db14 100644 --- a/src/views/configManage/neManage/index.vue +++ b/src/views/configManage/neManage/index.vue @@ -12,6 +12,10 @@ import { addNeInfo, updateNeInfo, delNeInfo, + exportSet, + startNf, + restartNf, + stopNf, } from '@/api/configManage/neManage'; import { parseDateToStr } from '@/utils/date-utils'; import useI18n from '@/hooks/useI18n'; @@ -329,6 +333,106 @@ function fnRecordDelete(row: Record) { }); } +/** + * 文件对话框弹出显示为 导出导入重启停止启动 + */ +function fnFileModalVisible(type: string | number, row: Record) { + if (type === 'export') { + const key = 'export'; + console.log(toRaw(row)); + message.loading({ content: '请稍等...', key }); + tableState.loading = true; + exportSet(row).then(res => { + if (res.code === RESULT_CODE_SUCCESS) { + message.success({ + content: `导出成功`, + key, + duration: 2, + }); + // fnGetList(); + } else { + message.error({ + content: `${res.msg}`, + key: key, + duration: 2, + }); + } + tableState.loading = false; + }); + } + + if (type === 'start') { + const key = 'start'; + console.log(toRaw(row)); + message.loading({ content: '请稍等...', key }); + tableState.loading = true; + startNf(row).then(res => { + if (res.code === RESULT_CODE_SUCCESS) { + message.success({ + content: `启动成功`, + key, + duration: 2, + }); + // fnGetList(); + } else { + message.error({ + content: `${res.msg}`, + key: key, + duration: 2, + }); + } + tableState.loading = false; + }); + } + + if (type === 'restart') { + const key = 'restart'; + console.log(toRaw(row)); + message.loading({ content: '请稍等...', key }); + tableState.loading = true; + restartNf(row).then(res => { + if (res.code === RESULT_CODE_SUCCESS) { + message.success({ + content: `重启成功`, + key, + duration: 2, + }); + // fnGetList(); + } else { + message.error({ + content: `${res.msg}`, + key: key, + duration: 2, + }); + } + tableState.loading = false; + }); + } + if (type === 'stop') { + const key = 'stop'; + console.log(toRaw(row)); + message.loading({ content: '请稍等...', key }); + tableState.loading = true; + stopNf(row).then(res => { + if (res.code === RESULT_CODE_SUCCESS) { + message.success({ + content: `重启成功`, + key, + duration: 2, + }); + // fnGetList(); + } else { + message.error({ + content: `${res.msg}`, + key: key, + duration: 2, + }); + } + tableState.loading = false; + }); + } +} + /**查询网元列表 */ function fnGetList() { if (tableState.loading) return; @@ -474,6 +578,43 @@ onMounted(() => { + + + + + + + + +