From 0c199ba0bb6ffca2c8dbeee8b76d21cb83ead10e Mon Sep 17 00:00:00 2001 From: xuhuajiao <13476289682@163.com> Date: Mon, 20 May 2024 17:10:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E5=A4=87=E4=BB=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/system/sql.js | 39 +++++++ src/utils/index.js | 13 +++ src/views/system/database/index.vue | 157 ++++++++++++++++++---------- 3 files changed, 151 insertions(+), 58 deletions(-) create mode 100644 src/api/system/sql.js diff --git a/src/api/system/sql.js b/src/api/system/sql.js new file mode 100644 index 0000000..b7adc15 --- /dev/null +++ b/src/api/system/sql.js @@ -0,0 +1,39 @@ +import request from '@/utils/request' + +// 备份数据库 +export function add(data) { + return request({ + url: 'api/database/backupSQL', + method: 'post', + data + }) +} + +// 获取备份数据库文件名 +export function FetchBackupName(params) { + return request({ + url: 'api/database/getBackupName', + method: 'get', + params + }) +} + +// 删除数据库备份 +export function del(data) { + return request({ + url: 'api/database/deleteDatabaseBackup', + method: 'post', + data + }) +} + +// 还原数据库 +export function FetchrestoreDatabase(params) { + return request({ + url: 'api/database/restoreDatabase', + method: 'get', + params + }) +} + +export default { add, FetchBackupName, del, FetchrestoreDatabase } diff --git a/src/utils/index.js b/src/utils/index.js index e806a38..bbd8f74 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -387,6 +387,19 @@ export function downloadFile(obj, name, suffix) { document.body.removeChild(link) } +// 下载文件 +export function downloadDataBase(obj, name, suffix) { + const url = window.URL.createObjectURL(new Blob([obj])) + const link = document.createElement('a') + link.style.display = 'none' + link.href = url + const fileName = name + '.' + suffix + link.setAttribute('download', fileName) + document.body.appendChild(link) + link.click() + document.body.removeChild(link) +} + // new - 导出 export function exportFile(url, fileName) { const link = document.createElement('a') diff --git a/src/views/system/database/index.vue b/src/views/system/database/index.vue index 925173a..44cb5ab 100644 --- a/src/views/system/database/index.vue +++ b/src/views/system/database/index.vue @@ -39,20 +39,22 @@ v-loading="crud.loading" :data="crud.data" style="width: 100%;" + height="calc(100vh - 380px)" @selection-change="crud.selectionChangeHandler" > - - - - + + + + + {{ getFileSize(scope.row.filesize) }} + - + - - + + - {{ scope.row.createTime | parseTime }} + {{ scope.row.create_time | parseTime }} @@ -66,34 +68,34 @@ 这里为技术人员维护系统时使用,普通用户无需设置 注意:强行修改会导致系统数据异常或丢失!如因用户强行修改,本系统不负责因此导致的相关后果! - + - + - + - - + + - - + + @@ -103,17 +105,18 @@
这里为技术人员维护系统时使用,普通用户无需设置
注意:强行修改会导致系统数据异常或丢失!如因用户强行修改,本系统不负责因此导致的相关后果!