const mapfunc = function (routers, routermap, curlevelrouters) {
routers.foreach(todoroute => {
routermap.foreach(maproute => {
if(maproute.menucode === todoroute.menucode){
const maproutecopy = _.cloneDeep(maproute)
const {submenulist} = todoroute
const {children} = maproute
if(submenulist.length>0&&children.length>0){
maproutecopy.children = []
curlevelrouters.push(maproutecopy)
mapfunc(submenulist,children,maproutecopy.children)
} else if(children.length >0&& submenulist.length === 0){
curlevelrouters.push(maproutecopy)
}
}
})
})
return curlevelrouters
}