diff --git a/src/views/configManage/neManage/index.vue b/src/views/configManage/neManage/index.vue index a463db14..de397a19 100644 --- a/src/views/configManage/neManage/index.vue +++ b/src/views/configManage/neManage/index.vue @@ -334,102 +334,143 @@ function fnRecordDelete(row: Record) { } /** - * 文件对话框弹出显示为 导出导入重启停止启动 + * 网元导出配置 + * @param row 网元编号ID */ -function fnFileModalVisible(type: string | number, row: Record) { +function fnRecordExport(row: Record) { + Modal.confirm({ + title: '提示', + content: `确认导出网元编号为 【${row.id}】 的配置信息?`, + onOk() { + const key = 'exportSet'; + message.loading({ content: '请稍等...', key }); + exportSet(row).then(res => { + if (res.code === RESULT_CODE_SUCCESS) { + message.success({ + content: `导出成功`, + key, + duration: 2, + }); + } else { + message.error({ + content: `${res.msg}`, + key: key, + duration: 2, + }); + } + }); + }, + }); +} + +/** + * 网元重启 + * @param row 网元编号ID + */ +function fnRecordRestart(row: Record) { + Modal.confirm({ + title: '提示', + content: `确认重启网元编号为 【${row.id}】 的网元?`, + onOk() { + const key = 'restartNf'; + message.loading({ content: '请稍等...', key }); + restartNf(row).then(res => { + if (res.code === RESULT_CODE_SUCCESS) { + message.success({ + content: `重启执行成功`, + key, + duration: 2, + }); + } else { + message.error({ + content: `${res.msg}`, + key: key, + duration: 2, + }); + } + }); + }, + }); +} + +/** + * 网元启动 + * @param row 网元编号ID + */ +function fnRecordStart(row: Record) { + Modal.confirm({ + title: '提示', + content: `确认启动网元编号为 【${row.id}】 的网元?`, + onOk() { + const key = 'startNf'; + message.loading({ content: '请稍等...', key }); + startNf(row).then(res => { + if (res.code === RESULT_CODE_SUCCESS) { + message.success({ + content: `启动执行成功`, + key, + duration: 2, + }); + } else { + message.error({ + content: `${res.msg}`, + key: key, + duration: 2, + }); + } + }); + }, + }); +} + +/** + * 网元停止 + * @param row 网元编号ID + */ +function fnRecordStop(row: Record) { + Modal.confirm({ + title: '提示', + content: `确认停止网元编号为 【${row.id}】 的网元?`, + onOk() { + const key = 'stopNf'; + message.loading({ content: '请稍等...', key }); + stopNf(row).then(res => { + if (res.code === RESULT_CODE_SUCCESS) { + message.success({ + content: `停止执行成功`, + key, + duration: 2, + }); + } else { + message.error({ + content: `${res.msg}`, + key: key, + duration: 2, + }); + } + }); + }, + }); +} + +/** + * 记录多项选择 + */ +function fnRecordMore(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; - }); + fnRecordExport(row); } 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; - }); + fnRecordStart(row); } 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; - }); + fnRecordRestart(row); } + 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; - }); + fnRecordStop(row); } } @@ -588,9 +629,7 @@ onMounted(() => {