处理前的源数组
let应用列表=[
{ applyNo: “1”、apply date :“2021-04-2210336041336031”、yearMonth: “2021年04月”}、
{ applyNo: “2”、apply date :“2021-04-131133602:18”、yearMonth: “2021年04月”}、
{ applyNo: “3”、apply date :“2021-03-0409336037336049”、yearMonth: “2021年03月”}、
{ applyNo: “4”、apply date :“2021-03-1717336052336027”、yearMonth: “2021年03月”}、
];
处理后的目标数组
let applyListHandle=[
{yearMonth: “2021年04月”、handle: [{ applyNo: “1”、apply date :“2021-04-2210336041:31”、year mor
{yearMonth: “2021年03月”,handle: [{ applyNo: “3”,apply date :“2021-03-04093360:49”,year monton
]
代码如下。
let tempArr=[]; this.apply list.foreach (index ((if ) temparr.indexof ) this.apply list [ index ].year month )=-1 ) this.applyly } else { this.applylisthandle.foreach ((it,I )=) if ) this.applylisthandle [ I ].year month==this.apply list }; ); }; ); //console.log (this.applylisthandle,' applylisthandle ';