调整删除方法 放弃使用el-popover 删除操作使用弹窗提示

This commit is contained in:
piexlMax
2024-03-13 22:37:07 +08:00
parent 7b79ec6c66
commit 50b1d21d13
11 changed files with 223 additions and 618 deletions
+17 -31
View File
@@ -95,31 +95,12 @@
fixed="right"
>
<template #default="scope">
<el-popover
v-model:visible="scope.row.visible"
placement="top"
width="160"
>
<p>确定要删除此用户吗</p>
<div style="text-align: right; margin-top: 8px;">
<el-button
type="primary"
link
@click="scope.row.visible = false"
>取消</el-button>
<el-button
type="primary"
@click="deleteUserFunc(scope.row)"
>确定</el-button>
</div>
<template #reference>
<el-button
type="primary"
link
icon="delete"
>删除</el-button>
</template>
</el-popover>
<el-button
type="primary"
link
icon="delete"
@click="deleteUserFunc(scope.row)"
>删除</el-button>
<el-button
type="primary"
link
@@ -390,12 +371,17 @@ const setOptions = (authData) => {
}
const deleteUserFunc = async(row) => {
const res = await deleteUser({ id: row.ID })
if (res.code === 0) {
ElMessage.success('删除成功')
row.visible = false
await getTableData()
}
ElMessageBox.confirm('确定要删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
const res = await deleteUser({ id: row.ID })
if (res.code === 0) {
ElMessage.success('删除成功')
await getTableData()
}
})
}
// 弹窗相关