<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;
	}
	.date_width{
	     width: 100px;
	}
</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/knowHowDetailSortList.html}" method="post">
	<input type="hidden" name="EQ_libId" th:value="${search.get('EQ_libId')}">
	<input type="hidden" name="EQ_howId" th:value="${search.get('EQ_howId')}">
	<input type="hidden" name="EQ_howDetailsId" th:value="${search.get('EQ_howDetailsId')}">
		<input type="hidden" name="EQ_courseName" th:value="${search.get('EQ_courseName')}">
	<ul class="seachform">
		<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="EQ_semester" >
					     <option value=""    >全部</option>
					      <option value="1"  th:selected="${ search.get('EQ_semester') eq '1' }"  >上学期</option>
						 <option  value="2"  th:selected="${ search.get('EQ_semester') eq '2' }" >下学期</option>
					</select>
		</li>
		<li>
		<label>版本</label>
					<select class="scinput select_width" name="EQ_banben" >
					     <option value=""   >全部</option>
					     
					       
					     <option th:each="version:${versions['数学'] }"  th:selected="${search.get('EQ_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('EQ_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('EQ_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('EQ_banben') eq '1'  && search.get('EQ_courseName')  eq '数学'}"   >北师大</option> -->
<!-- 						 <option  value="2" th:selected="${ search.get('EQ_banben') eq '2' && search.get('EQ_courseName')  eq '数学' }"  >人教版</option> -->
<!-- 						  <option  value="5" th:selected="${ search.get('EQ_banben') eq '5' && search.get('EQ_courseName')  eq '数学' }"  >江苏版</option> -->
<!-- 						 <option  value="6" th:selected="${ search.get('EQ_banben') eq '6' && search.get('EQ_courseName')  eq '数学' }"  >思维拓展</option> -->
						 
						   
<!-- 						 <option  value="2" th:selected="${ search.get('EQ_banben') eq '2' && search.get('EQ_courseName')  eq '语文' }"  >人教(部编)</option> -->
						 
						 
<!-- 						 <option value="2" th:selected="${ search.get('EQ_banben') eq '2' && search.get('EQ_courseName') eq '英语' }"   >教科版</option> -->
<!-- 						 <option  value="3" th:selected="${ search.get('EQ_banben') eq '3' }"  >沪教版（新）</option> -->
<!-- 						 <option  value="7" th:selected="${ search.get('EQ_banben') eq '7' }"  >朗文版</option> -->
<!-- 						 <option  value="8" th:selected="${ search.get('EQ_banben') eq '8' }"  >人教版（PEP）</option> -->
<!-- 						  <option  value="9" th:selected="${ search.get('EQ_banben') eq '9' }"  >牛津版</option> -->
					</select>
		</li>
		<li>
			<label>知识点</label>
			<input name="LIKE_alias" type="text" class="scinput" th:value="${search.get('LIKE_alias')}"/>
		</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="'knowHowDetailAdd(\''+${search.get('EQ_howId')}+'\',\''+${search.get('EQ_libId')}+'\',\''+${search.get('EQ_howDetailsId')}+'\')'">
					<li class="click"><span><img th:src="@{/static/sys/images/t01.png}" /></span>新增</li>
				</ul>
		</li>
		<li>
				<ul class="toolbar">
					<a th:href="@{/sys/zuoyb/knowHowDetailList.html(EQ_howId=${search.get('EQ_howId')},EQ_libId=${search.get('EQ_libId')},EQ_courseName=${search.get('EQ_courseName')})}"><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>序号</th>
		        <th>科目</th>
				<th>模块</th>
		        <th>知识点内容</th>
		        <th>版本</th>
		        <th style="text-align: center;">关联单元内容</th>
		        <th>年级</th>
		        <th>学期</th>
		        <th style="text-align: center;">排序</th>
				<!--<th>识记</th>
				<th>理解</th>
				<th>应用</th>-->
				<th>属性</th>
				<th>添加时间</th>
		        <th>操作</th>
					                
		    </tr>
		</thead>
		<tbody>
		
									<tr th:each="sort:${list}" >
										<td th:text="${sortStat.count}"  th:title="${sort.id}" ></td>
									   	<td th:text="${sort.course_name}" ></td>
										<td  th:title="${sort.module}" th:text="${sort.module} ? (${#strings.length(sort.module)} &gt; 10 ? ${#strings.substring(sort.module,0,10)} :${sort.module} ) :'' " ></td>
									   	<td th:text="${sort.alias}" ></td>
										<td  >
										
										
										    <span th:each="version:${versions[sort.course_name] }"  th:if="${sort.type eq version.versionType  }" class="stylecss">[[${version.versionName}]]</span>
										
										
<!-- 					  					 	<span th:if="${sort.type eq 1 && sort.course_name  eq '数学'}" class="stylecss">北师大</span> -->
<!-- 					  					  	<span th:if="${sort.type  eq 2 && sort.course_name  eq '数学'}" class="stylecss">人教版</span> -->
<!-- 					  					 	<span th:if="${sort.type  eq 5 && sort.course_name  eq '数学'}" class="stylecss">江苏版</span> -->
<!-- 					  					 	<span th:if="${sort.type  eq 6 && sort.course_name  eq '数学'}" class="stylecss">思维拓展</span> -->
						 
<!-- 					  					  	<span th:if="${sort.type  eq 2 && sort.course_name  eq '语文' }" class="stylecss">人教(部编)</span> -->
					  					 
<!-- 					  					 	 <span th:if="${sort.type  eq 2 && sort.course_name eq '英语'}" class="stylecss">教科版</span> -->
<!-- 					  					  	<span th:if="${sort.type  eq 3 }" class="stylecss">沪教版（新）</span> -->
<!-- 					  					 	 <span th:if="${sort.type  eq 7 }" class="stylecss">朗文版</span> -->
<!-- 					  					  	 <span th:if="${sort.type  eq 8 }" class="stylecss">人教版（PEP）</span> -->
<!-- 					  					 	 <span th:if="${sort.type  eq 9 }" class="stylecss">牛津版</span> -->
										</td>
										
										<td style="text-align: center;">
								    <a href="javascript:;" style="text-align:center;color: red; margin-right: 10px;" 
								       th:onclick="'getKnowHowSpecialTopic(\''+${sort.id}+'\',\''+${sort.course_name}+'\',\''+${sort.how_id}+'\',\''+${sort.grade_num}+'\',\''+${sort.semester}+'\',\''+${sort.type}+'\');'" th:text="${sort.howname !=''} ? ${sort.howname} :'请关联 单元' " ></a>
					                </td>
										<td th:title="${sort.grade_num}">
										 <span th:each="gr:${grade}"  th:if="${ gr.aliases eq (sort.grade_num+'') }"  th:text="${gr.name}"></span>
										 </td>
										<td th:switch="${sort.semester}" >
					  					  <span th:case="1" class="stylecss">上学期</span>
					  					  <span th:case="2" class="stylecss">下学期</span>
					    				  <span th:case="*" ></span>
										</td>
					                    <td style="text-align: center;"  >
												 <input type="number" th:value="${sort.num}" th:onBlur="'updateCourseNum(\''+${sort.id}+'\',\''+${sort.num}+'\',this,2)'"  class="dfinput" style="width: 70px; height: 30px;color: red;"  >
										</td>
									<!--	<td   th:utext="${sort.memorize eq '1' } ?'是':'否'" th:styleappend="${sort.memorize eq '1'} ? 'color: red;'  "></td>
										<td   th:utext="${sort.understanding eq '1' } ?'是':'否' " th:styleappend="${sort.understanding eq '1'} ? 'color: red;'  "></td>
										<td   th:utext="${sort.apply eq '1' } ?'是':'否'" th:styleappend="${sort.apply eq '1'} ? 'color: red;'  "></td>-->
										<td th:switch="${sort.get('attr_type')}" >
											<span th:case="1">陈述性</span>
											<span th:case="2">程序性</span>
											<span th:case="3">策略性</span>
											<span th:case="*"></span>
										</td>
										<td  th:text="${#calendars.format(sort.create_time,'yyyy-MM-dd')}" ></td>
										<td>
										 <a href="javascript:;"   th:onclick="'updateById(\''+${sort.id}+'\')'"  class="tablelink" >修改</a>
										 <a href="javascript:;"   th:onclick="'deleteById(\''+${sort.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 updateCourseNum(id,oldNum,_this,type){
	var num = $(_this).val();
	if(num == oldNum){
		return false;
	}
	if(num ==''|| num ==null){
		return false;
	}
	$(_this).removeAttr("onBlur");
	$.ajax({
		url : "[[${sysUrl}]]/sys/zuoyb/updateKnowHowDetailSortNum",
		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,"+type+")");
			}else{
				parent.layer.msg('操作失败',{icon: 9})
				$(_this).attr("onBlur","updateCourseNum("+id+","+oldNum+",this,"+type+")");
			}
		}
	});
}


function deleteById(id){
	layer.confirm("确定删除该知识点吗？",
			{icon: 4, btn: ['确定','取消']
	}, function(){
		$.ajax({
			url: '[[${sysUrl}]]/sys/zuoyb/knowHowDetailSortDelete',
			type: "post",
			data:{
				'id': id
			},
			dataType: "json",
			success:function(data){
					
					if(data.meta.success){
						layer.msg("删除成功",{icon:1});
				    	setTimeout(function(){
				    		location.reload();
						},1000);
					}else{
						layer.msg(data.meta.message,{icon:11});
					}
			}
		});
	});
}

function knowHowDetailAdd(howId,libId,howDetailsId){
	layer.open({
	    type: 2,
	    title: "添加知识点版本",
	    closeBtn: 1, //不显示关闭按钮
	    shift: 0.8,
	    //offset: '100px',
		area: ['100%', '100%'],
	    content: "[[${sysUrl}]]/sys/zuoyb/knowHowDetailSortAdd.html?howId="+howId+"&libId="+libId+"&howDetailsId="+howDetailsId
	});
}
function updateById(id){
	layer.open({
	    type: 2,
	    title: "修改知识点版本",
	    closeBtn: 1, //不显示关闭按钮
	    shift: 0.8,
	    //offset: '100px',
		area: ['100%', '100%'],
	    content: "[[${sysUrl}]]/sys/zuoyb/knowHowDetailSortAdd.html?id="+id
	});
}
function getKnowHowSpecialTopic(sortId,courseName,howId,grade,semester,banben){
	layer.open({
	    type: 2,
	    title: "关联单元",
	    closeBtn: 1, //不显示关闭按钮
	    shift: 0.8,
	    //offset: '100px',
	      area: ['80%', '90%'],
	    content: '[[${sysUrl}]]/sys/zuoyb/getknowHowList.html?sortId='+sortId+'&EQ_courseName='+courseName+'&howId='+howId+'&EQ_grade='+grade+'&semester='+semester+'&banben='+banben
	});
}
</script>
</html>