From b2f7e1d69bc00a1de70ceeae1131d4255a337c76 Mon Sep 17 00:00:00 2001 From: lai <371757574@qq.com> Date: Wed, 11 Oct 2023 16:35:56 +0800 Subject: [PATCH] =?UTF-8?q?---=E6=96=B0=E5=A2=9Elicense=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/configManage/license.ts | 216 +++++++++ src/api/faultManage/historyAlarm.ts | 28 +- src/i18n/locales/en-US.ts | 4 +- src/i18n/locales/zh-CN.ts | 4 +- src/views/configManage/license/index.vue | 583 +++++++++++++++++++++++ 5 files changed, 817 insertions(+), 18 deletions(-) create mode 100644 src/api/configManage/license.ts create mode 100644 src/views/configManage/license/index.vue diff --git a/src/api/configManage/license.ts b/src/api/configManage/license.ts new file mode 100644 index 00000000..2ab733f5 --- /dev/null +++ b/src/api/configManage/license.ts @@ -0,0 +1,216 @@ +import { + RESULT_CODE_ERROR, + RESULT_CODE_SUCCESS, + RESULT_MSG_ERROR, + } from '@/constants/result-constants'; + import { request } from '@/plugins/http-fetch'; + import { parseObjLineToHump } from '@/utils/parse-utils'; + + /** + * 查询软件列表 + * @param query 查询参数 + * @returns object + */ + export async function listLicense(query: Record) { + let totalSQL = 'select count(id) as total from ne_license '; + let rowsSQL = ' select * from ne_license '; + + // 查询 + let querySQL = 'where 1=1'; + if (query.neType) { + querySQL += ` and ne_type like '%${query.neType}%' `; + } + + // 分页 + const pageNum = query.pageNum - 1; + const limtSql = ` order by created_at desc limit ${pageNum},${query.pageSize} `; + + // 发起请求 + const result = await request({ + url: `/databaseManagement/v1/select/omc_db/ne_license`, + method: 'get', + params: { + totalSQL: totalSQL + querySQL, + rowsSQL: rowsSQL + querySQL + limtSql, + }, + }); + + // 解析数据 + if (result.code === RESULT_CODE_SUCCESS) { + const data: DataList = { + total: 0, + rows: [], + code: result.code, + msg: result.msg, + }; + result.data.data.forEach((item: any) => { + const itemData = item['ne_license']; + if (Array.isArray(itemData)) { + if (itemData.length === 1 && itemData[0]['total'] >= 0) { + data.total = itemData[0]['total']; + } else { + data.rows = itemData.map(v => parseObjLineToHump(v)); + } + } + }); + return data; + } + return result; + } + + + + /** + * 获取软件信息文件 + * @param menuId 网元ID + * @returns object + */ + export async function downloadNeSoftware(data: Record) { + return await request({ + url: `/systemManagement/v1/${data.neType}/software/${data.version}`, + method: 'get', + responseType: 'blob', + }); + } + + /** + * 上传文件 + * @param data 表单数据对象 + * @returns object + */ + export function uploadLicense(data: FormData) { + return request({ + url: `/systemManagement/v1/elementType/${data.get('nfType')}/objectType/license?neId=${data.get('nfId')}`, + method: 'post', + data, + dataType: 'form-data', + }); + } + + /** + * 下发文件 + * @param data 数据对象 + * @returns object + */ + export async function sendNeSoftware(data: Record) { + const result = await request({ + url: `/systemManagement/v1/${data.neType}/software/${data.version}/${data.neId}`, + method: 'post', + }); + // 解析数据 + if (result.code === RESULT_CODE_SUCCESS && result.data.data) { + let rows = result.data.data.affectedRows; + if (rows) { + delete result.data; + return result; + } else { + return { code: RESULT_CODE_ERROR, msg: RESULT_MSG_ERROR }; + } + } + return result; + } + + /** + * 激活文件 + * @param data 数据对象 + * @returns object + */ + export async function runNeSoftware(data: Record) { + const result = await request({ + url: `/systemManagement/v1/${data.neType}/software/${data.version}/${data.neId}`, + method: 'put', + }); + // 解析数据 + if (result.code === RESULT_CODE_SUCCESS && result.data.data) { + let rows = result.data.data.affectedRows; + if (rows) { + delete result.data; + return result; + } else { + return { code: RESULT_CODE_ERROR, msg: RESULT_MSG_ERROR }; + } + } + return result; + } + + /** + * 回退文件 + * @param data 数据对象 + * @returns object + */ + export async function backNeSoftware(data: Record) { + const result = await request({ + url: `/systemManagement/v1/${data.neType}/software/${data.version}/${data.neId}`, + method: 'patch', + }); + // 解析数据 + if (result.code === RESULT_CODE_SUCCESS && result.data.data) { + let rows = result.data.data.affectedRows; + if (rows) { + delete result.data; + return result; + } else { + return { code: RESULT_CODE_ERROR, msg: RESULT_MSG_ERROR }; + } + } + return result; + } + + /** + * 查询版本列表 + * @param query 查询参数 + * @returns object + */ + export async function listNeVersion(query: Record) { + let totalSQL = 'select count(id) as total from ne_version '; + let rowsSQL = 'select * from ne_version '; + + // 查询 + let querySQL = 'where 1=1'; + if (query.neType) { + querySQL += ` and ne_type like '%${query.neType}%' `; + } + if (query.status) { + querySQL += ` and status = '${query.status}' `; + } + if (query.beginTime && query.endTime) { + querySQL += ` and update_time BETWEEN '${query.beginTime}' AND '${query.endTime}' `; + } + + // 分页 + const pageNum = query.pageNum - 1; + const limtSql = ` order by update_time desc limit ${pageNum},${query.pageSize} `; + + // 发起请求 + const result = await request({ + url: `/databaseManagement/v1/select/omc_db/ne_version`, + method: 'get', + params: { + totalSQL: totalSQL + querySQL, + rowsSQL: rowsSQL + querySQL + limtSql, + }, + }); + + // 解析数据 + if (result.code === RESULT_CODE_SUCCESS) { + const data: DataList = { + total: 0, + rows: [], + code: result.code, + msg: result.msg, + }; + result.data.data.forEach((item: any) => { + const itemData = item['ne_version']; + if (Array.isArray(itemData)) { + if (itemData.length === 1 && itemData[0]['total'] >= 0) { + data.total = itemData[0]['total']; + } else { + data.rows = itemData.map(v => parseObjLineToHump(v)); + } + } + }); + return data; + } + return result; + } + \ No newline at end of file diff --git a/src/api/faultManage/historyAlarm.ts b/src/api/faultManage/historyAlarm.ts index 540602a5..be15b67f 100644 --- a/src/api/faultManage/historyAlarm.ts +++ b/src/api/faultManage/historyAlarm.ts @@ -6,14 +6,14 @@ import useUserStore from '@/store/modules/user'; import { ConsoleSqlOutlined } from '@ant-design/icons-vue'; /** - * ѯб - * @param query ѯ + * 查询列表 + * @param query 查询参数 * @returns object */ export async function listAct(query: Record) { let totalSQL = `select count(*) as total from alarm where alarm_status='0'`; let rowsSQL = `select * from alarm where alarm_status='0'`; - // ѯ + // 查询 let querySQL = ''; querySQL += query.alarm_code ? ` and alarm_code = '${query.alarm_code}' ` @@ -33,11 +33,11 @@ export async function listAct(query: Record) { ? ` and event_time BETWEEN '${query.beginTime}' and ' ${query.endTime}'` : ''; - // ҳ + // 分页 const pageNum = (query.pageNum - 1) * query.pageSize; const limtSql = ` order by clear_time desc limit ${pageNum},${query.pageSize} `; - // + // 发起请求 const result = await request({ url: `/databaseManagement/v1/select/omc_db/alarm`, method: 'get', @@ -47,7 +47,7 @@ export async function listAct(query: Record) { }, }); - // + // 解析数据 if (result.code === RESULT_CODE_SUCCESS) { const data: DataList = { total: 0, @@ -71,8 +71,8 @@ export async function listAct(query: Record) { } /** - * ȷϸ澯Ϣ - * @param data Ȩ + * 确认告警信息 + * @param data 鉴权对象 * @returns object */ export function updateConfirm(data: Record) { @@ -94,8 +94,8 @@ export function updateConfirm(data: Record) { } /** - * ȡȷϸ澯 - * @param data Ȩ + * 取消确认告警 + * @param data 鉴权对象 * @returns object */ export function cancelConfirm(data: (string | number)[]) { @@ -123,13 +123,13 @@ export function cancelConfirm(data: (string | number)[]) { /** - * ʷ澯 - * @param query ѯ + * 历史告警导出 + * @param query 查询参数 * @returns bolb */ export async function exportAll(query: Record) { let rowsSQL = `select * from alarm where alarm_status='0'`; - // ѯ + // 查询 let querySQL = ''; querySQL += query.alarm_code ? ` and alarm_code = '${query.alarm_code}' ` @@ -149,7 +149,7 @@ export async function exportAll(query: Record) { ? ` and event_time BETWEEN '${query.beginTime}' and ' ${query.endTime}'` : ''; - // + // 发起请求 const result = await request({ url: `/databaseManagement/v1/select/omc_db/alarm`, method: 'get', diff --git a/src/i18n/locales/en-US.ts b/src/i18n/locales/en-US.ts index 7b6f8151..ed2b0564 100644 --- a/src/i18n/locales/en-US.ts +++ b/src/i18n/locales/en-US.ts @@ -143,14 +143,14 @@ export default { neTypePlease: 'Select network element type', neType: 'Type', fileName: 'FileName', - creatTime: 'Uploaded', + createTime: 'Uploaded', comment: 'File Description', updateComment: 'License Description', updateCommentPlease: 'Please enter a license description', updateFile: 'License File', updateFilePlease: 'Please upload and update the License file', selectFile: 'SELECT FILE', - neId: 'Corresponding network element', + neId: 'Internal identification', neIdPlease: 'Please select the corresponding network element', }, }, diff --git a/src/i18n/locales/zh-CN.ts b/src/i18n/locales/zh-CN.ts index d4f597e7..5e0cb3b5 100644 --- a/src/i18n/locales/zh-CN.ts +++ b/src/i18n/locales/zh-CN.ts @@ -143,14 +143,14 @@ export default { neTypePlease: '选择网元类型', neType: '网元类型', fileName: '文件名', - creatTime: '上传时间', + createTime: '上传时间', comment: '文件说明', updateComment: 'License说明', updateCommentPlease: '请输入License说明', updateFile: 'License文件', updateFilePlease: '请上传更新License文件', selectFile: '选择文件', - neId: '对应网元', + neId: '网元内部标识', neIdPlease: '请选择对应网元', }, }, diff --git a/src/views/configManage/license/index.vue b/src/views/configManage/license/index.vue new file mode 100644 index 00000000..a970ad4e --- /dev/null +++ b/src/views/configManage/license/index.vue @@ -0,0 +1,583 @@ + + + + +