delete-device-list.php 7.73 KB
<?php
use yii\helpers\Url;
use app\ht\widgets\LinkPager;
use domain\device\DeviceStatus;

$this->title = '序列号删除管理';
$this->params['breadcrumbs'][] = '数据统计';
$this->params['breadcrumbs'][] = ['label' => '批次列表', 'url' => ['/datas/device/index']];
$this->params['breadcrumbs'][] =  $this->title;
?>
<style>
    .cell-cls{width:60%;word-wrap: break-word}
    .td-cls{padding:8px 0}
</style>
<div class="panel panel-default">
    <div class="panel-body">
        <form action="" method="get" id="search-form" class="filter-form">
            <input type="hidden" name="batch_id" value="<?=$gets['batch_id']?>" />
            <div class="form-group col-sm-12">
                <label for="serial_no" class="col-sm-1 control-label text-right">序列号:</label>
                <div class="col-sm-2 form-inline">
                    <input type="text" class="form-control" id="serial_no" name="serial_no" value="<?php if (!empty($gets['serial_no'])){ echo $gets['serial_no'];} ?>" autocomplete="off">
                </div>
                <label for="mac" class="col-sm-1 control-label text-right">MAC地址:</label>
                <div class="col-sm-2 form-inline">
                    <input type="text" class="form-control" id="mac" name="mac" value="<?php if (!empty($gets['mac'])){ echo $gets['mac'];} ?>" autocomplete="off">
                </div>
                <label for="device_id" class="col-sm-1 control-label text-right">设备ID:</label>
                <div class="col-sm-2 form-inline">
                    <input type="text" class="form-control" id="device_id" name="device_id" value="<?php if (!empty($gets['device_id'])){ echo $gets['device_id'];} ?>" autocomplete="off">
                </div>

                <label for="status" class="col-sm-1 control-label text-right">状态:</label>
                <div class="col-sm-2 form-inline">
                    <select id="status" class="form-control" name="status">
                        <option value="-1">全部</option>
                        <?php foreach($statusList as $k => $v):?>
                            <option value="<?=$k?>" <?php if($k == $gets['status']): ?>selected<?php endif; ?>><?=$v?></option>
                        <?php endforeach;?>
                    </select>

                </div>
            </div>

            <div class="form-group col-sm-12">
                <label for="apply_at" class="col-sm-1 control-label text-right">申请时间:</label>
                <div class="col-sm-4 form-inline">
                    <input type="date" class="form-control" style="width:140px" id="start_apply_at" name="start_apply_at" value="<?php if (!empty($gets['start_apply_at'])){ echo $gets['start_apply_at'];} ?>" autocomplete="off"> -
                    <input type="date" class="form-control" style="width:140px" id="end_apply_at" name="end_apply_at" value="<?php if (!empty($gets['end_apply_at'])){ echo $gets['end_apply_at'];} ?>" autocomplete="off">
                </div>
                <label for="auth_at" class="col-sm-1 control-label text-right">授权时间:</label>
                <div class="col-sm-4 form-inline">
                    <input type="date" class="form-control" style="width:140px" id="start_auth_at" name="start_auth_at" value="<?php if (!empty($gets['start_auth_at'])){ echo $gets['start_auth_at'];} ?>" autocomplete="off"> -
                    <input type="date" class="form-control" style="width:140px" id="end_auth_at" name="end_auth_at" value="<?php if (!empty($gets['end_auth_at'])){ echo $gets['end_auth_at'];} ?>" autocomplete="off">
                </div>
            </div>
            <div class="form-group col-sm-12" style="text-align: center;">
                <div style="display: flex;justify-content: space-between;width:40%;margin:0 auto"><button type="submit" class="btn btn-primary font-1" id="submitFilterBtn">查询</button>
                <a class="btn btn-default" href="javascript:void(0)" id="btn-export"> 导出数据 </a></div>
            </div>
        </form>
    </div>
</div>
<div class="panel" style="margin-bottom: 0">
    <div style="padding:10px ;20px;box-sizing: border-box"><b>厂商:</b><?=$gets['manufacture']?>    <b>项目:</b><?=$gets['project']?> <b>型号:</b><?=$gets['model']?> <b>生产日期:</b><?=$gets['production']?>
     <b> 批次编号:</b><?=$gets['batch_no']?>
    </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="6%">ID</th>
                <th width="15%">序列号</th>
                <th>MAC地址</th>
                <th width="12%">设备ID</th>
                <th width="12%">申请时间</th>
                <th width="12%">授权时间</th>
                <th width="12%">状态</th>
                <th width="12%">操作</th>
            </tr>
            </thead>

            <tbody>
            <?php if ($deviceList) { ?>
                <?php foreach ($deviceList as $item) : ?>
                    <tr>
                        <td class="td-cls">
                            <?= $item['id'] ?>
                        </td>
                        <td class="td-cls">
                            <div class="cell-cls"><?= $item['serial_no'] ?></div>
                        </td>
                        <td class="td-cls">
                            <div class="cell-cls edit_mac edit_mac_<?=$item['id']?>" data-id="<?=$item['id']?>" data="<?= $item['mac'] ?>"><?= $item['mac'] ?></div>
                        </td>
                        <td class="td-cls">
                            <div class="edit_device edit_device_<?=$item['id']?>" data-id="<?=$item['id']?>" data="<?=$item['device_id']?>"><?= $item['device_id']? $item['device_id']:'暂无'?></div>
                        </td>
                        <td class="td-cls">
                            <?= $item['apply_at']?date('Y-m-d H:i:s', $item['apply_at']):'暂无' ?>
                        </td>
                        <td class="td-cls">
                            <?= $item['auth_at']? date('Y-m-d H:i:s', $item['auth_at']):'暂无' ?>
                        </td>
                        <td class="td-cls">
                            <?= $statusList[$item['status']] ?>
                        </td>
                        <td>
                            已删除
                        </td>

                    </tr>
                <?php endforeach; ?>
            <?php } else { ?>
                <tr>
                    <td colspan="7">
                        <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 = "batch-delete-export" + $strQuery;
            return false;
        })
    });
</script>