<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Batch_Select.aspx.cs" Inherits="Component_AdvancedSearch_Batch_Select" %>
<%@ Register Src="~/Scripts/AWGridRuntime/UserControl/ListHeader.ascx" TagPrefix="uc1" TagName="ListHeader" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>选择批次</title>
    <uc1:ListHeader runat="server" ID="ListHeader" />
    <script type="text/javascript">
        //搜索
        function search_grid() {
            var fg = document.getElementById("frame_grid");
            var keyword = $("#keyword").val();
            var wh_id = '<%=Request["wh_id"]%>';
            var i_id = '<%=Request["i_id"]%>';
            var free1 = '<%=Request["free1"]%>';
            var free2 = '<%=Request["free2"]%>';
            var url = "Batch_Select_Grid.aspx?keyword=" + escape(keyword)
                    + "&wh_id=" + wh_id + "&i_id=" + i_id
                    + "&free1=" + escape(free1) + "&free2=" + escape(free2);
            fg.src = url;
        }
       //选择
        function modify() {
            var fg = document.getElementById("frame_grid"); //得到grid控件所在iframe
            var cw = fg.contentWindow;
            var batch = cw.aw_GetSelectRows(cw._batch);
            var quantity = cw.aw_GetSelectRows(cw._quantity);
            var num = cw.aw_GetSelectRows(cw._num);
            if (batch == "")
                return;
            if (batch.length == 0) {
                AlertNO('请选择记录!');
                return;
            }
            if (batch.length > 1) {
                AlertNO('一次只可以选择一条!');
                return;
            }
            parent.$("#batch").val(batch);
            parent.$("#quantity").val(quantity);
            if (parent.$("#aunit").val() != "") {
                parent.$("#num").val(num);
            }
            CloseDivWin(); //关闭窗口
        }
        
    </script>
</head>
<body onload="search_grid();">
    <!--工具栏-->
    <div style="height:30px;" class="list_menu_bar">
        <input type="text" class="edit_text_box" id="keyword" value="<%=keyword%>"/>
        <a href="javascript:search_grid()" plain="true" class="easyui-linkbutton" iconcls="icon-search">搜索</a>
        <a plain="true" class="easyui-linkbutton" onclick="modify()">选择</a>
        <a plain="true" class="easyui-linkbutton" onclick="DesignModuleFormat('Dialog_Batch_List')" style='<%=auth.FormatView()%>'>格式</a>
    </div>
    <!--Grid控件所在的iframe-->
    <%=xview["grid_frame"]%>
    <script type="text/javascript">
        //搜索框回车事件
        $('#keyword').keyup(function (e) {
            if (e.keyCode == 13) {
                search_grid();
            }
        });
        $('#keyword').focus();
    </script>
</body>
</html>
