fix: 移除OAM编辑也慢慢

This commit is contained in:
TsMask
2024-04-29 18:15:26 +08:00
parent 3ded481cce
commit 7bf2672981

View File

@@ -1,303 +0,0 @@
<script setup lang="ts">
import { reactive, onMounted, toRaw } from 'vue';
import { PageContainer } from 'antdv-pro-layout';
import { message } from 'ant-design-vue/lib';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import useI18n from '@/hooks/useI18n';
import {
getNeInfoByTypeAndIDNe,
getOAMFile,
saveOAMFile,
} from '@/api/ne/neInfo';
import useNeInfoStore from '@/store/modules/neinfo';
const { t } = useI18n();
/**对象信息信息状态类型 */
type StateType = {
/**网元选择 */
neCascaderOptions: any[];
neType: string[];
/**同步到网元 */
sync: boolean;
/**表单数据 */
from: Record<string, any>;
/**确定按钮 loading */
confirmLoading: boolean;
};
/**对象信息状态 */
let state: StateType = reactive({
neCascaderOptions: [],
neType: [],
sync: false,
from: {
httpManageCfg: {
ipType: 'ipv4',
ipv4: '172.60.5.140',
ipv6: '',
port: 33030,
scheme: 'http',
},
oamConfig: {
enable: true,
ipType: 'ipv4',
ipv4: '172.60.5.99',
ipv6: '',
port: 33030,
scheme: 'http',
neConfig: {
neId: '002',
rmUid: '4400HX1UDM002',
neName: 'UDM_002',
dn: '网络标识',
vendorName: 'GD',
province: '网元所在省份',
pvFlag: 'PNF',
},
},
snmpConfig: {
enable: false,
ipType: 'ipv4',
ipv4: '172.60.5.140',
ipv6: '',
port: 4957,
},
kpiConfig: {
enable: true,
timer: 60,
},
},
confirmLoading: false,
});
/**保存文件数据*/
function fnSaveData() {
const [neType, neId] = state.neType;
if (state.confirmLoading || !neType) return;
state.confirmLoading = true;
saveOAMFile({ neType, neId, content: toRaw(state.from), syncNe: state.sync })
.then(res => {
message.success('Save Success ${res.msg}');
})
.finally(() => {
state.confirmLoading = false;
});
}
/**获取文件数据*/
function fnGetData() {
const [neType, neId] = state.neType;
if (state.confirmLoading || !neType) return;
state.confirmLoading = true;
Promise.all([getOAMFile(neType, neId), getNeInfoByTypeAndIDNe(neType, neId)])
.then(resArr => {
const data = resArr[0].data || state.from;
if (resArr[1].code === RESULT_CODE_SUCCESS) {
const neInfo = resArr[1].data;
data.neConfig = {
neId: neInfo.neId,
rmUid: neInfo.rmUid,
neName: neInfo.neName,
dn: neInfo.dn,
vendorName: neInfo.vendorName,
province: neInfo.province,
pvFlag: neInfo.pvFlag,
};
}
Object.assign(state.from, data);
})
.finally(() => {
state.confirmLoading = false;
});
}
onMounted(() => {
useNeInfoStore()
.fnNelist()
.then(res => {
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) {
// 过滤不可用的网元
state.neCascaderOptions = useNeInfoStore().getNeCascaderOptions.filter(
(item: any) => {
return !['OMC'].includes(item.value);
}
);
} else {
message.warning({
content: t('common.noData'),
duration: 2,
});
}
})
.finally(() => {
// 获取文件数据
fnGetData();
});
});
</script>
<template>
<PageContainer>
<a-card :bordered="false">
<!-- 插槽-卡片左侧侧 -->
<template #title>
<a-form layout="inline">
<a-form-item
:label="t('views.logManage.neFile.neType')"
name="neType"
>
<a-cascader
v-model:value="state.neType"
:options="state.neCascaderOptions"
@change="fnGetData()"
:allow-clear="false"
:placeholder="t('views.logManage.neFile.neTypePlease')"
:disabled="state.confirmLoading"
/>
</a-form-item>
<a-form-item label="Sync To NE" name="sync">
<a-switch
:checked-children="t('common.switch.open')"
:un-checked-children="t('common.switch.shut')"
v-model:checked="state.sync"
:disabled="state.confirmLoading"
></a-switch>
</a-form-item>
</a-form>
</template>
<!-- 插槽-卡片右侧 -->
<template #extra>
<a-space :size="8" align="center">
<a-button
type="default"
:disabled="state.confirmLoading"
@click.prevent="fnGetData()"
>
<template #icon><ReloadOutlined /></template>
Reload
</a-button>
<a-button
type="primary"
:loading="state.confirmLoading"
@click="fnSaveData()"
>
<template #icon><SaveOutlined /></template>
Save
</a-button>
</a-space>
</template>
<a-form
name="para5GFileeFrom"
layout="horizontal"
:label-col="{ span: 6 }"
:label-wrap="true"
:hidden="!state.neType.length"
>
<div>{{ state.from }}</div>
<a-divider orientation="left">httpManageCfg </a-divider>
<a-row :gutter="16">
<a-col :lg="24" :md="24" :xs="24">
<a-form-item
label="oamConfig.enable"
name="oamConfig.enable"
:label-col="{ span: 3 }"
:label-wrap="true"
>
<a-switch
:checked-children="t('common.switch.open')"
:un-checked-children="t('common.switch.shut')"
v-model:checked="state.from.oamConfig.enable"
></a-switch>
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="dnn_data" name="dnn_data">
<a-input
v-model:value="state.from.oamConfig.ipv4"
allow-clear
:placeholder="t('common.inputPlease')"
:maxlength="50"
>
</a-input>
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="port" name="port">
<a-input
v-model:value="state.from.oamConfig.port"
allow-clear
:placeholder="t('common.inputPlease')"
:maxlength="50"
>
</a-input>
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="scheme" name="scheme">
<a-input
v-model:value="state.from.oamConfig.scheme"
allow-clear
:placeholder="t('common.inputPlease')"
:maxlength="50"
>
</a-input>
</a-form-item>
</a-col>
{{ state.from.oamConfig.neConfig }}
</a-row>
<a-divider orientation="left">httpManageCfg </a-divider>
<a-row :gutter="16">
<a-col :lg="24" :md="24" :xs="24">
<a-form-item
label="oamConfig.enable"
name="oamConfig.enable"
:label-col="{ span: 3 }"
:label-wrap="true"
>
<a-switch
:checked-children="t('common.switch.open')"
:un-checked-children="t('common.switch.shut')"
v-model:checked="state.from.oamConfig.enable"
></a-switch>
</a-form-item>
</a-col>
<a-col :lg="24" :md="24" :xs="24">
<a-form-item
label="snmpConfig.enable"
name="snmpConfig.enable"
:label-col="{ span: 3 }"
:label-wrap="true"
>
<a-switch
:checked-children="t('common.switch.open')"
:un-checked-children="t('common.switch.shut')"
v-model:checked="state.from.snmpConfig.enable"
></a-switch>
</a-form-item>
</a-col>
<a-col :lg="24" :md="24" :xs="24">
<a-form-item
label="timer"
name="timer"
:label-col="{ span: 3 }"
:label-wrap="true"
>
<a-input-number
v-model:value="state.from.kpiConfig.timer"
:min="1"
:max="65535"
placeholder="1-65535"
></a-input-number>
</a-form-item>
</a-col>
</a-row>
</a-form>
</a-card>
</PageContainer>
</template>
<style lang="less" scoped></style>