<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: 70px;
	}
	.date_width{
	     width: 100px;
	}
</style>
<body>
<div class="place">
	<span>位置：</span>
	<ul class="placeul">
		<li><a href="#">后台系统管理</a></li>
		<li><a th:href="@{/sys/sales/libStaffingList.html}">总部销售人员管理</a></li>
	</ul>
</div>
<div class="rightinfo">
	<form id="seachform" th:action="@{/sys/sales/libStaffingList.html}" method="post">
	<ul class="seachform">
		<li>
			<label>销售人员</label>
			<input name="LIKE_user.name" type="text" class="scinput" th:value="${search.get('LIKE_user.name')}"/>
		</li>
		<li>
			<label>&nbsp;</label>
			<input type="button" class="scbtn" value="查询" />
		</li>
		<li>
				<ul class="toolbar" onclick="getUserList('SSJ','SSJ-SSJ-XX','SSJ')">
					<li class="click"><span><img th:src="@{/static/sys/images/t01.png}" /></span>新增</li>
				</ul>
		</li>
	</ul>
	</form>
	<table class="tablelist">
		<thead>
		    <tr>
		        <th style="width: 80px;">序号</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.user.name}" ></td>
					<td  class="imgtd">
							<img  th:if="${item.user.photo}!=null" th:src="${imgUrl}+''+${item.user.photo}+'?x-oss-process=image/resize,m_lfit,h_100,w_100'" style="width: 50px;height: 50px;" />
					</td>
					<td  th:text="${#calendars.format(item.createTime,'yyyy-MM-dd HH:mm:ss')}" ></td>
					<td >
						<a href="javascript:;"  th:onclick="'deleteById(\''+${item.id}+'\',\''+${item.name}+'\',\''+${item.type}+'\',\''+${item.libId}+'\')'"   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 getUserList(libId,orgCode,type){
	layer.open({
	    type: 2,
	    title: "添加总部销售人员",
	    closeBtn: 1, //不显示关闭按钮
	    shift: 0.8,
	    //offset: '100px',
	    area: ['80%', '90%'],
	    content: '[[${sysUrl}]]/sys/sales/getUserList.html?orgCode='+orgCode+'&type='+type+'&libId='+libId
	});
}
function deleteById(id){
	layer.confirm("确定删除该用户？",
			{icon: 4, btn: ['确定','取消']
	}, function(){
		$.ajax({
			url: '[[${sysUrl}]]/sys/sales/libStaffingDelete',
			type: "post",
			data:{
				'id': id,
				'name': name,
				'type': type,
				'libId': libId
			},
			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>