const data = [
{
"id": "ijskldlfkjkajfds22",
"entity_id": "oixcvjksdksdflkfds",
"entity_resource": "equipment",
"entity_name": "磨边机",
"creator_id": "cvjiwojflkwkjf23242",
"creator_name": "刘义",
"created_time": 1599234992344,
"title": "磨边机点巡检",
"summary": "这是摘要"
},
{
"id": "ijskldlfkjkajfds22",
"entity_id": "oixcvjksdksdflkfds",
"entity_resource": "equipment",
"entity_name": "磨边机",
"creator_id": "cvjiwojflkwkjf23242",
"creator_name": "刘义",
"created_time": 1599234992344,
"title": "磨边机点巡检",
"summary": "这是摘要"
}
]
const GY = [{
label:'设备名',
code:'entity_name',
content:''
},{
label:'创建人员',
code:'creator_name',
content:''
},{
label:'创建时间',
code:'created_time',
content:''
},{
label:'描述',
code:'summary',
content:''
}
];
let temp = [];
let temp2 = data.map((val)=>{
let temp = GY.map((valG)=>{
console.log(val[valG.code] )
valG.content = val[valG.code]
return valG;
}
)
return Object.assign(val,{GY:temp});
})
console.log(temp2);
console