增加回滚不删表按钮防止误删数据库重要数据

This commit is contained in:
piexlmax
2022-03-30 22:48:43 +08:00
parent 08c2b02be9
commit 13b12d80da
4 changed files with 21 additions and 11 deletions

View File

@@ -36,10 +36,11 @@
</el-tag>
</template>
</el-table-column>
<el-table-column align="left" label="操作" min-width="180">
<el-table-column align="left" label="操作" min-width="240">
<template #default="scope">
<div>
<el-button size="small" type="text" :disabled="scope.row.flag === 1" @click="rollbackFunc(scope.row)">回滚</el-button>
<el-button size="small" type="text" :disabled="scope.row.flag === 1" @click="rollbackFunc(scope.row,true)">回滚(删表)</el-button>
<el-button size="small" type="text" :disabled="scope.row.flag === 1" @click="rollbackFunc(scope.row,false)">回滚(不删表)</el-button>
<el-button size="small" type="text" @click="goAutoCode(scope.row)">复用</el-button>
<el-button size="small" type="text" @click="deleteRow(scope.row)">删除</el-button>
</div>
@@ -120,13 +121,13 @@ const deleteRow = async(row) => {
}
})
}
const rollbackFunc = async(row) => {
ElMessageBox.confirm('此操作将删除自动创建的文件和api, 是否继续?', '提示', {
const rollbackFunc = async(row, flag) => {
ElMessageBox.confirm(`此操作将删除自动创建的文件和api${flag ? '(包含数据库表!)' : ''}, 是否继续?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async() => {
const res = await rollback({ id: Number(row.ID) })
const res = await rollback({ id: Number(row.ID), deleteTable: flag })
if (res.code === 0) {
ElMessage.success('回滚成功')
getTableData()