<%@page import="javax.swing.text.html.HTML"%>
|
<%@ page language="java" import="java.sql.*" contentType="text/html; charset=UTF-8"
|
pageEncoding="UTF-8"%>
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
<html >
|
<head>
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
<title>权限设置</title>
|
|
<style>
|
|
body,html{
|
width:99%;
|
height:95%
|
}
|
|
|
#shangpin {
|
width: 99%;
|
margin-left: 10px;
|
|
margin-right: 10px;
|
border-collapse:separate;
|
border-spacing: 0px;
|
}
|
|
#shangpin input {
|
width: 97%;
|
height: 20px;
|
text-align: center;
|
outline: none;
|
|
|
}
|
#tbody1 input
|
{
|
height:20px; width:100%; overflow:hidden; border: 0;
|
outline: 0;readyOnly:readyOnly;
|
|
}
|
|
#menu{
|
position:absolute;
|
top:55px;
|
}
|
|
|
#shangpin{
|
left:190px;
|
position:absolute;
|
top:55px;
|
}
|
|
#xinzeng{
|
right:290px;
|
position:absolute;
|
top:55px;
|
}
|
|
|
#fanhui{
|
right:100px;
|
position:absolute;
|
top:55px;
|
}
|
</style>
|
<script src="../../js/jquery-3.4.1.min.js"></script>
|
<link rel="stylesheet" href="../../css/quanxiang.css">
|
<link rel="shortcut icon" href="../../img/3.ico" />
|
|
</head>
|
|
|
<%@include file="../mysqlconnect.jsp"%>
|
<body style='background-color:#D5EAFF'>
|
|
|
<form action="" method="post" >
|
|
<!--主页面左侧菜单栏实现-->
|
|
<div class='menu' id='menu' >
|
<%
|
String adminid=request.getParameter("adminid");
|
String erjibianhao=request.getParameter("erjibianhao1");
|
String anquanma=request.getParameter("anquanma");
|
System.out.println(adminid);
|
String cn="cn";
|
int mid=0;
|
//连接数据库
|
Class.forName(driverClass);{
|
Connection con=DriverManager.getConnection( urlglass,user,password);
|
|
//通过connection数据库链接对象 创建一个statement对象数据库操作对象
|
Statement stmts=con.createStatement();
|
//执行sql语句
|
String anquan="select * from anquanbiao where anquanma = '"+request.getParameter("anquanma")+"' ";
|
ResultSet rss = stmts.executeQuery(anquan);
|
int coun=0;
|
while(rss.next())
|
{
|
coun++;
|
}
|
if(coun==0){
|
|
out.print("<script type='text/javascript'>alert('请先登录后操作');window.parent.location.href='../index.jsp'; </script>");
|
}
|
con.close();
|
}
|
|
|
|
%>
|
|
|
</form>
|
|
</div>
|
<form action="" method="post" >
|
|
|
|
|
|
<div id="chuanshu" style="display:none;">
|
<input type="text" >
|
<input type="text" name="id2">
|
<input type="text" name='mid'>
|
<input type="text" name='caidanid'>
|
<input type="text" name='gongnengid' >
|
<input type="text" name='zhuangtai' >
|
|
|
</div>
|
<div id="data" class='data' align="center">
|
|
<table style='width:50%;' id="shangpin" border="1" align="center" class='shangpin'>
|
<thead>
|
<tr>
|
<th style="width:2px;">序号</th>
|
|
<th style="width:2px;display:none;">用户名id</th>
|
<th style="width:30px;display:none;">模块id</th>
|
<th style="width:30px;display:none;">菜单id</th>
|
<th style="width:30px;display:none;">功能id</th>
|
<th style="width:30px;" >选择 <input style="width:15px;right:500px;position:absolute;" type="checkbox" id='all' > </th>
|
<th style="width:30px;">用户名</th>
|
<th style="width:30px;">功能</th>
|
<th style="width:30px;display:none;">状态</th>
|
|
|
</tr>
|
</thead>
|
|
<tbody id='tbody1'>
|
|
<%
|
|
String erjibianhao1=request.getParameter("erjibianhao1");
|
String caidanid=request.getParameter("erjibianhao1");
|
|
|
//装载一个类并且对其进行实例化的操作
|
Class.forName(driverClass);{
|
Connection con=DriverManager.getConnection( urlglass,user,password);
|
|
//调用存储过程
|
CallableStatement cs = con.prepareCall("{call quanxiangongengchaxun(?,?)}");
|
|
/* if(erjibianhao1==""){
|
cs.setString(2, erjibianhao1);
|
|
}else{
|
cs.setString(2, erjibianhao1);
|
|
} */
|
cs.setString(1, adminid);
|
cs.setString(2, erjibianhao1);
|
//判断订单日期是否为null
|
ResultSet rs = cs.executeQuery();
|
|
int i=1;
|
while(rs.next())
|
{
|
if(i%2!=0){
|
out.println("<tr class='one1' >");
|
}
|
else
|
{
|
out.println("<tr class='double1' >");
|
}
|
out.print("<td style='text-align:center;'><input type='text' readOnly='readOnly' style=' background:#D5EAFF;border:none;' value='"+i+"'></td>");
|
out.print("<td style='display:none;'><input type='text' value='"+adminid+"'></td>");
|
out.print("<td style='display:none;'><input type='text' value='"+rs.getString(5)+"'></td>");
|
out.print("<td style='display:none;'><input type='text' value='"+caidanid+"'></td>");
|
out.print("<td style='display:none;'><input type='text' value='"+rs.getString(1)+"'></td>");
|
out.print("<td><input type='checkbox' onclick='join(this)' class='checkbox_1' id='' value='0' ></td>");
|
out.print("<td><input type='text' readOnly='readOnly' style=' background:#D5EAFF;border:none;' value='"+rs.getString(3)+"'></td>");
|
out.print("<td ><input type='text' readOnly='readOnly' style=' background:#D5EAFF;border:none;' value='"+rs.getString(2)+"'></td>");
|
out.print("<td style='display:none;'><input type='text' class='zhuangtai' value='"+rs.getString(4)+"'></td>");
|
out.println("</tr>");
|
i++;
|
|
}
|
|
con.close();
|
|
}
|
|
|
|
|
%>
|
|
|
|
|
|
|
<%
|
|
try{
|
String id3 =request.getParameter("id2");
|
String mid2 =request.getParameter("mid");
|
String gongnengid2 =request.getParameter("gongnengid");
|
String caidanid1 =request.getParameter("caidanid");
|
String zhuangtai2 =request.getParameter("zhuangtai");
|
if(request.getParameter("tj")!=null){
|
//装载一个类并且对其进行实例化的操作
|
Class.forName(driverClass);{
|
Connection con=DriverManager.getConnection( urlglass,user,password);
|
|
|
CallableStatement cs = con.prepareCall("{call shezhiquanxian(?,?,?,?,?,?,?,?)}");
|
|
cs.setString(1, id3);
|
|
cs.setString(2, mid2);
|
cs.setString(3, caidanid1);
|
cs.setString(4, gongnengid2);
|
cs.setString(5, zhuangtai2);
|
cs.setString(6, request.getRemoteAddr());
|
cs.setString(7, request.getParameter("adminid"));
|
|
cs.registerOutParameter(8 , java.sql.Types.INTEGER);
|
cs.execute();
|
int fanhui=cs.getInt(8);
|
if(fanhui==5000){
|
out.print("<script type='text/javascript'>alert('设置权限成功!');window.history.back(-1); </script>");
|
|
}else{
|
out.print("<script type='text/javascript'>alert('设置权限失败!');window.history.back(-1); </script>");
|
}
|
con.close();
|
}
|
}
|
}catch(Exception e){
|
out.print("<script type='text/javascript'>alert('设置权限失败,出现未知错误!'); console.log(\""+ e.toString() +"\")</script>");
|
}
|
|
%>
|
|
|
<tbody>
|
</table>
|
<div id="bc">
|
<button type="submit" name="tj" style="float: right;width: 10%; height: 30px;;outline: 0;border: 0; background-color:#5CADFE;" id="xinzeng" onclick="zhenghe()" value='0' >确定</button>
|
</div>
|
|
|
<div id="fh">
|
<button id='fanhui' type="button" style="float: right;width: 10%; height: 30px;;outline: 0;border: 0; background-color:#5CADFE;" onClick="window.history.back(-1);" value='0' >返回</button>
|
</div>
|
</form>
|
</div>
|
<script>
|
|
|
|
window.onload=function()
|
{
|
|
|
|
var btn = document.getElementById("all");
|
btn.onclick = function() {
|
var flag = this.checked;
|
var items = document.getElementsByClassName("checkbox_1");
|
for (var i = 0; i < items.length; i++) {
|
items[i].checked = flag;
|
items[i].value=1;
|
//将所有item的状态设为全选按钮的状态
|
if(items[i].checked==false){
|
items[i].value=0;
|
|
}
|
}
|
|
}
|
|
|
var items = document.getElementsByClassName("checkbox_1");
|
for (var i = 0; i < items.length; i++) {
|
items[i].onclick = function() {//对每个item设置点击
|
var number = 0;//记录选中的个数
|
for (var j = 0; j < items.length; j++) {
|
if (items[j].checked) {
|
number++;
|
items[j].value=1;
|
}
|
|
|
}
|
|
|
for (var j = 0; j < items.length; j++) {
|
if(items[j].checked==false){
|
items[j].value=0;
|
|
}
|
|
|
}
|
document.getElementById("all").checked = (items.length == number);
|
}
|
}
|
|
|
var cells=$('#shangpin').find('tr');
|
for(var i=1;i<cells.length;i++)
|
{
|
|
var zhuangtai= $('#shangpin').find("tr").eq(i).find("input[class='zhuangtai']").val();
|
const check=$('#shangpin').find('tr').eq(i).find('.checkbox_1');
|
const lls=($('#shangpin').find("tr").eq(i).find("input[class='checkbox_1']").val());
|
if(zhuangtai == 1){
|
check[0].checked=true;
|
check[0].value=1;
|
}
|
|
}
|
|
}
|
|
|
|
/* $('#all').click(function(){
|
$('.shangpin input').prop('checked',$(this).prop('checked'));
|
|
});
|
$('.shangpin input').click(function(){
|
//each 便利每一个元素,让其执行该函数
|
$('.shangpin input').each(function(){
|
if(!$(this).prop('checked')){
|
$('#all').prop('checked',false);
|
|
//有一个不满足就 跳出该循环,避免执行下面
|
return false;
|
}
|
})
|
}) */
|
|
|
/*
|
var cksAll=document.getElementById('all');
|
var cks = document.getElementById('shangpin').getElementsByClassName("checkbox_1");
|
cksAll.onclick=function() {
|
for (var i = 0; i < cks.length; i++) {
|
cks[i].checked=this.checked;
|
cks[i].value=1;
|
}
|
};
|
var cks = document.getElementById('shangpin').getElementsByClassName("checkbox_1");
|
for(var i=0;i<cks.length;i++){
|
|
|
cks[i].onclick=function(){
|
|
|
var flag=true;
|
for(var j=0;j<cks.length;j++){
|
|
cks[j].value=0;
|
if(!cks[j].checked){
|
flag=false;
|
|
|
break;
|
}
|
}
|
cksAll.checked=flag;
|
|
};
|
} */
|
|
|
|
function zhenghe()
|
{
|
var tiaoshu=$('#data').find('tr').length;
|
|
var lieshu=$("#data").find('th').length ;
|
var cars = [];
|
cars[0]=1;
|
var value1=document.getElementById('shangpin');
|
|
for(var i=0;i<lieshu;i++)
|
{
|
cars[i]='';
|
|
for(var j=1;j<tiaoshu;j++)
|
{
|
|
|
/* alert(value1.rows[j].cells[i].getElementsByTagName("input")[0].value); */
|
var value2=value1.rows[j].cells[i].getElementsByTagName("input")[0].value;
|
|
|
|
|
|
|
|
cars[i]+=value2+'~';
|
|
/* alert('i:'+i+'j:'+j); */
|
|
}
|
|
}
|
|
|
var chuanshu_count=$("#chuanshu").find('input');
|
for(p=0;p<chuanshu_count.length;p++)
|
{
|
chuanshu_count[p].value=cars[p];
|
|
}
|
|
}
|
|
|
|
function join(e){
|
if(e.checked==true ){
|
e.value=1;
|
}else{
|
e.value=0;
|
}
|
}
|
|
|
|
/* function tiaoz(n){
|
n=n+window.parent.location.search.substr(1);
|
window.open(n);} */
|
</script>
|
</body>
|
</html>
|