indexUser.html
4.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<title>员工列表</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" type="image/x-icon" href="/power/img/favicon.ico">
<!-- 引入 Bootstrap -->
<link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="row clearfix">
<div class="col-md-12 column">
<div class="page-header">
<h1>
欢迎 <span th:if="${session.user!=null}" th:text="${session.user.userName}"></span>
</h1>
<div><a th:href="@{/user/logout}">退出登录</a></div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4 column">
<a class="btn btn-primary" th:href="@{/user/addUser}">添加员工</a>
<!-- <a class="btn btn-primary" th:href="@{/employee/queryAllEmployees}">显示全部员工</a>-->
</div>
<div class="col-md-4 column"></div>
<div class="col-md-4 column">
<form class="form-inline" th:action="@{/user/page}" method="post" style="float: right">
<span style="color:red;font-weight: bold">
</span>
<input type="text" name="searchName" class="form-control" th:value="${searchName}"
placeholder="登录名/姓名/手机号">
<input type="submit" value="查询" class="btn btn-primary">
</form>
</div>
</div>
<div class="row clearfix">
<div class="col-md-12 column">
<table class="table table-hover table-striped">
<thead>
<tr>
<th>登录名</th>
<th>姓名</th>
<th>手机号</th>
<th>头像</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr th:each="user,state:${list}">
<td><span th:text="${user.loginName}"></span></td>
<td><span th:text="${user.userName}"></span></td>
<td><span th:text="${user.mobile}"></span></td>
<!-- <td><img th:src="@{/photo/}+${user.photo}" width="30px"></td>-->
<!-- <td><span th:text="${#dates.format(emp.birthday,'yyyy-MM-dd')}"></span></td>-->
<td>
<a th:if="${(session != null && session.user != null) && (user.userName == session.user.userName || session.user.loginName == 'admin')}" th:href="@{/user/toUpdateUser/} + ${user.userId}">编辑</a>
<a th:if="${user.loginName != 'admin' && (session != null && session.user != null) && session.user.loginName == 'admin'}" href="javascript:;" th:onclick="confirmDelete([[${user.userId}]])"> | 删除</a>
<a th:if="${(session != null && session.user != null) && (user.userName == session.user.userName || session.user.loginName == 'admin')}" th:href="@{/user/toUpdatePasswd/} + ${user.userId}"> | 修改密码</a>
<a th:if="${(session != null && session.user != null) && (user.userName == session.user.userName || session.user.loginName == 'admin')}" href="javascript:;" th:onclick="resertPasswd([[${user.userId}]])"> | 重置密码</a>
</td>
</tr>
</c:forEach>
<script>
function confirmDelete(userId) {
// alert(userId);
if (window.confirm("确定要删除该人员吗?")) {
location.href = "[[@{/user/deleteUser/}]]" + userId;
}
}
function resertPasswd(userId) {
// alert(userId);
if (window.confirm("确定要重置密码吗?重置后密码为\"hczd\"")) {
location.href = "[[@{/user/resertPasswd/}]]" + userId;
alert("重置成功");
}
}
</script>
</tbody>
</table>
<p>
<a th:href="@{page(pageNo=1, searchName=${searchName})}">首页 </a>
<a th:if="${current} != 1" th:href="@{page(pageNo=${current}-1, searchName=${searchName})}">上一页 </a>
<a th:if="${current} != ${pages}" th:href="@{page(pageNo=${current}+1, searchName=${searchName})}">下一页 </a>
<a th:href="@{page(pageNo=${pages}, searchName=${searchName})}">末页 </a>
第 <span th:text="${current}"></span> 页
总数:<span th:text="${total}"></span>
</p>
</div>
</div>
</div>
</body>
</html>