fix: 网元OAM下发开关控制重启

This commit is contained in:
TsMask
2025-04-22 14:22:17 +08:00
parent ceea517613
commit 73eb70b7d8

View File

@@ -4,7 +4,7 @@ import { ProModal } from 'antdv-pro-modal';
import { message, Form } from 'ant-design-vue/es'; import { message, Form } from 'ant-design-vue/es';
import useI18n from '@/hooks/useI18n'; import useI18n from '@/hooks/useI18n';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import { getOAMFile, saveOAMFile } from '@/api/ne/neInfo'; import { getOAMFile, saveOAMFile, serviceNeAction } from '@/api/ne/neInfo';
const { t } = useI18n(); const { t } = useI18n();
const emit = defineEmits(['ok', 'cancel', 'update:open']); const emit = defineEmits(['ok', 'cancel', 'update:open']);
const props = defineProps({ const props = defineProps({
@@ -29,8 +29,8 @@ type ModalStateType = {
openByEdit: boolean; openByEdit: boolean;
/**标题 */ /**标题 */
title: string; title: string;
/**是否同步 */ /**是否重启 */
sync: boolean; restart: boolean;
/**表单数据 */ /**表单数据 */
from: Record<string, any>; from: Record<string, any>;
/**确定按钮 loading */ /**确定按钮 loading */
@@ -41,7 +41,7 @@ type ModalStateType = {
let modalState: ModalStateType = reactive({ let modalState: ModalStateType = reactive({
openByEdit: false, openByEdit: false,
title: 'OAM Configuration', title: 'OAM Configuration',
sync: true, restart: false,
from: { from: {
omcIP: '', omcIP: '',
oamEnable: true, oamEnable: true,
@@ -114,12 +114,19 @@ function fnModalOk() {
neType: props.neType, neType: props.neType,
neId: props.neId, neId: props.neId,
content: from, content: from,
sync: modalState.sync, sync: true,
}) })
.then(res => { .then(res => {
if (res.code === RESULT_CODE_SUCCESS) { if (res.code === RESULT_CODE_SUCCESS) {
message.success(t('common.operateOk'), 3); message.success(t('common.operateOk'), 3);
emit('ok'); emit('ok');
if (modalState.restart) {
serviceNeAction({
neType: props.neType,
neId: props.neId,
action: 'restart',
});
}
fnModalCancel(); fnModalCancel();
} else { } else {
message.error({ message.error({
@@ -145,6 +152,7 @@ function fnModalOk() {
function fnModalCancel() { function fnModalCancel() {
modalState.openByEdit = false; modalState.openByEdit = false;
modalState.confirmLoading = false; modalState.confirmLoading = false;
modalState.restart = false;
modalStateFrom.resetFields(); modalStateFrom.resetFields();
emit('cancel'); emit('cancel');
emit('update:open', false); emit('update:open', false);
@@ -183,15 +191,15 @@ watch(
:labelWrap="true" :labelWrap="true"
> >
<a-form-item <a-form-item
:label="t('views.ne.neInfo.oam.sync')" :label="t('views.ne.neInfo.oam.restart')"
name="sync" name="restart"
:label-col="{ span: 6 }" :label-col="{ span: 6 }"
:labelWrap="true" :labelWrap="true"
> >
<a-switch <a-switch
:checked-children="t('common.switch.open')" :checked-children="t('common.switch.open')"
:un-checked-children="t('common.switch.shut')" :un-checked-children="t('common.switch.shut')"
v-model:checked="modalState.sync" v-model:checked="modalState.restart"
></a-switch> ></a-switch>
</a-form-item> </a-form-item>