fix: 用户编辑弹窗修复 — footer 简化 + 删除后关闭弹窗

- footer 用 span 替代 flex div (避免 element-plus 兼容问题)
- 删除成功后自动关闭弹窗

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-06-27 12:02:04 +08:00
parent 7e31606b45
commit 015af18d3c
+6 -7
View File
@@ -65,6 +65,7 @@ async function handleDelete(row: any) {
await ElMessageBox.confirm(`确定删除「${row.name}」?此操作不可恢复。`, '确认删除', { type: 'warning', confirmButtonText: '删除', cancelButtonText: '取消' })
await api.delete(`/users/${row.id}`)
ElMessage.success(`已删除「${row.name}`)
editDialogVisible.value = false
await loadUsers()
} catch (e: any) { if (e !== 'cancel') ElMessage.error('删除失败: ' + (e.response?.data?.detail || e.message)) }
}
@@ -127,13 +128,11 @@ async function handleDelete(row: any) {
</el-form>
</template>
<template #footer>
<div style="display:flex;justify-content:space-between;width:100%">
<el-button v-if="auth.isDirector" type="danger" @click="handleDelete(editUser)">删除用户</el-button>
<div>
<el-button @click="editDialogVisible = false">取消</el-button>
<el-button type="primary" @click="handleSave">保存</el-button>
</div>
</div>
<span>
<el-button v-if="auth.isDirector" type="danger" @click="handleDelete(editUser)" style="float:left">删除用户</el-button>
<el-button @click="editDialogVisible = false">取消</el-button>
<el-button type="primary" @click="handleSave">保存</el-button>
</span>
</template>
</el-dialog>
</div>