fix: 网元版本操作升级回退
This commit is contained in:
@@ -64,3 +64,17 @@ export function delNeVersion(versionIds: string | number) {
|
||||
timeout: 60_000,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 网元版本操作
|
||||
* @param data {neType,neId,preinput:{参数},action:"upgrade"}
|
||||
* @returns object
|
||||
*/
|
||||
export function operateNeVersion(data: Record<string, any>) {
|
||||
return request({
|
||||
url: `/ne/version/operate`,
|
||||
method: 'post',
|
||||
data: data,
|
||||
timeout: 180_000,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -8,8 +8,10 @@ import useNeInfoStore from '@/store/modules/neinfo';
|
||||
import useI18n from '@/hooks/useI18n';
|
||||
import { NE_TYPE_LIST } from '@/constants/ne-constants';
|
||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||
import { listNeVersion } from '@/api/ne/neVersion';
|
||||
import { listNeVersion, operateNeVersion } from '@/api/ne/neVersion';
|
||||
import { parseDateToStr } from '@/utils/date-utils';
|
||||
import useLockedStore from '@/store/modules/locked';
|
||||
const lockedStore = useLockedStore();
|
||||
const { t } = useI18n();
|
||||
|
||||
// 异步加载组件
|
||||
@@ -251,39 +253,78 @@ function fnModalEditCancel() {
|
||||
modalState.visibleByEdit = false;
|
||||
}
|
||||
|
||||
/**升级到新版本 */
|
||||
function fnRecordUpdate(id: string) {
|
||||
/**版本控制升级回退 */
|
||||
function fnRecordVersion(
|
||||
action: 'upgrade' | 'rollback',
|
||||
row: Record<string, any>
|
||||
) {
|
||||
if (action === 'upgrade') {
|
||||
if (row.newVersion === '' || row.newVersion === '-') {
|
||||
message.warning('There are currently no upgraded versions available', 3);
|
||||
return;
|
||||
}
|
||||
if (row.newVersion === row.version) {
|
||||
message.warning(
|
||||
'The current version is the same as the previous version',
|
||||
3
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (action === 'rollback') {
|
||||
if (row.preVersion === '' || row.preVersion === '-') {
|
||||
message.warning('There are currently no rollback versions available', 3);
|
||||
return;
|
||||
}
|
||||
if (row.preVersion === row.version) {
|
||||
message.warning(
|
||||
'The current version is the same as the previous version',
|
||||
3
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Modal.confirm({
|
||||
title: t('common.tipTitle'),
|
||||
content: 'Removing software packages?',
|
||||
content: `${action} version packages?`,
|
||||
onOk() {
|
||||
if (modalState.confirmLoading) return;
|
||||
modalState.confirmLoading = true;
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
// installNeSoftware({
|
||||
// software: from,
|
||||
// preinput: {},
|
||||
// action: 'install',
|
||||
// })
|
||||
// .then(res => {
|
||||
// if (res.code === RESULT_CODE_SUCCESS) {
|
||||
// installState.setp = 'log';
|
||||
// installState.setpLog = res.data;
|
||||
// message.success('软件安装成功', 3);
|
||||
// // 记录当前步骤状态信息
|
||||
// stepState.states[stepState.current] = {
|
||||
// from: from,
|
||||
// preinput: preinput,
|
||||
// };
|
||||
// stepState.stepNext = true;
|
||||
// } else {
|
||||
// message.error(res.msg, 3);
|
||||
// }
|
||||
// })
|
||||
// .finally(() => {
|
||||
// hide();
|
||||
// installState.confirmLoading = false;
|
||||
// });
|
||||
let preinput = {};
|
||||
if (row.neType.toUpperCase() === 'IMS') {
|
||||
preinput = { pisCSCF: 'n' };
|
||||
}
|
||||
operateNeVersion({
|
||||
neType: row.neType,
|
||||
neId: row.neId,
|
||||
action: action,
|
||||
preinput: preinput,
|
||||
})
|
||||
.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;
|
||||
}
|
||||
console.log(res);
|
||||
} else {
|
||||
message.error(res.msg, 3);
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
hide();
|
||||
modalState.confirmLoading = false;
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -457,15 +498,21 @@ onMounted(() => {
|
||||
<template v-if="column.key === 'id'">
|
||||
<a-space :size="8" align="center">
|
||||
<a-tooltip>
|
||||
<template #title>Update To Previous version</template>
|
||||
<a-button type="link" @click.prevent="">
|
||||
<template #icon><ProfileOutlined /></template>
|
||||
<template #title>Upgrade To Previous version</template>
|
||||
<a-button
|
||||
type="link"
|
||||
@click.prevent="fnRecordVersion('upgrade', record)"
|
||||
>
|
||||
<template #icon><ThunderboltOutlined /></template>
|
||||
</a-button>
|
||||
</a-tooltip>
|
||||
<a-tooltip>
|
||||
<template #title>Update To New Version</template>
|
||||
<a-button type="link" @click.prevent="">
|
||||
<template #icon><ProfileOutlined /></template>
|
||||
<template #title>Rollback To New Version</template>
|
||||
<a-button
|
||||
type="link"
|
||||
@click.prevent="fnRecordVersion('rollback', record)"
|
||||
>
|
||||
<template #icon><RollbackOutlined /></template>
|
||||
</a-button>
|
||||
</a-tooltip>
|
||||
</a-space>
|
||||
|
||||
Reference in New Issue
Block a user