<%@ page language="C#" autoeventwireup="true" inherits="SB_admin_N47_PrintForm, App_Web_wkioulim" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>操作</title>
    <script type="text/javascript" language="javascript" src="<%=ResolveUrl("~/SB/control/easy_ui/jquery.min.js?v=1")%>"></script>
    <script type="text/javascript" language="javascript" src="<%=ResolveUrl("~/SB/control/easy_ui/jquery.easyui.min.js?v=1")%>"></script>
    <script type="text/javascript" language="javascript" src="<%=ResolveUrl("~/SB/control/easy_ui/locale/easyui-lang-zh_CN.js?v=1")%>"></script>
    <script type="text/javascript" language="javascript" src="<%=ResolveUrl("~/SB/control/easy_ui/jquery.load.js?v=1")%>"></script>
    <script type="text/javascript" language="javascript" src="<%=ResolveUrl("~/SB/control/easy_ui/jquery.json.js?v=1")%>"></script>
    <script type="text/javascript" language="javascript" src="<%=ResolveUrl("~/SB/control/easy_ui/jquery.easyui.validtor.js?v=1")%>"></script>
    <script type="text/javascript" language="javascript" src="<%=ResolveUrl("~/SB/control/js/PageDialog.js?v=1")%>"></script>
    <link rel="stylesheet" type="text/css" href="<%=ResolveUrl("~/SB/control/easy_ui/themes/bootstrap/easyui.css?v=1")%>" />
    <link rel="stylesheet" type="text/css" href="<%=ResolveUrl("~/SB/control/easy_ui/themes/icon.css?v=1")%>" />
    <link rel="stylesheet" type="text/css" href="<%=ResolveUrl("~/SB/control/easy_ui/load.css?v=1")%>" />
    <link rel="stylesheet" type="text/css" href="<%=ResolveUrl("~/SB/control/css/main.css?v=1")%>" />
    <script language="javascript" type="text/javascript">
       function query(){
	        $("#dataview").datagrid("load",{
					pf_number: $("#qpf_number").val(),
					pf_name: $("#qpf_name").val()
			});
   	   }
   </script>
   
   
</head>
<body class="easyui-layout" style="visibility:hidden" >
    <div region="center" border="false">
        <table id="dataview">
            <thead>
                <tr>  
					<th field="ck" checkbox="true"></th>
						<th field="id" width="120" formatter='OperFormat'>操作</th>
						<th field="pf_pid" width="130" >所属项目</th>
						<th field="pf_number" width="135" >编号</th>
						<th field="pf_name" width="150" >制作名称</th>
						<th field="pf_size" width="150" >规格尺寸</th>
						<th field="pf_amount" width="60" >数量</th>
                        <th field="pf_money" width="100" >金额</th>
                        <th field="pf_moneyP" width="100" >加工金额</th>
                        <th field="pf_ProcessingCompany" width="150" >加工单位</th>
						              
						
						<th field="pf_sumAmout" width="70" >印刷总页数</th>
						<th field="pf_cover" width="80" >封面用纸</th>
						<th field="pf_insidePages" width="80" >内页用纸</th>
						<th field="pf_other" width="80" >其他工艺</th>
						<th field="pf_bindingStyle" width="80" >装订方式</th>
						<th field="pf_delivery" width="80" >交货时间</th>
						<th field="pf_deliveryMode" width="80" >交货方式</th>
						<th field="pf_note" width="150" >备注</th>
						<th field="pf_cdate" width="120" >创建日期</th>


				</tr>
            </thead>
        </table>
    </div>
    <div id="toolbar"   style="height:55px"   >
        <a class="easyui-linkbutton" iconcls="icon-add" plain="true" onclick="Add()">添 加</a>
        <a class="easyui-linkbutton" iconcls="icon-remove" plain="true" onclick="deleteList()">删除</a>
    <%--<a class="easyui-linkbutton" iconcls="icon-remove" plain="true" onclick="excelOut()">导出选中到EXCEL</a>--%>
        <br />
				编号 ：<input id="qpf_number" name="name" type="text" maxlength="255" onkeydown= "if(event.keyCode==13)query()"/>
				制作名称 ：<input id="qpf_name" name="name" type="text" maxlength="255" onkeydown= "if(event.keyCode==13)query()"/>
        <a class="easyui-linkbutton" iconcls="icon-search" plain="true" onclick="query()">查询 </a>
        <a class="easyui-linkbutton" iconcls="icon-book" plain="true" onclick="$('#dataview').datagrid('load',{})">全部显示</a>
        
  <%--  <div style="display:none">
        <form id="ff" method="post">  -
            <input id="hValue" type="hidden" />
        </form>
        </div> --%>
    </div>
    
</body>

<script language="javascript" type="text/javascript">
$(function(){

    $("#dataview").datagrid({
        toolbar:"#toolbar",
        fit:true,
        idfield:"id",
        border:false,
        pageSize:30,
        resizable:true,
        pagination:true,
        rownumbers:true,
        showFooter:true,
        url:"N47_PrintForm/N47_PrintForm_Dataview.aspx",
        queryParams:{
            pf_pid:'<%=pid %>'
        },
        onLoadSuccess:function(){ $('#dataview').datagrid("unselectAll"); }
      
    });
    $("body").css("visibility","visible"); 
});
function OperFormat(value,row,index){
    if(value != null)
	return "<a href='javascript:void(0)' onclick=\"editItem('"+value+"')\">编辑</a>&nbsp;|&nbsp;<a href='javascript:void(0)' onclick=\"deleteItem('"+value+"')\">删除</a>&nbsp;|&nbsp;<a href='N47_PrintForm/N47_PrintForm_Print.aspx?id="+value+"'\">打印</a>";
}
function deleteItem(key){
     $.messager.confirm('确认','确定要删除选中吗?',function(r){
     if(!r){ return }load("删除中...");
             $.ajax({
                type: "POST",
                url:"N47_PrintForm/N47_PrintForm_Delete.aspx",
                dataType:"json",
                data: {"deleteKey": key},
                success: function(data){
                  unload();
                  if(data.state==1){
                      $.messager.show({title: '提示', msg: data.data});
                      $('#dataview').datagrid('reload').datagrid("unselectAll");
                  }
                  else{
                     $.messager.alert('错误',data.data,'message');
                  }
               }
            });
     });
}
function deleteList(){
     var row = $('#dataview').datagrid('getSelections');
     if(row.length==0){$.messager.alert('提示',"请选择删除项！",'message'); return;}
     $.messager.confirm('确认','确定要删除选中吗?',function(r){
     if(r){
                 load("删除中...");
                 var list = new Array();
                 for(var index =0; index<row.length;index++){ list.push(row[index].id);  }
                 $.ajax({
                    type: "POST",
                    url:"N47_PrintForm/N47_PrintForm_Delete.aspx",
                    dataType:"json",
                    data: {"deleteList": list.join(",")}, 
                    success: function(data){
                      unload();
                      if(data.state==1){
                          $.messager.show({ title: '提示', msg: "总共删除"+data.data+"条信息" });
                          $('#dataview').datagrid('reload').datagrid("unselectAll");
                      }else{
                         $.messager.alert('错误',data.data,'message');
                      }
                   }
                });
     }
     });
}

//function excelOut(){
//    var row = $('#dataview').datagrid('getSelections');
//    if(row.length==0){$.messager.alert('提示',"请选择EXCEL导出的制作单！",'message'); return;}
//    else{
//        $(row.studnet)
//    }
//    $('#ff').form('submit', {  
//    url:"N47_PrintForm/N47_PrintForm_Excel.aspx",
//    });  
//}


function editItem(key){
    ShowDialog("edit","N47_PrintForm/N47_PrintForm_Edit.aspx?id="+key,800,650,100,100);
}
function Add(){
 	ShowDialog("add","N47_PrintForm/N47_PrintForm_Insert.aspx?pid=<%=pid %>&s="+new Date().getTime(),800,650,100,100);
}
function reload(param){
    if(param=='last'){
        var grid = $('#dataview'); 
        var gridOptions = grid.datagrid("options"); 
        var options = grid.datagrid('getPager').data("pagination").options;  
        var pagenumber = options.total==0?1:Math.ceil( options.total/options.pageSize);
        gridOptions.pageNumber = pagenumber 
        options.pageNumber = pagenumber;
        $('#dataview').datagrid('reload');
    }
    $('#dataview').datagrid('reload');
}
</script>

</html>
