test:function(){
var arr =[
{pName:'内蒙古',pId:'1',cName:'内1',cId:'11'},
{pName:'内蒙古',pId:'1',cName:'内2',cId:'12'},
{pName:'河南省',pId:'2',cName:'郑州',cId:'21'},
{pName:'河南省',pId:'2',cName:'焦作',cId:'22'},
{pName:'江苏省',pId:'3',cName:'苏州',cId:'31'},
{pName:'江苏省',pId:'3',cName:'杭州',cId:'32'}
];
let pNameMap = new Map();
arr.forEach( x => {
if(!pNameMap.has(x.pName)){
pNameMap.set(x.pName,{
pName:x.pName,
pId:x.pId,
cityList:[]
})
}
pNameMap.get(x.pName).cityList.push({
cName:x.cName,
cId:x.cId
})
})
return Array.from(pNameMap.values())
}