vue table刷新单行数据

1.给el-table加上标记方法
<el-table v-loading="loading" :data="tagList1" @selection-change="handleSelectionChange1" :row-class-name="tableRowClassName">
 
tableRowClassName({ row, rowIndex }) {
      row.index = rowIndex;
    },
 
2.提交数据到后台,重新获取此行数据
 
confirmBut(row, type, tabIndex){
      let _this = this
      let putParam = {"confirmId": row.confirmId, "type":type}
      editConfirmInfo(putParam).then(res =>{
        if(res.code == 200){
          //更改单行数据
          //重新去数据库中获取
          this.msgSuccess("成功");
          _this.changeLine(row, tabIndex)
        }else{
          this.msgError("失败,刷新页面查看事件是否已被确认!")
        }
      })
    },
 
changeLine(row, tabIndex){
      selectSmtTagAllById(row.id).then(response => {
        if(tabIndex==1){
          this.tagList1.splice(row.index,1,response.data)
        }else if(tabIndex==2){
          this.tagList2.splice(row.index,1,response.data)
        }else if(tabIndex==3){
          this.tagList3.splice(row.index,1,response.data)
        }
       
      });
    },
posted @ 2022-12-10 14:23  雨后丶云初霁  阅读(580)  评论(0编辑  收藏  举报