index.php 4.66 KB
<?php

use yii\helpers\Url;
use app\ht\widgets\LinkPager;
use domain\order\RepairOrderRate;

$this->title = '维修厂列表';
$this->params['breadcrumbs'][] = '维修厂管理';
$this->params['breadcrumbs'][] = $this->title;

?>

<style>
    .btncls{margin:0 10px!important;}
    .combo-select{margin-bottom: 0; width: 100%; text-align: left}
</style>
<div class="panel panel-default">
    <div class="panel-body" style="overflow-y: auto">
        <form action="" method="get" id="search-form" class="filter-form">
            <table width="100%" class="table table-bordered">
                <tbody>
                <tr >
                    <td width="10%" class="text-right">维修厂名称:</td>
                    <td width="10%"  class="text-left"><input type="text" class="form-control" name="name" id="name" value="<?php if (!empty($gets['name'])){ echo $gets['name']; } ?>"></td>

                    <td width="10%" class="text-right">维修厂电话:</td>
                    <td width="10%"  class="text-left"><input type="text" class="form-control" name="mobile" id="mobile" value="<?php if (!empty($gets['mobile'])){ echo $gets['mobile']; } ?>"></td>


                    <td width="10%"  class="text-right">注册时间(起):</td>
                    <td width="10%" class="text-left"><input type="date" class="form-control" name="createTime" id="createTime" value="<?php if (!empty($gets['createTime'])){ echo $gets['createTime']; } ?>"></td>

                    <td width="10%"  class="text-right">注册时间(止):</td>
                    <td width="10%" class="text-left"><input type="date" class="form-control" name="endTime" id="endTime" value="<?php if (!empty($gets['endTime'])){ echo $gets['endTime']; } ?>"></td>
                </tr>

                <tr class="search">
                    <td colspan="8"  class="text-center">
                        <button type="submit" class="btn btn-primary btncls" id="search"><i class="glyphicon glyphicon-search"></i> 查 询  </button>
                        <a class="btn btn-default btncls" href="<?=Url::toRoute(["/maintainer/user/index"])?>">重&nbsp;&nbsp;&nbsp;&nbsp;置</a>
                        <a class="btn btn-success btncls" id="exportBtn" href="javascript:void(0)">导出维修厂名单</a>

                    </td>
                </tr>
                </tbody>
            </table>
        </form>
    </div>
</div>

<div class="panel panel-default">
    <div  class="panel-body">

        <div style="overflow-y: auto">
        <?php if (!empty($listdata)) : ?>
            <table class="table table-striped table-bordered"  id="brand-table">
                <thead>
                <tr>
                    <th style="width:4%;">ID</th>
                    <th style="width:10%;">维修厂名称</th>
                    <th style="width:10%;">维修厂电话</th>
                    <th style="width:10%;">注册时间</th>

                    <th style="width:7%;">操作</th>
                </tr>
                </thead>
                <tbody>
                <?php foreach ($listdata as $user) : ?>
                    <tr>
                        <td class="hqy-row-select"><?=$user['id'] ?></td>
                        <td><?=$user['name']?></td>
                        <td><?=$user['mobile']?></td>
                        <td><?=date('Y-m-d H:i', $user['created_at'])?></td>

                        <td >
                            <a class="btn btn-primary" style="margin: 4px;" href="<?php echo Url::toRoute(['/maintainer/user/info', 'id' => $user['id']])  ?>">查看详情</a>

                        </td>
                    </tr>
                <?php endforeach; ?>
                </tbody>
            </table>
        </div>
        <?php else : ?>
            <p class="text-center">
                没有找到数据
            </p>
        <?php endif; ?>
    </div>

    <div class="panel-footer">
        <div class="hqy-panel-pager">
            <?= LinkPager::widget([
                'pagination' => $pages,
            ]); ?>
            <div class="clearfix"></div>
        </div>
    </div>
</div>

<script>

    $(function(){

        var getUrl ='<?=Url::toRoute("/maintainer/user/export-da")?>';
        var filterUrl ='<?=Url::toRoute("/maintainer/user/index")?>';
        $(function(){
            $('#exportBtn').click(function(e){
                $('#search-form').attr('action',getUrl);
                $('#search-form').submit();
                return false;
            })
            //
            $('#search').click(function(e){
                $('#search-form').attr('action',filterUrl);
                $('#search-form').submit();
                return false;
            })
        })


    })
</script>