@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Index.cshtml";
}
<style>
    .td {
        padding: 0 5px 0 5px;
    }
</style>
<script>
    var WorkPoints = $.request("WorkPoint");
    $(function () {
        gridList();
    })

    function gridList() {
        var $gridList = $("#gridList");
        var queryJson = {
            WarehouseCode: $("#txt_WarehouseCode").val(),
            WarehouseName: $("#txt_WarehouseName").val(),
        }
        $gridList.dataGrid({
            url: "/DHAY/ICSCustomerSuppliedReturn/GetWHCodeList" + "?" + Math.random(),
            postData: { queryJson: JSON.stringify(queryJson), WorkPoint: JSON.stringify(WorkPoints) },
            height: $(window).height() - 120,
            width: $(window).width() - 180,
            colModel: [
                { label: "主键", name: "ID", hidden: true, key: true },
                { label: '仓库编码', name: 'WarehouseCode', width: 240, align: 'left' },
                { label: '仓库名称', name: 'WarehouseName', width: 240, align: 'left', hidden: true },
            ],
            sortname: 'WarehouseCode',
            shrinkToFit: true,//宽度自适应
            pager: "#gridPager",
            //sortname: 'ID',
            viewrecords: true,
            multiselect: true,
            rowNum: 200
        });
        $("#btn_search").click(function () {
            var queryJson = {
                WarehouseCode: $("#txt_WarehouseCode").val(),
                WarehouseName: $("#txt_WarehouseName").val(),
            }
            $gridList.jqGrid('setGridParam', {
                postData: { queryJson: JSON.stringify(queryJson) },
            }).trigger('reloadGrid');
        });
    }
    //提交
    function submitForm() {
        debugger;
        var rows = $("#gridList").jqGrid('getGridParam', 'selarrrow');
        if (rows.length != 1) {
            $.modalAlertNew("WMS00079");
            return;
        }
        var rowdata = $("#gridList").jqGrid("getRowData", rows[0]);

        var obj = {
            WarehouseCode: rowdata.WarehouseCode,
            WarehouseName: rowdata.WarehouseName,
        }
        return obj;
    }

    function Close() {
        $.modalClose();
    }
</script>

<form id="form1">
    <div class="topPanel" style="height:50px">
        <div class="search">
            <table>
                <tr>
                    <td style="text-align:right;padding: 0 5px 0 5px;">
                        <label>仓库编码:</label>
                    </td>
                    <td>
                        <div class="input-group">
                            <input id="txt_WarehouseCode" type="text" class="form-control" placeholder="仓库编码" style="width: 100px;">
                        </div>
                    </td>
                    <td style="text-align:right;padding: 0 5px 0 5px;">
                        <label>仓库名称:</label>
                    </td>
                    <td>
                        <div class="input-group">
                            <input id="txt_WarehouseName" type="text" class="form-control" placeholder="仓库名称" style="width: 100px;">
                        </div>
                    </td>
                    <td>
                        <span class="input-group-btn" style="padding-left:10px;">
                            <button id="btn_search" type="button" class="btn  btn-primary"><i class="fa fa-search"></i></button>
                        </span>
                    </td>
                </tr>
            </table>

        </div>
    </div>
    <div class="gridPanel">
        <table id="gridList"></table>
        <div id="gridPager"></div>
    </div>
</form>