获取一个数组中相同的属性的对象数组
initDependLink(arr) {
let links = {};
for (let item of arr) {
if (!links[item.target]) {
links[item.target] = [];
}
links[item.target].push(item.source);
}
let relas = [];
for (let key in links) {
let item = {
relaType1: "e2b",
relaType2: "AND",
fromIds: links[key],
toIds: [key]
};
relas.push(item)
}
console.log(relas);
},