[{time:12/30/2018,cabin:'w',Type:'NonStop',dcp:37},{time:12/30/2018,cabin:'w',Type:'NonStop',dcp:37},{time:12/31/2018,cabin:'a',Type:'NonStop',dcp:37},{time:12/31/2018,cabin:'w',Type:'NonStop',dcp:37},{time:12/31/2018,cabin:'w',Type:'NonStop',dcp:37},{time:12/30/2017,cabin:'w',Type:'NonStop',dcp:37},{time:12/31/2017,cabin:'w',Type:'NonStop',dcp:37},{time:12/31/2017,cabin:'w',Type:'NonStop',dcp:37},{time:12/31/2017,cabin:'w',Type:'NonStop',dcp:37},{time:12/31/2017,cabin:'j',Type:'NonStop',dcp:37},][{time:12/30/2018,cabin:'w',Type:'NonStop',dcp:74,w:2},{time:12/31/2018,cabin:'w',Type:'NonStop',dcp:74,w:2},{time:12/31/2018,cabin:'a',Type:'NonStop',dcp:37,a:1},{time:12/31/2017,cabin:'w',Type:'NonStop',dcp:111,w:3},{time:12/31/2017,cabin:'j',Type:'NonStop',dcp:37,j:1},]请问各位大佬,如何把上面的数组整合成下面的数组形式啊,只要是日期相同,cabin相同,那么他们的其他字段的数值就相加,并且把cabin字段的value取出来变为一个新的字段加入当前对象,而它的值则是重复的数量,就是同一日期同一个cabin的数量
忽然笑
慕丝7291255
相关分类