<el-table
:data="tableData"
highlight-current-row //点击当前行高亮
ref="multipleTable" //绑定ref
>
<el-table-column
fixed
align="center"
type="index"
width="50"
label="序号"
></el-table-column>
<el-table-column align="center" label="操作" width="300">
<template slot-scope="scope">
<el-button
size="mini"
type="primary"
@click="handlerQuestionnaireDataAjax(scope.row)"
plain
>
<i class="el-icon-finished"></i>
{{ scope.row.isStatistics == 1 ? '重新统计' : '统计' }}
</el-button>
<el-button
size="mini"
type="danger"
@click="handleDeleteMonitorQnInfo(scope.row)"
plain
>
<i class="el-icon-delete"></i>
删除
</el-button>
</template>
</el-table-column>
</el-table>
//data里面去申明multipleTable
用法:this.$refs.multipleTable.setCurrentRow( this.contactQnData[0],true)
handlerMonitorDataAjax () {
for (let index = 0; index < this.contactQnData.length; index++) {
const element = this.contactQnData[index];
if (element.isStatistics == 0) {
this.$message.error(element.title + '还未统计,请先统计')
//动态让未通过的数据高亮
this.$refs.multipleTable.setCurrentRow(this.contactQnData[index], true)
return false
}
}
this.fullscreenLoading = this.$loading({
text: "统计中,请稍等...",
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.5)',
fontSize: '20px'
});
handlerMonitorData({ code: this.contactrOjb.code }).then(res => {
this.fullscreenLoading.close()
if (res.code == 200) {
this.$message.success(res.msg)
} else {
this.$message.error(res.msg)
}
}).catch(res => {
this.$message.error('接口出错,请联系管理员')
this.fullscreenLoading.close()
})
},
element-table组件,动态添加行背景。
最新推荐文章于 2024-03-08 09:01:09 发布