📄 admin.jsp
字号:
<%@ page contentType="text/html; charset=GB2312" pageEncoding="GBK"%>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>学生管理系统</title>
<link rel="stylesheet" type="text/css" media="all" href="./../../css/Style1.css"/>
<script type="text/javascript" language="javascript">
var identity=0;
function updateczylist(){
var groupid=document.czy.groupid.value;
xmlhttp=getxmlhttp();
if(xmlhttp){
var i = Math.floor(Math.random()*1000);
xmlhttp.open("get","/xsglxt/updateczylist?groupid="+groupid+"&adsf="+i,false);
xmlhttp.onreadystatechange=fillczylist;
xmlhttp.send(null);
}
fillrolelist();
}
function getxmlhttp(){
if(window.XMLHttpRequest){
xmlhttp=new XMLHttpRequest();
}else if(typeof ActiveXObject != "undefined"){
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
return xmlhttp;
}
function fillczylist(){
if (xmlhttp.readyState==4) {
var response = xmlhttp.responseXML.documentElement;
//alert(response);
var czylist=document.czy.czymc;
for(i=czylist.options.length-1;i>=0;i--){
czylist.options.remove(i)
}
var rows=response.getElementsByTagName("option");
for(i=0;i<rows.length;i++){
var text=rows[i].childNodes[0].firstChild.nodeValue;
var value=rows[i].childNodes[1].firstChild.nodeValue;
var option=new Option(text,value);
czylist.add(option);
}
}
}
function info(){
if (xmlhttp.readyState==4) {
var response = xmlhttp.responseText;
window.alert(response);
}
}
function remove(){
var czyid=document.czy.czymc.value;
xmlhttp=getxmlhttp();
if(xmlhttp){
var i = Math.floor(Math.random()*1000);
xmlhttp.open("get","/xsglxt/delczy?czyid="+czyid+"&asdfe="+i,false);
xmlhttp.onreadystatechange=info;
xmlhttp.send(null);
}
var j = Math.floor(Math.random()*1000);
window.location.href='/xsglxt/initadmin?idf='+j;
}
function add(){
var url="";
var groupid=document.addczy.groupid.value;
var yhm=document.addczy.yhm.value;
var zsxm=document.addczy.zsxm.value;
var mm=document.addczy.mm.value;
var mm1=document.addczy.mm1.value;
if (zsxm == "" || mm == "" || mm1 == "" || yhm == ""){
alert("请输入完整信息!");
return false;
}
if(mm!=mm1){
alert("两次输入的密码不一致!");
return false;
}
var role=document.addczy.role;
var i = Math.floor(Math.random()*1000);
url ="/xsglxt/addczy?groupid="+groupid+"&yhm="+yhm+"&zsxm="+zsxm+"&mm="+mm+"&awerw="+i;
if(role.length==null){
url+="&roles=";
url+=document.modifyczy.role.value;
}else{
for(i=0;i<role.length;i++){
if(document.addczy.role[i].checked==true){
url+="&roles=";
url+=document.addczy.role[i].value;
}
}
}
xmlhttp=getxmlhttp();
if(xmlhttp){
xmlhttp.open("get",url,false);
xmlhttp.onreadystatechange=info;
xmlhttp.send(null);
}
var j = Math.floor(Math.random()*1000);
window.location.href='/xsglxt/initadmin?ksdf='+j;
}
function modify(){
var url="";
var index=document.czy.czymc.value;
var groupid=document.modifyczy.groupid.value;
var remark=document.modifyczy.remark.value;
var state=document.modifyczy.state.value;
var zsxm=document.modifyczy.zsxm.value;
var mm=document.modifyczy.mm.value;
// if (zsxm == "" || mm == ""){
// alert("请输入完整信息!");
// return false;
//}
var i = Math.floor(Math.random()*1000);
url ="/xsglxt/updateczy?groupid="+groupid+"&state="+state+"&zsxm="+zsxm+"&index="+index+"&remark="+remark+"&mm="+mm+"&dfdsfgdf="+i;//+"&yhm="+yhm;
var role=document.modifyczy.role;
if(role.length==null){
url+="&roles=";
url+=document.modifyczy.role.value;
}else{
for(i=0;i<role.length;i++){
if(document.modifyczy.role[i].checked==true){
url+="&roles=";
url+=document.modifyczy.role[i].value;
}
}
}
xmlhttp=getxmlhttp();
if(xmlhttp){
xmlhttp.open("get",url,false);
xmlhttp.onreadystatechange=info;
xmlhttp.send(null);
}
var j = Math.floor(Math.random()*1000);
window.location.href='/xsglxt/initadmin?jj='+j;
}
function fillrolelist(){
rolediv.innerHTML="";
var czyid=document.getElementById("czymc").value;
if(czyid==""){
return false;
}
var j = Math.floor(Math.random()*1000);
var url="/xsglxt/updateczyrole?czyid="+czyid+"&jj="+j;
xmlhttp=getxmlhttp();
if(xmlhttp){
xmlhttp.open("get",url,false);
xmlhttp.onreadystatechange=fillrole;
xmlhttp.send(null);
}
}
function fillrole(){
if (xmlhttp.readyState==4) {
//if(xmlhttp.status==200){
// window.status="";
var str="";
var response=xmlhttp.responseXML.documentElement;
//alert(response);
var rows=response.getElementsByTagName("js");
var rolediv=document.getElementById("rolediv");
str += "<table class='app' style='font-size:12px' width='100%'>";
document.modifyczy.zsxm.value=response.getElementsByTagName("zxxm")[0].firstChild.nodeValue;
document.modifyczy.mm.value=response.getElementsByTagName("mm")[0].firstChild.nodeValue;
document.modifyczy.remark.value=response.getElementsByTagName("remark")[0].firstChild.nodeValue;
document.modifyczy.state.value=response.getElementsByTagName("czyzt")[0].firstChild.nodeValue;
for(i=0;i<rows.length;i++){
var text=rows[i].childNodes[0].firstChild.nodeValue;
var value=rows[i].childNodes[1].firstChild.nodeValue;
var jss=rows[i].childNodes[2].firstChild.nodeValue;
if(i%5==0){
str+="<tr>";
}
if (jss == '1'){
str += "<td><input type='checkbox' value="+value+" name=role checked='checked' >"+text+"</td>";
}else{
str += "<td><input type='checkbox' value="+value+" name=role >"+text+"</td>";
}
if(i%5==4){
str+="</tr>";
}
}
str += "</tr></table>";
rolediv.innerHTML=str;
// }
}
}
function showmodify(){
if(document.getElementById("czymc").value!=""){
document.getElementById("modifydiv").style.display="";
fillrolelist();
}else{
alert("请先选择操作员信息!");
}
}
</script>
</head>
<body id="mainFrame" onload="updateczylist()">
<div class="part">
<form action="" name="czy">
<div class="part1">
<div class="parttop">
<div class="parttop-L1">
操作员管理
</div>
<div class="parttop-R">
<div class="parttop-select">
院系名称
<select name="groupid" onchange="updateczylist()">
<c:forEach items="${grouplist}" var="row">
<option value='<c:out value="${row.id}"/>'>
<c:out value="${row.strName}"/>
</option>
</c:forEach>
</select>
</div>
<div class="parttop-select">
操作员名称
<select name="czymc" id="czymc" onchange="fillrolelist()"> </select>
</div>
<div class="parttop-list">
<a href="#" onClick='document.getElementById("adddiv").style.display="";document.addczy.groupid.value=document.czy.groupid.value'>添加人员</a>
</div>
<div class="parttop-list">
<a href="#" onClick="showmodify()">修改人员</a>
</div>
<div class="parttop-list">
<a href="#" onClick="remove()">删除人员</a>
</div>
</div>
</div>
</div>
</form>
<div id="adddiv" style="display:none">
<form action="" name="addczy">
<div class="part3">
<div class="parttop3">
<div class="parttop-L3">
添加人员
</div>
<div class="parttop-R">
<table style="font-size: 12px" border=0 width="100%">
<tr class="tr1">
<td align='right'>所属院系名称</td>
<td align='left'>
<div class="parttop-select">
<select name="groupid">
<c:forEach items="${grouplist}" var="row">
<option value='<c:out value="${row.id}"/>'>
<c:out value="${row.strName}"/>
</option>
</c:forEach>
</select>
</div>
</td>
</tr>
<tr class="tr1">
<td align='right'>操作员登陆名称</td>
<td align='left'><input name="yhm"/>(建议用人名字的拼音)</td>
</tr>
<tr class="tr1">
<td align='right'>真实姓名</td>
<td align='left'><input name="zsxm">
</td>
</tr>
<tr class="tr1">
<td align='right'>密码</td>
<td align='left'> <input type="password" name="mm">
</td>
</tr>
<tr class="tr1">
<td align='right'>密码确认</td>
<td align='left'><input type="password" name="mm1">
</td>
</tr>
</table>
</div>
</div>
<div class="partbody">
<table style="font-size: 12px" width="100%">
<tr class="tr1">
<td>【授于角色】</td>
</tr>
</table>
<table style="font-size: 12px" width="100%">
<tr>
<td>
<div>
<c:forEach items="${roles}" var="row" varStatus="statu">
<c:if test="${statu.index mod 7==0}">
<tr >
</c:if>
<td>
<input type="checkbox" name="role" value='<c:out value="${row.id}"/>'/>
<c:out value="${row.name}"> </c:out>
</td>
<!-- <c:if test="${statu.index mod 7==6}"></tr></c:if> -->
</c:forEach>
</div>
</td></tr>
</table>
</div>
</div>
<div class="partfoot">
<div class="partfoot-list">
<a href="#" onClick="add()">添 加</a>
</div>
<div class="partfoot-list">
<a href="#" onClick='document.getElementById("adddiv").style.display="none"'>取 消</a>
</div>
</div>
</form>
</div>
<div id="modifydiv" style="display:none">
<form action="" name="modifyczy">
<div class="part2">
<div class="parttop">
<div class="parttop-L2">
修改信息
</div>
<div class="parttop-R">
</div>
</div>
<div class="partbody">
<table style="font-size: 12px" border=0 width="100%">
<tr class="tr1">
<td>
<div class="parttop-select">
院系名称
<select name="groupid">
<c:forEach items="${grouplist}" var="row">
<option value='<c:out value="${row.id}"/>'>
<c:out value="${row.strName}"/>
</option>
</c:forEach>
</select>
</div><br>
真实姓名
<input name="zsxm"> <br>
密 码
<input name="mm">
<div class="parttop-select">
状 态
<select name="state">
<option value="0">正常</option>
<option value="1">禁止</option>
</select>
</div>
</td>
</tr>
<tr class="tr1">
<td>
备 注
<textarea name="remark" cols="70" rows="5"></textarea>
</td>
</tr>
<tr class="topbody">
<td>【授于角色】</td>
</tr>
<tr class="tr1">
<td>
<div id="rolediv"></div>
</td>
</tr>
</table>
</div>
<div class="partfoot">
<div class="partfoot-list">
<span> <a href="#" onClick="modify()"> 修 改</a> </span>
</div>
<div class="partfoot-list">
<span><a href="#" onclick='document.getElementById("modifydiv").style.display="none"'> 取 消</a></span>
</div>
</div>
</div>
</form>
</div>
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -