weixin_58648225 2022-03-31 17:14 采纳率: 89.2%
浏览 29
已结题

csv抽出列问题-续


<form class="mt20" method="post" action="">
                        <input id="data_html" type="hidden" name="data">
                        <input type="hidden" name="action" value="csv_out">
                        <input class="btn btn-primary" type="submit" value="CSVで保存">
                    </form>
                    <div id="div_html">
                        <table class="table">
                            <thead>
                                <tr>
                                    <th><?php echo $word->get('lesson_id'); ?></th>
                                    <th><?php echo $word->get('client_name'); ?></th>
                                    <th><?php echo $word->get('app_id'); ?></th>
                                    <th><?php echo $word->get('app_name'); ?></th>
                                    <th><?php echo $word->get('ymd'); ?></th>
                                    <th><?php echo $word->get('time'); ?></th>
                                    <th><?php echo $word->get('lesson_form'); ?></th>
                                    <th><?php echo $word->get('lesson_type'); ?></th>
                                    <th><?php echo $word->get('classroom'); ?></th>
                                    <th><?php echo $word->get('tutor'); ?></th>
                                    <th></th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php foreach ($list as $info) : ?>
                                    <tr>
                                        <td>
                                            <a href="<?php echo get_url_top(); ?>/assign/conf?id=<?php echo $info->id; ?>&back_to=assign_index"><?php echo $info->id; ?></a>
                                            <?php if ($info->lesson_reserve_request_id) : ?>
                                                <br>[仮]No.<?php echo $info->lesson_reserve_request_id; ?>
                                            <?php endif; ?>
                                        </td>
                                        <td><a href="<?php echo get_url_top(); ?>/client/conf?id=<?php echo $info->client_id; ?>"><?php echo $info->client_name; ?></a></td>
                                        <td><a href="<?php echo get_url_top(); ?>/app/conf?id=<?php echo $info->app_id; ?>" target="_blank"><?php echo $info->app_id; ?></a></td>
                                        <td><a href="<?php echo get_url_top(); ?>/app/conf?id=<?php echo $info->app_id; ?>" target="_blank"><?php echo $info->lesson_name; ?></a></td>
                                        <td><?php echo $info->date; ?></td>
                                        <td><?php echo $info->start_time; ?><?php echo $info->end_time; ?></td>
                                        <td><?php echo MasterCode::get_one_by_type_code(CODE_TYPE_LESSON_FORM, $info->form)->name; ?></td>
                                        <td><?php echo $info->lesson_type_str; ?></td>
                                        <?php if ($info->form == 1) : ?>
                                            <?php if ($info->classroom_assigned == 1) : ?>
                                                <td>
                                                    <?php echo $info->classroom_name; ?>
                                                </td>
                                            <?php else : ?>
                                                <td>
                                                    <span class="label label-danger"><?php echo $word->get('unset'); ?></span>
                                                </td>
                                            <?php endif; ?>
                                        <?php else : ?>
                                            <td>----</td>
                                        <?php endif; ?>
                                        <?php if ($info->tutor_assigned == 1) : ?>
                                            <td>
                                                <a href="<?php echo get_url_top(); ?>/tutor_admin/conf?id=<?php echo $info->tutor_id; ?>" target="_blank"><?php echo $info->tutor_dispname; ?></a>
                                            </td>
                                        <?php else : ?>
                                            <td>
                                                <span class="label label-danger"><?php echo $word->get('unset'); ?></span>
                                            </td>
                                        <?php endif; ?>
                                        <td>
                                            <?php if ($info->lesson_state & LSN_REPLACED) : ?>
                                                <span class="label label-danger">Replaced</span>
                                            <?php elseif ($info->lesson_state & LSN_TTR_CANCELLED) : ?>
                                                <span class="label label-danger">Cancelled</span>
                                            <?php elseif ($info->lesson_state & LSN_ADM_CANCELLED) : ?>
                                                <span class="label label-danger">Cancelled by admin</span>
                                            <?php elseif ($info->lesson_state & LSN_CLI_CANCELLED) : ?>
                                                <span class="label label-danger">Cancelled by client</span>
                                            <?php elseif ($info->lesson_state & LSN_TTR_CANCEL_REQUEST) : ?>
                                                <span class="label label-danger">Cancel requested</span>
                                            <?php elseif ($info->lesson_state & LSN_TTR_READY) : ?>
                                                <span class="label label-success">Ready</span>
                                            <?php else : ?>
                                                <span class="label label-warning">Not Ready</span>
                                            <?php endif; ?>
                                        </td>
                                        <td>
                                            <?php if ($bigin_last_list) : ?>
                                                <?php foreach ($bigin_last_list as $begin_last_info) : ?>
                                                    <?php if ($info->app_id === $begin_last_info->app_id) : ?>

                                                        <!-- first lesson label -->
                                                        <?php if (($info->date === $begin_last_info->begin_date) && ($info->start_time === $begin_last_info->begin_time)) : ?>
                                                            <span class="label label-info">First Lesson</span>
                                                            <?php break; ?>
                                                        <?php endif; ?>
                                                        <?php if (($info->lesson_estimated_time <= $begin_last_info->total_actual_hours) && ($info->date === $begin_last_info->now_last_date) && ($info->end_time === $begin_last_info->now_last_time)) : ?>
                                                            <span class="label label-info">Last Lesson</span>
                                                            <?php break; ?>
                                                        <?php endif; ?>
                                                    <?php endif; ?>
                                                <?php endforeach; ?>
                                            <?php endif; ?>
                                        </td>
                                        <td style="display: none"><?php echo $info->tutor_name; ?></td>
                                        <td style="display: none"><?php echo $info->tutor_code; ?></td>
                                        <td style="display: none"><?php echo $info->tutor_zipcode; ?></td>
                                        <td style="display: none"><?php echo $info->tutor_address; ?></td>
                                        <td style="display: none"><?php echo $info->tutor_delivery_email; ?></td>
                                        <td style="display: none"><?php echo $info->tutor_tel; ?></td>
                                        <td style="display: none"><?php echo $info->tutor_tel_mobile; ?></td>
                                        <td style="display: none"><?php echo $info->tutor_available_str; ?></td>
                                        <td>
                                            <a class="btn btn-primary" href="<?php echo get_url_top(); ?>/assign/conf?id=<?php echo $info->id; ?>&back_to=assign_index"><?php echo $word->get('select'); ?></a>
                                        </td>
                                    </tr>
                                <?php endforeach; ?>
                            </tbody>
                        </table>
                    
  • 写回答

2条回答 默认 最新

  • CSDN专家-showbo 2022-03-31 17:24
    关注

    删除最后一列可以用下面的代码

    
    <form class="mt20" method="post" action="">
        <input id="data_html" type="hidden" name="data">
        <input type="hidden" name="action" value="csv_out">
        <input class="btn btn-primary" type="submit" value="CSVで保存">
    </form>
    <div id="div_html">
        <table class="table">
            <thead>
                <tr>
                    <th><?php echo $word->get('lesson_id'); ?></th>
                    <th><?php echo $word->get('client_name'); ?></th>
                    <th><?php echo $word->get('app_id'); ?></th>
                    <th><?php echo $word->get('app_name'); ?></th>
                    <th><?php echo $word->get('ymd'); ?></th>
                    <th><?php echo $word->get('time'); ?></th>
                    <th><?php echo $word->get('lesson_form'); ?></th>
                    <th><?php echo $word->get('lesson_type'); ?></th>
                    <th><?php echo $word->get('classroom'); ?></th>
                    <th><?php echo $word->get('tutor'); ?></th>
                    <th></th>
                </tr>
            </thead>
            <tbody>
                <?php foreach ($list as $info) : ?>
                <tr>
                    <td>
                        <a href="<?php echo get_url_top(); ?>/assign/conf?id=<?php echo $info->id; ?>&back_to=assign_index"><?php echo $info->id; ?></a>
                        <?php if ($info->lesson_reserve_request_id) : ?>
                        <br>[仮]No.<?php echo $info->lesson_reserve_request_id; ?>
                        <?php endif; ?>
                    </td>
                    <td><a href="<?php echo get_url_top(); ?>/client/conf?id=<?php echo $info->client_id; ?>"><?php echo $info->client_name; ?></a></td>
                    <td><a href="<?php echo get_url_top(); ?>/app/conf?id=<?php echo $info->app_id; ?>" target="_blank"><?php echo $info->app_id; ?></a></td>
                    <td><a href="<?php echo get_url_top(); ?>/app/conf?id=<?php echo $info->app_id; ?>" target="_blank"><?php echo $info->lesson_name; ?></a></td>
                    <td><?php echo $info->date; ?></td>
                    <td><?php echo $info->start_time; ?><?php echo $info->end_time; ?></td>
                    <td><?php echo MasterCode::get_one_by_type_code(CODE_TYPE_LESSON_FORM, $info->form)->name; ?></td>
                    <td><?php echo $info->lesson_type_str; ?></td>
                    <?php if ($info->form == 1) : ?>
                    <?php if ($info->classroom_assigned == 1) : ?>
                    <td>
                        <?php echo $info->classroom_name; ?>
                    </td>
                    <?php else : ?>
                    <td>
                        <span class="label label-danger"><?php echo $word->get('unset'); ?></span>
                    </td>
                    <?php endif; ?>
                    <?php else : ?>
                    <td>----</td>
                    <?php endif; ?>
                    <?php if ($info->tutor_assigned == 1) : ?>
                    <td>
                        <a href="<?php echo get_url_top(); ?>/tutor_admin/conf?id=<?php echo $info->tutor_id; ?>" target="_blank"><?php echo $info->tutor_dispname; ?></a>
                    </td>
                    <?php else : ?>
                    <td>
                        <span class="label label-danger"><?php echo $word->get('unset'); ?></span>
                    </td>
                    <?php endif; ?>
                    <td>
                        <?php if ($info->lesson_state & LSN_REPLACED) : ?>
                        <span class="label label-danger">Replaced</span>
                        <?php elseif ($info->lesson_state & LSN_TTR_CANCELLED) : ?>
                        <span class="label label-danger">Cancelled</span>
                        <?php elseif ($info->lesson_state & LSN_ADM_CANCELLED) : ?>
                        <span class="label label-danger">Cancelled by admin</span>
                        <?php elseif ($info->lesson_state & LSN_CLI_CANCELLED) : ?>
                        <span class="label label-danger">Cancelled by client</span>
                        <?php elseif ($info->lesson_state & LSN_TTR_CANCEL_REQUEST) : ?>
                        <span class="label label-danger">Cancel requested</span>
                        <?php elseif ($info->lesson_state & LSN_TTR_READY) : ?>
                        <span class="label label-success">Ready</span>
                        <?php else : ?>
                        <span class="label label-warning">Not Ready</span>
                        <?php endif; ?>
                    </td>
                    <td>
                        <?php if ($bigin_last_list) : ?>
                        <?php foreach ($bigin_last_list as $begin_last_info) : ?>
                        <?php if ($info->app_id === $begin_last_info->app_id) : ?>
    
                        <!-- first lesson label -->
                        <?php if (($info->date === $begin_last_info->begin_date) && ($info->start_time === $begin_last_info->begin_time)) : ?>
                        <span class="label label-info">First Lesson</span>
                        <?php break; ?>
                        <?php endif; ?>
                        <?php if (($info->lesson_estimated_time <= $begin_last_info->total_actual_hours) && ($info->date === $begin_last_info->now_last_date) && ($info->end_time === $begin_last_info->now_last_time)) : ?>
                        <span class="label label-info">Last Lesson</span>
                        <?php break; ?>
                        <?php endif; ?>
                        <?php endif; ?>
                        <?php endforeach; ?>
                        <?php endif; ?>
                    </td>
                    <td style="display: none"><?php echo $info->tutor_name; ?></td>
                    <td style="display: none"><?php echo $info->tutor_code; ?></td>
                    <td style="display: none"><?php echo $info->tutor_zipcode; ?></td>
                    <td style="display: none"><?php echo $info->tutor_address; ?></td>
                    <td style="display: none"><?php echo $info->tutor_delivery_email; ?></td>
                    <td style="display: none"><?php echo $info->tutor_tel; ?></td>
                    <td style="display: none"><?php echo $info->tutor_tel_mobile; ?></td>
                    <td style="display: none"><?php echo $info->tutor_available_str; ?></td>
                    <td>
                        <a class="btn btn-primary" href="<?php echo get_url_top(); ?>/assign/conf?id=<?php echo $info->id; ?>&back_to=assign_index"><?php echo $word->get('select'); ?></a>
                    </td>
                </tr>
                <?php endforeach; ?>
            </tbody>
        </table>
    
        <script src="https://g.csdnimg.cn/??lib/jquery/1.12.4/jquery.min.js"></script>
        <script>
        var table = $('#div_html>table').clone();
    
            table.find(`tr th:last-child,tr td:last-child`).remove()
    
    
        var html = table[0].outerHTML
        $('#data_html').html(html)
        console.log(html)
        </script>
    
    
    
    
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 4月9日
  • 已采纳回答 4月1日
  • 创建了问题 3月31日

悬赏问题

  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用