<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/bookList/materielList.html}" method="post">
	  <input type="hidden" name="type" id="reportType" />
	<ul class="seachform">
			
			<li>
				<label>物料名称</label>
				<input type="text" id="materielName" name="materielName" th:value="${search.get('materielName')}" class="scinput date_width " placeholder="物料名称">
			</li>

			<li>
				<input type="button" class="scbtn" value="查询" />
				<input type="button" id="button" class="scbtn" value="导出" />
			</li>
			<li>
				<ul class="toolbar">
					<a th:href="@{/sys/bookList/materielAdd.html}"><li class="click"><span><img th:src="@{/static/sys/images/t01.png}" /></span>物料入库</li></a>
					<a th:href="@{/sys/bookList/materielDel.html}"><li class="click"><span><img th:src="@{/static/sys/images/t03.png}" /></span>物料核销</li></a>
				</ul>
			</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>
				<th>供应商</th>
				<th>入库时间</th>
				<th th:if="${isManager==1}">单价</th>
				<th th:if="${isManager==1}">金额</th>
				<th th:if="${isManager==1}">操作</th>
		    </tr>
		</thead>
		<tbody>
			<tr th:each="item:${list}" >
					<td th:text="${itemStat.count}"></td>
					<td th:text="${item.get('materiel_flow')}"></td>
					<td th:text="${item.get('materiel_name')}"></td>
					<td th:text="${item.get('materie_code')}"></td>
					<td th:text="${item.get('leaf_count')}"></td>
					<td th:text="${item.get('in_count')}"></td>
					<td th:text="${item.get('userd_count')}"></td>
					<td th:text="${item.get('supplier')}"></td>
					<td th:text="${item.get('create_time')}"></td>
					<td th:text="${item.get('price')}" th:if="${isManager==1}"></td>
					<td th:text="${item.get('total_sum')}" th:if="${isManager==1}"></td>
					<td th:if="${isManager==1}"><a th:href="@{/sys/bookList/materielAdd.html(id=${item.get('id')})}"  class="tablelink">修改</a> <a th:if="${isManager==1 && item.get('leaf_count') ==0}" href="javascript:;" th:onclick="'deleteById(\''+${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">
	$("#button").on('click',function(){
		$("#reportType").val(5);
		document.getElementById("seachform").action = "[[${sysUrl}]]/sys/bookList/exportDetail";
		$("#seachform").submit();
		window.setTimeout(function(){
			document.getElementById("seachform").action = "[[${sysUrl}]]/sys/bookList/materielList.html";
		},3000);
	});

	function deleteById(id){
		layer.confirm("确定删除该管理员？",
				{icon: 4, btn: ['确定','取消']
				}, function(){
					$.ajax({
						url: '[[${sysUrl}]]/sys/bookList/materielDelete',
						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});
							}
						}
					});
				});
	}
</script>


</html>