index.php 6.64 KB
<?php

use yii\helpers\Url;
use app\ht\widgets\LinkPager;
use domain\upgrade\UpgradeStatus;
use domain\upgrade\UpgradeLogStatus;

$this->title = '序列号统计';
$this->params['breadcrumbs'][] =  $this->title;
?>
<style>
    .table > tbody > tr > td
    {
        border: white 0px solid;
        border-top: solid 1px #fff;
        border-bottom: 1px solid #fff;
    }
    .table{
        margin-bottom: 0px!important;
    }
</style>
<div class="panel panel-default">
    <div class="panel-body">
        <form action="" method="get" id="search-form" class="filter-form">
            <table width="100%" class="table">
                <tbody>
                <tr >
                    <td width="25%" class="text-left">
                        <label>厂商:</label>
                        <input type="text" class="form-control" name="manufacture_name" placeholder="输入厂商" value="<?php if (!empty($gets['manufacture_name'])){ echo $gets['manufacture_name']; } ?>">
                    </td>
                    <td width="25%" class="text-left">
                        <label>项目:</label>
                        <input type="text" class="form-control" name="project_name" placeholder="项目" value="<?php if (!empty($gets['project_name'])){ echo $gets['project_name']; } ?>">
                    </td>
                    <td width="25%" class="text-left">
                        <label>型号:</label>
                        <input type="text" class="form-control" name="model_name" placeholder="设备型号" value="<?php if (!empty($gets['model_name'])){ echo $gets['model_name']; } ?>">
                    </td>

                    <td width="25%" class="text-left">
                        <label>生产日期:</label>
                        <input type="text" class="form-control" name="production_name" placeholder="生产日期" value="<?php if (!empty($gets['production_name'])){ echo $gets['production_name']; } ?>">
                    </td>
                </tr>

                <tr class="search">
                    <td colspan="4"  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(["/datas/device/index"])?>">重&nbsp;&nbsp;&nbsp;&nbsp;置</a>
                        <a class="btn btn-default" href="javascript:void(0)" id="btn-export"> 导出数据 </a>&nbsp;&nbsp;
                    </td>
                </tr>
                </tbody>
            </table>
        </form>
    </div>
</div>

<div class="panel panel-default">
    <div  class="panel-body">
        <table class="table table-striped table-bordered"  id="brand-table">
            <thead>
            <tr>
                <th width="9%">编码</th>
                <th width="9%">厂商</th>
                <th width="8%">项目</th>
                <th width="8%">型号</th>
                <th width="8%">生产日期</th>
                <th width="7%" ><span title="预生成数,总生成包含超出部分,但是不包含删除的">预 | 总生成</span></th>
                <th width="7%">已删除</th>
                <th width="7%">已授权</th>
                <th width="7%">未授权</th>
                <th width="7%">授权失败(超出)</th>
                <th width="7%">已处理(超出)</th>
                <th width="7%">授权失败(系统)</th>
            </tr>
            </thead>

            <tbody>
            <?php if ($listdata) { ?>
                <?php foreach ($listdata as $item) : ?>
                    <tr>
                        <td style="padding:12px;"><?= (isset($item["batch_no"]) ? $item["batch_no"] : "") ?></td>
                        <td style="padding:12px;"><?= (isset($item["manufacture_name"]) ? $item["manufacture_name"] : "") ?></td>
                        <td style="padding:12px;"><?= (isset($item["project_name"]) ? $item["project_name"] : "") ?></td>
                        <td style="padding:12px;"><?= (isset($item["model_name"]) ? $item["model_name"] : "") ?></td>
                        <td style="padding:12px;"><?= (isset($item["production_name"]) ? $item["production_name"] : "") ?></td>
                        <td style="padding:12px;"><?= (isset($item["num"]) ? $item["num"] : "0") ?>|<a href="<?=Url::toRoute(['device/device-list','batch_id' => $item['id']])?>"><?= (isset($item["total_num"]) ? $item["total_num"] : "0") ?></a></td>
                        <td style="padding:12px;"><a href="<?=Url::toRoute(['device/delete-device-list','batch_id' => $item['id']])?>"><?= (isset($item["del_num"]) ? $item["del_num"] : "0") ?></a></td>
                        <td style="padding:12px;"><?= (isset($item["has_auth_num"]) ? $item["has_auth_num"] : "0") ?></td>
                        <td style="padding:12px;"><?= (!empty($item["no_auth_num"]) ? $item["no_auth_num"] : "0") ?></td>
                        <td><a href="<?=Url::toRoute(['device/fail-list','batch_no' => $item['batch_no']])?>"><?= (isset($item["out_of_num"]) ? $item["out_of_num"] : "0") ?></a></td>
                        <td style="padding:12px;"><?= (!empty($item["handle_auth_fail_num"]) ? $item["handle_auth_fail_num"] : "0") ?></td>
                        <td style="padding:12px;"><?= (!empty($item["auth_fail_num"]) ? $item["auth_fail_num"] : "0") ?></td>

                    </tr>
                <?php endforeach; ?>
            <?php } else { ?>
            <tr>
                <td colspan="9">
                    <center>暂无记录</center>
                </td>
            </tr>
            <?php } ?>
            </tbody>
        </table>
    </div>

    <div class="panel-footer">
        <div class="hqy-panel-pager">
            <?= LinkPager::widget([
                'pagination' => $pages,
            ]); ?>
            <div class="clearfix"></div>
        </div>
    </div>
</div>
<script>
    window.queryParams = function(params) {
        $("#search-form").find('input[name]').each(function () {
            var val = $(this).val();
            var name = $(this).attr('name');
            if(val){
                params[name] = val;
            }
        });
        return params;
    }
    $(document).ready(function () {
        $('#btn-export').click(function(e){
            var params = {};
            window.queryParams(params);

            $strQuery = "?";
            if (params) {
                for (var p in params) {
                    $strQuery += p + "=" + params[p] + "&";
                }
            }
            $strQuery = $strQuery.substring(0, $strQuery.length-1);
            window.location.href = "export" + $strQuery;
            return false;
        })
    });
</script>