最近搜索

遍历 arrar 数组 list 合并行。 td 合并行。

浏览:168
管理员 2024-03-22 02:21


//假如recordValueList有3行。那么 , 把第1个recordValue td弄一个rowspan =3   第2 第3个td不要   name pos wei xinghao num //但是要后面的。



function load_data(){
    $.post('/admin/record/head/guzhang/find/id', {recordHeadId: recordHeadId}, function (result) {
        //拿到的数据加载到select_array 里面。
        result.shebeiList.forEach((item)=>{
            if(item.recordValueList.length<1){
                $("#data_list  table tbody").append('   ' +
                    '<tr   style="cursor: pointer; ">\n' +
                    '            <td >'+item.name+'</td>\n' +
                    '            <td >'+item.pos+'</td>' +
                    '            <td >'+item.wei+'</td>' +
                    '            <td >'+item.xinghao+'</td>' +
                    '            <td >'+item.num+'</td>' +

                    '            <td > </td>' +
                    '            <td > </td>' +
                    '            <td > </td>' +
                    '            <td > </td>' +
                    '            <td > </td>' +

                    '            <td > </td>' +
                    '            <td > </td>' +
                    '            <td > </td>' +
                    '            <td > </td>' +
                    '            <td > </td>' +

                    '            <td > </td>' +
                    '            <td > </td>' +
                    '        </tr>');
            }else{
                let rowspanSet = false;
                item.recordValueList.forEach((recordValue, index)=>{
                    $("#data_list table tbody").append('   ' +
                        '<tr style="cursor: pointer;">' +
                        ( index=== 0 && !rowspanSet ? '<td rowspan="'+item.recordValueList.length+'">'+item.name+'</td>' +
                            '<td rowspan="'+item.recordValueList.length+'">'+item.pos+'</td>' +
                            '<td rowspan="'+item.recordValueList.length+'">'+item.wei+'</td>' +
                            '<td rowspan="'+item.recordValueList.length+'">'+item.xinghao+'</td>' +
                            '<td rowspan="'+item.recordValueList.length+'">'+item.num+'</td>' : '') +
                        '            <td>'+recordValue.yunTime+'</td>' +
                        '            <td>'+recordValue.guzhangTime+'</td>' +
                        '            <td>'+recordValue.xiufuStartTime+'</td>' +
                        '            <td>'+recordValue.xiufuEndTime+'</td>' +
                        '            <td>'+recordValue.xiufuYunTime+'</td>' +
                        '            <td>'+recordValue.jiezhiTime+'</td>' +
                        '            <td>'+recordValue.guzhangCi+'</td>' +
                        '            <td>'+recordValue.guzhang+'</td>' +
                        '            <td>'+recordValue.pjXiuTime+'</td>' +
                        '            <td>'+recordValue.pjGuzhangTime+'</td>' +
                        '            <td>'+recordValue.pjGuzhangJiange+'</td>' +
                        '            <td></td>' +
                        '        </tr>');
                    if (index === 0 && !rowspanSet) {
                        rowspanSet = true;
                    }
                });
            }
        });
    }, 'json');
}



image.png

联系站长

站长微信:xiaomao0055

站长QQ:14496453