![在这里插入图片描述](https://img-blog.csdnimg.cn/c42e1df7b066431095aa183ef58c7ad3.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAQWtpbW90byBIaXJvc2hp,size_9,color_FFFFFF,t_70,g_se,x_16)
<el-table-column label="账户状态" align="center" width="180px">
<template v-slot="scope">
<el-switch active-value="1" inactive-value="0" v-model="scope.row.sfyx" active-text="启用" @change="updateUserState(scope.row)" inactive-text="停用" active-color="#13ce66" inactive-color="#ff4949"></el-switch>
</template>
</el-table-column>
async updateUserState(row) {
let options = {
yhbh: row.yhbh,
zhbh: row.zhbh,
zh: row.zh,
sfyx: row.sfyx
};
try {
let {
data: res } = await updateAccountStatus(options);
if (res.code !== 200) {
return;
}
this.$message.success(`${
row.sfyx === '1' ? '启用' : '停用'}成功`);
this.onSubmit()
} catch (error) {
return error;
}
}