我需要根据我的文件号和文件卷号检索类型
[
{
ApplicantPartySiteNumber: "60229",
ManufacturerPartySiteNumber: "1095651",
FileVolumeNumber: "E312534.2",
Type: "Manufacturer",
FileNumber: "E312534"
},
{
ApplicantPartySiteNumber: "1095651",
ManufacturerPartySiteNumber: null,
FileVolumeNumber: "E63418.1",
Type: "Applicant",
FileNumber: "E63418"
},
{
ApplicantPartySiteNumber: "1095651",
ManufacturerPartySiteNumber: null,
FileVolumeNumber: "E61772.2",
Type: "Applicant",
FileNumber: "E61772"
}
];
答案 0 :(得分:0)
尝试一下:
const data = [{
"ApplicantPartySiteNumber":"60229",
"ManufacturerPartySiteNumber":"1095651",
"FileVolumeNumber":"E312534.2",
"Type":"Manufacturer",
"FileNumber":"E312534"
},
{
"ApplicantPartySiteNumber":"1095651",
"ManufacturerPartySiteNumber":null,
"FileVolumeNumber":"E63418.1",
"Type":"Applicant",
"FileNumber":"E63418"
},
{
"ApplicantPartySiteNumber":"1095651",
"ManufacturerPartySiteNumber":null,
"FileVolumeNumber":"E61772.2",
"Type":"Applicant",
"FileNumber":"E61772"
}]
const result = data.map(res=>({'FileNumber': res['FileNumber'], 'FileVolumeNumber': res['FileVolumeNumber']}));
console.log(result)
答案 1 :(得分:0)
您的json中缺少括号,说明不清楚,对不起
答案 2 :(得分:0)
例如使用数组查找方法
var obj=this.fileArr.find(x=>x.FileVolumeNumber == "E312534.2" && x.FileNumber == "E312534");
if(obj)
{
alert(obj.Type);
}
请参阅此Stack-Blitz。
谢谢。