前端项目实战204-根据组号和日期排序

for (const item of temp) {
                            let minDate = "none"
                            for (const day of item.dayPlan) {
                                if (day.dayDate < minDate) {
                                    minDate = day.dayDate
                                }
                            }
                            item.sortProp = `${item.team}-${minDate}`
                        }

                        temp = temp.sort((a: any, b: any) => 
{ return a.sortProp.localeCompare(b.sortProp) })
const data1 = {
    planBeginDate: "2022-11-01",
    planEndDate: "2022-11-30",
    manufacture: [{
        team: "1",
        styleNumber: "2",
        manufactureCode: "3",
        total: "4",
        po: "5",
        planDate: "6",
        productionQty: "7",
        dayPlan: [
            {
                targetCapacity: "300",
                dayDate: "2022-11-01",
            },
            {
                targetCapacity: "200",
                dayDate: "2022-11-05"
            }
        ]
    }]
}

posted @ 2022-11-28 19:17  前端导师歌谣  阅读(34)  评论(0)    收藏  举报