开关
This commit is contained in:
parent
dfed24cdfb
commit
3018a0d1e0
@ -29,7 +29,7 @@
|
|||||||
<el-table-column width="100" label="状态" >
|
<el-table-column width="100" label="状态" >
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-switch
|
<el-switch
|
||||||
v-model="scope.row.mg_state" @change="changeState">
|
v-model="scope.row.mg_state" @change="changeState(scope.row)">
|
||||||
</el-switch>
|
</el-switch>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@ -82,8 +82,13 @@ export default {
|
|||||||
this.queryInfo.pagenum = val
|
this.queryInfo.pagenum = val
|
||||||
this.getUserList()
|
this.getUserList()
|
||||||
},
|
},
|
||||||
changeState (state) {
|
async changeState (row) {
|
||||||
console.log(state)
|
const { data: res } = await this.$http.put(`users/${row.id}/state/${row.mg_state}`)
|
||||||
|
if (res.meta.code !== 200) {
|
||||||
|
row.mg_state = !row.mg_state
|
||||||
|
return this.$message.error(res.meta.msg)
|
||||||
|
}
|
||||||
|
this.$message.success(res.meta.msg)
|
||||||
},
|
},
|
||||||
async getUserList () {
|
async getUserList () {
|
||||||
const { data: res } = await this.$http.get('users', {
|
const { data: res } = await this.$http.get('users', {
|
||||||
|
Loading…
Reference in New Issue
Block a user