JavaScript转换平级数据为父子级数据

假如后端返回的结构如下:

[
  emAuxService": null,
        "aeaServiceLegalClause": null,
        "aeaItemRightsObligations": null,
        "aeaItemLegalRemedy": null,
        "unifiedSocialCreditCode": null,
        "legalClauseIds": null,
        "id": null,
        "name": null,
        "type": null,
        "open": null,
        "isParent": null,
        "nocheck": null,
        "hasChildren": false,
        "serviceItems": null,
        "children": null,
        "isOptionItem": null,
        "isDoneItem": null,
        "isRecommend": null,
        "projName": null,
        "localCode": null,
        "centralCode": null,
        "applicant": null,
        "idCard": null,
        "approveOrgId": null,
        "currItemId": null,
        "searchItemIds": null,
        "isCheck": false,
        "projCode": null,
        "stageName": null,
        "isNode": null,
        "aeaHiIteminst": null,
        "iteminstState": null,
        "catalogItemVerId": null,
        "catalogItemName": null,
        "catalogCode": null,
        "isSync": null,
        "itemStateList": null,
        "regionIds": null,
        "carryOutItems": null,
        "currentCarryOutItem": null,
        "childAeaItemBasic": null,
        "orgTel": null,
        "serveTypeText": null,
        "resultMats": null,
        "isStateItem": null,
        "isOptionParal": null,
        "subFormId": null,
        "localRowId": null,
        "isHandleItem": null,
        "parStateId": null,
        "itemGzcnAttCount": null,
        "isReportCountry": "1",
        "aeaItemBasicExt": null,
        "oldCertCode": null,
        "stateItemCode": null,
        "parentItemIds": null,
        "stageId": null,
        "modifyTimeQuery": null,
        "itemProcessUpdateTimeQuery": null,
        "itemProcessUpdateTime": null,
        "stageItemId": null,
        "simplifyId": null,
        "simplifyName": null,
        "simplifyDescribe": null,
        "pId": null,
        "create": false
    },
    {
   
        "itemBasicId": "df4008c2-a183-4d43-a8b7-05f124875018",
        "itemId": "82194470-4022-4571-bd00-f31d5003b8bf",
        "itemVerId": "5a0b474f-809a-4004-8047-aa8094467387",
        "itemCode": "JSGCGHXKJSGC",
        "itemName": "建设工程规划许可(工改)",
        "orgId": "",
        "itemType": "01",
        "bjType": null,
        "acceptMode": null,
        "handleArticle": null,
        "handleFlow": null,
        "dueNum": null,
        "notifyDueNum": null,
        "notifyDueUnit": null,
        "sendResultMode": null,
        "docTemplate": null,
        "applyTableDemo": null,
        "applyTableTemplate": null,
        "standardItemCode": null,
        "parentCode": null,
        "itemMemo": null,
        "creater": null,
        "createTime": null,
        "modifier": null,
        "modifyTime": null,
        "appId": null,
        "itemDirId": null,
        "innerAppId": null,
        "itemProperty": "1",
        "directorycode": null,
        "directoryId": null,
        "baseName": null,
        "basecode": null,
        "wtbm": null,
        "sqjb": null,
        "sfzhlr": null,
        "slyj": null,
        "bbh": null,
        "sxmlzt": "1",
        "fbsj": null,
        "sssj": null,
        "isold": null,
        "sfwsbl": null,
        "bwsblly": null,
        "unonlinereasonother": null,
        "sfczwtxftzssqk": null,
        "fzcd": null,
        "sscode": null,
        "sxglfslx": null,
        "wtfqfx": null,
        "wtfqqtsm": null,
        "slfs": null,
        "isNeedState": null,
        "isMilestoneItem": null,
        "outerSystemHandle": null,
        "outerSystemDesc": null,
        "outerSystemUrl": null,
        "isAsyn": null,
        "asynTime": null,
        "isLocal": null,
        "isFee": null,
        "xkdx": null,
        "itemAlias": null,
        "isNeedFrontCond": null,
        "areaCode": null,
        "areaCodeName": null,
        "kpItemId": null,
        "itemNature": "0",
        "sfsxgzcnz": null,
        "rootOrgId": null,
        "isCatalog": "1",
        "guideOrgName": null,
        "sfbasx": null,
        "isCatalogs": null,
        "anticipateDay": null,
        "anticipateType": null,
        "elContent": null,
        "regionId": null,
        "itemCategoryMark": null,
        "itemCategoryMarks": null,
        "itemExchangeWay": null,
        "isLink": null,
        "isLinkDesc": null,
        "isLinkUrl": null,
        "gkfs": null,
        "useOneForm": null,
        "isCheckItem": null,
        "isCheckPartform": null,
        "isCheckProj": null,
        "isShare": null,
        "isUseStateItem": null,
        "isUseParentConfig": null,
        "isUseSpecial": null,
        "isApprove": null,
        "hasResults": null,
        "approveLevel": null,
        "isProvice": "0",
        "isShowMall": null,
        "isShowMallRelStage": null,
        "guideDeptType": null,
        "itemCategoryType": null,
        "itemHandleCategory": null,
        "itemRange": null,
        "parentItemVerId": null,
        "useLevel": null,
        "extendCode": null,
        "newItemStateVerId": null,
        "notRelItemIds": null,
        "orgName": null,
        "unitGbCode": null,
        "matList": null,
        "isDone": null,
        "isRecommended": null,
        "sortNo": null,
        "regionName": null,
        "regionType": null,
        "regionNum": null,
        "approvalOrgs": null,
        "validTime": null,
        "invalidTime": null,
        "orgIds": null,
        "keyword": null,
        "orgCode": null,
        "verNum": 1,
        "verNumVo": "V1.0",
        "parentItemId": "root",
        "parentName": null,
        "itemSeq": null,
        "isDeleted": null,
        "hasNoActiveVer": null,
        "itemVerStatus": "TEST_RUN",
        "aeaItemExeorg": null,
        "aeaItemServiceServe": null,
        "aeaItemAcceptRange": null,
        "aeaItemServiceFlow": null,
        "aeaItemInout": null,
        "aeaItemServiceConsulting": null,
        "aeaServiceWindow": null,
        "aeaItemServiceCharge": null,
        "aeaItemAuxService": null,
        "aeaServiceLegalClause": null,
        "aeaItemRightsObligations": null,
        "aeaItemLegalRemedy": null,
        "unifiedSocialCreditCode": null,
        "legalClauseIds": null,
        "id": null,
        "name": null,
        "type": null,
        "open": null,
        "isParent": null,
        "nocheck": null,
        "hasChildren": false,
        "serviceItems": null,
        "children": null,
        "isOptionItem": null,
        "isDoneItem": null,
        "isRecommend": null,
        "projName": null,
        "localCode": null,
        "centralCode": null,
        "applicant": null,
        "idCard": null,
        "approveOrgId": null,
        "currItemId": null,
        "searchItemIds": null,
        "isCheck": false,
        "projCode": null,
        "stageName": null,
        "isNode": null,
        "aeaHiIteminst": null,
        "iteminstState": null,
        "catalogItemVerId": null,
        "catalogItemName": null,
        "catalogCode": null,
        "isSync": null,
        "itemStateList": null,
        "regionIds": null,
        "carryOutItems": null,
        "currentCarryOutItem": null,
        "childAeaItemBasic": null,
        "orgTel": null,
        "serveTypeText": null,
        "resultMats": null,
        "isStateItem": null,
        "isOptionParal": null,
        "subFormId": null,
        "localRowId": null,
        "isHandleItem": null,
        "parStateId": null,
        "itemGzcnAttCount": null,
        "isReportCountry": "1",
        "aeaItemBasicExt": null,
        "oldCertCode": null,
        "stateItemCode": null,
        "parentItemIds": null,
        "stageId": null,
        "modifyTimeQuery": null,
        "itemProcessUpdateTimeQuery": null,
        "itemProcessUpdateTime": null,
        "stageItemId": null,
        "simplifyId": null,
        "simplifyName": null,
        "simplifyDescribe": null,
        "pId": null,
        "create": false
    },
    {
   
        "itemBasicId": "baedd1af-f6bf-44f6-b06d-de3aea46bdb4",
        "itemId": "a9fb8c14-b7a3-42b1-b1df-5e6157855b49",
        "itemVerId": "61bf2b21-67b9-4893-93ff-5162cfd19012"

你可能感兴趣的:(JavaScript,javascript,java,前端)