|
|
@@ -53,7 +53,7 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="is_active" label="状态">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-switch v-model="scope.row.is_active"> </el-switch>
|
|
|
+ <el-switch @change="set(scope.row)" v-model="scope.row.is_active"> </el-switch>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="cname" label="编辑人"> </el-table-column>
|
|
|
@@ -121,6 +121,9 @@ export default {
|
|
|
this.loading = true;
|
|
|
this.$api.getColdWordList(parm).then((res) => {
|
|
|
let list = res.data.data.list;
|
|
|
+ list.forEach(item => {
|
|
|
+ item.is_active=Boolean(item.is_active)
|
|
|
+ });
|
|
|
this.list = list;
|
|
|
this.total = res.data.data.total;
|
|
|
this.loading = false;
|
|
|
@@ -175,6 +178,24 @@ export default {
|
|
|
}
|
|
|
this.dialogVisible = false;
|
|
|
},
|
|
|
+ set(data){
|
|
|
+ var parm={
|
|
|
+ id:data.id,
|
|
|
+ is_active:Number(data.is_active),
|
|
|
+ name:data.name
|
|
|
+ }
|
|
|
+ this.$api.updateHotWord(parm).then((res) => {
|
|
|
+ if (res.data.code == 0) {
|
|
|
+ this.$message({
|
|
|
+ type: "success",
|
|
|
+ message: "设置成功!",
|
|
|
+ });
|
|
|
+ // this.getData();
|
|
|
+ } else {
|
|
|
+ this.$message.error("设置失败!");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
created() {
|
|
|
this.getData();
|