Files
OFD/WebContent/view/leaveList.jsp

409 lines
14 KiB
Plaintext
Raw Normal View History

2026-03-18 10:19:33 +08:00
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<meta charset="UTF-8">
<title>请假列表</title>
<link rel="stylesheet" type="text/css" href="static/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="static/easyui/themes/icon.css">
<link rel="stylesheet" type="text/css" href="static/easyui/css/demo.css">
<script type="text/javascript" src="static/easyui/jquery.min.js"></script>
<script type="text/javascript" src="static/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="static/easyui/js/validateExtends.js"></script>
<script type="text/javascript">
$(function() {
//datagrid初始化
$('#dataList').datagrid({
title:'请假列表',
iconCls:'icon-more',//图标
border: true,
collapsible: false,//是否可折叠的
fit: true,//自动大小
method: "post",
url:"LeaveServlet?method=LeaveList&t="+new Date().getTime(),
idField:'id',
singleSelect: false,//是否单选
pagination: true,//分页控件
rownumbers: true,//行号
sortName:'id',
sortOrder:'DESC',
remoteSort: false,
columns: [[
{field:'chk',checkbox: true,width:50},
{field:'id',title:'ID',width:50, sortable: true},
{field:'studentId',title:'学生',width:80,
formatter: function(value,row,index){
if (row.studentId){
var studentList = $("#studentList").combobox("getData");
for(var i=0;i<studentList.length;i++ ){
if(row.studentId == studentList[i].studentId)return studentList[i].name;
}
return row.studentId;
} else {
return 'not found';
}
}
},
{field:'info',title:'请假原因',width:300},
{field:'teacherId',title:'审批人',width:80,
formatter: function(value,row,index){
if (row.teacherId){
var teacherList = $("#teacherList").combobox("getData");
for(var i=0;i<teacherList.length;i++ ){
if(row.teacherId == teacherList[i].teacherId)return teacherList[i].name;
}
return row.teacherId;
} else {
return 'not found';
}
}
},
{field:'status',title:'状态',width:60,
formatter: function(value,row,index){
switch(row.status){
case '0':{
return '等待审核';
}
case '1':{
return '审核通过';
}
case '2':{
return '审核不通过';
}
}
}
},
{field:'remark',title:'批复内容',width:300},
{field:'applyTime',title:'申请时间',width:80,
formatter: function(value,row,index){
if (row.applyTime){
return row.applyTime.year + '-' + row.applyTime.monthValue + '-' + row.applyTime.dayOfMonth + ' ' + row.applyTime.hour + ':' + row.applyTime.minute;
} else {
return row.applyTime;
}
}
},
{field:'approveTime',title:'审批时间',width:80,
formatter: function(value,row,index){
if (row.approveTime){
return row.approveTime.year + '-' + row.approveTime.monthValue + '-' + row.approveTime.dayOfMonth + ' ' + row.approveTime.hour + ':' + row.approveTime.minute;
} else {
return row.approveTime;
}
}
}
]],
toolbar: "#toolbar",
onBeforeLoad : function(){
try{
$("#studentList").combobox("getData");
$("#teacherList").combobox("getData")
}catch(err){
preLoadStudent();
preLoadTeacher();
}
}
});
//提前加载学生信息
function preLoadStudent(){
$("#studentList").combobox({
width: "150",
height: "25",
valueField: "studentId",
textField: "name",
multiple: false, //不可多选
editable: true, //可编辑
method: "post",
limitToList: "true", //模糊搜索
url: "StudentServlet?method=StudentList&t="+new Date().getTime()+"&from=combox",
onChange: function(newValue, oldValue){
}
});
}
//提前加载教师信息
function preLoadTeacher(){
$("#teacherList").combobox({
width: "150",
height: "25",
valueField: "teacherId",
textField: "name",
multiple: false, //可多选
editable: false, //不可编辑
method: "post",
url: "LeaveServlet?method=ApproveTeacher&t="+new Date().getTime(),
onChange: function(newValue, oldValue){
}
});
}
//设置分页控件
var p = $('#dataList').datagrid('getPager');
$(p).pagination({
pageSize: 10,//每页显示的记录条数默认为10
pageList: [10,20,30,50,100],//可以设置每页记录条数的列表
beforePageText: '第',//页数文本框前显示的汉字
afterPageText: '页 共 {pages} 页',
displayMsg: '当前显示 {from} - {to} 条记录 共 {total} 条记录',
});
//设置工具类按钮
$("#add").click(function(){
$("#addDialog").dialog("open");
});
//设置审核按钮
$("#check").click(function(){
var selectRows = $("#dataList").datagrid("getSelections");
if(selectRows.length != 1){
$.messager.alert("消息提醒", "请选择一条数据进行操作!", "warning");
} else{
if(selectRows[0].status != 0){
$.messager.alert("消息提醒", "该请假信息已被审核,请勿重复审核!", "warning");
return;
}
$("#checkDialog").dialog("open");
}
});
//审核请假信息
$("#checkDialog").dialog({
title: "审核请假信息",
width: 450,
height: 350,
iconCls: "icon-edit",
modal: true,
collapsible: false,
minimizable: false,
maximizable: false,
draggable: true,
closed: true,
buttons: [
{
text:'提交',
plain: true,
iconCls:'icon-add',
handler:function(){
var validate = $("#checkForm").form("validate");
if(!validate){
$.messager.alert("消息提醒","请检查你输入的数据!","warning");
return;
} else{
$.ajax({
type: "post",
url: "LeaveServlet?method=CheckLeave",
data: $("#editForm").serialize(),
success: function(msg){
if(msg == "success"){
$.messager.alert("消息提醒","审核成功!","info");
//关闭窗口
$("#checkDialog").dialog("close");
//清空原表格数据
$("#check_remark").textbox('setValue',"");
//重新刷新页面数据
$('#dataList').datagrid("reload");
$('#dataList').datagrid("uncheckAll");
} else{
$.messager.alert("消息提醒","审核失败!","warning");
return;
}
}
});
}
}
},
{
text:'重置',
plain: true,
iconCls:'icon-reload',
handler:function(){
$("#check_remark").textbox('setValue', "");
$("#check_statusList").textbox('setValue', "");
}
},
],
onBeforeOpen: function(){
var selectRow = $("#dataList").datagrid("getSelected");
$("#edit-id").val(selectRow.id);
$("#edit-studentId").val(selectRow.studentId);
},
onClose: function(){
$("#check_remark").val("");
}
});
//设置添加窗口
$("#addDialog").dialog({
title: "添加请假单",
width: 450,
height: 350,
iconCls: "icon-add",
modal: true,
collapsible: false,
minimizable: false,
maximizable: false,
draggable: true,
closed: true,
buttons: [
{
text:'添加',
plain: true,
iconCls:'icon-book-add',
handler:function(){
var validate = $("#addForm").form("validate");
if(!validate){
$.messager.alert("消息提醒","请检查你输入的数据!","warning");
return;
} else{
$.ajax({
type: "post",
url: "LeaveServlet?method=AddLeave",
data: $("#addForm").serialize(),
success: function(msg){
if(msg == "success"){
$.messager.alert("消息提醒","添加成功!","info");
//关闭窗口
$("#addDialog").dialog("close");
//清空原表格数据
//$("#add_name").textbox('setValue', "");
//刷新
$('#dataList').datagrid("reload");
} else{
$.messager.alert("消息提醒","添加失败!","warning");
return;
}
}
});
}
}
},
{
text:'重置',
plain: true,
iconCls:'icon-book-reset',
handler:function(){
$("#info").textbox('setValue', "");
}
},
]
});
//下拉框通用属性
$("#studentList").combobox({
width: "200",
height: "30",
valueField: "studentId",
textField: "name",
multiple: false, //不可多选
editable: true, //可编辑
method: "post",
limitToList: "true", //模糊搜索
});
$("#teacherList").combobox({
width: "200",
height: "30",
valueField: "teacherId",
textField: "name",
multiple: false, //不可多选
editable: false, //不可编辑
method: "post",
});
//搜索按钮监听事件
$("#search-btn").click(function(){
$('#dataList').datagrid('load',{
studentId: $("#studentList").combobox('getValue') == '' ? 0 : $("#studentList").combobox('getValue'),
teacherId: $("#teacherList").combobox('getValue') == '' ? 0 : $("#teacherList").combobox('getValue'),
status: $("#status").combobox('getValue')
});
});
//导出按钮监听事件
$("#export").click(function(){
studentId = $("#studentList").combobox('getValue') == '' ? 0 : $("#studentList").combobox('getValue'),
teacherId = $("#teacherList").combobox('getValue') == '' ? 0 : $("#teacherList").combobox('getValue'),
status = $("#status").combobox('getValue')
url = 'LeaveServlet?method=ExportLeaveList&studentId='+studentId+"&teacherId="+teacherId+"&status="+status;
window.location.href = url;
});
//清空搜索条件
$("#clear-btn").click(function(){
$('#dataList').datagrid("reload",{});
$("#studentList").combobox('clear');
$("#teacherList").combobox('clear');
$("#status").combobox('clear');
});
});
</script>
</head>
<body>
<!-- 数据列表 -->
<table id="dataList" cellspacing="0" cellpadding="0"></table>
<!-- 工具栏 -->
<div id="toolbar">
<c:if test="${roleCode == 'student'}">
<div style="float: left;"><a id="add" href="javascript:;" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true">添加</a></div>
<div style="float: left;" class="datagrid-btn-separator"></div>
</c:if>
<c:if test="${roleCode == 'teacher' && isCounselor == 'y'}">
<div style="float: left;"><a id="check" href="javascript:;" class="easyui-linkbutton" data-options="iconCls:'icon-edit',plain:true">审核</a></div>
<div style="float: left;" class="datagrid-btn-separator"></div>
</c:if>
<div style="float: left;"><a id="export" href="javascript:;" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true">导出</a></div>
<div style="float: left;" class="datagrid-btn-separator"></div>
<div style="margin-top: 3px;">
学生:<input id="studentList" class="easyui-textbox" name="studentId" />
审批人:<input id="teacherList" class="easyui-textbox" name="teacherId" />
审批状态:
<select id="status" class="easyui-combobox" name="status" style="width: 200px; height: 30px;">
<option value=""></option>
<option value="0">等待审核</option>
<option value="1">审核通过</option>
<option value="2">审核不通过</option>
</select>
<a id="search-btn" href="javascript:;" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true">搜索</a>
<a id="clear-btn" href="javascript:;" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true">清空搜索</a>
</div>
</div>
<!-- 添加数据窗口 -->
<div id="addDialog" style="padding: 10px">
<form id="addForm" method="post">
<table cellpadding="8" >
<tr>
<td>请假原因:</td>
<td>
<textarea id="info" name="info" style="width: 300px; height: 160px;" class="easyui-textbox" data-options="multiline:true,required:true, missingMessage:'请假原因不能为空'" ></textarea>
</td>
</tr>
</table>
</form>
</div>
<!-- 审核数据窗口 -->
<div id="checkDialog" style="padding: 10px">
<form id="editForm" method="post">
<input type="hidden" id="edit-id" name="id">
<input type="hidden" id="edit-studentId" name="studentId">
<table cellpadding="8" >
<tr>
<td style="width:60px">审核:</td>
<td colspan="3">
<select id="check_statusList" style="width: 300px; height: 30px;" class="easyui-combobox" name="status" data-options="required:true, missingMessage:'请选择状态'" >
<option value="1">审核通过</option>
<option value="2">审核不通过</option>
</select>
</td>
</tr>
<tr>
<td>批复内容:</td>
<td>
<textarea id="check_remark" name="remark" style="width: 300px; height: 160px;" class="easyui-textbox" data-options="multiline:true" ></textarea>
</td>
</tr>
</table>
</form>
</div>
</body>
</html>