|
|
|
@ -44,19 +44,15 @@ |
|
|
|
|
<el-table-column prop="updateTime" label="时间" align="center"></el-table-column> |
|
|
|
|
<el-table-column label="操作" align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<template v-if="scope.row.isEnable"> |
|
|
|
|
<el-button v-if="auth('查看')" type="text" @click="showQues(scope.row)">查看</el-button> |
|
|
|
|
</template> |
|
|
|
|
<template v-else> |
|
|
|
|
<el-button v-if="auth('修改')" type="text" @click="editQues(scope.row)">修改</el-button> |
|
|
|
|
</template> |
|
|
|
|
<el-button v-if="auth('查看')" type="text" @click="showQues(scope.row)">查看</el-button> |
|
|
|
|
<el-button v-if="auth('编辑')" type="text" @click="editQues(scope.row)">编辑</el-button> |
|
|
|
|
<el-switch |
|
|
|
|
v-if="auth('禁用')" |
|
|
|
|
v-model="scope.row.isEnable" |
|
|
|
|
:active-text="scope.row.isEnable ? '关闭' : '启用'" |
|
|
|
|
:active-text="!scope.row.isEnable ? '禁用' : '启用'" |
|
|
|
|
:active-value="1" |
|
|
|
|
:inactive-value="0" |
|
|
|
|
style="margin: 0 10px 0 5px" |
|
|
|
|
style="margin: 0 10px;" |
|
|
|
|
@change="switchQues($event,scope.row,scope.$index)" |
|
|
|
|
></el-switch> |
|
|
|
|
<el-button v-if="auth('删除')" type="text" @click="delData(scope.row)">删除</el-button> |
|
|
|
@ -395,15 +391,10 @@ export default { |
|
|
|
|
this.resetForm(); |
|
|
|
|
}, |
|
|
|
|
switchQues(val, row, index) { |
|
|
|
|
this.$post(`${this.api.questionsIsDisable}?id=${row.id}`) |
|
|
|
|
.then(res => { |
|
|
|
|
if (res.status == 400) { |
|
|
|
|
util.errorMsg(res.message); |
|
|
|
|
row.isEnable = row.isEnable == 1 ? 0 : 1; |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
.catch(err => { |
|
|
|
|
}); |
|
|
|
|
this.$post(`${this.api.questionsIsDisable}?id=${row.id}`).then(res => { |
|
|
|
|
util.successMsg("更新状态成功"); |
|
|
|
|
this.getData(); |
|
|
|
|
}).catch(err => {}); |
|
|
|
|
}, |
|
|
|
|
delData(row) { |
|
|
|
|
this.$confirm("确定要删除吗?", "提示", { |
|
|
|
@ -664,5 +655,8 @@ export default { |
|
|
|
|
.check-wrap.checked { |
|
|
|
|
color: #9076FF; |
|
|
|
|
} |
|
|
|
|
/deep/ .el-switch__label *{ |
|
|
|
|
font-size: 12px; |
|
|
|
|
} |
|
|
|
|
</style> |
|
|
|
|
|
|
|
|
|