branch_li
LFF 3 months ago
parent 908c02403a
commit ba64413ead

@ -26,17 +26,22 @@
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script> <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
<![endif]--> <![endif]-->
<script> <script>
function changePageSize() { function changePageSize()
{
//获取下拉框的值 //获取下拉框的值
var pageSize = $("#changePageSize").val(); var pageSize = $("#changePageSize").val();
//向服务器发送请求,改变每页显示条数 //向服务器发送请求,改变每页显示条数
location.href = "${pageContext.request.contextPath}/dorm/findAll?page=1&size="+ pageSize; location.href = "${pageContext.request.contextPath}/dorm/findAll?page=1&size="+ pageSize;
} }
$("#serarch_btn").click(function () {
$("#serarch_btn").click(function ()
{
var keyword = $("#keyword").val(); var keyword = $("#keyword").val();
location.href="${pageContext.request.contextPath}/dorm/findAll?page=1&size=5&keyword="+keyword; location.href="${pageContext.request.contextPath}/dorm/findAll?page=1&size=5&keyword="+keyword;
}); });
$("#refresh").click(function () {
$("#refresh").click(function ()
{
$("#myform").reset(); $("#myform").reset();
location.href="${pageContext.request.contextPath}/dorm/findAll?page=1&size=5"; location.href="${pageContext.request.contextPath}/dorm/findAll?page=1&size=5";
}); });
@ -85,6 +90,7 @@
<th style="text-align: center">宿舍奖惩</th> <th style="text-align: center">宿舍奖惩</th>
<th style="text-align: center">宿舍长</th> <th style="text-align: center">宿舍长</th>
<th style="text-align: center">育人导师</th> <th style="text-align: center">育人导师</th>
<!--当前用户的权限大于2则显示“操作”列-->
<c:if test="${sessionScope.adminInfo.power > 2}"> <c:if test="${sessionScope.adminInfo.power > 2}">
<th style="text-align: center">操作</th> <th style="text-align: center">操作</th>
</c:if> </c:if>
@ -93,6 +99,8 @@
<% <%
int j = 1; int j = 1;
%> %>
<!--通过JSTL标签<c:forEach>循环遍历pageInfo.list中的每个宿舍对象dorm-->
<c:forEach items="${pageInfo.list}" var="dorm"> <c:forEach items="${pageInfo.list}" var="dorm">
<tr id="light" style="text-align: center"> <tr id="light" style="text-align: center">
<td><%=j++%></td> <td><%=j++%></td>
@ -118,6 +126,7 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
<!--关闭表格和外层容器的标签-->
</div> </div>
<div class="pull-left"> <div class="pull-left">
<div class="form-group form-inline"> <div class="form-group form-inline">
@ -186,7 +195,8 @@
<script> <script>
//查看详情 //查看详情
function look(id) { function look(id)
{
layer.open({ layer.open({
type: 2, type: 2,
title:'宿舍详情', title:'宿舍详情',
@ -194,14 +204,20 @@
area: ['800px', '430px'], //宽高 area: ['800px', '430px'], //宽高
content: '${pageContext.request.contextPath}/dorm/look?id='+id content: '${pageContext.request.contextPath}/dorm/look?id='+id
}); });
} }
//导出Excel操作 //导出Excel操作
function exportInfo(power) { function exportInfo(power)
if (power < 3) { {
if (power < 3)
{
layer.msg('对不起,您没有权限导出宿舍信息'); layer.msg('对不起,您没有权限导出宿舍信息');
return false; return false;
} }
layer.confirm('确定导出所有宿舍数据吗?',function (index) {
layer.confirm('确定导出所有宿舍数据吗?',function (index)
{
location.href="${pageContext.request.contextPath}/dorm/export"; location.href="${pageContext.request.contextPath}/dorm/export";
layer.close(index); layer.close(index);
}); });

@ -96,21 +96,25 @@
</table> </table>
</form> </form>
<script> <script>
$(function () { $(function ()
{
//ajax校验学号已被注册 //ajax校验学号已被注册
$("#sno").change(function () { $("#sno").change(function ()
{
//取sno的值 //取sno的值
var sno = $(this).val(); var sno = $(this).val();
//ajax异步请求 //ajax异步请求
$.get("${pageContext.request.contextPath}/student/isExist",{"sno":sno},function (date) { $.get("${pageContext.request.contextPath}/student/isExist",{"sno":sno},function (date) {
//$(".error").html(msg); //$(".error").html(msg);
if (date) { if (date)
{
layer.msg('学号已被注册,请重新输入!'); layer.msg('学号已被注册,请重新输入!');
return false; return false;
} }
}); });
}); });
}); });
$("#add-student").click(function () { $("#add-student").click(function () {
var name = $("#name").val().trim(); var name = $("#name").val().trim();
var sex = $("#sex").val().trim(); var sex = $("#sex").val().trim();
@ -122,10 +126,12 @@
var teacher = $("#teacher").val().trim(); var teacher = $("#teacher").val().trim();
var status = $("#status").val().trim(); var status = $("#status").val().trim();
if (name == 0 || sex == 0 || sno == 0 || stu_class == 0 || phone == 0 || place == 0 || teacher == 0) { if (name == 0 || sex == 0 || sno == 0 || stu_class == 0 || phone == 0 || place == 0 || teacher == 0)
{
layer.msg('字段不能为空'); layer.msg('字段不能为空');
return false; return false;
} }
$.ajax({ $.ajax({
url: "${pageContext.request.contextPath}/student/add",//要请求的服务器url url: "${pageContext.request.contextPath}/student/add",//要请求的服务器url
//这是一个对象表示请求的参数两个参数method=ajax&val=xxx服务器可以通过request.getParameter()来获取 //这是一个对象表示请求的参数两个参数method=ajax&val=xxx服务器可以通过request.getParameter()来获取
@ -141,14 +147,19 @@
teacher:teacher, teacher:teacher,
status:status status:status
}, },
type: "POST", //请求方式为POST type: "POST", //请求方式为POST
dataType: "json", dataType: "json",
success:function(result){ //这个方法会在服务器执行成功时被调用 参数data就是服务器返回的值(现在是json类型) success:function(result)
{ //这个方法会在服务器执行成功时被调用 参数data就是服务器返回的值(现在是json类型)
//alert(result); //alert(result);
if(result){ if(result)
{
layer.msg('添加成功!'); layer.msg('添加成功!');
setTimeout(function () {window.location.href='${pageContext.request.contextPath}/dorm/byDorm_leader?uid=${sessionScope.adminInfo.uid}';},2000); setTimeout(function () {window.location.href='${pageContext.request.contextPath}/dorm/byDorm_leader?uid=${sessionScope.adminInfo.uid}';},2000);
}else { }
else
{
layer.msg('添加失败,请联系管理员'); layer.msg('添加失败,请联系管理员');
setTimeout(function () {window.location.href='${pageContext.request.contextPath}/dorm/byDorm_leader?uid=${sessionScope.adminInfo.uid}';},2000); setTimeout(function () {window.location.href='${pageContext.request.contextPath}/dorm/byDorm_leader?uid=${sessionScope.adminInfo.uid}';},2000);
} }

@ -26,17 +26,22 @@
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script> <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
<![endif]--> <![endif]-->
<script> <script>
function changePageSize() { function changePageSize()
{
//获取下拉框的值 //获取下拉框的值
var pageSize = $("#changePageSize").val(); var pageSize = $("#changePageSize").val();
//向服务器发送请求,改变每页显示条数 //向服务器发送请求,改变每页显示条数
location.href = "${pageContext.request.contextPath}/student/findAll?page=1&size="+ pageSize; location.href = "${pageContext.request.contextPath}/student/findAll?page=1&size="+ pageSize;
} }
$("#serarch_btn").click(function () {
$("#serarch_btn").click(function ()
{
var keyword = $("#keyword").val(); var keyword = $("#keyword").val();
location.href="${pageContext.request.contextPath}/student/findAll?page=1&size=5&keyword="+keyword; location.href="${pageContext.request.contextPath}/student/findAll?page=1&size=5&keyword="+keyword;
}); });
$("#refresh").click(function () {
$("#refresh").click(function ()
{
$("#myform").reset(); $("#myform").reset();
location.href="${pageContext.request.contextPath}/student/findAll?page=1&size=5"; location.href="${pageContext.request.contextPath}/student/findAll?page=1&size=5";
}); });

@ -26,20 +26,26 @@
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script> <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
<![endif]--> <![endif]-->
<script> <script>
function changePageSize() { function changePageSize()
{
//获取下拉框的值 //获取下拉框的值
var pageSize = $("#changePageSize").val(); var pageSize = $("#changePageSize").val();
//向服务器发送请求,改变每页显示条数 //向服务器发送请求,改变每页显示条数
location.href = "${pageContext.request.contextPath}/dorm/findAll?page=1&size="+ pageSize; location.href = "${pageContext.request.contextPath}/dorm/findAll?page=1&size="+ pageSize;
} }
$("#serarch_btn").click(function () {
$("#serarch_btn").click(function ()
{
var keyword = $("#keyword").val(); var keyword = $("#keyword").val();
location.href="${pageContext.request.contextPath}/dorm/findAll?page=1&size=5&keyword="+keyword; location.href="${pageContext.request.contextPath}/dorm/findAll?page=1&size=5&keyword="+keyword;
}); });
$("#refresh").click(function () {
$("#refresh").click(function ()
{
$("#myform").reset(); $("#myform").reset();
location.href="${pageContext.request.contextPath}/dorm/findAll?page=1&size=5"; location.href="${pageContext.request.contextPath}/dorm/findAll?page=1&size=5";
}); });
</script> </script>
</head> </head>
<body> <body>
@ -107,8 +113,8 @@
</div> </div>
<script> <script>
//查看详情 function look(id) //查看详情
function look(id) { {
layer.open({ layer.open({
type: 2, type: 2,
title:'宿舍详情', title:'宿舍详情',

Loading…
Cancel
Save