点击刷新实现当前行内数据刷新
// 单行刷新
async refreshInfo(row,index){
let devid = row.dev_id;
singleRefresh({dev_id:row.dev_id}).then(res=>{
if(res.data.code===200){
setTimeout(async () => {
const res1 = await devlistInfo({search_key:'dev_id',search_value:devid});
let arr = [];
res1.data.device_infos.forEach(devInfo=>{
const workinfo = res1.data.device_workinfos.find(devWorkinfo=>devWorkinfo.dev_id === devInfo.dev_id);
if(workinfo){
const infoWorkinfo = {...devInfo,...workinfo};
arr.push(infoWorkinfo);
};
//更新当前行数
this.tableData[index] = {...arr[0]};
this.$set(this.tableData, index, {...arr[0]});
this.$message.success('设备ID为'+ devid +'的数据已刷新');
});
}, 1000);
};
})
},
(新手小白,欢迎批评指正)