SOURCE

let res = {
    "planList": [
        {
            "parentId": null,
            "taskGuid": "ccaff7b0-0a21-f111-9b48-2816ada18249",
            "taskID": 0,
            "projectId": "3a1ff1ff-8dd5-4f77-c091-884c669e881c",
            "type": 0,
            "name": "项目1",
            "startDate": "2025-11-01 00:00:00",
            "endDate": "2026-01-01 00:00:00",
            "duration": 46.00,
            "units": "d",
            "preTask": null,
            "progress": null,
            "resource": null,
            "remark": null,
            "status": 0,
            "creationTime": "2026-03-16 15:36:07",
            "finishDate": null,
            "projectPlanPartCount": 0,
            "projectPlanAssist": null,
            "id": "9be83cd8-e12a-4ce6-ad95-49117c26e456"
        },
        {
            "parentId": "9be83cd8-e12a-4ce6-ad95-49117c26e456",
            "taskGuid": "cdaff7b0-0a21-f111-9b48-2816ada18249",
            "taskID": 1,
            "projectId": "3a1ff1ff-8dd5-4f77-c091-884c669e881c",
            "type": 1,
            "name": "测试",
            "startDate": "2025-11-01 00:00:00",
            "endDate": "2025-11-02 00:00:00",
            "duration": 2.00,
            "units": "d",
            "preTask": null,
            "progress": null,
            "resource": "",
            "remark": null,
            "status": 0,
            "creationTime": "2026-03-16 15:36:07",
            "finishDate": null,
            "projectPlanPartCount": 4,
            "projectPlanAssist": {
                "projectPlanId": "12c59627-51dc-4be4-b93a-9716a8c195f2",
                "content": "",
                "reason": null
            },
            "id": "12c59627-51dc-4be4-b93a-9716a8c195f2"
        },
        {
            "parentId": "9be83cd8-e12a-4ce6-ad95-49117c26e456",
            "taskGuid": "ceaff7b0-0a21-f111-9b48-2816ada18249",
            "taskID": 2,
            "projectId": "3a1ff1ff-8dd5-4f77-c091-884c669e881c",
            "type": 1,
            "name": "1",
            "startDate": "2025-11-02 00:00:00",
            "endDate": "2025-11-06 00:00:00",
            "duration": 5.00,
            "units": "d",
            "preTask": null,
            "progress": null,
            "resource": "",
            "remark": null,
            "status": 0,
            "creationTime": "2026-03-16 15:36:07",
            "finishDate": null,
            "projectPlanPartCount": 1,
            "projectPlanAssist": {
                "projectPlanId": "139aa92f-167c-4b76-ba09-7470dc7e258d",
                "content": "2",
                "reason": null
            },
            "id": "139aa92f-167c-4b76-ba09-7470dc7e258d"
        },
        {
            "parentId": "9be83cd8-e12a-4ce6-ad95-49117c26e456",
            "taskGuid": "cfaff7b0-0a21-f111-9b48-2816ada18249",
            "taskID": 3,
            "projectId": "3a1ff1ff-8dd5-4f77-c091-884c669e881c",
            "type": 1,
            "name": "2",
            "startDate": "2025-11-07 00:00:00",
            "endDate": "2025-11-13 00:00:00",
            "duration": 5.00,
            "units": "d",
            "preTask": "2FS",
            "progress": null,
            "resource": "",
            "remark": null,
            "status": 0,
            "creationTime": "2026-03-16 15:36:07",
            "finishDate": null,
            "projectPlanPartCount": 2,
            "projectPlanAssist": null,
            "id": "05aaabc2-3c65-4c82-973c-88ddbdb12498"
        },
        {
            "parentId": "9be83cd8-e12a-4ce6-ad95-49117c26e456",
            "taskGuid": "d0aff7b0-0a21-f111-9b48-2816ada18249",
            "taskID": 4,
            "projectId": "3a1ff1ff-8dd5-4f77-c091-884c669e881c",
            "type": 1,
            "name": "3",
            "startDate": "2025-11-14 00:00:00",
            "endDate": "2025-11-20 00:00:00",
            "duration": 5.00,
            "units": "d",
            "preTask": "3FS",
            "progress": null,
            "resource": "",
            "remark": null,
            "status": 0,
            "creationTime": "2026-03-16 15:36:07",
            "finishDate": null,
            "projectPlanPartCount": 3,
            "projectPlanAssist": null,
            "id": "99b9892c-c681-4a51-9e46-cfdcefff02c6"
        },
        {
            "parentId": "9be83cd8-e12a-4ce6-ad95-49117c26e456",
            "taskGuid": "d1aff7b0-0a21-f111-9b48-2816ada18249",
            "taskID": 5,
            "projectId": "3a1ff1ff-8dd5-4f77-c091-884c669e881c",
            "type": 1,
            "name": "4",
            "startDate": "2025-11-21 00:00:00",
            "endDate": "2025-11-27 00:00:00",
            "duration": 5.00,
            "units": "d",
            "preTask": "4FS",
            "progress": null,
            "resource": "",
            "remark": null,
            "status": 0,
            "creationTime": "2026-03-16 15:36:07",
            "finishDate": null,
            "projectPlanPartCount": 4,
            "projectPlanAssist": null,
            "id": "be5f3d00-6c46-4661-9ed3-14bfa2c1682c"
        },
        {
            "parentId": "9be83cd8-e12a-4ce6-ad95-49117c26e456",
            "taskGuid": "d2aff7b0-0a21-f111-9b48-2816ada18249",
            "taskID": 6,
            "projectId": "3a1ff1ff-8dd5-4f77-c091-884c669e881c",
            "type": 1,
            "name": "5",
            "startDate": "2025-11-28 00:00:00",
            "endDate": "2025-12-04 00:00:00",
            "duration": 5.00,
            "units": "d",
            "preTask": "5FS",
            "progress": null,
            "resource": "",
            "remark": null,
            "status": 0,
            "creationTime": "2026-03-16 15:36:07",
            "finishDate": null,
            "projectPlanPartCount": 0,
            "projectPlanAssist": null,
            "id": "d568eb30-b074-4210-a1eb-6a175487df26"
        },
        {
            "parentId": "9be83cd8-e12a-4ce6-ad95-49117c26e456",
            "taskGuid": "d3aff7b0-0a21-f111-9b48-2816ada18249",
            "taskID": 7,
            "projectId": "3a1ff1ff-8dd5-4f77-c091-884c669e881c",
            "type": 1,
            "name": "6",
            "startDate": "2025-12-05 00:00:00",
            "endDate": "2025-12-11 00:00:00",
            "duration": 5.00,
            "units": "d",
            "preTask": "6FS",
            "progress": null,
            "resource": "",
            "remark": null,
            "status": 0,
            "creationTime": "2026-03-16 15:36:07",
            "finishDate": null,
            "projectPlanPartCount": 0,
            "projectPlanAssist": null,
            "id": "62ac8fdc-b18c-4902-83d9-e27762059247"
        },
        {
            "parentId": "9be83cd8-e12a-4ce6-ad95-49117c26e456",
            "taskGuid": "d4aff7b0-0a21-f111-9b48-2816ada18249",
            "taskID": 8,
            "projectId": "3a1ff1ff-8dd5-4f77-c091-884c669e881c",
            "type": 1,
            "name": "7",
            "startDate": "2025-12-12 00:00:00",
            "endDate": "2025-12-18 00:00:00",
            "duration": 5.00,
            "units": "d",
            "preTask": "7FS",
            "progress": null,
            "resource": "",
            "remark": null,
            "status": 0,
            "creationTime": "2026-03-16 15:36:07",
            "finishDate": null,
            "projectPlanPartCount": 0,
            "projectPlanAssist": null,
            "id": "c484e336-ab91-44e5-b611-fa0ca4e4d886"
        },
        {
            "parentId": "9be83cd8-e12a-4ce6-ad95-49117c26e456",
            "taskGuid": "d5aff7b0-0a21-f111-9b48-2816ada18249",
            "taskID": 9,
            "projectId": "3a1ff1ff-8dd5-4f77-c091-884c669e881c",
            "type": 1,
            "name": "8",
            "startDate": "2025-12-19 00:00:00",
            "endDate": "2025-12-25 00:00:00",
            "duration": 5.00,
            "units": "d",
            "preTask": "8FS",
            "progress": null,
            "resource": "",
            "remark": null,
            "status": 0,
            "creationTime": "2026-03-16 15:36:07",
            "finishDate": null,
            "projectPlanPartCount": 0,
            "projectPlanAssist": null,
            "id": "780bb776-04cf-42ec-89fe-863d3289cd03"
        },
        {
            "parentId": "9be83cd8-e12a-4ce6-ad95-49117c26e456",
            "taskGuid": "d6aff7b0-0a21-f111-9b48-2816ada18249",
            "taskID": 10,
            "projectId": "3a1ff1ff-8dd5-4f77-c091-884c669e881c",
            "type": 1,
            "name": "9",
            "startDate": "2025-12-26 00:00:00",
            "endDate": "2026-01-01 00:00:00",
            "duration": 5.00,
            "units": "d",
            "preTask": "9FS",
            "progress": null,
            "resource": "",
            "remark": null,
            "status": 0,
            "creationTime": "2026-03-16 15:36:07",
            "finishDate": null,
            "projectPlanPartCount": 0,
            "projectPlanAssist": null,
            "id": "c5043c54-1395-4834-8162-e0547f49576d"
        }
    ],
    "modelList": [
        {
            "parentId": null,
            "docName": "root",
            "suffix": null,
            "modelName": null,
            "docSize": 0,
            "docVer": null,
            "docStatus": 0,
            "docStatusName": "上传中",
            "remark": null,
            "docType": 6,
            "openStatus": 2,
            "children": [
                {
                    "parentId": "3a1ff203-1665-1df2-1a90-a7bc0edf259a",
                    "docName": "house",
                    "suffix": ".glzip",
                    "modelName": "4761820661569210711",
                    "docSize": 10585955,
                    "docVer": "V260312101826",
                    "docStatus": 3,
                    "docStatusName": "轻量化成功",
                    "remark": null,
                    "docType": 2,
                    "openStatus": 1,
                    "children": [

                    ],
                    "documentVer": [

                    ],
                    "documentLog": [

                    ],
                    "isLeaf": true,
                    "openStatusStr": "Public",
                    "creatorName": null,
                    "creationName": null,
                    "hasLinkFile": 0,
                    "longitude": 0,
                    "latitude": 0,
                    "matrix": null,
                    "setContent": null,
                    "isShow": true,
                    "lastModificationTime": "2026-03-12 10:19:56",
                    "lastModifierId": null,
                    "creationTime": "2026-03-12 10:18:26",
                    "creatorId": "3a1ff1f7-bdb4-d509-afc5-283a2d03cf38",
                    "id": "3a1ff203-6653-e8ec-9218-faa4799eddec"
                },
                {
                    "parentId": "3a1ff203-1665-1df2-1a90-a7bc0edf259a",
                    "docName": "750kV输变电工程",
                    "suffix": ".gim",
                    "modelName": "5449016887157444802",
                    "docSize": 14114646,
                    "docVer": "V260316143557",
                    "docStatus": 3,
                    "docStatusName": "轻量化成功",
                    "remark": "",
                    "docType": 2,
                    "openStatus": 1,
                    "children": [

                    ],
                    "documentVer": [

                    ],
                    "documentLog": [

                    ],
                    "isLeaf": true,
                    "openStatusStr": "Public",
                    "creatorName": null,
                    "creationName": null,
                    "hasLinkFile": 0,
                    "longitude": 1.9003144895714261,
                    "latitude": 0.5969026041820608,
                    "matrix": null,
                    "setContent": null,
                    "isShow": true,
                    "lastModificationTime": "2026-03-16 22:36:03",
                    "lastModifierId": null,
                    "creationTime": "2026-03-16 14:35:57",
                    "creatorId": "3a1ff1f7-bdb4-d509-afc5-283a2d03cf38",
                    "id": "3a200788-9b3b-c83c-1352-a6035acfc424"
                }
            ],
            "documentVer": [

            ],
            "documentLog": [

            ],
            "isLeaf": false,
            "openStatusStr": "Private",
            "creatorName": null,
            "creationName": null,
            "hasLinkFile": 0,
            "longitude": null,
            "latitude": null,
            "matrix": null,
            "setContent": null,
            "isShow": true,
            "lastModificationTime": null,
            "lastModifierId": null,
            "creationTime": "2026-03-12 10:18:05",
            "creatorId": "3a1ff1f7-bdb4-d509-afc5-283a2d03cf38",
            "id": "3a1ff203-1665-1df2-1a90-a7bc0edf259a"
        }
    ],
    "modelPart": [
        {
            "parentId": "3a1ff203-1665-1df2-1a90-a7bc0edf259a",
            "docName": "house",
            "suffix": ".glzip",
            "modelName": "4761820661569210711",
            "docSize": 10585955,
            "docVer": "V260312101826",
            "docStatus": 3,
            "docStatusName": "轻量化成功",
            "remark": null,
            "docType": 2,
            "openStatus": 1,
            "children": [

            ],
            "documentVer": [

            ],
            "documentLog": [

            ],
            "isLeaf": true,
            "openStatusStr": "Public",
            "creatorName": null,
            "creationName": null,
            "hasLinkFile": 0,
            "longitude": 0,
            "latitude": 0,
            "matrix": null,
            "setContent": null,
            "isShow": true,
            "lastModificationTime": "2026-03-12 10:19:56",
            "lastModifierId": null,
            "creationTime": "2026-03-12 10:18:26",
            "creatorId": "3a1ff1f7-bdb4-d509-afc5-283a2d03cf38",
            "id": "3a1ff203-6653-e8ec-9218-faa4799eddec"
        },
        {
            "parentId": "3a1ff203-1665-1df2-1a90-a7bc0edf259a",
            "docName": "750kV输变电工程",
            "suffix": ".gim",
            "modelName": "5449016887157444802",
            "docSize": 14114646,
            "docVer": "V260316143557",
            "docStatus": 3,
            "docStatusName": "轻量化成功",
            "remark": "",
            "docType": 2,
            "openStatus": 1,
            "children": [

            ],
            "documentVer": [

            ],
            "documentLog": [

            ],
            "isLeaf": true,
            "openStatusStr": "Public",
            "creatorName": null,
            "creationName": null,
            "hasLinkFile": 0,
            "longitude": 1.9003144895714261,
            "latitude": 0.5969026041820608,
            "matrix": null,
            "setContent": null,
            "isShow": true,
            "lastModificationTime": "2026-03-16 22:36:03",
            "lastModifierId": null,
            "creationTime": "2026-03-16 14:35:57",
            "creatorId": "3a1ff1f7-bdb4-d509-afc5-283a2d03cf38",
            "id": "3a200788-9b3b-c83c-1352-a6035acfc424"
        }
    ],
    "partList": [
        {
            "projectPlanId": "05aaabc2-3c65-4c82-973c-88ddbdb12498",
            "lightweightName": "3a1ff203-6653-e8ec-9218-faa4799eddec",
            "externalId": "4573806",
            "isFinish": false,
            "id": "3a201206-a430-1f40-2fa5-2ac3adddb79b"
        },
        {
            "projectPlanId": "05aaabc2-3c65-4c82-973c-88ddbdb12498",
            "lightweightName": "3a1ff203-6653-e8ec-9218-faa4799eddec",
            "externalId": "4388611",
            "isFinish": false,
            "id": "3a201206-a430-c376-57cb-4ea199b55aac"
        },
        {
            "projectPlanId": "99b9892c-c681-4a51-9e46-cfdcefff02c6",
            "lightweightName": "3a1ff203-6653-e8ec-9218-faa4799eddec",
            "externalId": "4573806",
            "isFinish": false,
            "id": "3a201206-e756-1663-be49-48cca5e9d6e4"
        },
        {
            "projectPlanId": "99b9892c-c681-4a51-9e46-cfdcefff02c6",
            "lightweightName": "3a1ff203-6653-e8ec-9218-faa4799eddec",
            "externalId": "4388611",
            "isFinish": false,
            "id": "3a201206-e756-e670-a50c-729957db90cb"
        },
        {
            "projectPlanId": "99b9892c-c681-4a51-9e46-cfdcefff02c6",
            "lightweightName": "3a1ff203-6653-e8ec-9218-faa4799eddec",
            "externalId": "4386919",
            "isFinish": false,
            "id": "3a201206-e756-4d50-1c1c-590a79ddb8bf"
        },
        {
            "projectPlanId": "be5f3d00-6c46-4661-9ed3-14bfa2c1682c",
            "lightweightName": "3a1ff203-6653-e8ec-9218-faa4799eddec",
            "externalId": "4573806",
            "isFinish": false,
            "id": "3a201207-2712-86c4-eb87-01800cb178e5"
        },
        {
            "projectPlanId": "be5f3d00-6c46-4661-9ed3-14bfa2c1682c",
            "lightweightName": "3a1ff203-6653-e8ec-9218-faa4799eddec",
            "externalId": "4388611",
            "isFinish": false,
            "id": "3a201207-2712-6962-6ebe-97a69d330ff4"
        },
        {
            "projectPlanId": "be5f3d00-6c46-4661-9ed3-14bfa2c1682c",
            "lightweightName": "3a1ff203-6653-e8ec-9218-faa4799eddec",
            "externalId": "4386919",
            "isFinish": false,
            "id": "3a201207-2712-7a38-defa-6c67a19c1764"
        },
        {
            "projectPlanId": "be5f3d00-6c46-4661-9ed3-14bfa2c1682c",
            "lightweightName": "3a1ff203-6653-e8ec-9218-faa4799eddec",
            "externalId": "4389311",
            "isFinish": false,
            "id": "3a201207-2712-4928-8a84-14961d31894c"
        },
        {
            "projectPlanId": "139aa92f-167c-4b76-ba09-7470dc7e258d",
            "lightweightName": "3a1ff203-6653-e8ec-9218-faa4799eddec",
            "externalId": "4573806",
            "isFinish": false,
            "id": "3a201208-9ca0-9fbf-8d29-05d39d2f95ed"
        },
        {
            "projectPlanId": "12c59627-51dc-4be4-b93a-9716a8c195f2",
            "lightweightName": "3a200788-9b3b-c83c-1352-a6035acfc424",
            "externalId": "4697",
            "isFinish": false,
            "id": "3a2015e6-e3c7-b597-e5d3-3acd630fccfb"
        },
        {
            "projectPlanId": "12c59627-51dc-4be4-b93a-9716a8c195f2",
            "lightweightName": "3a200788-9b3b-c83c-1352-a6035acfc424",
            "externalId": "87598",
            "isFinish": false,
            "id": "3a2015e6-e3c7-9da4-fcb2-0d0db3ee173c"
        },
        {
            "projectPlanId": "12c59627-51dc-4be4-b93a-9716a8c195f2",
            "lightweightName": "3a1ff203-6653-e8ec-9218-faa4799eddec",
            "externalId": "4421841",
            "isFinish": false,
            "id": "3a2015e6-e3c7-7123-a7ed-fe180af90df6"
        },
        {
            "projectPlanId": "12c59627-51dc-4be4-b93a-9716a8c195f2",
            "lightweightName": "3a1ff203-6653-e8ec-9218-faa4799eddec",
            "externalId": "4573806",
            "isFinish": false,
            "id": "3a2015e6-e3c7-f0b7-04fb-076c66127125"
        }
    ]
}
let planlist = res.planList.filter(item => item.projectPlanPartCount)
console.log('计划id集合', planlist)
planlist.map(item => {
    let part = []
    res.partList.forEach(r => {
        if (r.projectPlanId == item.id) {
            part.push(r)

        }
    })
    item.partList = part

})
console.log('计划和构件集合', planlist)
//将计划拆成每日形式
let day = []
planlist.forEach(item => {
    const startDate = moment(item.startDate); // 起始日期
    const endDate = moment(item.endDate);   // 结束日期
     const daysDiff = endDate.diff(startDate, 'days'); // 计算相差天数
    // console.log('111',startDate,endDate)
    console.log('item', item,daysDiff)
})
console 命令行工具 X clear

                    
>
console