element-table组件,动态添加行背景。

 <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()

      })
    },


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值