<html xmlns:th="http://www.thymeleaf.org">
<head>
<title>私塾家</title>
<script th:include="sys/common/metaCSS" th:remove="tag"></script> 
<script th:include="sys/common/metaJS" th:remove="tag"></script> 
</head>
<style>
	.tablelink{margin-right:10px;}
	.stylecss{
	      color: red;
	}
	.select_width{
	width: 100px;
	}
</style>
<body>
<div class="rightinfo">
	<form id="seachform" th:action="@{/sys/zuoyb/getknowHowList.html}" method="post">
	<input type="hidden" name="EQ_libId" th:value="${search.get('EQ_libId')}">
	<input type="hidden" id="sortId" name="sortId" th:value="${search.get('sortId')}">
	<ul class="seachform">
		<li>
		<label>课程</label>
					<select class="scinput select_width" name="EQ_courseName" >
					     <option value=""  th:selected="${ search.get('EQ_courseName') eq '' }"  >全部</option>
						 <option  th:each="sort:${zyb_course}"  th:value="${sort.name}"  th:if="${sort.name ne '总体'}" th:selected="${ search.get('EQ_courseName')  eq sort.name }" th:text="${sort.name}" ></option>
					</select>
		</li>
		<li>
		<label>年级</label>
					<select class="scinput select_width" name="EQ_grade" >
					     <option value=""    >全部</option>
						 <option  th:each="sort:${grade}"  th:value="${sort.aliases}"   th:selected="${ sort.aliases  eq search.get('EQ_grade')  }"     th:text="${sort.name}" ></option>
					</select>
		</li>
		<li>
		<label>学期</label>
					<select class="scinput select_width" name="semester" >
					     <option value=""    >全部</option>
					      <option value="1"  th:selected="${ search.get('semester') eq '1' }"  >上学期</option>
						 <option  value="2"  th:selected="${ search.get('semester') eq '2' }" >下学期</option>
					</select>
		</li>
		<li>
		<label>版本</label>
					<select class="scinput select_width" name="banben" >
					     <option value=""   >全部</option>
					     
					     <option th:each="version:${versions['数学'] }"  th:selected="${search.get('banben') eq (version.versionType+'') && search.get('EQ_courseName') eq '数学'}"  th:value="${version.versionType }">[[${version.courseName +':'+version.versionName}]]</option>
						 <option th:each="version:${versions['语文'] }"  th:selected="${search.get('banben') eq (version.versionType+'') && search.get('EQ_courseName') eq '语文'}"  th:value="${version.versionType }">[[${version.courseName +':'+version.versionName}]]</option>
					 	 <option th:each="version:${versions['英语'] }"  th:selected="${search.get('banben') eq (version.versionType+'') && search.get('EQ_courseName') eq '英语'}"  th:value="${version.versionType }">[[${version.courseName +':'+version.versionName}]]</option>
					     
					     
<!-- 						 <option value="1" th:selected="${ search.get('banben') eq '1'  && search.get('EQ_courseName')  eq '数学'  }"   >北师大</option> -->
<!-- 						 <option  value="2" th:selected="${ search.get('banben') eq '2' && search.get('EQ_courseName')  eq '数学' }"  >人教版</option> -->
<!-- 						  <option  value="5" th:selected="${ search.get('banben') eq '5' && search.get('EQ_courseName')  eq '数学' }"  >江苏版</option> -->
<!-- 						 <option  value="6" th:selected="${ search.get('banben') eq '6' && search.get('EQ_courseName')  eq '数学' }"  >思维拓展</option> -->
						 
<!-- 						 <option  value="2" th:selected="${ search.get('banben') eq '2' && search.get('EQ_courseName')  eq '语文' }"  >人教(部编)</option> -->
						 

<!-- 						 <option value="2" th:selected="${ search.get('banben') eq '2' && search.get('EQ_courseName') eq '英语' }"   >教科版</option> -->
<!-- 						 <option  value="3" th:selected="${ search.get('banben') eq '3' }"  >沪教版（新）</option> -->
<!-- 						 <option  value="7" th:selected="${ search.get('banben') eq '7' }"  >朗文版</option> -->
<!-- 						 <option  value="8" th:selected="${ search.get('banben') eq '8' }"  >人教版（PEP）</option> -->
<!-- 						 <option  value="9" th:selected="${ search.get('banben') eq '9' }"  >牛津版</option> -->
					</select>
		</li>
		<li>
			<label>单元</label>
			<input name="LIKE_name" type="text" class="scinput" th:value="${search.get('LIKE_name')}"/>
		</li>
		<li>
			<label>&nbsp;</label>
			<input type="button" class="scbtn" value="查询" />
		</li>
		<li>
				<ul class="toolbar" id="select">
					<li class="click"><span><img style="width: 24px;height: 24px" th:src="@{/static/sys/images/select.png}" /></span>选择</li>
				</ul>
		</li>
		
	</ul>
	</form>
	<table class="tablelist">
		<thead>
		    <tr>
		        <td></td>
		        <th style="width: 50px;">序号</th>
		        <th>课程</th>
		        <th>模块</th>
		        <th>单元</th>
		        <th>单元序号</th>
		        <th>是否专题</th>
		        <th>添加时间</th>
		    </tr>
		</thead>
		<tbody>
			<tr th:each="item:${list}" >
				    <td><input name="selectlist" type="radio" th:data-id="${item.get('id')}" th:checked="${ item.get('id') eq howId  }" /></td>
				    <td th:text="${itemStat.count}" ></td>
					<td th:text="${item.course_name}"  th:title="${item.course_name}" ></td>
					<td th:text="${item.module}"  th:title="${item.module}" ></td>
					<td th:text="${item.name} ? (${#strings.length(item.name)} &gt; 20 ? ${#strings.substring(item.name,0,20)} :${item.name} ) :'' "   th:title="${item.name}" ></td>
					 <td th:text="${item.num}">
					</td>
					 <td   th:utext="${item.is_zt eq '1' } ?'是':'否'" th:styleappend="${item.is_zt eq '1'} ? 'color: red;'  "></td>
					<td  th:text="${#calendars.format(item.create_time,'yyyy-MM-dd')}" ></td>
			</tr>
		</tbody>
	</table>
	<!-- 分页 -->
	<div class="pagin">
    	<div class="message">共<i class="blue">[[${page.rowCnt}]]</i>条记录，当前显示第&nbsp;<i class="blue">[[${page.pageNo }]]&nbsp;</i>页</div>
    	<div th:utext='${listNavigatHtml}' th:remove="tag" ></div>
   	</div>
</div>
</body>
<script type="text/javascript">
var newhowId ;
$(function(){
	 
		$('#select li.click').click(function () {
			 $('[name=selectlist]:radio:checked').each(function() {
				 newhowId = $(this).attr('data-id');
			 });
			 if(newhowId!=null && newhowId!='' && newhowId!=undefined){
				 showIndex(newhowId);
		   	 }else{
		   		closeWin();
		   	 }
			 
		 });
		
})

function showIndex(newhowId){
	var content ="您确定要修改吗?";
	parent.layer.confirm(content, {
		icon: 4, btn: ['确定','关闭'] //按钮
	}, function(){
		var url="[[${sysUrl}]]/sys/zuoyb/saveSortHowId";
		 var params ={
		            'sortId' : $("#sortId").val(),
		            'howId' : newhowId
		        };
		$.post(url,params,function(data){
			if(data.meta.success){
				parent.layer.msg("修改成功",{icon:1});
				closeWin();
			}else{
				parent.layer.msg(data.meta.message,{icon:11});
				closeWin();
			}
		});
	});
}
function closeWin(){
	parent.location.reload();
	parent.layer.close(parent.layer.getFrameIndex(window.name));
}

</script>
</html>