<el-table-column
label="是否启用"
align="center"
key="status"
v-hasPermi="['psychology:survey:changeStatus']"
prop="status">
<template #default="scope">
<el-switch
v-model="scope.row.status"
active-value="0"
inactive-value="1"
@change="handleStatusChange(scope.row)"/>
</template>
</el-table-column>
//启用、停用按钮
function handleStatusChange(row) {
let params = [row.surveyId];
if (row.status === "1") {
disablePsychology(params)
.then((response) => {
proxy.$modal.msgSuccess("成功停用");
})
.catch(() => {
row.status = "0";
});
} else {
enablePsychology(params)
.then((response) => {
proxy.$modal.msgSuccess("成功启用");
})
.catch(() => {
row.status = "1";
});
}
}