From 60978d5261aea17af89669c1c6d2139942703631 Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Mon, 18 Sep 2023 15:09:14 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=85=8D=E7=BD=AE=E7=AE=A1=E7=90=86>?= =?UTF-8?q?=E5=A4=87=E4=BB=BD=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/configManage/backupManage.ts | 80 ++++ src/views/configManage/backupManage/index.vue | 349 ++++++++++++++++++ src/views/configManage/neManage/index.vue | 4 +- 3 files changed, 431 insertions(+), 2 deletions(-) create mode 100644 src/api/configManage/backupManage.ts create mode 100644 src/views/configManage/backupManage/index.vue diff --git a/src/api/configManage/backupManage.ts b/src/api/configManage/backupManage.ts new file mode 100644 index 00000000..c5846e6e --- /dev/null +++ b/src/api/configManage/backupManage.ts @@ -0,0 +1,80 @@ +import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; +import { request } from '@/plugins/http-fetch'; +import { parseObjLineToHump } from '@/utils/parse-utils'; + +/** + * 查询备份列表 + * @param query 查询参数 + * @returns object + */ +export async function listNeBackup(query: Record) { + let totalSQL = 'select count(id) as total from ne_backup '; + let rowsSQL = ' select * from ne_backup '; + + // 查询 + let querySQL = 'where 1=1'; + if (query.neType) { + querySQL += ` and ne_type like '%${query.neType}%' `; + } + + // 分页 + const pageNum = query.pageNum - 1; + const limtSql = ` order by create_time desc limit ${pageNum},${query.pageSize} `; + + // 发起请求 + const result = await request({ + url: `/databaseManagement/v1/select/omc_db/ne_backup`, + 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_backup']; + if (Array.isArray(itemData)) { + if (itemData.length === 1 && itemData[0]['total']) { + data.total = itemData[0]['total']; + } else { + data.rows = itemData.map(v => parseObjLineToHump(v)); + } + } + }); + return data; + } + return result; +} + +/** + * 删除备份信息 + * @param noticeId 网元ID + * @returns object + */ +export async function delNeBackup(data: Record) { + return request({ + url: `/systemManagement/v1/${data.neType}/neBackup/${data.fileName}`, + method: 'delete', + }); +} + +/** + * 获取备份信息文件 + * @param menuId 网元ID + * @returns object + */ +export async function downloadNeBackup(data: Record) { + return await request({ + url: `/systemManagement/v1/${data.neType}/neBackup/${data.fileName}`, + method: 'get', + responseType: 'blob', + }); +} diff --git a/src/views/configManage/backupManage/index.vue b/src/views/configManage/backupManage/index.vue new file mode 100644 index 00000000..7a675e61 --- /dev/null +++ b/src/views/configManage/backupManage/index.vue @@ -0,0 +1,349 @@ + + + + + diff --git a/src/views/configManage/neManage/index.vue b/src/views/configManage/neManage/index.vue index 6ef20868..1cb88ae1 100644 --- a/src/views/configManage/neManage/index.vue +++ b/src/views/configManage/neManage/index.vue @@ -134,7 +134,7 @@ let tableColumns: ColumnsType = [ }, }, { - title: '操作', + title: t("common.operate"), key: 'id', align: 'center', }, @@ -158,7 +158,7 @@ let tablePagination = reactive({ showSizeChanger: true, /**数据总数 */ total: 0, - showTotal: (total: number) => `总共 ${total} 条`, + showTotal: (total: number) => t('common.tablePaginationTotal', { total }), onChange: (page: number, pageSize: number) => { tablePagination.current = page; tablePagination.pageSize = pageSize;