删除用户

This commit is contained in:
xing 2020-06-22 10:56:13 +08:00
parent 4f946fafad
commit 03eeee14e4

View File

@ -36,7 +36,7 @@
<el-table-column label="操作" >
<template slot-scope="scope">
<el-button @click="edit(scope.row)" size="mini" type="primary" icon="el-icon-edit"></el-button>
<el-button size="mini" type="danger" icon="el-icon-delete"></el-button>
<el-button size="mini" type="danger" icon="el-icon-delete" @click="del(scope.row.id)"></el-button>
<el-tooltip effect="dark" content="分配角色" placement="top" :enterable="false">
<el-button size="mini" type="warning" icon="el-icon-setting"></el-button>
</el-tooltip>
@ -174,6 +174,16 @@ export default {
}
},
methods: {
del (id) {
this.$confirm('要删除该用户么?').then(async value => {
const { data: res } = await this.$http.delete('users/' + id)
if (res.meta.status !== 200) {
return this.$message.error(res.meta.msg)
}
this.$message.success(res.meta.msg)
return this.getUserList()
}).catch(error => error)
},
edit (data) {
['id', 'username', 'email', 'mobile'].forEach(v => {
this.editForm[v] = data[v]