<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="../common/init.jsp"%>
<!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>
<link rel='stylesheet' href='${ctx}/resources/css/easyui.css' type='text/css' media='screen' />
<link rel='stylesheet' href='${ctx}/resources/css/easyui/icon.css' type='text/css' media='screen' />
<link rel='stylesheet' href='${ctx}/resources/css/user-center-style.css' type='text/css' media='screen' />
<%@ include file="../common/top.jsp"%>
<script type="text/javascript" src="${ctx}/resources/js/jquery.easyui.min.js"></script>
<script type="text/javascript" src="${ctx}/resources/js/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="${ctx}/resources/js/validator.js"></script>
<%@ include file="../common/validation.jsp"%>
<title>查询细目表</title>
</head>
<body>
 <%@ include file="../common/header.jsp"%>
    <div id="content" class="content">
        <%@ include file="../common/sub_menu.jsp"%>
        <div class="page" id="page" >
        <div class="page-header" >查询细目表</div>
        <div class="page-body">
	        <div>
	            <form id="search-form" method="post" >
		            <input name="name" placeholder="细目表名称"/>
		            <button id="searchBtn">查询</button>
	            </form>
				</div>
	        
	        <div class="right" style="min-height:300px;position: relative;">
	             <div id="list-wrap posts" class="listview">
	                 <table id="dg" class="easyui-datagrid"
	                     data-options="url:'${ctx}/paperSkeleton/auditPaperSkeletons',fitColumns:true,singleSelect:false,striped:true,pagination:true,
	                     idField:'id',toolbar: '#tb'">
	                     <thead>
	                         <tr class="title">
	                             <th data-options="field:'name',width:160">细目表名称</th>
	                             <th data-options="field:'courseName',width:120">课程名称</th>
	                             <th data-options="field:'bookName',width:150">教材名称</th>
	                             <!-- <th data-options="field:'chaptersCount',width:80">章节总数</th>
	                             <th data-options="field:'keyChapters',width:80">重点章节</th>  -->
	                             <th data-options="field:'statusName',width:80">状态</th>
	                             <th data-options="field:'createdTime',formatter: formatDate,width:80">创建时间</th>
	                         </tr>
	                     </thead>
	                   </table>
	                   <div id="tb" style="height:auto">
					         <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-edit',plain:true" id="viewBtn">查看</a> 
					   </div>
	               </div>
	            </div>
	        </div>
        </div>
    </div>
    <div id="global-dialog"></div>
</body>
</html>
    
<script language="javascript">
$(document).ready(function(){
	$("#viewBtn").click(function(){
		var rowData = $("#dg").datagrid('getSelected');
		if(rowData != null){
			var url = "${ctx}/paperSkeleton/viewskeletondetail/"+rowData.id;
			window.location.href = url;
		}
	});
	
	$("#dg").datagrid({
	    onDblClickRow: function (rowIndex, rowData) {
	    	$("#viewBtn").click();
	    }
	});
	$('#search-form').submit(function(event){
	    event.preventDefault(); 
	    var param = $('#search-form').serializeJson();
	    param = $.extend(param, {page:1,rows:10});
	    $('#dg').datagrid('load',param);
	});
});

function formatDate(date){
	var d=undefined;
	if(typeof(date)=="undefined"){
		d=new Date();
	}else{
		d = new Date(date);
	}
	
	return (d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate());
}
</script>
        