<el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope">
<el-switch
v-model="scope.row.status"
active-value="1"
inactive-value="0"
@change="handleStatusChange(scope.row)"
></el-switch>
</template>
</el-table-column>
handleStatusChange(row) {
let text = row.status === '1' ? '启用' : '停用'
this.$confirm('确认要"' + text + '""' + row.username+ '"吗?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function () {
return changeStatus(row.id, row.status)
}).then(() => {
this.msgSuccess(text + '成功')
}).catch(function () {
row.status = row.status === '0' ? '1' : '0'
})
},