diff --git a/.gitignore b/.gitignore index a2583a80..64db6d9d 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ selenium-debug.log package-lock.json yarn.lock +src/typings/components.d.ts diff --git a/src/api/configuration/net-ele.ts b/src/api/configuration/net-ele.ts new file mode 100644 index 00000000..43d4fdb5 --- /dev/null +++ b/src/api/configuration/net-ele.ts @@ -0,0 +1,113 @@ +import { request } from '@/plugins/http-fetch'; + +/** + * 查询网元列表 + * @param query 查询参数 + * @returns object + */ +export async function listNeInfo(query: Record) { + 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) { + return request({ + url: `/systemManagement/v1/elementType/${data.ne_type}/objectType/neInfo`, + method: 'post', + data: data, + }); +} + +/** + * 修改网元 + * @param data 网元对象 + * @returns object + */ +export function updateNeInfo(data: Record) { + 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) { + return request({ + url: `/systemManagement/v1/elementType/${data.ne_type}/objectType/neInfo?ne_id=${data.ne_id}`, + method: 'delete', + }); +} diff --git a/src/api/log.ts b/src/api/log.ts new file mode 100644 index 00000000..b5dea7f7 --- /dev/null +++ b/src/api/log.ts @@ -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], + }); +} diff --git a/src/i18n/locales/en-US.ts b/src/i18n/locales/en-US.ts index 8b253ece..cfe23a01 100644 --- a/src/i18n/locales/en-US.ts +++ b/src/i18n/locales/en-US.ts @@ -9,6 +9,8 @@ export default { desc: '', loading: 'Please wait...', tipTitle: 'Prompt', + msgSuccess: "Success {msg}", + errorFields: "Please fill in the required information in {num} correctly!", }, // 全局页脚 diff --git a/src/i18n/locales/zh-CN.ts b/src/i18n/locales/zh-CN.ts index 3ca44f94..b9c1d5e7 100644 --- a/src/i18n/locales/zh-CN.ts +++ b/src/i18n/locales/zh-CN.ts @@ -9,6 +9,8 @@ export default { desc: '', loading: '请稍等...', tipTitle: '提示', + msgSuccess: "成功 {msg}", + errorFields: "请正确填写 {num} 处必填信息!", }, // 全局页脚 diff --git a/src/typings/request.d.ts b/src/typings/request.d.ts new file mode 100644 index 00000000..343cda6e --- /dev/null +++ b/src/typings/request.d.ts @@ -0,0 +1,7 @@ +/**数据列表 */ +type DataList = { + code: number; + msg: string; + total: number; + rows: Record; +}; diff --git a/src/views/configuration/net-ele/index.vue b/src/views/configuration/net-ele/index.vue new file mode 100644 index 00000000..dd1fbd13 --- /dev/null +++ b/src/views/configuration/net-ele/index.vue @@ -0,0 +1,669 @@ + + + + +