export const standardUtil={
    getStandardAttrs:(list:Array<any>)=>{
        let tempmap:any = {};
        let childrenlist:any = []
        list.forEach((item:any)=>{
            if(item.show){
                if(item.childAttr){
                    childrenlist.push(item)
                }else{
                    if(tempmap[item.status]){
                        tempmap[item.status] = [...tempmap[item.status],item]
                    }else{
                        tempmap[item.status] = [item]
                    }
                }
            }
        })
        let attrtype:any = []
        for(let key in tempmap){
            attrtype.push({title:key,children:tempmap[key]||[]})
        }
        return {typelist:attrtype,childrenAttr:childrenlist}
    },
    getStandardColumns:(list:Array<any>)=>{
        let tempmap:any = [];
        let childrenlist:any = [];
        (list||[]).forEach((item:any)=>{
            if(item.show){
                if(item.childAttr){
                    childrenlist.push(item)
                }else{
                    tempmap.push(item)
                }
            }
        })
        return {typelist:tempmap,childrenAttr:childrenlist}
    },
}