fix: 网元版本操作升级回退
This commit is contained in:
@@ -64,3 +64,17 @@ export function delNeVersion(versionIds: string | number) {
|
|||||||
timeout: 60_000,
|
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 useI18n from '@/hooks/useI18n';
|
||||||
import { NE_TYPE_LIST } from '@/constants/ne-constants';
|
import { NE_TYPE_LIST } from '@/constants/ne-constants';
|
||||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-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 { parseDateToStr } from '@/utils/date-utils';
|
||||||
|
import useLockedStore from '@/store/modules/locked';
|
||||||
|
const lockedStore = useLockedStore();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
// 异步加载组件
|
// 异步加载组件
|
||||||
@@ -251,39 +253,78 @@ function fnModalEditCancel() {
|
|||||||
modalState.visibleByEdit = false;
|
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({
|
Modal.confirm({
|
||||||
title: t('common.tipTitle'),
|
title: t('common.tipTitle'),
|
||||||
content: 'Removing software packages?',
|
content: `${action} version packages?`,
|
||||||
onOk() {
|
onOk() {
|
||||||
if (modalState.confirmLoading) return;
|
if (modalState.confirmLoading) return;
|
||||||
modalState.confirmLoading = true;
|
modalState.confirmLoading = true;
|
||||||
const hide = message.loading(t('common.loading'), 0);
|
const hide = message.loading(t('common.loading'), 0);
|
||||||
// installNeSoftware({
|
let preinput = {};
|
||||||
// software: from,
|
if (row.neType.toUpperCase() === 'IMS') {
|
||||||
// preinput: {},
|
preinput = { pisCSCF: 'n' };
|
||||||
// action: 'install',
|
}
|
||||||
// })
|
operateNeVersion({
|
||||||
// .then(res => {
|
neType: row.neType,
|
||||||
// if (res.code === RESULT_CODE_SUCCESS) {
|
neId: row.neId,
|
||||||
// installState.setp = 'log';
|
action: action,
|
||||||
// installState.setpLog = res.data;
|
preinput: preinput,
|
||||||
// message.success('软件安装成功', 3);
|
})
|
||||||
// // 记录当前步骤状态信息
|
.then(res => {
|
||||||
// stepState.states[stepState.current] = {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
// from: from,
|
// OMC自升级
|
||||||
// preinput: preinput,
|
if (row.neType.toUpperCase() === 'OMC') {
|
||||||
// };
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
// stepState.stepNext = true;
|
lockedStore.fnLock('reload');
|
||||||
// } else {
|
} else {
|
||||||
// message.error(res.msg, 3);
|
message.error({
|
||||||
// }
|
content: `${res.msg}`,
|
||||||
// })
|
duration: 3,
|
||||||
// .finally(() => {
|
});
|
||||||
// hide();
|
}
|
||||||
// installState.confirmLoading = false;
|
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'">
|
<template v-if="column.key === 'id'">
|
||||||
<a-space :size="8" align="center">
|
<a-space :size="8" align="center">
|
||||||
<a-tooltip>
|
<a-tooltip>
|
||||||
<template #title>Update To Previous version</template>
|
<template #title>Upgrade To Previous version</template>
|
||||||
<a-button type="link" @click.prevent="">
|
<a-button
|
||||||
<template #icon><ProfileOutlined /></template>
|
type="link"
|
||||||
|
@click.prevent="fnRecordVersion('upgrade', record)"
|
||||||
|
>
|
||||||
|
<template #icon><ThunderboltOutlined /></template>
|
||||||
</a-button>
|
</a-button>
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
<a-tooltip>
|
<a-tooltip>
|
||||||
<template #title>Update To New Version</template>
|
<template #title>Rollback To New Version</template>
|
||||||
<a-button type="link" @click.prevent="">
|
<a-button
|
||||||
<template #icon><ProfileOutlined /></template>
|
type="link"
|
||||||
|
@click.prevent="fnRecordVersion('rollback', record)"
|
||||||
|
>
|
||||||
|
<template #icon><RollbackOutlined /></template>
|
||||||
</a-button>
|
</a-button>
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
</a-space>
|
</a-space>
|
||||||
|
|||||||
Reference in New Issue
Block a user