const projectName = "北京,东京";
const arr = [
{
"id": "769c9974-3a4b-c6c2-55df-5ac99da47a07",
"projectName": "北京",
},
{
"id": "1f0e9e4d-3f38-5051-a57c-67911d2e7e80",
"projectName": "南京",
},
{
"id": "3f97858d-2d27-656b-f0e6-3af3f7de64dd",
"projectName": "东京",
},
{
"id": "4b8bbe9b-7fa7-4782-9168-c6e1cec300da",
"projectName": "西京",
},
];
const projectNames = projectName.split(',');
const result = arr
.filter(item => projectNames.includes(item.projectName))
.map(item => item.id);
console.log(result);