[{
"controlGroupId": 0,
"controlGroupName": "基础数据",
"controlSortId": 0,
"controlType": "CtlComboBoxEdit",
"domain": "CodeAirportAiracType"
},{
"controlGroupId": 0,
"controlGroupName": "基础数据",
"controlSortId": 2,
"controlType": "CtlComboBoxEdit",
"domain": "CodeAirportAiracType"
}, {
"controlGroupId": 2,
"controlGroupName": "高级",
"controlSortId": 6,
"controlType": "CtlComboBoxEdit",
"domain": "CodeAirportAiracType"
}, {
"controlGroupId": 2,
"controlGroupName": "高级",
"controlSortId": 9,
"controlType": "CtlComboBoxEdit",
"domain": "CodeAirportAiracType"
}]
这是例子真实情况controlGroupId可能有多个不确定的值。
举例:controlGroupId为0的分为一组,为2的分为一组,取controlGroupName为组名,并且组之间升序。
各组之中再根据controlSortId升序。
这个例子期望的结果为
[
{
title: "基础数据",
group: [
{
controlGroupId: 0,
controlGroupName: "基础数据",
controlSortId: 0,
controlType: "CtlComboBoxEdit",
domain: "CodeAirportAiracType"
},
{
controlGroupId: 0,
controlGroupName: "基础数据",
controlSortId: 2,
controlType: "CtlComboBoxEdit",
domain: "CodeAirportAiracType"
}
]
},
{
title: "高级",
group: [
{
controlGroupId: 2,
controlGroupName: "高级",
controlSortId: 6,
controlType: "CtlComboBoxEdit",
domain: "CodeAirportAiracType"
},
{
controlGroupId: 2,
controlGroupName: "高级",
controlSortId: 9,
controlType: "CtlComboBoxEdit",
domain: "CodeAirportAiracType"
}
]
}
];
写的有点糙, 但是运行了没问题, 你把上面数据传进来就会 return 你想要的结构了