@{
    ViewBag.Title = "SeachInventory";
    Layout = "~/Views/Shared/_Index.cshtml";
}
<link href="~/Content/js/select2/select2.min.css" rel="stylesheet" />
<link href="~/Content/js/dialog/dialog.css" rel="stylesheet" />
<script src="~/Content/js/datepicker/WdatePicker.js"></script>
<script src="~/Content/js/select2/select2.min.js"></script>
<script>
    debugger;
    var Type = $.request("Type");
    $(function(){
        Init();
    })
    function Init() {
        var CodeName = '';
        debugger;
        if (Type == '1') {CodeName = '项目号';}
        if (Type == '2') { CodeName = '批次'; }
        if (Type == '3') { CodeName = '版本'; }
        if (Type == '4') { CodeName = '厂牌'; }
        if (Type == '5') { CodeName = '自由项1'; }
        if (Type == '6') { CodeName = '自由项2'; }
        if (Type == '7') { CodeName = '自由项3'; }
        if (Type == '8') { CodeName = '自由项4'; }
        if (Type == '9') { CodeName = '自由项5'; }
        if (Type == '10') { CodeName = '自由项6'; }
        if (Type == '11') { CodeName = '自由项7'; }
        if (Type == '12') { CodeName = '自由项8'; }
        if (Type == '13') { CodeName = '自由项9'; }
        if (Type == '14') { CodeName = '自由项10'; }
        document.getElementById("gridPanel").innerHTML = '<table id="gridList"></table><div id="gridPager"></div>   ';//重置grid
        var Common = $("#txt_BatchCode").val();
        $("#gridList").dataGrid({
            url: "/WMS/ICSMTDOC/GetCode?Type=" + Type + "&Common=" + Common + "&" + Math.random(),
            height: $(window).height() - 20,
            width: $(window).width() - 300,
            colModel: [
           { label: CodeName, name: 'Code', width: 150, align: 'left' },
            ],
            pager: "#gridPager",
            sortorder: "desc",
            sortname: 'Code',
            viewrecords: true,
            multiselect: true,
            gridComplete: function () {
            },
            beforeSelectRow: function (rowid, e) {
                $("#gridList").jqGrid('resetSelection');
                return (true);
            },
        })
    };



    function submitForm() {
        var rows = $("#gridList").jqGrid('getGridParam', 'selarrrow');
        if (rows.length != 1) {
            $.modalAlertNew("WMS00079");
            return;
        } 
        var rowdata = $("#gridList").jqGrid("getRowData", rows[0]);

        var obj = {
            Code: rowdata.Code,
        }
        return obj;
    }

    function Close() {
        $.modalClose();
    }





</script>
<div class="topPanel" style="height:50px">
    <div class="search">
        <table>
            <tr>
                <td>
                    <label>批次号:</label>
                </td>
                <td>
                    <div class="input-group">
                        <input id="txt_BatchCode" type="text" class="form-control" placeholder="批次号" style="width: 120px;">
                    </div>
                </td>
                <td>
                    <a id="Search" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="Init()"><i class="fa fa-pencil-square-o"></i>查询</a>
                </td>
            </tr>
            <tr></tr>
        </table>
    </div>
</div>
<div class="gridPanel" id="gridPanel">
    <table id="gridList"></table>
    <div id="gridPager"></div>
</div>