<!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">
<input type="hidden" id="rowIds">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>物料编码：</label>
                            <input type="text" name="goodsId"/>
                        </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="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var prefix = ctx + "business/mesManage";

    $(function () {
        var options = {
            url: prefix + "/orderTaskOut/query",
            showSearch: false,
            showRefresh: false,
            showToggle: false,
            showColumns: false,
            fixedColumns: true,
            fixedNumber: 3,
            columns: [{
                radio: true
            },
                {
                    field: 'goodsId',
                    title: '物料编码',
                    sortable: true
                },
                {
                    field: 'needNum',
                    title: '需求数量'
                },
                {
                    field: 'finishNum',
                    title: '已发数量'
                },
                {
                    field: 'waitNum',
                    title: '待发数量'
                }
            ]
        };
        $.table.init(options);
    });

    /* 添加物料-选择物料-提交 */
    function submitHandler() {
        var rows = $.table.selectFirstColumns();
        if (rows.length == 0) {
            $.modal.alertWarning("请至少选择一条记录");
            return;
        }
        alert(rows.join());
    }

    /* 添加用户-选择用户-提交(回调形式-父页面调用子页面) */
    function getSelections() {
        var selectInfo = [];
        selectInfo.push($.table.selectColumns('goodsId'));
        selectInfo.push($.table.selectColumns('waitNum'));
        return selectInfo;
    }

    $("#bootstrap-table").on("check.bs.table check-all.bs.table uncheck.bs.table uncheck-all.bs.table", function (e, rowsAfter, rowsBefore) {
        var rows = $.common.equals("uncheck-all", e.type) ? rowsBefore : rowsAfter;
        var rowIds = $.table.affectedRowIds(rows);
        $("#rowIds").val(rowIds);
    });
</script>
</body>
</html>