fix: 网元管理更多操作提示

This commit is contained in:
TsMask
2023-10-17 16:38:55 +08:00
parent bf91430786
commit f57b2bccfb

View File

@@ -334,14 +334,16 @@ function fnRecordDelete(row: Record<string, any>) {
}
/**
* 文件对话框弹出显示为 导出导入重启停止启动
* 网元导出配置
* @param row 网元编号ID
*/
function fnFileModalVisible(type: string | number, row: Record<string, any>) {
if (type === 'export') {
const key = 'export';
console.log(toRaw(row));
function fnRecordExport(row: Record<string, any>) {
Modal.confirm({
title: '提示',
content: `确认导出网元编号为 【${row.id}】 的配置信息?`,
onOk() {
const key = 'exportSet';
message.loading({ content: '请稍等...', key });
tableState.loading = true;
exportSet(row).then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
@@ -349,7 +351,6 @@ function fnFileModalVisible(type: string | number, row: Record<string, any>) {
key,
duration: 2,
});
// fnGetList();
} else {
message.error({
content: `${res.msg}`,
@@ -357,47 +358,29 @@ function fnFileModalVisible(type: string | number, row: Record<string, any>) {
duration: 2,
});
}
tableState.loading = false;
});
}
},
});
}
if (type === 'start') {
const key = 'start';
console.log(toRaw(row));
/**
* 网元重启
* @param row 网元编号ID
*/
function fnRecordRestart(row: Record<string, any>) {
Modal.confirm({
title: '提示',
content: `确认重启网元编号为 【${row.id}】 的网元?`,
onOk() {
const key = 'restartNf';
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: `重启成功`,
content: `重启执行成功`,
key,
duration: 2,
});
// fnGetList();
} else {
message.error({
content: `${res.msg}`,
@@ -405,22 +388,59 @@ function fnFileModalVisible(type: string | number, row: Record<string, any>) {
duration: 2,
});
}
tableState.loading = false;
});
},
});
}
/**
* 网元启动
* @param row 网元编号ID
*/
function fnRecordStart(row: Record<string, any>) {
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,
});
}
if (type === 'stop') {
const key = 'stop';
console.log(toRaw(row));
});
},
});
}
/**
* 网元停止
* @param row 网元编号ID
*/
function fnRecordStop(row: Record<string, any>) {
Modal.confirm({
title: '提示',
content: `确认停止网元编号为 【${row.id}】 的网元?`,
onOk() {
const key = 'stopNf';
message.loading({ content: '请稍等...', key });
tableState.loading = true;
stopNf(row).then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `重启成功`,
content: `停止执行成功`,
key,
duration: 2,
});
// fnGetList();
} else {
message.error({
content: `${res.msg}`,
@@ -428,8 +448,29 @@ function fnFileModalVisible(type: string | number, row: Record<string, any>) {
duration: 2,
});
}
tableState.loading = false;
});
},
});
}
/**
* 记录多项选择
*/
function fnRecordMore(type: string | number, row: Record<string, any>) {
if (type === 'export') {
fnRecordExport(row);
}
if (type === 'start') {
fnRecordStart(row);
}
if (type === 'restart') {
fnRecordRestart(row);
}
if (type === 'stop') {
fnRecordStop(row);
}
}
@@ -588,9 +629,7 @@ onMounted(() => {
<template #icon><EllipsisOutlined /> </template>
</a-button>
<template #overlay>
<a-menu
@click="({ key }:any) => fnFileModalVisible(key, record)"
>
<a-menu @click="({ key }:any) => fnRecordMore(key, record)">
<a-menu-item key="export">
<ExportOutlined />
{{ t('views.configManage.neManage.export') }}
@@ -604,7 +643,7 @@ onMounted(() => {
{{ t('views.configManage.neManage.start') }}
</a-menu-item>
<a-menu-item key="restart">
<loading-outlined />
<UndoOutlined />
{{ t('views.configManage.neManage.restart') }}
</a-menu-item>
<a-menu-item key="stop">