<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>
	<script src="sys/js/My97DatePicker/WdatePicker.js" th:src="@{/static/sys/js/My97DatePicker/WdatePicker.js}"></script>
</head>
<style>
	.tablelink{margin-right:10px;}
	.stylecss{
	      color: red;
	}
	.select_width{
	     width: 70px;
	}
	.select_width2{
		width: 120px;
	}
</style>
<body>
<div class="place">
	<span>位置：</span>
	<ul class="placeul">
		<li><a href="#">后台系统管理</a></li>
		<li><a href="#">单元配置</a></li>
	</ul>
</div>
<div class="rightinfo">
	<form id="seachform" th:action="@{/sys/zuoyb/knowHowList.html}" method="post">
	<input type="hidden" name="EQ_libId" th:value="${search.get('EQ_libId')}">
	<ul class="seachform">
		<li>
		<label>课程</label>
					<select class="scinput select_width" name="EQ_courseName" id="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" id="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" id="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_width2" name="banben" id="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>开始时间</label>
			<input type="text" id="beginDate" name="beginDate"  onclick="WdatePicker({readOnly:true,maxDate:'#F{$dp.$D(\'endDate\')}'})" th:value="${search.beginDate }" class="scinput date_width " placeholder="开始时间">
		</li>


		<li>
			<label>结束时间</label>
			<input type="text" id="endDate" name="endDate"  onclick="WdatePicker({minDate:'#F{$dp.$D(\'beginDate\')}',maxDate:'%y-%M-%d'})" th:value="${search.endDate }" class="scinput date_width" placeholder="结束时间">
		</li>
		<li>
			<label>id</label>
			<input name="LIKE_id" type="text" class="scinput" th:value="${search.get('LIKE_id')}"/>
		</li>
		<li>
			<label>&nbsp;</label>
			<input type="button" class="scbtn" value="查询" />
		</li>
		<li>
				<ul class="toolbar"  th:onclick="'knowHowAdd(\''+${search.get('EQ_libId')}+'\')'">
					<li class="click"><span><img th:src="@{/static/sys/images/t01.png}" /></span>新增</li>
				</ul>
		</li>

		</ul>
 	<ul class="seachform">
		<li>
				<ul class="toolbar " id="howDetaisName">
					<li class="click"><span><img style="width: 24px;height: 24px" th:src="@{/static/sys/images/jump.png}" /></span>知识点</li>
				</ul>
		</li>
		<li>
				<ul class="toolbar" id="howDetaisKdName">
					<li class="click"><span><img style="width: 24px;height: 24px" th:src="@{/static/sys/images/jump.png}" /></span>考点</li>
				</ul>
		</li>
		<!--<li>-->
				<!--<ul class="toolbar"  th:onclick="'knowHowImport(\''+${search.get('EQ_libId')}+'\')'">-->
					<!--<li class="click"><span><img th:src="@{/static/sys/images/t01.png}" /></span>导入单元知识点考点</li>-->
				<!--</ul>-->
		<!--</li>-->
		<li>
				<input type="button" id="button" style="width: 100px;" class="scbtnbution" value="导出单元" />
		</li>
		<li>
				<input type="button" id="buttondetails" style="width: 100px;" class="scbtnbution" value="导出知识点" />
		</li>
		<li>
				<input type="button" id="buttonkd" style="width: 100px;" class="scbtnbution" value="导出考点" />
		</li>
		
		<li th:if="${search.get('EQ_libId') ne 'SSJ'}">
				<ul class="toolbar">
					<a th:href="@{/sys/lib/libJoinList.html}"><li class="click"><span><img style="width: 24px;height: 24px" th:src="@{/static/sys/images/goto.png}" /></span>返回</li></a>
				</ul>
		</li>
	</ul> 
	</form>
	<table class="tablelist">
		<thead>
		    <tr>
		        <th style="width: 80px;">序号</th>
		        <th>课程</th>
		        <th>模块</th>
		        <th>单元</th>
		        <th style="text-align: center;" >单元序号</th>
		        <th>是否专题</th>
		        <th>添加时间</th>
		        <th>操作</th>
		    </tr>
		</thead>
		<tbody>
			<tr th:each="item:${list}" >
				<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 style="text-align: center;">
					 <input type="number" th:value="${item.num}" th:onBlur="'updateCourseNum(\''+${item.id}+'\',\''+${item.num}+'\',this)'"  class="dfinput" style="width: 70px; height: 30px;color: red;"  >
					</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>
					<td>
						 <a  th:href="@{/sys/zuoyb/knowHowDetailList.html(EQ_howId=${item.id},EQ_libId=${search.get('EQ_libId')},EQ_courseName=${search.get('EQ_courseName')})}"  class="tablelink" >知识点明细</a>
						 <a  th:href="@{/sys/zuoyb/knowHowVersionList.html(EQ_howId=${item.id},EQ_stat=1,EQ_courseName=${search.get('EQ_courseName')})}"  class="tablelink" >单元版本</a>
						 <a href="javascript:;"   th:onclick="'updateById(\''+${item.id}+'\')'"  class="tablelink" >修改</a>
				    </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">
$(function(){
	
	$("#howDetaisName").click(function(){
		var url = "[[${sysUrl}]]/sys/zuoyb/knowHowDetailList.html?EQ_libId=[[${search.get('EQ_libId')}]]";
		var EQ_courseName = $('#EQ_courseName').val();
		var EQ_grade = $('#EQ_grade').val();
		var semester = $('#semester').val();
		var banben = $('#banben').val();
		if(EQ_courseName!=''&& EQ_courseName!=null){
			url = url + "&EQ_courseName="+EQ_courseName;
		}
		if(EQ_grade!=''&&EQ_grade!=null){
			url = url + "&EQ_grade="+EQ_grade;
		}
		if(semester!=''&&semester!=null){
			url = url + "&semester="+semester;
		}
		if(banben!=''&&banben!=null){
			url = url + "&banben="+banben;
		}
		window.open(url); 
	});
	$("#howDetaisKdName").click(function(){
		var url = "[[${sysUrl}]]/sys/zuoyb/knowHowDetailKdList.html?EQ_libId=[[${search.get('EQ_libId')}]]";
		var EQ_courseName = $('#EQ_courseName').val();
		var EQ_grade = $('#EQ_grade').val();
		var semester = $('#semester').val();
		var banben = $('#banben').val();
		if(EQ_courseName!=''&&EQ_courseName!=null){
			url = url + "&EQ_courseName="+EQ_courseName;
		}
		if(EQ_grade!=''&&EQ_grade!=null){
			url = url + "&EQ_grade="+EQ_grade;
		}
		if(semester!=''&&semester!=null){
			url = url + "&semester="+semester;
		}
		if(banben!=''&&banben!=null){
			url = url + "&banben="+banben;
		}
		window.open(url); 
	});
	
});
function updateCourseNum(id,oldNum,_this){
	var num = $(_this).val();
	if(num == oldNum){
		return false;
	}
	if(num ==''|| num ==null){
		return false;
	}
	$(_this).removeAttr("onBlur");
	$.ajax({
		url : "[[${sysUrl}]]/sys/zuoyb/updateKnowHowNum",
		type : "post",
		data : {
			id : id,
			num : num
		},
		dataType : "json",
		success : function(data) {
			if(data.meta.success){
				 parent.layer.msg('操作成功',{icon:1});
				 $(_this).attr("onBlur","updateCourseNum("+id+","+num+",this)");
			}else{
				parent.layer.msg('操作失败',{icon: 9})
				$(_this).attr("onBlur","updateCourseNum("+id+","+oldNum+",this)");
			}
		}
	});
}



function knowHowAdd(id){
	layer.open({
	    type: 2,
	    title: "添加大纲内容",
	    closeBtn: 1, //不显示关闭按钮
	    shift: 0.8,
	    //offset: '100px',
	    area: ['55%', '90%'],
	    content: "[[${sysUrl}]]/sys/zuoyb/knowHowAdd.html?libId="+id
	});
}

function knowHowImport(id){
	layer.open({
	    type: 2,
	    title: "导入课程知识点",
	    closeBtn: 1, //不显示关闭按钮
	    shift: 0.8,
	    //offset: '100px',
	    area: ['55%', '82%'],
	    content: "[[${sysUrl}]]/sys/zuoyb/knowHowImport.html?libId="+id
	});
}

function updateById(id){
	layer.open({
	    type: 2,
	    title: "修改大纲内容",
	    closeBtn: 1, //不显示关闭按钮
	    shift: 0.8,
	    //offset: '100px',
	    area: ['55%', '90%'],
	    content: "[[${sysUrl}]]/sys/zuoyb/knowHowAdd.html?id="+id
	});
}


$("#button").on('click',function(){
	
	document.getElementById("seachform").action = "[[${sysUrl}]]/sys/zuoyb/exportHowExcel";
	$("#seachform").submit();
	document.getElementById("seachform").action = "[[${sysUrl}]]/sys/zuoyb/knowHowList.html";
});
$("#buttondetails").on('click',function(){
	
	document.getElementById("seachform").action = "[[${sysUrl}]]/sys/zuoyb/exportHowDetailsExcel";
	$("#seachform").submit();
	document.getElementById("seachform").action = "[[${sysUrl}]]/sys/zuoyb/knowHowList.html";
});
$("#buttonkd").on('click',function(){
	
	document.getElementById("seachform").action = "[[${sysUrl}]]/sys/zuoyb/exportHowDetailsKdExcel";
	$("#seachform").submit();
	document.getElementById("seachform").action = "[[${sysUrl}]]/sys/zuoyb/knowHowList.html";
});

</script>
</html>