1、两个数组比对去重(函数)
getSomeArr(arr1, arr2) {
return arr1.filter((v) => arr2.every((val) => val.fieldName != v.fieldName));
},
2、取两个数组过滤去重后数据后的数组
let a = b.filter((item) => {
return !c.some(ele => ele.name=== item.name)
});
3、通过一个数组匹配另外一个数组的完整数据(通过小数组匹配大数组)
let a= b.filter((item) => {
return c.find((prop) => {
return name == name;
});
});
4、单个数组去重
let a = Array.from(new Set(b));
5、数据导出
exportData(data).then((response) => {
let blob = new Blob([response], {
type: "application/vnd.ms-excel",
});
let fileName = new Date().toLocaleString() + "导出数据" + ".xlsx";
// 允许用户在客户端上保存文件
let link = document.createElement("a");
link.href = window.URL.createObjectURL(blob);
link.download = fileName;
link.click();
//释放内存
window.URL.revokeObjectURL(link.href);
});
6、数据获取索引并移除
let a= b.findIndex(i => i.name=== name && c.name=== i.name)
c.splice(newindex, 1)