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 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大