add: 网元列表

This commit is contained in:
TsMask
2023-09-06 19:36:39 +08:00
parent 7207e0812e
commit 51aa994a9e
7 changed files with 820 additions and 0 deletions

View File

@@ -0,0 +1,113 @@
import { request } from '@/plugins/http-fetch';
/**
* 查询网元列表
* @param query 查询参数
* @returns object
*/
export async function listNeInfo(query: Record<string, any>) {
let totalSQL = 'select count(*) as total from ne_info where status=0 ';
let rowsSQL = 'select * from ne_info where status=0 ';
// 查询
let querySQL = '';
if (query.neType) {
querySQL += ` and ne_type = '${query.neType}' `;
}
// 分页
const pageNum = query.pageNum - 1;
const limtSql = ` limit ${pageNum},${query.pageSize} `;
// 发起请求
const result = await request({
url: `/databaseManagement/v1/select/omc_db/ne_info`,
method: 'get',
params: {
totalSQL: totalSQL + querySQL,
rowsSQL: rowsSQL + querySQL + limtSql,
},
});
// 解析数据
if (result.code === 1) {
const data: DataList = {
total: 0,
rows: [],
code: result.code,
msg: result.msg,
};
result.data.data.forEach((item: any) => {
const itemData = item['ne_info'];
if (Array.isArray(itemData)) {
if (itemData.length === 1 && itemData[0]['total']) {
data.total = itemData[0]['total'];
} else {
data.rows = itemData;
}
}
});
return data;
}
return result;
}
/**
* 查询网元详细
* @param menuId 网元ID
* @returns object
*/
export async function getNeInfo(id: string | number) {
// 发起请求
const result = await request({
url: `/databaseManagement/v1/select/omc_db/ne_info`,
method: 'get',
params: {
SQL: `select * from ne_info where status=0 and id = ${id}`,
},
});
// 解析数据
if (result.code === 1 && Array.isArray(result.data.data)) {
const data = result.data.data[0];
return Object.assign(result, { data: data['ne_info'][0] });
}
return result;
}
/**
* 新增网元
* @param data 网元对象
* @returns object
*/
export function addNeInfo(data: Record<string, any>) {
return request({
url: `/systemManagement/v1/elementType/${data.ne_type}/objectType/neInfo`,
method: 'post',
data: data,
});
}
/**
* 修改网元
* @param data 网元对象
* @returns object
*/
export function updateNeInfo(data: Record<string, any>) {
return request({
url: `/systemManagement/v1/elementType/${data.ne_type}/objectType/neInfo`,
method: 'put',
data: data,
});
}
/**
* 删除网元
* @param noticeId 网元ID
* @returns object
*/
export async function delNeInfo(data: Record<string, any>) {
return request({
url: `/systemManagement/v1/elementType/${data.ne_type}/objectType/neInfo?ne_id=${data.ne_id}`,
method: 'delete',
});
}

26
src/api/log.ts Normal file
View File

@@ -0,0 +1,26 @@
import { request } from '@/plugins/http-fetch';
type OperationLogType = {
account_name: string;
account_type: string; //type:int
op_ip: string;
subsys_tag: string;
op_type: string;
op_content: string;
op_result: string;
begin_time: string;
end_time: string;
vnf_flag: string; //0-物理设备 1-虚拟化设备
};
/**
* 操作日志
* @returns object
*/
export function operationLog(opt: OperationLogType) {
return request({
url: '/databaseManagement/v1/insert/omc_db/operation_log',
method: 'post',
data: [opt],
});
}