<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('盘点记录列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li class="select-time">
                            <label>盘点时间：</label>
                            <input type="text" class="time-input" id="startTime" placeholder="开始时间"
                                   name="params[beginCheckTime]"/>
                            <span>-</span>
                            <input type="text" class="time-input" id="endTime" placeholder="结束时间"
                                   name="params[endCheckTime]"/>
                        </li>
                        <li>
                            <label>盘点人：</label>
                            <input type="text" name="checkUser"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <!--            <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="manage:record_store_check:add">-->
            <!--                <i class="fa fa-plus"></i> 添加-->
            <!--            </a>-->
            <a class="btn btn-primary single disabled" onclick="$.operate.edit()"
               shiro:hasPermission="manage:record_store_check:edit">
                <i class="fa fa-edit"></i> 增加盘点说明
            </a>
            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()"
               shiro:hasPermission="manage:record_store_check:remove">
                <i class="fa fa-remove"></i> 删除
            </a>
            <!--            <a class="btn btn-warning" onclick="$.table.exportExcel()"-->
            <!--               shiro:hasPermission="manage:record_store_check:export">-->
            <!--                <i class="fa fa-download"></i> 导出-->
            <!--            </a>-->
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('manage:record_store_check:edit')}]];
    var removeFlag = [[${@permission.hasPermi('manage:record_store_check:remove')}]];
    var prefix = ctx + "manage/record_store_check";

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "盘点记录",
            detailView: true,
            onExpandRow: function (index, row, $detail) {
                initChildTable(index, row, $detail);
            },
            columns: [{
                checkbox: true
            },
                {
                    field: 'checkId',
                    title: '主键',
                    visible: false
                },
                {
                    field: 'checkTime',
                    title: '盘点时间'
                },
                {
                    field: 'checkUser',
                    title: '盘点人'
                },
                {
                    field: 'checkNumber',
                    title: '盘点条数'
                },
                {
                    field: 'checkRemack',
                    title: '盘点说明'
                },
                /*   {
                       title: '操作',
                       align: 'center',
                       formatter: function(value, row, index) {
                           var actions = [];
                           actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.checkId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                           actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.checkId + '\')"><i class="fa fa-remove"></i>删除</a>');
                           return actions.join('');
                       }
                   }*/]
        };
        $.table.init(options);
    });
    var checkStateDatas = [[${@dict.getType('sys_yes_no')}]];
    initChildTable = function (index, row, $detail) {
        var childTable = $detail.html('<table style="table-layout:fixed"></table>').find('table');

        $(childTable).bootstrapTable({
            url: ctx + "manage/check_info/list",
            method: 'post',
            sidePagination: "server",
            contentType: "application/x-www-form-urlencoded",
            queryParams: {
                checkId: row.checkId
            },
            columns: [
                {

                    title: '序号',
                    formatter: function (value, row, index) {
                        return index+1
                    }
                },
                {
                    field: 'epcCode',
                    title: 'RFID'
                },
                {
                    field: 'locationCode',
                    title: '库位码'
                },
                {
                    field: 'checkState',
                    title: '是否扫描',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(checkStateDatas, value);
                    }
                }]
        });
    };
</script>
</body>
</html>