子表字段名,示例脚本
function(rows, importRows){
debugger
//遍历导入的所有元素
importRows.forEach((item) => {
for(let i =0;i<rows.length;i++){
//处理组合主键,如果相同就删除原数组的元素
if(item.zb == rows[i].zb && item.zbe === rows[i].zbe){
rows.splice(i, 1)
}
}
})
const newRows = rows.concat(importRows);
return newRows;
}
可以处理两个数组集合的并集。然后返回一个新的结果展示给前端。
Rows 是页面上已有数据,importRows是excel导入数据。