feat: 新增oam配置文件读写接口
This commit is contained in:
@@ -99,7 +99,7 @@ export function stateNeInfo(neType: string, neId: string) {
|
||||
* @param neId 网元ID
|
||||
* @returns object
|
||||
*/
|
||||
export function getTypeAndIDNeInfo(neType: string, neId: string) {
|
||||
export function getNeInfoByTypeAndIDNe(neType: string, neId: string) {
|
||||
return request({
|
||||
url: '/ne/info/byTypeAndID',
|
||||
method: 'get',
|
||||
@@ -142,23 +142,48 @@ export function saveConfigFile(data: Record<string, any>) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 网元端公共配置文件读取
|
||||
* @param fileType oam_manager.yaml '' txt json yaml yml 根据指定文件类型进行解析序列出map->json
|
||||
* 网元端OAM配置文件读取
|
||||
* @param neType 网元类型
|
||||
* @param neId 网元ID
|
||||
* @returns object
|
||||
*/
|
||||
export function getPara5GFilee(fileType: string) {
|
||||
export function getOAMFile(neType: string, neId: string) {
|
||||
return request({
|
||||
url: '/ne/info/oamFile',
|
||||
method: 'get',
|
||||
params: { neType, neId },
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 网元端配置文件写入
|
||||
* @param neType 网元类型
|
||||
* @param neId 网元ID
|
||||
* @param content txt内容为字符串 其他文件格式都用json对象
|
||||
* @param sync 同步到网元
|
||||
* @returns object
|
||||
*/
|
||||
export function saveOAMFile(data: Record<string, any>) {
|
||||
return request({
|
||||
url: `/ne/info/oamFile`,
|
||||
method: 'put',
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 网元端公共配置文件读取
|
||||
* @returns object
|
||||
*/
|
||||
export function getPara5GFilee() {
|
||||
return request({
|
||||
url: '/ne/info/para5GFile',
|
||||
method: 'get',
|
||||
params: {
|
||||
fileType,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 网元端公共配置文件写入
|
||||
* @param fileType yaml 解析内容数据到对应文件类型
|
||||
* @param content txt内容为字符串 其他文件格式都用json对象
|
||||
* @param syncNe 同步到网元端 NeType@ NeId
|
||||
* @returns object
|
||||
|
||||
303
src/views/ne/neConfOAM/index.vue
Normal file
303
src/views/ne/neConfOAM/index.vue
Normal file
@@ -0,0 +1,303 @@
|
||||
<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>
|
||||
Reference in New Issue
Block a user