Files
OFD/WebContent/view/creditRecordsList.jsp
2026-03-18 10:19:33 +08:00

290 lines
11 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@ 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:"CreditRecordsServlet?method=CreditRecordsList&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:'number',title:'学号',width:120},
{field:'studentName',title:'学生',width:80},
{field:'userName',title:'操作人',width:80},
{field:'clazzName',title:'班级名称',width:80},
{field:'credit',title:'学分',width:80},
{field:'creditType',title:'增减范围',width:80,
formatter: function(value,row,index){
switch(row.creditType){
case '1':{
return '本周学分';
}
case '2':{
return '本科学分';
}
}
}
},
{field:'remark',title:'批注',width:300},
{field:'createTime',title:'操作时间',width:150,
formatter: function(value,row,index){
var date = row.createTime;
if (date){
return date.year + '-' + date.monthValue + '-' + date.dayOfMonth + ' ' + date.hour + ':' + date.minute;
} else {
return date;
}
}
}
]],
toolbar: "#toolbar"
});
//设置分页控件
var p = $('#dataList').datagrid('getPager');
$(p).pagination({
pageSize: 10,//每页显示的记录条数默认为10
pageList: [10,20,30,50,100],//可以设置每页记录条数的列表
beforePageText: '第',//页数文本框前显示的汉字
afterPageText: '页 共 {pages} 页',
displayMsg: '当前显示 {from} - {to} 条记录 共 {total} 条记录',
});
//搜索按钮监听事件
$("#search-btn").click(function(){
$('#dataList').datagrid('load',{
studentName: $("#search_student_name").val(),
number: $("#search_number").val(),
clazzName: $("#search_clazz_name").val(),
creditType: $("#search_credit_type").combobox('getValue'),
startTime: $("#startTime").combobox('getValue'),
endTime: $("#endTime").combobox('getValue')
});
});
//清空搜索条件
$("#clear-btn").click(function(){
$('#dataList').datagrid("reload",{});
$("#search_student_name").textbox('setValue', "");
$("#search_number").textbox('setValue', "");
$("#search_clazz_name").textbox('setValue', "");
$("#search_credit_type").combobox('clear');
$("#startTime").textbox('setValue', "");
$("#endTime").textbox('setValue', "");
});
//设置工具类按钮
$("#add").click(function(){
$("#addDialog").dialog("open");
});
//设置添加窗口
$("#addDialog").dialog({
title: "学分增减变动",
width: 650,
height: 450,
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: "CreditRecordsServlet?method=AddCreditRecords",
data: $("#addForm").serialize(),
success: function(msg){
if(msg == "success"){
$.messager.alert("消息提醒","变动成功!","info");
//关闭窗口
$("#addDialog").dialog("close");
//刷新
$('#dataList').datagrid("reload");
} else{
$.messager.alert("消息提醒","变动失败!","warning");
return;
}
}
});
}
}
},
{
text:'重置',
plain: true,
iconCls:'icon-book-reset',
handler:function(){
$("#add_studentList").textbox('setValue', "");
$("#add_creditType").textbox('setValue', "");
$("#add_mathType").textbox('setValue', "");
$("#add_credit").textbox('setValue', "");
$("#add_remark").textbox('setValue', "");
}
},
]
});
//添加信息学生选择框
$("#add_studentList").combobox({
url: "StudentServlet?method=StudentList&t="+new Date().getTime()+"&from=combox",
onLoadSuccess: function(){
//默认选择第一条数据
var data = $(this).combobox("getData");
$(this).combobox("setValue", data[0].id);
}
});
//下拉框通用属性
$("#add_studentList").combobox({
width: "200",
height: "30",
valueField: "studentId",
textField: "name",
multiple: false, //不可多选
editable: true, //可编辑
method: "post",
limitToList: "true" //模糊搜索
});
//datebox开始时间限制结束时间datebox截止日期要比起始日期大
$("#startTime").datebox({
onSelect : function(beginDate){
$('#endTime').datebox().datebox('calendar').calendar({
validator: function(date){
return beginDate<date;
}
});
}
});
//导出按钮监听事件
$("#export").click(function(){
studentName = $("#search_student_name").val(),
number = $("#search_number").val(),
clazzName = $("#search_clazz_name").val(),
creditType = $("#search_credit_type").combobox('getValue'),
startTime = $("#startTime").combobox('getValue'),
endTime = $("#endTime").combobox('getValue')
url = 'CreditRecordsServlet?method=ExportCreditRecordsList&studentName='+studentName+"&number="+number+"&clazzName="+clazzName+"&creditType="+creditType+"&startTime="+startTime+"&endTime="+endTime;
window.location.href = url;
});
});
</script>
<script type="text/javascript">
function myformatter(date){
var y = date.getFullYear();
var m = date.getMonth()+1;
var d = date.getDate();
return y+'-'+(m<10?('0'+m):m)+'-'+(d<10?('0'+d):d);
}
function myparser(s){
if (!s) return new Date();
var ss = (s.split('-'));
var y = parseInt(ss[0],10);
var m = parseInt(ss[1],10);
var d = parseInt(ss[2],10);
if (!isNaN(y) && !isNaN(m) && !isNaN(d)){
return new Date(y,m-1,d);
} else {
return new Date();
}
}
</script>
</head>
<body>
<!-- 数据列表 -->
<table id="dataList" cellspacing="0" cellpadding="0"></table>
<!-- 工具栏 -->
<div id="toolbar">
<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>
<div style="margin-top: 3px;">
学生:<input id="search_student_name" class="easyui-textbox" name="studentName" />
学号:<input id="search_number" class="easyui-textbox" name="number" />
班级:<input id="search_clazz_name" class="easyui-textbox" name="clazzName" />
增减范围:
<select id="search_credit_type" class="easyui-combobox" name="creditType" style="width: 200px;">
<option value=""></option>
<option value="2">本科学分</option>
<option value="1">本周学分</option>
</select>
</div>
<br>
<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>
日期:<input id="startTime" name="startTime" class="easyui-datebox" format="yyyy-MM-dd HH:mm:ss" timeFormat="HH:mm:ss" showTime="true" showOkButton="true" showClearButton="false" data-options="formatter:myformatter,parser:myparser"/>
<span style="width: 3% ; text-align: center">-</span>
<input id="endTime" name="endTime" class="easyui-datebox" format="yyyy-MM-dd HH:mm:ss" timeFormat="HH:mm:ss" showTime="true" showOkButton="true" showClearButton="false" data-options="formatter:myformatter,parser:myparser"/>
<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><input style="width: 200px; height: 30px;" id="add_studentList" class="easyui-textbox" name="studentId" data-options="required:true, missingMessage:'请选择学生'" /></td>
<td>范围:</td>
<td>
<select style="width: 200px; height: 30px;" id="add_creditType" class="easyui-combobox" name="creditType" data-options="required:true, missingMessage:'请选择范围'" >
<option value="2">本科学分</option>
<option value="1">本周学分</option>
</select>
</td>
</tr>
<tr>
<td>增减:</td>
<td>
<select style="width: 200px; height: 30px;" id="add_mathType" class="easyui-combobox" name="mathType" data-options="required:true, missingMessage:'请选择增减'" >
<option value="1">减学分</option>
<option value="2">加学分</option>
</select>
</td>
<td>学分:</td>
<td><input id="add_credit" style="width: 200px; height: 30px;" class="easyui-textbox" type="text" name="credit" validType="number" data-options="required:true, missingMessage:'请输入学分'" /></td>
</tr>
<tr>
<td>批复:</td>
<td colspan="2">
<textarea id="add_remark" name="remark" style="width: 300px; height: 160px;" class="easyui-textbox" data-options="multiline:true,required:true, missingMessage:'批复不能为空'" ></textarea>
</td>
</tr>
</table>
</form>
</div>
</body>
</html>