<%@page import="com.qmth.qrzk.repository.utils.Consts"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="../common/init.jsp"%>
<c:set var="skeletonStatus" value="<%=Consts.SkeletonStatus.dicMap%>" scope="request"/>
<c:set var="defaultSkeletonToApproveStatus" value="<%=Consts.SkeletonStatus.TOAPPROVE%>" scope="request"/>
<!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="keyword" placeholder="请输入任务单编号或者课程信息搜索" style="width: 270px;"/>
		            
		            <select name="status">
		            	<c:forEach var="map" items="${status }">
		            		<option value="${map['status'] }">${map['statusName'] } (${map['count'] } 套)</option>
		            	</c:forEach>
		            </select>
		            <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="fitColumns:true,singleSelect:true,striped:true,pagination:true,
	                     idField:'id',toolbar: '#tb'">
	                     <thead>
	                         <tr class="title">
	                             <th data-options="field:'taskNo',width:120">试卷编号</th>
	                             <th data-options="field:'statusName',width:90">状态</th>
	                             <th data-options="field:'courseName',width:130,formatter: function(value,row,index){
					return row.course.name + (row.course.code != null && row.course.code != ''?('(' + row.course.code + ')'):'');
				}">课程</th>
	                             <th data-options="field:'bookName',width:120,formatter: function(value,row,index){
					return row.book.name + (row.book.code != null && row.book.code != ''?('(' + row.book.code + ')'):'');
				}">教材</th>
	                             <th data-options="field:'propositionTeacherBean',formatter:formatNormalBean,width:70">命题教师1</th>
	                             <th data-options="field:'auditTeacherBean',formatter:formatNormalBean,width:70">命题教师2</th>
	                             <th data-options="field:'primarySecretaryBean',formatter:formatNormalBean,width:70">学科秘书</th>
	                             <%--<th data-options="field:'assistantSecretaryBean',formatter:formatNormalBean,width:70">学科秘书2</th>--%>
	                             <th data-options="field:'typesetterBean',formatter:formatNormalBean,width:70">排版员</th>
	                             <th data-options="field:'planStartTime',formatter: formatDate,width:90">计划开始时间</th>
	                             <th data-options="field:'planEndTime',formatter: formatDate,width:90">计划结束时间</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>
</body>
</html>
<script language="javascript">
$(document).ready(function(){
	$("#viewBtn").click(function(){
		var rowData = $("#dg").datagrid('getSelected');
		if(rowData != null){
			var url = "${ctx}/taskCenter/viewTaskCenterDetail/"+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({
        	'url':'${ctx}/taskCenter/queryTodoPaperTasks',
        	'queryParams':param
        });
    });
    window.setTimeout(function(){$('#search-form').submit();},200);
});
</script>
