let timestamp = new Date().getTime()
const guid = function(prefix) {
    prefix = prefix || '';
    return prefix + (timestamp++).toString(36);
}
const generRotes = data => {
    let ret = [];
    data.forEach(item => {
        if (item.hasOwnProperty('widgets')) {
            ret.push({
              name: item.label,    
              path: `/web4/${guid('web_console')}`,
              component: 'BasicLayout',
              routes: generRotes(item.widgets),
              extData: {...item}
            });
        } else {
            ret.push({
              name: item.label,
              component: 'BasicLayout',
              path: item.hasOwnProperty('url') ? `/web4/${item.url}`: guid('web_console'),
              extData: {...item}
            });
        }
    });
        return ret;
};  

export default generRotes;