<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: 220px;
	}
	.date_width{
	     width: 150px;
	}
</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/dispatcher/libRadomApplyList.html}" method="post">
			<ul class="seachform">

				<li>
					<label>图书馆名称：</label>
					<input type="text" id="leagueName" name="leagueName" th:value="${search.get('leagueName')}" class="scinput date_width " placeholder="图书馆">
				</li>
				<li>
					<input type="button" class="scbtn" value="查询" />
				</li>



			</ul>
		</form>
	<table class="tablelist">
		<thead>
		    <tr>
				<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 th:text="${itemStat.count}"></td>
				<td th:text="${item.get('league_name')}"></td>
				<td th:text="${item.get('bookSize')}"></td>
				<td  th:text="${item.get('grades')}"></td>
				<td th:text="${item.get('theme')}"></td>
				<td th:text="${item.get('stateSrc')}"></td>
				<td>
					<a th:if="${item.get('state')==null}"  href="javascript:;" id="createBook"   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 updateById(id){
		$("#createBook").removeAttr("onclick");
		var url="[[${sysUrl}]]/sys/dispatcher/saveApplyRadom";
		$.ajax({
			url: url,
			type: "post",
			data:{
				'id': id
			},
			dataType: "json",
			success:function(data){
				if(data.code="999"){
					parent.layer.msg("操作成功",{icon:1});
					window.setTimeout(function(){
						location.reload();
					},3000);

				}else{
					parent.layer.msg(data.msg,{icon:11});
					window.setTimeout(function(){
						location.reload();
					},3000);
				}
			}
		});
	}
</script>
</html>