|
@@ -66,8 +66,12 @@
|
|
|
<el-table-column label="类型名称" align="center" prop="type" />
|
|
|
<el-table-column label="是否首页展示" align="center" prop="whetherShow">
|
|
|
<template slot-scope="scope">
|
|
|
- <dict-tag :options="dict.type.sys_yes_no"
|
|
|
- :value="scope.row.whetherShow"/>
|
|
|
+ <el-switch
|
|
|
+ v-model="scope.row.whetherShow"
|
|
|
+ active-value="Y"
|
|
|
+ inactive-value="N"
|
|
|
+ @change="handleSwitchChange(scope.row)"
|
|
|
+ ></el-switch>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
@@ -127,7 +131,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { listType, getType, delType, addType, updateType } from "@/api/asking/type";
|
|
|
+import { listType, getType, delType, addType, updateType, updateAskType} from "@/api/asking/type";
|
|
|
|
|
|
export default {
|
|
|
name: "Type",
|
|
@@ -179,6 +183,19 @@ export default {
|
|
|
this.getList();
|
|
|
},
|
|
|
methods: {
|
|
|
+ /**点击开关 */
|
|
|
+ handleSwitchChange(row) {
|
|
|
+ console.log(row)
|
|
|
+ this.form.id = row.id
|
|
|
+ this.form.type = row.type
|
|
|
+ this.form.whetherShow = row.whetherShow
|
|
|
+ updateAskType(this.form).then(response => {
|
|
|
+ this.$modal.msgSuccess("修改成功");
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ // 在这里处理开关状态改变后的逻辑,例如发送一个请求到服务器
|
|
|
+ // console.log('Switch value:', row.homeDisplay);
|
|
|
+ },
|
|
|
/** 查询类型配置列表 */
|
|
|
getList() {
|
|
|
this.loading = true;
|