diff --git a/mayfly_go_web/src/views/ops/db/DbBackupHistoryList.vue b/mayfly_go_web/src/views/ops/db/DbBackupHistoryList.vue
new file mode 100644
index 00000000..aba70460
--- /dev/null
+++ b/mayfly_go_web/src/views/ops/db/DbBackupHistoryList.vue
@@ -0,0 +1,155 @@
+
+
+
+
+
+
+
+
+
+
+ 立即恢复
+ 删除
+
+
+
+
+ 立即恢复
+ 删除
+
+
+
+
+
+
+
+
diff --git a/mayfly_go_web/src/views/ops/db/DbBackupList.vue b/mayfly_go_web/src/views/ops/db/DbBackupList.vue
index 100f0dd1..63b79cfc 100644
--- a/mayfly_go_web/src/views/ops/db/DbBackupList.vue
+++ b/mayfly_go_web/src/views/ops/db/DbBackupList.vue
@@ -21,6 +21,7 @@
添加
启用
禁用
+ 删除
@@ -29,6 +30,7 @@
启用
禁用
立即备份
+ 删除
@@ -49,7 +51,7 @@ import { dbApi } from './api';
import PageTable from '@/components/pagetable/PageTable.vue';
import { TableColumn } from '@/components/pagetable';
import { SearchItem } from '@/components/SearchForm';
-import { ElMessage } from 'element-plus';
+import { ElMessage, ElMessageBox } from 'element-plus';
const DbBackupEdit = defineAsyncComponent(() => import('./DbBackupEdit.vue'));
const pageTableRef: Ref = ref(null);
@@ -72,10 +74,10 @@ const columns = [
TableColumn.new('name', '任务名称'),
TableColumn.new('startTime', '启动时间').isTime(),
TableColumn.new('intervalDay', '备份周期'),
- TableColumn.new('enabled', '是否启用'),
+ TableColumn.new('enabledDesc', '是否启用'),
TableColumn.new('lastResult', '执行结果'),
TableColumn.new('lastTime', '执行时间').isTime(),
- TableColumn.new('action', '操作').isSlot().setMinWidth(180).fixedRight(),
+ TableColumn.new('action', '操作').isSlot().setMinWidth(220).fixedRight(),
];
const emptyQuery = {
@@ -168,5 +170,25 @@ const startDbBackup = async (data: any) => {
await search();
ElMessage.success('备份任务启动成功');
};
+
+const deleteDbBackup = async (data: any) => {
+ let backupId: string;
+ if (data) {
+ backupId = data.id;
+ } else if (state.selectedData.length > 0) {
+ backupId = state.selectedData.map((x: any) => x.id).join(' ');
+ } else {
+ ElMessage.error('请选择需要删除的数据库备份任务');
+ return;
+ }
+ await ElMessageBox.confirm(`确定删除 “数据库备份任务” 吗?`, '提示', {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ type: 'warning',
+ });
+ await dbApi.deleteDbBackup.request({ dbId: props.dbId, backupId: backupId });
+ await search();
+ ElMessage.success('删除成功');
+};
diff --git a/mayfly_go_web/src/views/ops/db/DbList.vue b/mayfly_go_web/src/views/ops/db/DbList.vue
index b9a775fc..50c7dc25 100644
--- a/mayfly_go_web/src/views/ops/db/DbList.vue
+++ b/mayfly_go_web/src/views/ops/db/DbList.vue
@@ -63,13 +63,19 @@
详情
导出
- 备份
+ 备份任务
+
+
+ 备份历史
- 恢复
+ 恢复任务
@@ -138,6 +144,16 @@
+
+
+
+
import('./DbEdit.vue'));
@@ -263,6 +280,13 @@ const state = reactive({
dbs: [],
dbId: 0,
},
+ // 数据库备份历史弹框
+ dbBackupHistoryDialog: {
+ title: '',
+ visible: false,
+ dbs: [],
+ dbId: 0,
+ },
// 数据库恢复弹框
dbRestoreDialog: {
title: '',
@@ -295,7 +319,8 @@ const state = reactive({
},
});
-const { db, selectionData, query, infoDialog, sqlExecLogDialog, exportDialog, dbEditDialog, dbBackupDialog, dbRestoreDialog } = toRefs(state);
+const { db, selectionData, query, infoDialog, sqlExecLogDialog, exportDialog, dbEditDialog, dbBackupDialog, dbBackupHistoryDialog, dbRestoreDialog } =
+ toRefs(state);
onMounted(async () => {
if (Object.keys(actionBtns).length > 0) {
@@ -359,6 +384,10 @@ const handleMoreActionCommand = (commond: any) => {
onShowDbBackupDialog(data);
return;
}
+ case 'backupHistory': {
+ onShowDbBackupHistoryDialog(data);
+ return;
+ }
case 'restoreDb': {
onShowDbRestoreDialog(data);
return;
@@ -412,6 +441,13 @@ const onShowDbBackupDialog = async (row: any) => {
state.dbBackupDialog.visible = true;
};
+const onShowDbBackupHistoryDialog = async (row: any) => {
+ state.dbBackupHistoryDialog.title = `${row.name}`;
+ state.dbBackupHistoryDialog.dbId = row.id;
+ state.dbBackupHistoryDialog.dbs = row.database.split(' ');
+ state.dbBackupHistoryDialog.visible = true;
+};
+
const onShowDbRestoreDialog = async (row: any) => {
state.dbRestoreDialog.title = `${row.name}`;
state.dbRestoreDialog.dbId = row.id;
diff --git a/mayfly_go_web/src/views/ops/db/DbRestoreEdit.vue b/mayfly_go_web/src/views/ops/db/DbRestoreEdit.vue
index 38a3107d..91d4ddaf 100644
--- a/mayfly_go_web/src/views/ops/db/DbRestoreEdit.vue
+++ b/mayfly_go_web/src/views/ops/db/DbRestoreEdit.vue
@@ -62,7 +62,7 @@