//结构部分
<el-table-column
label="置顶"
width="150"
align="center"
:fixed="$store.getters.tableFixed"
>
<template slot-scope="scope">
<el-button
type="success"
size="small"
@click="handleSetTop(scope.$index, scope.row)"
>
{{ scope.row.isTop == 0 ? "置顶" : "取消置顶" }}
</el-button>
</template>
</el-table-column>
//js 点击置顶按钮执行的方法
handleSetTop(index, row) {
const params = {
id: row.id,
tag: row.isTop == 0 ? true : false,
};
//置顶接口
toTop(params).then((res) => {
console.log(res,'ppppppppppppppppppp');
this.$message({
message: res.data.message,
type: res.data.sucFlag ? "success" : "error",
});
if (res.data.sucFlag) {
this.getScenicDist();
this.getSelectData();
}
});
},
//分页查询数据
getScenicDist() {
const params = {
currentPage: this.page,
lineSize: this.lineSize,
};
getScenicPages(params).then((res) => {
// this.loading = false;
this.pageSize = res.data.pageSize;
this.total = res.data.totalCount;
this.tableData = res.data.data;
});
},
// 进入页面显示第一条,并且调用接口数据显示出来
getSelectData() {
getSelet().then((res) => {
this.SelectData = res.data.data;
this.value = res.data.data[0].organizationStairTName;
getSeletSon(res.data.data[0].id).then((res) => {
this.tableData = res.data.data;
console.log("首页数据", this.tableData);
});
});
},
控制数据是否置顶按钮
最新推荐文章于 2024-08-15 17:32:04 发布