// 下右 table
function RightTableInit(list=[]){

    //清除interval定时器
    if(window.IntervalItemRight1){
        clearInterval(window.IntervalItemRight1)
    }

    let _len=0

    const groups = groupData(list,6);

    $('#tableIndex').html("");

    if(groups[0]) {
        $('#tableIndex').append(
            groups[0].map((o,i)=>`
            <li>
                <span>${o.key}</span>
                <span>
                    <span>${o.value}</span>
                    <span>台</span>
                 </span>
             </li>
            `)
        );
    }

    _len=_len+1


    let groupsLenth=groups.length
    window.IntervalItemRight1=setInterval(()=>{

        if(_len>=groupsLenth){
            _len=0
        }

        if( groups[_len] ){

            const _obj=groups[_len]

            if(_obj) {
                $('#tableIndex').html("");
                $('#tableIndex').append(
                    _obj.map((o,i)=>`
            <li>
                <span>${o.key}</span>
                <span>
                    <span>${o.value}</span>
                    <span>台</span>
                 </span>
             </li>
            `)
                );
            }



            _len=_len+1
        }


    },5000)


}

// 分组函数
function groupData(data, itemsPerGroup) {
    const groups = [];
    for (let i = 0; i < data.length; i += itemsPerGroup) {
        groups.push(data.slice(i, i + itemsPerGroup));
    }
    return groups;
}

function isNull(id) {
    $('#'+id).html("");
    $('#'+id).append(`<div class="container"><div class="centered-text">无</div></div>`);
}
