Merge remote-tracking branch 'origin/main'

main
R 4 months ago
commit 119783c84b

@ -1,78 +1,93 @@
<!-- 酒店管理系统的登录页面 前端结构-->
<!DOCTYPE html>
<html>
<head>
<title>酒店管理系统</title>
<meta http-equiv="Content-Type" Content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/index.css">
<link rel="stylesheet" type="text/css" href="css/footer.css">
<title>酒店管理系统</title>
<meta http-equiv="Content-Type" Content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/index.css">
<link rel="stylesheet" type="text/css" href="css/footer.css">
</head>
<!--页面最外层容器container-fluid 使容器占满屏幕宽度main 是自定义类-->
<body>
<div class="container-fluid main" id="main" style="padding: 0">
<nav class="navbar navbar-default">
<div class="container-fluid nav-con">
<div class="navbar-header">
<a class="navbar-brand" href="#" style="padding-top: 2rem;color: #EDEDED">
<span style="font-size: 2.3rem;padding-right: 2rem;letter-spacing: 2px">酒店管理系统</span>
</a>
</div>
</div>
</nav>
<div class="col-md-7 col-xs-1"></div>
<div class="col-md-3 col-xs-10 logindiv">
<div class="login-h">
<h3 class="loginh">
登录
</h3>
</div>
<form class="form-horizontal login-f">
<div class="form-group">
<label for="inputName" class="col-sm-2 control-label">Username</label>
<div class="col-md-12 col-xs-12">
<input type="text" class="form-control forminput" id="inputName" placeholder="账号 Account">
</div>
</div>
<div class="form-group">
<label for="inputPassword" class="col-sm-2 control-label">Password</label>
<div class="col-md-12 col-xs-12">
<input type="password" class="form-control forminput" id="inputPassword" placeholder="密码 Password">
<nav class="navbar navbar-default">
<!--顶部系统标识栏-->
<div class="container-fluid nav-con">
<div class="navbar-header">
<a class="navbar-brand" href="#" style="padding-top: 2rem;color: #EDEDED">
<span style="font-size: 2.3rem;padding-right: 2rem;letter-spacing: 2px">酒店管理系统</span>
</a>
</div>
</div>
</div>
<div class="form-group">
<label for="inputCode" class="col-sm-2 control-label">Code</label>
<div class="col-md-8 col-xs-7">
<input type="text" class="form-control forminput inputcode" id="inputCode" placeholder="验证码 code">
</nav>
<!-- 登录框布局(左侧留白 + 右侧登录框)-->
<div class="col-md-7 col-xs-1"></div>
<div class="col-md-3 col-xs-10 logindiv">
<!--登录框顶部标题区:
login-h/loginh自定义类控制标题位置如居中、底部边框、间距
标题 “登录” 明确功能,引导用户操作-->
<div class="login-h">
<h3 class="loginh">
登录
</h3>
</div>
<div class="col-md-4 col-xs-5" style="padding-left:0">
<img class="code" id="code" src=" ">
</div>
</div>
<div class="form-group">
</div>
<div class="form-group">
<div class="col-md-offset-3 col-md-6 col-xs-12">
<button type="button" id="loginBtn" class="form-control btn loginbtn" style="transition: all 0.6s;" >登 录</button>
</div>
</form>
</div>
</div>
<!--:登录表单容器-->
<form class="form-horizontal login-f">
<!--收集用户登录账号-->
<div class="form-group">
<label for="inputName" class="col-sm-2 control-label">Username</label>
<div class="col-md-12 col-xs-12">
<input type="text" class="form-control forminput" id="inputName" placeholder="账号 Account">
</div>
</div>
<!--收集用户登录密码-->
<div class="form-group">
<label for="inputPassword" class="col-sm-2 control-label">Password</label>
<div class="col-md-12 col-xs-12">
<input type="password" class="form-control forminput" id="inputPassword" placeholder="密码 Password">
</div>
</div>
<!--收集验证码,防止自动化登录:
左侧输入框col-md-8 col-xs-7id="inputCode" 用于输入验证码;
右侧图片区col-md-4 col-xs-5id="code" 是验证码图片容器src=" " 初始为空,后续通过 JS 从后端加载验证码图片;
inputcode/code自定义类控制验证码输入框宽度、图片尺寸。-->
<div class="form-group">
<label for="inputCode" class="col-sm-2 control-label">Code</label>
<div class="col-md-8 col-xs-7">
<input type="text" class="form-control forminput inputcode" id="inputCode" placeholder="验证码 code">
</div>
<div class="col-md-4 col-xs-5" style="padding-left:0">
<img class="code" id="code" src=" ">
</div>
</div>
<div class="form-group">
</div>
<!--提交登录请求-->
<div class="form-group">
<div class="col-md-offset-3 col-md-6 col-xs-12">
<button type="button" id="loginBtn" class="form-control btn loginbtn" style="transition: all 0.6s;" >登 录</button>
</div>
</form>
</div>
</div>
</div>
<!--页面底部版权与辅助链接区-->
<footer class="bs-docs-footer">
<div class="col-md-12">
<p>
<a href="#">关于本站</a>
<a href="#">廉正举报</a>
<a href="#">开放平台</a>
<a href="#">诚征英才</a>
<a href="#">联系我们</a>
<a href="#">网站地图</a><br/><br/>
<em>Copyright © 2018 西安工业大学 All Rights Reserved</em>
</p>
<div class="col-md-12">
<p>
<a href="#">关于本站</a>
<a href="#">廉正举报</a>
<a href="#">开放平台</a>
<a href="#">诚征英才</a>
<a href="#">联系我们</a>
<a href="#">网站地图</a><br/><br/>
<em>Copyright © 2018 西安工业大学 All Rights Reserved</em>
</p>
</div>
</div>
</footer>
@ -80,5 +95,5 @@
</html>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript" src="js/index.js"></script><!--登录页面自定义脚本-->

@ -1,220 +1,259 @@
var pageNum=1;
var pageSize=8;
var l;
// 定义分页相关变量:当前页码、每页显示数量、当前页数据条数
var pageNum=1;// 当前页码初始为第1页
var pageSize=8;// 每页显示8条数据
var l;// 用于记录当前页实际加载的数据条数
// 页面DOM加载完成后执行
$(document).ready(function(){
getStaffList();
$("#pre").on('click',function(){
getPre();
});
$("#next").on('click',function(){
getNext();
});
getStaffList(); // 调用函数,调用获取员工列表的函数,初始化页面数据
// 绑定"上一页"按钮点击事件点击时调用getPre()函数
$("#pre").on('click',function(){
getPre();
});
// 绑定"下一页"按钮点击事件点击时调用getNext()函数
$("#next").on('click',function(){
getNext();
});
})
//判断对象/JSON是否为空 空返回1 非空返回0
function isEmptyObject(e) {
var t;
for (t in e)
return 0;
return 1;
var t;
for (t in e) // 遍历对象属性,若存在属性则说明非空
return 0;
return 1;
}
// 存储当前页的员工列表数据
var list;
// 获取员工列表数据的函数
function getStaffList(){
$.ajax({
type:"post",
url:"../user/getAllUser.do",
dataType:"JSON",
data:{
"pageNum":pageNum,
"pageSize":pageSize
},
success:function(data){
if(data.code=="0"){
if(isEmptyObject(data.List)&&pageNum>0){
pageNum=pageNum-1;
getStaffList();
}
else{
var power=" ";
var htmlStr=" ";
var btnStr=" ";
list=data.List;
l=0;
$("#pre").css("display","block");
$("#next").css("display","block");
$("#staffList").empty();
$("#staffList").append("<tr><th>账号</th><th>员工号</th><th>姓名</th><th>年龄</th><th>职位</th><th>联系方式</th><th>操作</th></tr>")
for(i in list){
if(list[i].power=="0") {
power="管理员";
btnStr=" ";
}
else if(list[i].power=="1") {
power="经理";
btnStr="<input type=\"button\" id=\"setStaff\" data-userid=\""+list[i].userid+"\" class=\"btn btn-success\" value=\"设置为员工\"/> <input type=\"button\" id=\"delUser\" data-userid=\""+list[i].userid+"\" class=\"btn btn-danger\" value=\"删除\"/>"
}
else if(list[i].power=="2") {
power="员工";
btnStr="<input type=\"button\" id=\"setManage\" data-userid=\""+list[i].userid+"\" class=\"btn btn-success\" value=\"设置为经理\"/> <input type=\"button\" id=\"setPwd\" data-userid=\""+list[i].userid+"\" class=\"btn btn-info\" value=\"重置密码\"/> <input type=\"button\" id=\"delUser\" data-userid=\""+list[i].userid+"\" class=\"btn btn-danger\" value=\"删除\"/>"
}
else {
power="清洁工";
btnStr="<input type=\"button\" id=\"setPwd\" data-userid=\""+list[i].userid+"\" class=\"btn btn-info\" value=\"重置密码\"/> <input type=\"button\" id=\"delUser\" data-userid=\""+list[i].userid+"\" class=\"btn btn-danger\" value=\"删除\"/> "
}
htmlStr="<tr data-userid=\""+list[i].userid+"\"><td>"+list[i].useraccount+"</td><td>"+list[i].idnumber+"</td><td>"+list[i].username+"</td><td>"+list[i].age+"</td><td>"+power+"</td><td>"+list[i].phonenumber+"</td><td>"+btnStr+"</td></tr>";
$("#staffList").append(htmlStr);
l++;
//console.log(htmlStr)
}
if(pageNum=="1") $("#pre").css("display","none");
if(pageSize>l) $("#next").css("display","none");
btnOn();
}
}
else{
alert("获取员工列表失败")
}
},
error:function(){
alert("获取员工列表发生错误")
}
})
$.ajax({
type:"post",// 请求类型为POST
url:"../user/getAllUser.do",// 请求后端接口地址
dataType:"JSON",// 预期返回数据类型为JSON
data:{// 传递给后端的参数:当前页码和每页数量
"pageNum":pageNum,
"pageSize":pageSize
},
// 请求成功的回调函数
success:function(data){
// 后端返回状态码为"0"表示成功
if(data.code=="0"){
// 若当前页数据为空且页码大于0回退到上一页并重新加载
if(isEmptyObject(data.List)&&pageNum>0){
pageNum=pageNum-1;
getStaffList();
}
else{
var power=" ";// 存储职位名称
var htmlStr=" ";// 存储表格行HTML
var btnStr=" ";// 存储操作按钮HTML
list=data.List;// 将后端返回的列表数据存入全局变量
l=0;// 重置当前页数据条数计数
// 显示上一页和下一页按钮(默认先显示,后续根据情况隐藏)
$("#pre").css("display","block");
$("#next").css("display","block");
// 清空表格内容并添加表头
$("#staffList").empty();
$("#staffList").append("<tr><th>账号</th><th>员工号</th><th>姓名</th><th>年龄</th><th>职位</th><th>联系方式</th><th>操作</th></tr>")
// 遍历员工列表,生成表格内容
for(i in list){
// 根据权限值(power)设置职位名称和操作按钮
if(list[i].power=="0") {
power="管理员";
btnStr=" ";// 管理员无操作按钮
}
else if(list[i].power=="1") {
power="经理";
// 经理的操作按钮:设置为员工、删除
btnStr="<input type=\"button\" id=\"setStaff\" data-userid=\""+list[i].userid+"\" class=\"btn btn-success\" value=\"设置为员工\"/> <input type=\"button\" id=\"delUser\" data-userid=\""+list[i].userid+"\" class=\"btn btn-danger\" value=\"删除\"/>"
}
else if(list[i].power=="2") {
power="员工";// 员工的操作按钮:设置为经理、重置密码、删除
btnStr="<input type=\"button\" id=\"setManage\" data-userid=\""+list[i].userid+"\" class=\"btn btn-success\" value=\"设置为经理\"/> <input type=\"button\" id=\"setPwd\" data-userid=\""+list[i].userid+"\" class=\"btn btn-info\" value=\"重置密码\"/> <input type=\"button\" id=\"delUser\" data-userid=\""+list[i].userid+"\" class=\"btn btn-danger\" value=\"删除\"/>"
}
else {
power="清洁工";
// 清洁工的操作按钮:重置密码、删除
btnStr="<input type=\"button\" id=\"setPwd\" data-userid=\""+list[i].userid+"\" class=\"btn btn-info\" value=\"重置密码\"/> <input type=\"button\" id=\"delUser\" data-userid=\""+list[i].userid+"\" class=\"btn btn-danger\" value=\"删除\"/> "
}
// 拼接当前员工的表格行HTML
htmlStr="<tr data-userid=\""+list[i].userid+"\"><td>"+list[i].useraccount+"</td><td>"+list[i].idnumber+"</td><td>"+list[i].username+"</td><td>"+list[i].age+"</td><td>"+power+"</td><td>"+list[i].phonenumber+"</td><td>"+btnStr+"</td></tr>";
// 将表格行添加到表格中
$("#staffList").append(htmlStr);
l++;// 累加当前页数据条数
//console.log(htmlStr)
}
// 若当前是第1页隐藏"上一页"按钮
if(pageNum=="1") $("#pre").css("display","none");
// 若当前页数据条数小于每页显示数量,说明是最后一页,隐藏"下一页"按钮
if(pageSize>l) $("#next").css("display","none");
// 绑定操作按钮的点击事件
btnOn();
}
}
else{
alert("获取员工列表失败")
}
},
// 请求失败的回调函数
error:function(){
alert("获取员工列表发生错误")
}
})
}
// 绑定操作按钮的点击事件
function btnOn(){
$("input").filter("#setStaff").on('click',function(event){
// 绑定"设置为员工"按钮事件调用setPosition并传递权限值"2"
$("input").filter("#setStaff").on('click',function(event){
setPosition(event,"2");
});
$("input").filter("#setManage").on('click',function(event){
setPosition(event,"1");
});
$("input").filter("#setPwd").on('click',function(event){
});
// 绑定"设置为经理"按钮事件调用setPosition并传递权限值"1"
$("input").filter("#setManage").on('click',function(event){
setPosition(event,"1");
});
// 绑定"重置密码"按钮事件调用setPwd
$("input").filter("#setPwd").on('click',function(event){
setPwd(event);
});
$("input").filter("#delUser").on('click',function(event){
delUser(event);
});
$("input").filter("#setPageBtn").on('click',function( ){
setPage( );
})
});
// 绑定"删除"按钮事件调用delUser
$("input").filter("#delUser").on('click',function(event){
delUser(event);
});
// 绑定"跳转页码"按钮事件调用setPage
$("input").filter("#setPageBtn").on('click',function( ){
setPage( );
})
}
// 上一页功能页码减1并重新加载列表
function getPre(){
pageNum=pageNum-1;
getStaffList();
pageNum=pageNum-1;
getStaffList();
}
// 下一页功能页码加1并重新加载列表
function getNext(){
pageNum=pageNum+1;
getStaffList();
pageNum=pageNum+1;
getStaffList();
}
// 跳转指定页码功能
function setPage(){
if($("#inputPage").val()<0 || $("#inputPage").val()==0)
alert("请输入正确页码");
else{
pageNum=$("#inputPage").val();
getStaffList();
}
// 验证输入的页码是否合法大于0
if($("#inputPage").val()<0 || $("#inputPage").val()==0)
alert("请输入正确页码");
else{
pageNum=$("#inputPage").val(); // 更新页码
getStaffList();// 重新加载列表
}
}
// 修改员工职位(权限)的函数
function setPosition(event,alter){
var userid=$(event.target).data("userid");
var info;
for(i in list){
if(list[i].userid==userid){
info=list[i];
}
}
$.ajax({
type:"POST",
url:"../user/updateUser.do",
dataType:"JSON",
data:{
"userid":info.userid,
"power":alter
},
success:function(data){
if(data.code==0){
alert("修改成功");
getStaffList();
}
else
alert("修改失败")
},
error:function(){
alert("修改信息出现错误");
}
})
var userid=$(event.target).data("userid"); // 获取目标员工的ID
var info;// 存储目标员工的详细信息
// 从当前列表中查找目标员
for(i in list){
if(list[i].userid==userid){
info=list[i];
}
}
// 发送AJAX请求修改权限
$.ajax({
type:"POST",
url:"../user/updateUser.do",// 后端修改用户接口
dataType:"JSON",
data:{// 传递用户ID和新权限值
"userid":info.userid,
"power":alter
},
success:function(data){
if(data.code==0){// 修改成功
alert("修改成功");
getStaffList();// 重新加载列表刷新数据
}
else
alert("修改失败")
},
error:function(){
alert("修改信息出现错误");
}
})
}
// 重置员工密码的函数
function setPwd(event){
var userid=$(event.target).data("userid");
var info;
for(i in list){
if(list[i].userid==userid){
info=list[i];
}
}
info.password="111111";
$.ajax({
type:"POST",
url:"../user/updateUser.do",
dataType:"JSON",
data:{
"userid":info.userid,
"password":info.password
},
success:function(data){
if(data.code==0){
alert("修改成功");
getStaffList();
}
else
alert("修改失败")
},
error:function(){
alert("修改信息出现错误");
}
})
var userid=$(event.target).data("userid");// 获取目标员工的ID
var info;// 存储目标员工的详细信息
// 从当前列表中查找目标员工
for(i in list){
if(list[i].userid==userid){
info=list[i];
}
}
info.password="111111"; // 重置密码为"111111"
// 发送AJAX请求修改密码
$.ajax({
type:"POST",
url:"../user/updateUser.do",// 后端修改用户接口
dataType:"JSON",
data:{// 传递用户ID和新密码
"userid":info.userid,
"password":info.password
},
success:function(data){
if(data.code==0){// 修改成功
alert("修改成功");
getStaffList(); // 重新加载列表刷新数据
}
else
alert("修改失败")
},
error:function(){
alert("修改信息出现错误");
}
})
}
// 删除员工的函数
function delUser(event){
var userid=$(event.target).data("userid");
$.ajax({
type:"POST",
url:"../user/delUser.do",
dataType:"JSON",
data:{
"userid":userid
},
success:function(data){
if(data.code==0){
alert("删除成功");
if(l==1)
pageNum=pageNum-1;
getStaffList();
}
else
alert("删除失败")
},
error:function(){
alert("删除出现错误");
}
})
var userid=$(event.target).data("userid"); // 获取目标员工的ID
// 发送AJAX请求删除用户
$.ajax({
type:"POST",
url:"../user/delUser.do",// 后端删除用户接口
dataType:"JSON",
data:{ // 传递用户ID
"userid":userid
},
success:function(data){
if(data.code==0){// 删除成功
alert("删除成功");
// 若当前页只剩1条数据删除后页码回退1页
if(l==1)
pageNum=pageNum-1;
getStaffList();// 重新加载列表刷新数据
}
else
alert("删除失败")
},
error:function(){
alert("删除出现错误");
}
})
}

@ -1,215 +1,253 @@
var pageNum=1;
var pageSize=8;
var l;
// 定义分页相关变量:当前页码、每页显示数量、当前页数据条数
var pageNum=1;// 当前页码初始为第1页
var pageSize=8;// 每页显示8条数据
var l;// 记录当前页实际加载的数据条数
// 页面DOM加载完成后执行初始化操作
$(document).ready(function(){
getorderList();
getConfig();
$("#pre").on('click',function(){
getPre();
});
$("#next").on('click',function(){
getNext();
});
getorderList(); // 加载订单列表
getConfig();// 加载系统配置信息
// 绑定"上一页"按钮点击事件
$("#pre").on('click',function(){
getPre();
});
// 绑定"下一页"按钮点击事件
$("#next").on('click',function(){
getNext();
});
})
//判断对象/JSON是否为空 空返回1 非空返回0
function isEmptyObject(e) {
var t;
for (t in e)
return 0;
return 1;
var t;
for (t in e)// 遍历对象属性,存在属性则非空
return 0;
return 1;
}
// 存储当前页的订单列表数据
var list;
// 获取订单列表数据
function getorderList(){
$.ajax({
type:"post",
url:"../order/getAllOrder.do",
dataType:"JSON",
data:{
"pageNum":pageNum,
"pageSize":pageSize
},
success:function(data){
if(isEmptyObject(data.List)&&pageNum>0){
pageNum=pageNum-1;
getorderList();
}
else{
list=data.List;
var htmlStr=" ";
var btnStr=" ";
var state=" ";
var sdate;
var edate;
l=0;
$("#pre").css("display","block");
$("#next").css("display","block");
$("#orderList").empty();
$("#orderList").append("<tr><th>入住人</th><th>身份证号</th><th>开始时间</th><th>结束时间</th><th>总金额</th><th>状态</th><th>操作</th></tr>")
for(i in list){
sdate=/\d{4}-\d{1,2}-\d{1,2}/g.exec(list[i].starttime);
edate=/\d{4}-\d{1,2}-\d{1,2}/g.exec(list[i].endtime);
if(list[i].state=="0"){
state="未付款";
btnStr="<input type=\"button\" class=\"btn btn-info\" data-roomid=\""+list[i].roomid+"\" id=\"showRoom\" data-toggle=\"modal\" data-target=\"#showRoomT\" value=\"查看房间\">";
}
else if(list[i].state=="1"){
state="已付款";
btnStr="<input type=\"button\" class=\"btn btn-info\" data-roomid=\""+list[i].roomid+"\" id=\"showRoom\" data-toggle=\"modal\" data-target=\"#showRoomT\" value=\"查看房间\"> ";
}
else if(list[i].state=="2"){
state="已完成";
btnStr="<input type=\"button\" class=\"btn btn-info\" data-roomid=\""+list[i].roomid+"\" id=\"showRoom\" data-toggle=\"modal\" data-target=\"#showRoomT\" value=\"查看房间\"> <input type=\"button\" class=\"btn btn-success\" data-orderid=\""+list[i].orderid+"\" id=\"delOrder\" value=\"删除\">";
}
else{
state="已取消";
btnStr="<input type=\"button\" class=\"btn btn-info\" data-roomid=\""+list[i].roomid+"\" id=\"showRoom\" data-toggle=\"modal\" data-target=\"#showRoomT\" value=\"查看房间\"> <input type=\"button\" class=\"btn btn-success\" data-orderid=\""+list[i].orderid+"\" id=\"delOrder\" value=\"删除\">";
}
htmlStr="<tr data-orderid=\""+list[i].orderid+"\"><td>"+list[i].householdname+"</td><td>"+list[i].id+"</td><td>"+sdate+"</td><td>"+edate+"</td><td>"+list[i].money+"</td><td>"+state+"</td><td>"+btnStr+"</td></tr>";
$("#orderList").append(htmlStr);
l++;
}
if(pageNum=="1") $("#pre").css("display","none");
if(pageSize>l) $("#next").css("display","none");
btnOn();
}
},
error:function(){
alert("获取订单列表发生错误")
}
})
$.ajax({
type:"post",// 请求类型为POST
url:"../order/getAllOrder.do", // 后端获取订单列表的接口
dataType:"JSON",// 预期返回JSON格式数据
data:{// 传递分页参数
"pageNum":pageNum,
"pageSize":pageSize
},
// 请求成功的回调函数
success:function(data){
// 若当前页数据为空且页码>0回退到上一页重新加载
if(isEmptyObject(data.List)&&pageNum>0){
pageNum=pageNum-1;
getorderList();
}
else{
list=data.List;// 存储订单列表数据
var htmlStr=" ";// 表格行HTML字符串
var btnStr=" ";// 操作按钮HTML字符串
var state=" ";// 订单状态文本
var sdate;// 入住日期(格式化后)
var edate;// 退房日期(格式化后)
l=0;// 重置当前页数据计数
// 显示分页按钮(默认先显示,后续根据情况隐藏)
$("#pre").css("display","block");
$("#next").css("display","block");
// 清空表格并添加表头
$("#orderList").empty();
$("#orderList").append("<tr><th>入住人</th><th>身份证号</th><th>开始时间</th><th>结束时间</th><th>总金额</th><th>状态</th><th>操作</th></tr>")
for(i in list){
// 从时间字符串中提取日期部分(格式:年-月-日)
sdate=/\d{4}-\d{1,2}-\d{1,2}/g.exec(list[i].starttime);
edate=/\d{4}-\d{1,2}-\d{1,2}/g.exec(list[i].endtime);
// 根据订单状态state设置状态文本和操作按钮
if(list[i].state=="0"){
state="未付款";
// 未付款订单:仅显示"查看房间"按钮(关联模态框)
btnStr="<input type=\"button\" class=\"btn btn-info\" data-roomid=\""+list[i].roomid+"\" id=\"showRoom\" data-toggle=\"modal\" data-target=\"#showRoomT\" value=\"查看房间\">";
}
else if(list[i].state=="1"){
state="已付款";
// 已付款订单:仅显示"查看房间"按钮
btnStr="<input type=\"button\" class=\"btn btn-info\" data-roomid=\""+list[i].roomid+"\" id=\"showRoom\" data-toggle=\"modal\" data-target=\"#showRoomT\" value=\"查看房间\"> ";
}
else if(list[i].state=="2"){
state="已完成";
// 已完成订单:显示"查看房间"和"删除"按钮
btnStr="<input type=\"button\" class=\"btn btn-info\" data-roomid=\""+list[i].roomid+"\" id=\"showRoom\" data-toggle=\"modal\" data-target=\"#showRoomT\" value=\"查看房间\"> <input type=\"button\" class=\"btn btn-success\" data-orderid=\""+list[i].orderid+"\" id=\"delOrder\" value=\"删除\">";
}
else{
state="已取消";
// 已取消订单:显示"查看房间"和"删除"按钮
btnStr="<input type=\"button\" class=\"btn btn-info\" data-roomid=\""+list[i].roomid+"\" id=\"showRoom\" data-toggle=\"modal\" data-target=\"#showRoomT\" value=\"查看房间\"> <input type=\"button\" class=\"btn btn-success\" data-orderid=\""+list[i].orderid+"\" id=\"delOrder\" value=\"删除\">";
}
// 拼接订单表格行HTML
htmlStr="<tr data-orderid=\""+list[i].orderid+"\"><td>"+list[i].householdname+"</td><td>"+list[i].id+"</td><td>"+sdate+"</td><td>"+edate+"</td><td>"+list[i].money+"</td><td>"+state+"</td><td>"+btnStr+"</td></tr>";
// 添加到表格中
$("#orderList").append(htmlStr);
l++;// 累加当前页数据条数
}
// 若为第1页隐藏"上一页"按钮
if(pageNum=="1") $("#pre").css("display","none");
// 若当前页数据少于每页数量,说明是最后一页,隐藏"下一页"按钮
if(pageSize>l) $("#next").css("display","none");
// 绑定操作按钮事件
btnOn();
}
},
// 请求失败的回调
error:function(){
alert("获取订单列表发生错误")
}
})
}
// 绑定操作按钮的点击事件
function btnOn(){
$("input").filter("#setPageBtn").on('click',function( ){
setPage( );
});
$("input").filter("#showRoom").on('click',function(event){
showRoom(event);
})
$("input").filter("#delOrder").on('click',function(event){
delOrder(event);
});
// 绑定"跳转页码"按钮事件
$("input").filter("#setPageBtn").on('click',function( ){
setPage( );
});
// 绑定"查看房间"按钮事件
$("input").filter("#showRoom").on('click',function(event){
showRoom(event);
})
// 绑定"删除订单"按钮事件
$("input").filter("#delOrder").on('click',function(event){
delOrder(event);
});
}
// 上一页功能页码减1并重新加载列表
function getPre(){
pageNum=pageNum-1;
getorderList();
pageNum=pageNum-1;
getorderList();
}
// 下一页功能页码加1并重新加载列表
function getNext(){
pageNum=pageNum+1;
getorderList();
pageNum=pageNum+1;
getorderList();
}
// 跳转指定页码功能
function setPage(){
if($("#inputPage").val()<0 || $("#inputPage").val()==0)
alert("请输入正确页码");
else{
pageNum=$("#inputPage").val();
getorderList();
}
// 验证页码合法性必须大于0
if($("#inputPage").val()<0 || $("#inputPage").val()==0)
alert("请输入正确页码");
else{
pageNum=$("#inputPage").val();// 更新页码
getorderList();// 重新加载列表
}
}
// 删除订单功能
function delOrder(event){
var orderid=$(event.target).data("orderid");
$.ajax({
type:"POST",
url:"../order/delOrder.do",
dataType:"JSON",
data:{
"orderid":orderid
},
success:function(data){
if(data.code==0){
alert("删除成功");
if(l==1)
pageNum=pageNum-1;
getorderList();
}
else
alert("删除失败")
},
error:function(){
alert("删除出现错误");
}
})
var orderid=$(event.target).data("orderid");// 获取订单ID
$.ajax({
type:"POST",
url:"../order/delOrder.do",// 后端删除订单接口
dataType:"JSON",
data:{// 传递订单ID
"orderid":orderid
},
success:function(data){
if(data.code==0){// 删除成功
alert("删除成功");
// 若当前页只剩1条数据删除后页码回退1页
if(l==1)
pageNum=pageNum-1;
getorderList();// 重新加载列表刷新数据
}
else
alert("删除失败")
},
error:function(){
alert("删除出现错误");
}
})
}
// 查看房间详情功能(点击后显示模态框)
function showRoom(event){
var roomid=$(event.target).data("roomid");
$.ajax({
type:"POST",
url:"../room/getRoomById.do",
dataType:"JSON",
data:{
"roomid":roomid
},
success:function(data){
var room=data.room;
if(data.code==0){
var htmlStr=" ";
var state=" ";
var type=" ";
$("#roomTable").empty();
if(room.state=="0")
state="停用";
else if(room.state=="1")
state="未预定";
else if(room.state=="2")
state="已预定(入住)";
else
state="待清扫";
if(room.type=="1")
type="单人间";
else if(room.type=="2")
type="双人间";
else if(room.type=="3")
type="大床房";
else
type="套房";
htmlStr="<tr><th>位置</th><td>"+room.local+"</td></tr><tr><th>价格</th><td>"+room.money+"</td></tr><tr><th>类型</th><td>"+type+"</td></tr><tr><th>状态</th><td>"+state+"</td></tr>"
$("#roomTable").append(htmlStr);
}
else
alert("获取失败")
},
error:function(){
alert("获取信息出现错误");
}
})
var roomid=$(event.target).data("roomid");// 获取房间ID
$.ajax({
type:"POST",
url:"../room/getRoomById.do",// 后端获取房间详情接口
dataType:"JSON",
data:{// 传递房间ID
"roomid":roomid
},
success:function(data){
var room=data.room;// 房间详情数据
if(data.code==0){// 获取成功
var htmlStr=" ";// 房间信息表格HTML
var state=" ";// 房间状态文本
var type=" ";// 房间类型文本
// 清空模态框中的表格
$("#roomTable").empty();
// 转换房间状态编码为文本
if(room.state=="0")
state="停用";
else if(room.state=="1")
state="未预定";
else if(room.state=="2")
state="已预定(入住)";
else
state="待清扫";
// 转换房间类型编码为文本
if(room.type=="1")
type="单人间";
else if(room.type=="2")
type="双人间";
else if(room.type=="3")
type="大床房";
else
type="套房";
// 拼接房间信息表格HTML
htmlStr="<tr><th>位置</th><td>"+room.local+"</td></tr><tr><th>价格</th><td>"+room.money+"</td></tr><tr><th>类型</th><td>"+type+"</td></tr><tr><th>状态</th><td>"+state+"</td></tr>"
// 添加到模态框表格中
$("#roomTable").append(htmlStr);
}
else
alert("获取失败")
},
error:function(){
alert("获取信息出现错误");
}
})
}
// 获取系统配置信息(如总营业额、总房间数)
function getConfig(){
$.ajax({
type:"POST",
url:"../config/getConfig.do",
dataType:"JSON",
data:{},
success:function(data){
if(data.code=="0"){
var config=data.config;
$("#totalMoney").text(config.totalmoney);
$("#totalRoom").text(config.totalroom);
}
else{
alert("获取配置错误");
}
},
error:function(){
alert("获取配置发生错误")
}
});
$.ajax({
type:"POST",
url:"../config/getConfig.do",// 后端获取配置接口
dataType:"JSON",
data:{},// 无参数
success:function(data){
if(data.code=="0"){// 获取成功
var config=data.config;// 配置数据
// 更新页面上的总金额和总房间数显示
$("#totalMoney").text(config.totalmoney);
$("#totalRoom").text(config.totalroom);
}
else{
alert("获取配置错误");
}
},
error:function(){
alert("获取配置发生错误")
}
});
}

@ -1,103 +1,129 @@
// 页面DOM加载完成后执行的初始化函数
$(document).ready(function(){
getConfig();
$("#showConfig").click(function(){
changeTab();
});
$("#alterConfig").click(function(){
changeTab();
});
$("#alterConfigBtn").click(function(){
alterConfig();
})
// 加载配置信息
getConfig();
// 给"查看配置"按钮绑定点击事件,点击时切换显示的标签页
$("#showConfig").click(function(){
changeTab();
});
// 给"修改配置"按钮绑定点击事件,点击时切换显示的标签页
$("#alterConfig").click(function(){
changeTab();
});
// 给"确认修改"按钮绑定点击事件,点击时执行修改配置的逻辑
$("#alterConfigBtn").click(function(){
alterConfig();
})
})
// 全局变量,用于存储从后端获取的配置信息
var config;
//判断字符串是否为空 空返回1 非空返回0
function isEmptyString(str){
if(str=='null'||str=='')
return 1;
return 0;
// 如果字符串是'null'或空字符串,视为空
if(str=='null'||str=='')
return 1;
return 0;
}
// 从后端获取配置信息并展示
function getConfig(){
$.ajax({
type:"POST",
url:"../config/getConfig.do",
dataType:"JSON",
data:{},
success:function(data){
if(data.code=="0"){
config=data.config;
var htmlStr="<tr><td>经理</td><td>"+config.manage+"</td><td>"+config.managesalary+"%</td></tr>"+
"<tr><td>员工</td><td>"+config.staff+"</td><td>"+config.staffsalary+"%</td></tr>"+
"<tr><td>清洁工</td><td>"+config.cleaner+"</td><td>"+config.cleanerssalary+"%</td></tr>";
$("#configList").append(htmlStr);
$("#inputMS").val(config.manage);
$("#inputSS").val(config.staff);
$("#inputCS").val(config.cleaner);
$("#inputM").val(config.managesalary);
$("#inputS").val(config.staffsalary);
$("#inputC").val(config.cleanerssalary);
}
else{
alert("获取配置错误");
}
// 发起AJAX POST请求
$.ajax({
type:"POST",// 请求类型
url:"../config/getConfig.do", // 请求后端接口地址
dataType:"JSON", // 预期后端返回的数据类型
data:{},// 请求参数(无参数)
// 请求成功的回调函数
success:function(data){
// 后端返回成功状态码假设code="0"为成功)
if(data.code=="0"){
// 存储配置信息到全局变量
config=data.config;
// 拼接配置信息的HTML字符串用于展示表格
var htmlStr="<tr><td>经理</td><td>"+config.manage+"</td><td>"+config.managesalary+"%</td></tr>"+
"<tr><td>员工</td><td>"+config.staff+"</td><td>"+config.staffsalary+"%</td></tr>"+
"<tr><td>清洁工</td><td>"+config.cleaner+"</td><td>"+config.cleanerssalary+"%</td></tr>";
// 将HTML添加到表格中展示
$("#configList").append(htmlStr);
// 给修改表单的输入框赋值(默认显示当前配置)
$("#inputMS").val(config.manage);
$("#inputSS").val(config.staff);
$("#inputCS").val(config.cleaner);
$("#inputM").val(config.managesalary);
$("#inputS").val(config.staffsalary);
$("#inputC").val(config.cleanerssalary);
}
else{
// 后端返回失败,提示错误
alert("获取配置错误");
}
},
error:function(){
alert("获取配置发生错误")
}
},
// 请求失败的回调函数
error:function(){
alert("获取配置发生错误")
}
});
});
}
// 切换标签页(切换"查看配置"和"修改配置"区域的显示状态)
function changeTab(){
var info=$("#showConfigDiv").css("display");
var alter=$("#alterConfigDiv").css("display");
if(info=="block"){
$("#showConfigDiv").css("display","none");
$("#alterConfigDiv").fadeIn();
}
else{
$("#alterConfigDiv").css("display","none")
$("#showConfigDiv").fadeIn();
}
// 获取两个区域当前的显示状态
var info=$("#showConfigDiv").css("display"); // 查看配置区域
var alter=$("#alterConfigDiv").css("display");// 修改配置区域
// 如果查看区域正在显示,则隐藏查看区域,显示修改区域(带动画)
if(info=="block"){
$("#showConfigDiv").css("display","none");
$("#alterConfigDiv").fadeIn(); // 淡入动画
}
else{
// 否则隐藏修改区域,显示查看区域(带动画)
$("#alterConfigDiv").css("display","none")
$("#showConfigDiv").fadeIn();// 淡入动画
}
}
// 提交修改配置的请求
function alterConfig(){
if(isEmptyString($("#inputMS").val())||isEmptyString($("#inputM").val())||isEmptyString($("#inputSS").val())||isEmptyString($("#inputS").val())||isEmptyString($("#inputCS").val())||isEmptyString($("#inputC").val()))
alert("请填写全内容");
else{
$.ajax({
type:"POST",
url:"../config/updateConfig.do",
dataType:"JSON",
data:{
"managesalary":$("#inputM").val(),
"staffsalary":$("#inputS").val(),
"cleanerssalary":$("#inputC").val(),
"manage":$("#inputMS").val(),
"staff":$("#inputSS").val(),
"cleaner":$("#inputCS").val()
},
success:function(data){
if(data.code=="0"){
alert("修改成功");
}
else{
alert("修改配置错误");
}
window.location.reload();
// 校验输入框是否为空调用isEmptyString函数
if(isEmptyString($("#inputMS").val())||isEmptyString($("#inputM").val())||isEmptyString($("#inputSS").val())||isEmptyString($("#inputS").val())||isEmptyString($("#inputCS").val())||isEmptyString($("#inputC").val()))
alert("请填写全内容");// 有空值则提示
else{
// 输入完整,发起修改请求
$.ajax({
type:"POST", // 请求类型
url:"../config/updateConfig.do",// 后端修改接口地址
dataType:"JSON", // 预期返回数据类型
// 请求参数(从输入框获取新的配置值)
data:{
"managesalary":$("#inputM").val(),
"staffsalary":$("#inputS").val(),
"cleanerssalary":$("#inputC").val(),
"manage":$("#inputMS").val(),
"staff":$("#inputSS").val(),
"cleaner":$("#inputCS").val()
},
// 请求成功的回调函数
success:function(data){
if(data.code=="0"){
alert("修改成功");
}
else{
alert("修改配置错误");
}
// 无论成功与否,刷新页面重新加载配置
window.location.reload();
},
error:function(){
alert("修改配置发生错误")
}
},
// 请求失败的回调函数
error:function(){
alert("修改配置发生错误")
}
});
});
}
}
}

@ -1,208 +1,245 @@
// 扩展jQuery方法添加获取URL参数的功能
(function($){
$.getData=function(name){
var reg=new RegExp("(^|&)"+name+"=([^&]+)(&|$)?");
var result = window.location.search.substr(1).match(reg);
if (result!= null) return result[2]; return null;
}
// 定义$.getData方法用于从URL查询参数中获取指定名称的值
$.getData=function(name){
// 构建正则表达式匹配URL中"name=value"的参数格式
var reg=new RegExp("(^|&)"+name+"=([^&]+)(&|$)?");
// 从URL的查询字符串?后的部分)中提取参数并匹配正则
var result = window.location.search.substr(1).match(reg);
// 若匹配到结果则返回参数值否则返回null
if (result!= null) return result[2]; return null;
}
})(jQuery);
// 从URL参数中获取userid和power用户ID和权限等级
var userid=$.getData('userid');
var power=$.getData('power');
// 页面DOM加载完成后执行的初始化函数
$(document).ready(function(){
var w=$("#userpic").width();
$("#userpic").height(w);
$("#inputNone").attr("value",userid);
$("#showInfo").click(function(){
changeTab();
});
$("#showAlter").click(function(){
changeTab();
});
getInfo();
getSalary();
$("#alterInfoBtn").click(function(){
alterInfo();
});
$("#alterPwdBtn").click(function(){
alterPwd();
})
// 设置用户头像的宽高相等(正方形)
var w=$("#userpic").width();
$("#userpic").height(w);
// 给隐藏输入框赋值userid可能用于表单提交时传递用户ID
$("#inputNone").attr("value",userid);
// 绑定"查看信息"按钮点击事件,切换标签页
$("#showInfo").click(function(){
changeTab();
});
// 绑定"修改信息"按钮点击事件,切换标签页
$("#showAlter").click(function(){
changeTab();
});
// 加载用户基本信息
getInfo();
// 加载用户薪资信息(根据权限判断是否显示)
getSalary();
// 绑定"确认修改信息"按钮点击事件,执行修改信息逻辑
$("#alterInfoBtn").click(function(){
alterInfo();
});
// 绑定"确认修改密码"按钮点击事件,执行修改密码逻辑
$("#alterPwdBtn").click(function(){
alterPwd();
})
})
//判断对象/JSON是否为空 空返回1 非空返回0
function isEmptyObject(e) {
var t;
for (t in e)
return 0;
return 1;
var t;
// 遍历对象,若存在属性则非空
for (t in e)
return 0;
return 1;
}
//判断字符串是否为空 空返回1 非空返回0
function isEmptyString(str){
if(str=='null'||str=='')
return 1;
return 0;
// 若字符串为'null'或空字符串,视为空
if(str=='null'||str=='')
return 1;
return 0;
}
// 切换标签页(切换"查看信息"和"修改信息"区域的显示状态)
function changeTab(){
var info=$("#showInfodiv").css("display");
var alter=$("#showAlterdiv").css("display");
if(info=="block"){
$("#showInfodiv").css("display","none");
$("#showAlterdiv").fadeIn();
}
else{
$("#showAlterdiv").css("display","none")
$("#showInfodiv").fadeIn();
}
// 获取两个区域当前的显示状态
var info=$("#showInfodiv").css("display");// 查看信息区域
var alter=$("#showAlterdiv").css("display"); // 修改信息区域
// 若查看区域显示,则隐藏查看区域,淡入显示修改区域
if(info=="block"){
$("#showInfodiv").css("display","none");
$("#showAlterdiv").fadeIn();
}
else{
// 否则隐藏修改区域,淡入显示查看区域
$("#showAlterdiv").css("display","none")
$("#showInfodiv").fadeIn();
}
}
// 全局变量,用于存储用户信息
var info;
// 从后端获取用户详情信息并展示
function getInfo(){
$.ajax({
type:"POST",
url:"../user/getUserById.do",
dataType:"JSON",
data:{
"userid":userid
},
success:function(data){
if(data.code==0){
info=data.user;
var span=$("span");
$("#userpic").attr("src",'../'+info.photourl)
span.filter("#account").text(info.useraccount);
span.filter("#idnum").text(info.idnumber);
span.filter("#name").text(info.username);
$("#inputName").val(info.username);
span.filter("#age").text(info.age);
$("#inputAge").val(info.age)
span.filter("#phone").text(info.phonenumber);
$("#inputPhone").val(info.phonenumber)
}
else{
alert("获取信息失败");
}
},
error:function(){
alert("获取信息出现错误");
}
})
$.ajax({
type:"POST", // 请求类型
url:"../user/getUserById.do",// 后端接口地址根据用户ID获取信息
dataType:"JSON",// 预期返回数据类型
data:{
"userid":userid // 请求参数用户ID
},
// 请求成功的回调函数
success:function(data){
if(data.code==0){// 后端返回成功状态code=0
info=data.user;// 存储用户信息到全局变量
var span=$("span");// 获取所有span标签
// 设置用户头像图片路径
$("#userpic").attr("src",'../'+info.photourl)
// 填充查看区域的用户信息(账号、身份证号、姓名、年龄、手机号)
span.filter("#account").text(info.useraccount);
span.filter("#idnum").text(info.idnumber);
span.filter("#name").text(info.username);
$("#inputName").val(info.username);
// 填充修改区域的输入框(默认显示当前信息)
span.filter("#age").text(info.age);
$("#inputAge").val(info.age)
span.filter("#phone").text(info.phonenumber);
$("#inputPhone").val(info.phonenumber)
}
else{
alert("获取信息失败");// 后端返回失败
}
},
// 请求失败的回调函数
error:function(){
alert("获取信息出现错误");
}
})
}
// 提交用户基本信息修改请求
function alterInfo(){
var name=$("#inputName").val();
var age=$("#inputAge").val();
var phone=$("#inputPhone").val();
if(isEmptyString(name) || isEmptyString(age) || isEmptyString(phone)){
alert("请填写全信息");
}
else{
$.ajax({
type:"POST",
url:"../user/updateUser.do",
dataType:"JSON",
data:{
"userid":userid,
"password":info.password,
"username":name,
"age":age,
"power":power,
"IDnumber":info.idnumber,
"phonenumber":phone
},
success:function(data){
if(data.code==0){
alert("修改成功");
window.location.reload();
}
else
alert("修改失败")
},
error:function(){
alert("修改信息出现错误");
}
})
}
// 从输入框获取修改后的信息
var name=$("#inputName").val();
var age=$("#inputAge").val();
var phone=$("#inputPhone").val();
// 校验输入是否为空
if(isEmptyString(name) || isEmptyString(age) || isEmptyString(phone)){
alert("请填写全信息");
}
else{
// 输入完整,发起修改请求
$.ajax({
type:"POST",
url:"../user/updateUser.do",// 后端修改用户信息接口
dataType:"JSON",
data:{
"userid":userid, // 用户ID不变
"password":info.password, // 密码(不变,从原有信息获取)
"username":name,// 新姓名
"age":age, // 新年龄
"power":power,// 权限等级(不变)
"IDnumber":info.idnumber, // 身份证号(不变)
"phonenumber":phone // 新手机号
},
success:function(data){
if(data.code==0){
alert("修改成功");
window.location.reload();// 刷新页面加载最新信息
}
else
alert("修改失败")
},
error:function(){
alert("修改信息出现错误");
}
})
}
}
// 提交密码修改请求
function alterPwd(){
var oldPwd=$("#inputoldPwd").val();
var newPwd=$("#inputnewPwd").val();
var renewPwd=$("#inputrenewPwd").val();
if(isEmptyString(oldPwd) || isEmptyString(newPwd) || isEmptyString(renewPwd)){
alert("请填写全信息");
}
else if(oldPwd!=info.password)
alert("原密码不正确");
else if(newPwd!=renewPwd)
alert("新密码输入错误")
else{
$.ajax({
type:"POST",
url:"../user/updateUser.do",
dataType:"JSON",
data:{
"userid":userid,
"password":newPwd
},
success:function(data){
if(data.code==0){
alert("修改成功");
window.location.reload();
}
else
alert("修改失败")
},
error:function(){
alert("修改密码出现错误");
}
})
}
// 从输入框获取密码信息
var oldPwd=$("#inputoldPwd").val();// 原密码
var newPwd=$("#inputnewPwd").val(); // 新密码
var renewPwd=$("#inputrenewPwd").val(); // 确认新密码
if(isEmptyString(oldPwd) || isEmptyString(newPwd) || isEmptyString(renewPwd)){
alert("请填写全信息");
}
// 校验原密码是否正确(与原有信息比对)
else if(oldPwd!=info.password)
alert("原密码不正确");
// 校验新密码两次输入是否一致
else if(newPwd!=renewPwd)
alert("新密码输入错误")
else{
// 校验通过,发起密码修改请求
$.ajax({
type:"POST",
url:"../user/updateUser.do",// 后端修改用户信息接口(复用)
dataType:"JSON",
data:{
"userid":userid,// 用户ID
"password":newPwd // 新密码
},
success:function(data){
if(data.code==0){
alert("修改成功");
window.location.reload(); // 刷新页面
}
else
alert("修改失败")
},
error:function(){
alert("修改密码出现错误");
}
})
}
}
// 获取并展示用户薪资信息(根据权限判断是否显示)
function getSalary(){
if(power!="0"){
$("#showS").css("display","block");
$("#showC").css("display","block");
$.ajax({
type:"POST",
url:"../config/getConfig.do",
dataType:"JSON",
data:{},
success:function(data){
if(data.code=="0"){
var config=data.config;
if(power=="1"){
$("#salary").text(config.manage);
$("#commission").text(config.managesalary+"%");
}
else if(power=="2"){
$("#salary").text(config.staff);
$("#commission").text(config.staffsalary+"%");
}
else{
$("#salary").text(config.cleaner);
$("#commission").text(config.cleanerssalary+"%");
}
}
else{
alert("获取配置错误");
}
},
error:function(){
alert("获取配置发生错误")
}
});
}
// 若权限不为"0"假设0为非员工/游客1/2/3为不同角色则显示薪资区域
if(power!="0"){
$("#showS").css("display","block");// 显示薪资标签
$("#showC").css("display","block");// 显示提成标签
// 从后端获取薪资配置信息
$.ajax({
type:"POST",
url:"../config/getConfig.do",// 后端获取配置接口
dataType:"JSON",
data:{},// 无参数
success:function(data){
if(data.code=="0"){// 配置获取成功
var config=data.config;// 薪资配置信息
// 根据权限等级显示对应角色的薪资和提成比例
if(power=="1"){ // 假设1为经理
$("#salary").text(config.manage); // 经理基础薪资
$("#commission").text(config.managesalary+"%");// 经理提成比例
}
else if(power=="2"){// 假设2为员工
$("#salary").text(config.staff);// 员工基础薪资
$("#commission").text(config.staffsalary+"%");// 员工提成比例
}
else{ // 其他权限(假设为清洁工)
$("#salary").text(config.cleaner); // 清洁工基础薪资
$("#commission").text(config.cleanerssalary+"%");// 清洁工提成比例
}
}
else{
alert("获取配置错误");
}
},
error:function(){
alert("获取配置发生错误")
}
});
}
}

@ -2,134 +2,148 @@ var pageNum=1;
var pageSize=8;
var l;
// 页面DOM加载完成后执行初始化操作
$(document).ready(function(){
getroomList();
$("#pre").on('click',function(){
getPre();
});
$("#next").on('click',function(){
getNext();
});
getroomList();
$("#pre").on('click',function(){
getPre();
});
$("#next").on('click',function(){
getNext();
});
})
//判断对象/JSON是否为空 空返回1 非空返回0
function isEmptyObject(e) {
var t;
for (t in e)
return 0;
return 1;
var t;
for (t in e)
return 0;
return 1;
}
var list;
// 从后端获取房间列表并展示
function getroomList(){
$.ajax({
type:"post",
url:"../room/getRoom.do",
dataType:"JSON",
data:{
"state":"3",
"type":"-1",
"pageNum":pageNum,
"pageSize":pageSize
},
success:function(data){
if(isEmptyObject(data.List)&&pageNum>0){
pageNum=pageNum-1;
getroomList();
}
else{
list=data.List;
var power=" ";
var htmlStr=" ";
var btnStr=" ";
var state=" ";
var type=" ";
l=0;
$("#pre").css("display","block");
$("#next").css("display","block");
$("#roomList").empty();
$("#roomList").append("<tr><th>位置</th><th>价格</th><th>状态</th><th>类型</th><th>操作</th></tr>");
state="未清扫";
for(i in list){
if(list[i].type=="1")
type="单人间";
else if(list[i].type=="2")
type="双人间";
else if(list[i].type=="3")
type="大床房";
else
type="套房"
btnStr="<input type=\"button\" class=\"btn btn-success\" data-roomid=\""+list[i].roomid+"\" id=\"setRoom\" value=\"已清扫\">";
htmlStr="<tr data-roomid=\""+list[i].roomid+"\"><td>"+list[i].local+"</td><td>"+list[i].money+"</td><td>"+state+"</td><td>"+type+"</td><td>"+btnStr+"</td></tr>";
$("#roomList").append(htmlStr);
l++;
}
if(pageNum=="1") $("#pre").css("display","none");
if(pageSize>l) $("#next").css("display","none");
btnOn();
}
$.ajax({
type:"post",
url:"../room/getRoom.do",
dataType:"JSON",
data:{
"state":"3",
"type":"-1",
"pageNum":pageNum,
"pageSize":pageSize
},
// 请求成功的回调函数
success:function(data){
// 若当前页无数据且页码大于0回退到上一页并重新加载
if(isEmptyObject(data.List)&&pageNum>0){
pageNum=pageNum-1;
getroomList();
}
else{
// 存储房间列表数据
list=data.List;
var power=" ";
var htmlStr=" ";
var btnStr=" ";
var state=" ";
var type=" ";
l=0;
// 默认显示上一页、下一页按钮
$("#pre").css("display","block");
$("#next").css("display","block");
$("#roomList").empty();
$("#roomList").append("<tr><th>位置</th><th>价格</th><th>状态</th><th>类型</th><th>操作</th></tr>");
state="未清扫";
// 遍历房间列表,拼接表格内容
for(i in list){
if(list[i].type=="1")
type="单人间";
else if(list[i].type=="2")
type="双人间";
else if(list[i].type=="3")
type="大床房";
else
type="套房"
btnStr="<input type=\"button\" class=\"btn btn-success\" data-roomid=\""+list[i].roomid+"\" id=\"setRoom\" value=\"已清扫\">";
htmlStr="<tr data-roomid=\""+list[i].roomid+"\"><td>"+list[i].local+"</td><td>"+list[i].money+"</td><td>"+state+"</td><td>"+type+"</td><td>"+btnStr+"</td></tr>";
$("#roomList").append(htmlStr);
l++;
}
if(pageNum=="1") $("#pre").css("display","none");
if(pageSize>l) $("#next").css("display","none");
btnOn();
}
},
error:function(){
alert("获取房间列表发生错误")
}
})
},
// 请求失败的回调函数
error:function(){
alert("获取房间列表发生错误")
}
})
}
// 绑定页面中操作按钮的点击事件
function btnOn(){;
$("input").filter("#setPageBtn").on('click',function( ){
setPage( );
});
$("input").filter("#setRoom").on('click',function(event ){
setRoom(event);
});
$("input").filter("#setPageBtn").on('click',function( ){
setPage( );
});
$("input").filter("#setRoom").on('click',function(event ){
setRoom(event);
});
}
// 修改房间状态为"已清扫"
function setRoom(event){
var roomid=$(event.target).data("roomid");
$.ajax({
type:"POST",
url:"../room/updateRoom.do",
dataType:"JSON",
data:{
"roomid":roomid,
"state":"1"
},
success:function(data){
if(data.code==0){
alert("修改成功");
getroomList();
}
else{
alert("修改失败");
getroomList();
}
},
error:function(){
alert("修改信息出现错误");
}
})
var roomid=$(event.target).data("roomid");
$.ajax({
type:"POST",
url:"../room/updateRoom.do",
dataType:"JSON",
data:{
"roomid":roomid,
"state":"1"
},
// 请求成功的回调函数
success:function(data){
if(data.code==0){
alert("修改成功");
getroomList();
}
else{
alert("修改失败");
getroomList();
}
},
error:function(){
alert("修改信息出现错误");
}
})
}
// 加载上一页数据
function getPre(){
pageNum=pageNum-1;
getroomList();
pageNum=pageNum-1;
getroomList();
}
// 加载下一页数据
function getNext(){
pageNum=pageNum+1;
getroomList();
pageNum=pageNum+1;
getroomList();
}
// 跳转到指定页码
function setPage(){
if($("#inputPage").val()<0 || $("#inputPage").val()==0)
alert("请输入正确页码");
else{
pageNum=$("#inputPage").val();
getroomList();
}
if($("#inputPage").val()<0 || $("#inputPage").val()==0)
alert("请输入正确页码");
else{
pageNum=$("#inputPage").val();
getroomList();
}
}

@ -1,47 +1,51 @@
// 页面DOM加载完成后执行初始化操作
$(document).ready(function(){
getCode();
var h=$(window).height();
$("#main").css("height",h);
$("#loginBtn").click(function(){
login();
})
$("#code").click(function(){
getCode();
})
getCode();
var h=$(window).height();
$("#main").css("height",h);
$("#loginBtn").click(function(){
login();
})
$("#code").click(function(){
getCode();
})
})
//获取验证码
function getCode(){
$("#code").attr("src","./user/createImage?code="+Math.random());
$("#code").attr("src","./user/createImage?code="+Math.random());
}
//登录
function login(){
var user=$("#inputName").val();
var pwd=$("#inputPassword").val();
var code=$("#inputCode").val();
$.ajax({
type:"POST",
url:"./user/login.do",
dataType:"JSON",
data:{
"useraccount":user,
"password":pwd,
"icode":code
},
success:function(data){
console.log(data)
if(data.code=="0"){
var urlString="pages/myCenter.html?power="+data.power+"&userid="+data.userid;
window.location.href=urlString;
}
else if(data.code=="-1"){
alert("验证码或密码错误")
}
},
error:function(){
alert("登录 发生错误");
}
});
var user=$("#inputName").val();
var pwd=$("#inputPassword").val();
var code=$("#inputCode").val();
// 发起AJAX登录请求
$.ajax({
type:"POST",
url:"./user/login.do",
dataType:"JSON",
data:{
"useraccount":user,
"password":pwd,
"icode":code
},
// 请求成功的回调函数(后端返回数据后执行)
success:function(data){
console.log(data)
if(data.code=="0"){
var urlString="pages/myCenter.html?power="+data.power+"&userid="+data.userid;
window.location.href=urlString;
}
else if(data.code=="-1"){
alert("验证码或密码错误")
}
},
// 请求失败的回调函数(网络错误或接口异常时执行)
error:function(){
alert("登录 发生错误");
}
});
}

@ -2,283 +2,298 @@ var pageNum=1;
var pageSize=8;
var l;
// 页面DOM加载完成后执行初始化操作
$(document).ready(function(){
getroomList();
$("#pre").on('click',function(){
getPre();
});
$("#next").on('click',function(){
getNext();
});
$("input").filter("#setRoomBtn").on('click',function( ){
setRoomajax( );
});
getroomList();
$("#pre").on('click',function(){
getPre();
});
$("#next").on('click',function(){
getNext();
});
$("input").filter("#setRoomBtn").on('click',function( ){
setRoomajax( );
});
$("input").filter("#addRoomBtn").on('click',function(){
addRoom();
});
$("input").filter("#addRoomBtn").on('click',function(){
addRoom();
});
})
//判断对象/JSON是否为空 空返回1 非空返回0
function isEmptyObject(e) {
var t;
for (t in e)
return 0;
return 1;
var t;
for (t in e)
return 0;
return 1;
}
//判断字符串是否为空 空返回1 非空返回0
function isEmptyString(str){
if(str=='null'||str=='')
return 1;
return 0;
if(str=='null'||str=='')
return 1;
return 0;
}
var list;
// 从后端获取房间列表并展示
function getroomList(){
$.ajax({
type:"post",
url:"../room/getRoom.do",
dataType:"JSON",
data:{
"state":"-1",
"type":"-1",
"pageNum":pageNum,
"pageSize":pageSize
},
success:function(data){
if(isEmptyObject(data.List)&&pageNum>0){
pageNum=pageNum-1;
getroomList();
}
else{
list=data.List;
var power=" ";
var htmlStr=" ";
var btnStr=" ";
var state=" ";
var type=" ";
l=0;
$("#pre").css("display","block");
$("#next").css("display","block");
$("#roomList").empty();
$("#roomList").append("<tr><th>位置</th><th>价格</th><th>状态</th><th>类型</th><th>操作</th></tr>")
for(i in list){
if(list[i].state=="0"){
state="停用";
btnStr="<input type=\"button\" class=\"btn btn-info\" data-roomid=\""+list[i].roomid+"\" id=\"setStart\" value=\"开始使用\"> <input type=\"button\" class=\"btn btn-success\" data-toggle=\"modal\" data-target=\"#alterRoom\" data-roomid=\""+list[i].roomid+"\" id=\"setRoom\" value=\"修改信息\"> <input type=\"button\" class=\"btn btn-danger\" data-roomid=\""+list[i].roomid+"\" value=\"删除\" id=\"delRoom\">";
}
else if(list[i].state=="1"){
state="未预定";
btnStr="<input type=\"button\" class=\"btn btn-info\" data-roomid=\""+list[i].roomid+"\" id=\"setStop\" value=\"改为停用\"> <input type=\"button\" class=\"btn btn-success\" data-toggle=\"modal\" data-target=\"#alterRoom\" data-roomid=\""+list[i].roomid+"\" id=\"setRoom\" value=\"修改信息\"> <input type=\"button\" class=\"btn btn-danger\" data-roomid=\""+list[i].roomid+"\" value=\"删除\" id=\"delRoom\">";
}
else if(list[i].state=="2"){
state="已预定(入住)";
btnStr="<input type=\"button\" class=\"btn btn-success\" data-toggle=\"modal\" data-target=\"#alterRoom\" data-roomid=\""+list[i].roomid+"\" id=\"setRoom\" value=\"修改信息\">";
}
else{
state="待清扫";
btnStr="<input type=\"button\" class=\"btn btn-info\" data-roomid=\""+list[i].roomid+"\" id=\"setStop\" value=\"改为停用\"> <input type=\"button\" class=\"btn btn-success\" data-toggle=\"modal\" data-target=\"#alterRoom\" data-roomid=\""+list[i].roomid+"\" id=\"setRoom\" value=\"修改信息\"> <input type=\"button\" class=\"btn btn-danger\" data-roomid=\""+list[i].roomid+"\" value=\"删除\" id=\"delRoom\">";
}
$.ajax({
type:"post",
url:"../room/getRoom.do",
dataType:"JSON",
data:{
"state":"-1",
"type":"-1",
"pageNum":pageNum,
"pageSize":pageSize
},
// 请求成功的回调函数
success:function(data){
if(isEmptyObject(data.List)&&pageNum>0){
pageNum=pageNum-1;
getroomList();
}
else{
list=data.List;
var power=" ";
var htmlStr=" ";
var btnStr=" ";
var state=" ";
var type=" ";
l=0;
// 默认显示上一页、下一页按钮
$("#pre").css("display","block");
$("#next").css("display","block");
$("#roomList").empty();
$("#roomList").append("<tr><th>位置</th><th>价格</th><th>状态</th><th>类型</th><th>操作</th></tr>")
// 遍历房间列表,生成表格内容
for(i in list){
if(list[i].state=="0"){
state="停用";
btnStr="<input type=\"button\" class=\"btn btn-info\" data-roomid=\""+list[i].roomid+"\" id=\"setStart\" value=\"开始使用\"> <input type=\"button\" class=\"btn btn-success\" data-toggle=\"modal\" data-target=\"#alterRoom\" data-roomid=\""+list[i].roomid+"\" id=\"setRoom\" value=\"修改信息\"> <input type=\"button\" class=\"btn btn-danger\" data-roomid=\""+list[i].roomid+"\" value=\"删除\" id=\"delRoom\">";
}
else if(list[i].state=="1"){
state="未预定";
btnStr="<input type=\"button\" class=\"btn btn-info\" data-roomid=\""+list[i].roomid+"\" id=\"setStop\" value=\"改为停用\"> <input type=\"button\" class=\"btn btn-success\" data-toggle=\"modal\" data-target=\"#alterRoom\" data-roomid=\""+list[i].roomid+"\" id=\"setRoom\" value=\"修改信息\"> <input type=\"button\" class=\"btn btn-danger\" data-roomid=\""+list[i].roomid+"\" value=\"删除\" id=\"delRoom\">";
}
else if(list[i].state=="2"){
state="已预定(入住)";
btnStr="<input type=\"button\" class=\"btn btn-success\" data-toggle=\"modal\" data-target=\"#alterRoom\" data-roomid=\""+list[i].roomid+"\" id=\"setRoom\" value=\"修改信息\">";
}
else{
state="待清扫";
btnStr="<input type=\"button\" class=\"btn btn-info\" data-roomid=\""+list[i].roomid+"\" id=\"setStop\" value=\"改为停用\"> <input type=\"button\" class=\"btn btn-success\" data-toggle=\"modal\" data-target=\"#alterRoom\" data-roomid=\""+list[i].roomid+"\" id=\"setRoom\" value=\"修改信息\"> <input type=\"button\" class=\"btn btn-danger\" data-roomid=\""+list[i].roomid+"\" value=\"删除\" id=\"delRoom\">";
}
// 根据房间类型编码转换为文本
if(list[i].type=="1")
type="单人间";
else if(list[i].type=="2")
type="双人间";
else if(list[i].type=="3")
type="大床房";
else
type="套房"
if(list[i].type=="1")
type="单人间";
else if(list[i].type=="2")
type="双人间";
else if(list[i].type=="3")
type="大床房";
else
type="套房"
// 拼接表格行(包含房间信息和操作按钮)
htmlStr="<tr data-roomid=\""+list[i].roomid+"\"><td>"+list[i].local+"</td><td>"+list[i].money+"</td><td>"+state+"</td><td>"+type+"</td><td>"+btnStr+"</td></tr>";
$("#roomList").append(htmlStr);
l++;
}
if(pageNum=="1") $("#pre").css("display","none");
if(pageSize>l) $("#next").css("display","none");
btnOn();
}
htmlStr="<tr data-roomid=\""+list[i].roomid+"\"><td>"+list[i].local+"</td><td>"+list[i].money+"</td><td>"+state+"</td><td>"+type+"</td><td>"+btnStr+"</td></tr>";
$("#roomList").append(htmlStr);
l++;
}
if(pageNum=="1") $("#pre").css("display","none");
if(pageSize>l) $("#next").css("display","none");
btnOn();
}
},
error:function(){
alert("获取房间列表发生错误")
}
})
},
// 请求失败的回调函数
error:function(){
alert("获取房间列表发生错误")
}
})
}
// 绑定页面中所有操作按钮的点击事件
function btnOn(){
$("input").filter("#delRoom").on('click',function(event){
delRoom(event);
});
$("input").filter("#setPageBtn").on('click',function( ){
setPage( );
})
$("input").filter("#setStop").on('click',function(event){
setState(event,"0");
});
$("input").filter("#setStart").on('click',function(event){
setState(event,"1");
});
$("input").filter("#setRoom").on('click',function(event){
setRoom(event);
});
$("input").filter("#delRoom").on('click',function(event){
delRoom(event);
});
$("input").filter("#setPageBtn").on('click',function( ){
setPage( );
})
$("input").filter("#setStop").on('click',function(event){
setState(event,"0");
});
$("input").filter("#setStart").on('click',function(event){
setState(event,"1");
});
$("input").filter("#setRoom").on('click',function(event){
setRoom(event);
});
}
// 加载上一页数据
function getPre(){
pageNum=pageNum-1;
getroomList();
pageNum=pageNum-1;
getroomList();
}
// 加载下一页数据
function getNext(){
pageNum=pageNum+1;
getroomList();
pageNum=pageNum+1;
getroomList();
}
// 填充房间修改表单(将当前房间信息显示到修改弹窗中)
function setRoom(event){
var roomid=$(event.target).data("roomid");
var info;
for(i in list){
if(list[i].roomid==roomid){
info=list[i];
}
}
$("#reinputLocal").val(info.local);
$("#reinputPrice").val(info.money);
$("#reinputType").val(info.type);
$("#reinputid").val(roomid);
var roomid=$(event.target).data("roomid");
var info;
for(i in list){
if(list[i].roomid==roomid){
info=list[i];
}
}
// 将房间信息填充到修改表单的输入框中
$("#reinputLocal").val(info.local);
$("#reinputPrice").val(info.money);
$("#reinputType").val(info.type);
$("#reinputid").val(roomid);
}
// 提交房间信息修改请求AJAX
function setRoomajax( ){
$.ajax({
type:"POST",
url:"../room/updateRoom.do",
dataType:"JSON",
data:{
"roomid":$("#reinputid").val(),
"money":$("#reinputPrice").val(),
"type":$("#reinputType").val(),
"local":$("#reinputLocal").val()
},
success:function(data){
if(data.code==0){
alert("修改成功");
$("#reinputLocal").val("");
$("#reinputPrice").val("");
$("#reinputType").val("");
$("#reinputid").val("");
$('#alterRoom').modal('toggle');
getroomList();
}
else{
alert("修改失败");
getroomList();
}
},
error:function(){
alert("修改信息出现错误");
}
})
$.ajax({
type:"POST",
url:"../room/updateRoom.do",
dataType:"JSON",
data:{
"roomid":$("#reinputid").val(),
"money":$("#reinputPrice").val(),
"type":$("#reinputType").val(),
"local":$("#reinputLocal").val()
},
// 请求成功的回调函数
success:function(data){
if(data.code==0){
alert("修改成功");
$("#reinputLocal").val("");
$("#reinputPrice").val("");
$("#reinputType").val("");
$("#reinputid").val("");
$('#alterRoom').modal('toggle');
// 无论成功与否,重新加载房间列表展示最新数据
getroomList();
}
else{
alert("修改失败");
getroomList();
}
},
error:function(){
alert("修改信息出现错误");
}
})
}
// 修改房间状态(启用/停用)
function setState(event,alter){
var roomid=$(event.target).data("roomid");
$.ajax({
type:"POST",
url:"../room/updateRoom.do",
dataType:"JSON",
data:{
"roomid":roomid,
"state":alter
},
success:function(data){
if(data.code==0){
alert("修改成功");
getroomList();
}
else
alert("修改失败")
},
error:function(){
alert("修改信息出现错误");
}
})
var roomid=$(event.target).data("roomid");
$.ajax({
type:"POST",
url:"../room/updateRoom.do",
dataType:"JSON",
data:{
"roomid":roomid,
"state":alter
},
// 请求成功的回调函数
success:function(data){
if(data.code==0){
alert("修改成功");
// 重新加载房间列表展示最新状态
getroomList();
}
else
alert("修改失败")
},
error:function(){
alert("修改信息出现错误");
}
})
}
// 跳转到指定页码
function setPage(){
if($("#inputPage").val()<0 || $("#inputPage").val()==0)
alert("请输入正确页码");
else{
pageNum=$("#inputPage").val();
getroomList();
}
}
// 校验输入的页码是否合法必须大于0
if($("#inputPage").val()<0 || $("#inputPage").val()==0)
alert("请输入正确页码");
else{
pageNum=$("#inputPage").val();
getroomList();
}
}
// 删除房间
function delRoom(event){
var roomid=$(event.target).data("roomid");
$.ajax({
type:"POST",
url:"../room/delRoom.do",
dataType:"JSON",
data:{
"roomid":roomid
},
success:function(data){
if(data.code==0){
alert("删除成功");
if(l==1)
pageNum=pageNum-1;
getroomList();
}
else
alert("删除失败")
},
error:function(){
alert("删除出现错误");
}
})
var roomid=$(event.target).data("roomid");
$.ajax({
type:"POST",
url:"../room/delRoom.do",
dataType:"JSON",
data:{
"roomid":roomid
},
// 请求成功的回调函数
success:function(data){
if(data.code==0){
alert("删除成功");
if(l==1)
pageNum=pageNum-1;
getroomList();
}
else
alert("删除失败")
},
error:function(){
alert("删除出现错误");
}
})
}
// 添加新房间
function addRoom(){
if(isEmptyString($("#inputLocal").val())||isEmptyString($("#inputLocal").val())||isEmptyString($("#inputType").val()))
alert("请填写全内容");
else{
$.ajax({
type:"POST",
url:"../room/addRoom.do",
dataType:"JSON",
data:{
"local":$("#inputLocal").val(),
"money":$("#inputPrice").val(),
"state":"1",
"type":$("#inputType").val()
},
success:function(data){
if(data.code==0){
alert("添加成功");
$('#addRoom').modal('toggle');
$("#inputLocal").val(" ");
$("#inputPrice").val(" ");
$("#inputType").val(" ");
getroomList();
}
else{
alert("添加失败");
window.location.reload();
}
},
error:function(){
alert("添加出现错误");
}
})
}
if(isEmptyString($("#inputLocal").val())||isEmptyString($("#inputLocal").val())||isEmptyString($("#inputType").val()))
alert("请填写全内容");
else{
$.ajax({
type:"POST",
url:"../room/addRoom.do",
dataType:"JSON",
data:{
"local":$("#inputLocal").val(),
"money":$("#inputPrice").val(),
"state":"1",
"type":$("#inputType").val()
},
success:function(data){
if(data.code==0){
alert("添加成功");
$('#addRoom').modal('toggle');
$("#inputLocal").val(" ");
$("#inputPrice").val(" ");
$("#inputType").val(" ");
getroomList();
}
else{
alert("添加失败");
window.location.reload();
}
},
error:function(){
alert("添加出现错误");
}
})
}
}

@ -1,175 +1,182 @@
var pageNum=1;
var pageSize=8;
var l;
// 页面DOM加载完成后执行初始化操作
$(document).ready(function(){
getStaffList();
$("#pre").on('click',function(){
getPre();
});
$("#next").on('click',function(){
getNext();
});
$("#addUserBtn").on('click',function(){
addUser();
})
getStaffList();
$("#pre").on('click',function(){
getPre();
});
$("#next").on('click',function(){
getNext();
});
$("#addUserBtn").on('click',function(){
addUser();
})
})
//判断对象/JSON是否为空 空返回1 非空返回0
function isEmptyObject(e) {
var t;
for (t in e)
return 0;
return 1;
var t;
for (t in e)
return 0;
return 1;
}
//判断字符串是否为空 空返回1 非空返回0
function isEmptyString(str){
if(str=='null'||str=='')
return 1;
return 0;
if(str=='null'||str=='')
return 1;
return 0;
}
var list;
// 从后端获取员工列表并展示
function getStaffList(){
$.ajax({
type:"post",
url:"../user/getUserByPower.do",
dataType:"JSON",
data:{
"pageNum":pageNum,
"pageSize":pageSize,
"power":"2"
},
success:function(data){
if(data.code=="0"){
if(isEmptyObject(data.List)&&pageNum>0){
pageNum=pageNum-1;
getStaffList();
}
else{
var power=" ";
var htmlStr=" ";
var btnStr=" ";
list=data.List;
l=0;
$("#pre").css("display","block");
$("#next").css("display","block");
$("#staffList").empty();
$("#staffList").append("<tr><th>账号</th><th>员工号</th><th>姓名</th><th>年龄</th><th>职位</th><th>联系方式</th><th>操作</th></tr>")
for(i in list){
btnStr="<input type=\"button\" id=\"delUser\" data-userid=\""+list[i].userid+"\" class=\"btn btn-danger\" value=\"删除\"/>"
htmlStr="<tr data-userid=\""+list[i].userid+"\"><td>"+list[i].useraccount+"</td><td>"+list[i].idnumber+"</td><td>"+list[i].username+"</td><td>"+list[i].age+"</td><td>"+"员工"+"</td><td>"+list[i].phonenumber+"</td><td>"+btnStr+"</td></tr>";
$("#staffList").append(htmlStr);
//console.log(htmlStr);
l++;
}
if(pageNum=="1") $("#pre").css("display","none");
if(pageSize>l) $("#next").css("display","none");
btnOn();
}
}
else{
alert("获取员工列表失败");
}
},
error:function(){
alert("获取员工列表发生错误")
}
})
$.ajax({
type:"post",
url:"../user/getUserByPower.do",
dataType:"JSON",
data:{
"pageNum":pageNum,
"pageSize":pageSize,
"power":"2"
},
success:function(data){
// 后端返回成功状态code=0
if(data.code=="0"){
// 若当前页无数据且页码大于0回退到上一页并重新加载
if(isEmptyObject(data.List)&&pageNum>0){
pageNum=pageNum-1;
getStaffList();
}
else{
var power=" ";
var htmlStr=" ";
var btnStr=" ";
list=data.List;
l=0;
// 默认显示上一页、下一页按钮
$("#pre").css("display","block");
$("#next").css("display","block");
$("#staffList").empty();
$("#staffList").append("<tr><th>账号</th><th>员工号</th><th>姓名</th><th>年龄</th><th>职位</th><th>联系方式</th><th>操作</th></tr>")
// 遍历员工列表,生成表格内容
for(i in list){
btnStr="<input type=\"button\" id=\"delUser\" data-userid=\""+list[i].userid+"\" class=\"btn btn-danger\" value=\"删除\"/>"
htmlStr="<tr data-userid=\""+list[i].userid+"\"><td>"+list[i].useraccount+"</td><td>"+list[i].idnumber+"</td><td>"+list[i].username+"</td><td>"+list[i].age+"</td><td>"+"员工"+"</td><td>"+list[i].phonenumber+"</td><td>"+btnStr+"</td></tr>";
$("#staffList").append(htmlStr);
//console.log(htmlStr);
l++;
}
// 若当前是第1页隐藏"上一页"按钮
if(pageNum=="1") $("#pre").css("display","none");
if(pageSize>l) $("#next").css("display","none");
btnOn();
}
}
else{
alert("获取员工列表失败");
}
},
error:function(){
alert("获取员工列表发生错误")
}
})
}
// 绑定页面中操作按钮的点击事件
function btnOn(){
$("input").filter("#delUser").on('click',function(event){
delUser(event);
});
$("input").filter("#setPageBtn").on('click',function( ){
setPage( );
})
$("input").filter("#delUser").on('click',function(event){
delUser(event);
});
$("input").filter("#setPageBtn").on('click',function( ){
setPage( );
})
}
// 加载上一页数据
function getPre(){
pageNum=pageNum-1;
getStaffList();
pageNum=pageNum-1;
getStaffList();
}
// 加载下一页数据
function getNext(){
pageNum=pageNum+1;
getStaffList();
pageNum=pageNum+1;
getStaffList();
}
// 跳转到指定页码
function setPage(){
if($("#inputPage").val()<0 || $("#inputPage").val()==0)
alert("请输入正确页码");
else{
pageNum=$("#inputPage").val();
getStaffList();
}
}
if($("#inputPage").val()<0 || $("#inputPage").val()==0)
alert("请输入正确页码");
else{
pageNum=$("#inputPage").val();
getStaffList();
}
}
// 删除员工
function delUser(event){
var userid=$(event.target).data("userid");
$.ajax({
type:"POST",
url:"../user/delUser.do",
dataType:"JSON",
data:{
"userid":userid
},
success:function(data){
if(data.code==0){
alert("删除成功");
if(l==1)
pageNum=pageNum-1;
getStaffList();
}
else
alert("删除失败")
},
error:function(){
alert("删除出现错误");
}
})
var userid=$(event.target).data("userid");
$.ajax({
type:"POST",
url:"../user/delUser.do",
dataType:"JSON",
data:{
"userid":userid
},
success:function(data){
if(data.code==0){
alert("删除成功");
if(l==1)
pageNum=pageNum-1;
getStaffList();
}
else
alert("删除失败")
},
error:function(){
alert("删除出现错误");
}
})
}
// 添加新员工
function addUser(){
if(isEmptyString($("#inputAccount").val())||isEmptyString($("#inputPwd").val()))
alert("请填写全内容");
else{
$.ajax({
type:"POST",
url:"../user/addUser.do",
dataType:"JSON",
data:{
"useraccount":$("#inputAccount").val(),
"password":$("#inputPwd").val(),
"power":"2"
},
success:function(data){
if(data.code==0){
alert("添加成功");
$('#addUser').modal('toggle');
$("#inputAccount").val("");
$("#inputPwd").val("")
getStaffList();
}
else
alert("添加失败")
},
error:function(){
alert("添加用户出现错误");
}
})
}
if(isEmptyString($("#inputAccount").val())||isEmptyString($("#inputPwd").val()))
alert("请填写全内容");
else{
$.ajax({
type:"POST",
url:"../user/addUser.do",
dataType:"JSON",
data:{
"useraccount":$("#inputAccount").val(),
"password":$("#inputPwd").val(),
"power":"2"
},
success:function(data){
if(data.code==0){
alert("添加成功");
$('#addUser').modal('toggle');
$("#inputAccount").val("");
$("#inputPwd").val("")
getStaffList();
}
else
alert("添加失败")
},
// 重新加载员工列表展示新添加的员工
error:function(){
alert("添加用户出现错误");
}
})
}
}

@ -1,48 +1,49 @@
// 定义jQuery扩展方法从URL参数中获取指定名称的值
(function($){
$.getData=function(name){
var reg=new RegExp("(^|&)"+name+"=([^&]+)(&|$)?");
var result = window.location.search.substr(1).match(reg);
if (result!= null) return result[2]; return null;
}
$.getData=function(name){
var reg=new RegExp("(^|&)"+name+"=([^&]+)(&|$)?");
var result = window.location.search.substr(1).match(reg);
if (result!= null) return result[2]; return null;
}
})(jQuery);
// 从URL参数中获取用户权限power和用户IDuserid
var power=$.getData('power');
var userid=$.getData('userid');
// 页面DOM加载完成后执行初始化操作
$(document).ready(function(){
$("#mainFrame").attr("src","all_infor.html?userid="+userid+"&power="+power);
$("inputNone").attr("value",userid);
var h=$(window).height();
$("#tagList").css("height",h);
$("#mainFrame").css("height",h);
setList();
$("#mainFrame").attr("src","all_infor.html?userid="+userid+"&power="+power);
$("inputNone").attr("value",userid);
var h=$(window).height();
$("#tagList").css("height",h);
$("#mainFrame").css("height",h);
setList();
})
// 根据用户权限生成侧边栏菜单
function setList(){
var tagList=" ";
if(power=="0"){
tagList="<a href=\"all_infor.html?userid="+userid+"&power="+power+"\" target=\"mainFrame\" class=\"list-group-item active\"><span class=\"glyphicon glyphicon-user\" aria-hidden=\"true\"></span>个人信息</a><a href=\"ad_manage.html\" target=\"mainFrame\" class=\"list-group-item\"><span class=\"glyphicon glyphicon-list\" aria-hidden=\"true\"></span>人员管理</a> <a href=\"ad_order.html\" target=\"mainFrame\" class=\"list-group-item\"><span class=\"glyphicon glyphicon-shopping-cart\" aria-hidden=\"true\"></span> 订单管理</a> <a href=\"ad_salary.html\" target=\"mainFrame\" class=\"list-group-item\"><span class=\"glyphicon glyphicon-usd\" aria-hidden=\"true\"></span>工资管理</a>"
}
else if(power=="1"){
tagList="<a href=\"all_infor.html?userid="+userid+"&power="+power+"\" target=\"mainFrame\" class=\"list-group-item active\"><span class=\"glyphicon glyphicon-user\" aria-hidden=\"true\"></span>个人信息</a><a href=\"manage_staff.html\" target=\"mainFrame\" class=\"list-group-item\"><span class=\"glyphicon glyphicon-list\" aria-hidden=\"true\"></span>员工管理</a><a href=\"manage_room.html\" target=\"mainFrame\" class=\"list-group-item\"><span class=\"glyphicon glyphicon-home\" aria-hidden=\"true\"></span>房间管理</a><a href=\"ad_order.html\" target=\"mainFrame\" class=\"list-group-item\"><span class=\"glyphicon glyphicon-shopping-cart\" aria-hidden=\"true\"></span> 订单管理</a>"
}
else if(power=="2"){
tagList="<a href=\"all_infor.html?userid="+userid+"&power="+power+"\" target=\"mainFrame\" class=\"list-group-item active\"><span class=\"glyphicon glyphicon-user\" aria-hidden=\"true\"></span>个人信息</a><a href=\"staff_room.html?userid="+userid+"\" target=\"mainFrame\" class=\"list-group-item\"><span class=\"glyphicon glyphicon-home\" aria-hidden=\"true\"></span>订房</a><a href=\"staff_order.html\" target=\"mainFrame\" class=\"list-group-item\"><span class=\"glyphicon glyphicon-shopping-cart\" aria-hidden=\"true\"></span> 订单管理</a><a href=\"staff_cleaner.html\" target=\"mainFrame\" class=\"list-group-item\"><span class=\"glyphicon glyphicon-list\" aria-hidden=\"true\"></span>清洁工管理</a>"
}
else if(power=="3"){
tagList="<a href=\"all_infor.html?userid="+userid+"&power="+power+"\" target=\"mainFrame\" class=\"list-group-item active\"><span class=\"glyphicon glyphicon-user\" aria-hidden=\"true\"></span>个人信息</a><a href=\"cleaner_room.html\" target=\"mainFrame\" class=\"list-group-item\"><span class=\"glyphicon glyphicon-home\" aria-hidden=\"true\"></span>房间管理</a>"
}
$("#tagList").append(tagList);
tagList=$("#tagList").children("a");
tagList.on('click',function(event){
changeColor(event)
});
var tagList=" ";
if(power=="0"){
tagList="<a href=\"all_infor.html?userid="+userid+"&power="+power+"\" target=\"mainFrame\" class=\"list-group-item active\"><span class=\"glyphicon glyphicon-user\" aria-hidden=\"true\"></span>个人信息</a><a href=\"ad_manage.html\" target=\"mainFrame\" class=\"list-group-item\"><span class=\"glyphicon glyphicon-list\" aria-hidden=\"true\"></span>人员管理</a> <a href=\"ad_order.html\" target=\"mainFrame\" class=\"list-group-item\"><span class=\"glyphicon glyphicon-shopping-cart\" aria-hidden=\"true\"></span> 订单管理</a> <a href=\"ad_salary.html\" target=\"mainFrame\" class=\"list-group-item\"><span class=\"glyphicon glyphicon-usd\" aria-hidden=\"true\"></span>工资管理</a>"
}
else if(power=="1"){
tagList="<a href=\"all_infor.html?userid="+userid+"&power="+power+"\" target=\"mainFrame\" class=\"list-group-item active\"><span class=\"glyphicon glyphicon-user\" aria-hidden=\"true\"></span>个人信息</a><a href=\"manage_staff.html\" target=\"mainFrame\" class=\"list-group-item\"><span class=\"glyphicon glyphicon-list\" aria-hidden=\"true\"></span>员工管理</a><a href=\"manage_room.html\" target=\"mainFrame\" class=\"list-group-item\"><span class=\"glyphicon glyphicon-home\" aria-hidden=\"true\"></span>房间管理</a><a href=\"ad_order.html\" target=\"mainFrame\" class=\"list-group-item\"><span class=\"glyphicon glyphicon-shopping-cart\" aria-hidden=\"true\"></span> 订单管理</a>"
}
else if(power=="2"){
tagList="<a href=\"all_infor.html?userid="+userid+"&power="+power+"\" target=\"mainFrame\" class=\"list-group-item active\"><span class=\"glyphicon glyphicon-user\" aria-hidden=\"true\"></span>个人信息</a><a href=\"staff_room.html?userid="+userid+"\" target=\"mainFrame\" class=\"list-group-item\"><span class=\"glyphicon glyphicon-home\" aria-hidden=\"true\"></span>订房</a><a href=\"staff_order.html\" target=\"mainFrame\" class=\"list-group-item\"><span class=\"glyphicon glyphicon-shopping-cart\" aria-hidden=\"true\"></span> 订单管理</a><a href=\"staff_cleaner.html\" target=\"mainFrame\" class=\"list-group-item\"><span class=\"glyphicon glyphicon-list\" aria-hidden=\"true\"></span>清洁工管理</a>"
}
else if(power=="3"){
tagList="<a href=\"all_infor.html?userid="+userid+"&power="+power+"\" target=\"mainFrame\" class=\"list-group-item active\"><span class=\"glyphicon glyphicon-user\" aria-hidden=\"true\"></span>个人信息</a><a href=\"cleaner_room.html\" target=\"mainFrame\" class=\"list-group-item\"><span class=\"glyphicon glyphicon-home\" aria-hidden=\"true\"></span>房间管理</a>"
}
$("#tagList").append(tagList);
tagList=$("#tagList").children("a");
tagList.on('click',function(event){
changeColor(event)
});
}
// 切换菜单选中状态(高亮当前点击的菜单,取消其他菜单的高亮)
function changeColor(event){
var obj=event.target;
var objSi=$(obj).siblings();
$(obj).attr("class","list-group-item active");
$(objSi).attr("class","list-group-item ");
var obj=event.target;
var objSi=$(obj).siblings();
$(obj).attr("class","list-group-item active");
$(objSi).attr("class","list-group-item ");
}

@ -2,192 +2,202 @@ var pageNum=1;
var pageSize=8;
var l;
//页面DOM加载完成后执行初始化操作
$(document).ready(function(){
getStaffList();
$("#pre").on('click',function(){
getPre();
});
$("#next").on('click',function(){
getNext();
});
$("#addUserBtn").on('click',function(){
addUser();
})
getStaffList();
$("#pre").on('click',function(){
getPre();
});
$("#next").on('click',function(){
getNext();
});
$("#addUserBtn").on('click',function(){
addUser();
})
})
//判断对象/JSON是否为空 空返回1 非空返回0
function isEmptyObject(e) {
var t;
for (t in e)
return 0;
return 1;
var t;
for (t in e)
return 0;
return 1;
}
//判断字符串是否为空 空返回1 非空返回0
function isEmptyString(str){
if(str=='null'||str=='')
return 1;
return 0;
if(str=='null'||str=='')
return 1;
return 0;
}
// 全局变量:存储清洁工列表数据
var list;
// 从后端获取清洁工列表并展示
function getStaffList(){
$.ajax({
type:"post",
url:"../user/getUserByPower.do",
dataType:"JSON",
data:{
"pageNum":pageNum,
"pageSize":pageSize,
"power":"3"
},
success:function(data){
if(data.code){
if(isEmptyObject(data.List)&&pageNum>0){
pageNum=pageNum-1;
getStaffList();
}
else{
var power=" ";
var htmlStr=" ";
var btnStr=" ";
list=data.List;
l=0;
$("#pre").css("display","block");
$("#next").css("display","block");
$("#staffList").empty();
$("#staffList").append("<tr><th>账号</th><th>员工号</th><th>姓名</th><th>年龄</th><th>职位</th><th>联系方式</th><th>操作</th></tr>")
for(i in list){
btnStr="<input type=\"button\" id=\"delUser\" data-userid=\""+list[i].userid+"\" class=\"btn btn-danger\" value=\"删除\"/>"
htmlStr="<tr data-userid=\""+list[i].userid+"\"><td>"+list[i].useraccount+"</td><td>"+list[i].idnumber+"</td><td>"+list[i].username+"</td><td>"+list[i].age+"</td><td>"+"清洁工"+"</td><td>"+list[i].phonenumber+"</td><td>"+btnStr+"</td></tr>";
$("#staffList").append(htmlStr);
//console.log(htmlStr);
l++;
}
if(pageNum=="1") $("#pre").css("display","none");
if(pageSize>l) $("#next").css("display","none");
btnOn();
}
}
else{
alert("获取员工列表失败");
var power=" ";
var htmlStr=" ";
var btnStr=" ";
list=data.List;
l=0;
$("#pre").css("display","block");
$("#next").css("display","block");
$("#staffList").empty();
$("#staffList").append("<tr><th>账号</th><th>员工号</th><th>姓名</th><th>年龄</th><th>职位</th><th>联系方式</th><th>操作</th></tr>")
for(i in list){
btnStr="<input type=\"button\" id=\"delUser\" data-userid=\""+list[i].userid+"\" class=\"btn btn-danger\" value=\"删除\"/>"
htmlStr="<tr data-userid=\""+list[i].userid+"\"><td>"+list[i].useraccount+"</td><td>"+list[i].idnumber+"</td><td>"+list[i].username+"</td><td>"+list[i].age+"</td><td>"+"清洁工"+"</td><td>"+list[i].phonenumber+"</td><td>"+btnStr+"</td></tr>";
$("#staffList").append(htmlStr);
//console.log(htmlStr);
l++;
}
if(pageNum=="1") $("#pre").css("display","none");
if(pageSize>l) $("#next").css("display","none");
btnOn();
}
},
error:function(){
alert("获取员工列表发生错误")
}
})
$.ajax({
type:"post",
url:"../user/getUserByPower.do",
dataType:"JSON",
data:{
"pageNum":pageNum,
"pageSize":pageSize,
"power":"3"
},
// 请求成功的回调函数
success:function(data){
if(data.code){
if(isEmptyObject(data.List)&&pageNum>0){
pageNum=pageNum-1;
getStaffList();
}
else{
var power=" ";
var htmlStr=" ";
var btnStr=" ";
list=data.List;
l=0;// 重置当前页记录数
// 默认显示上一页、下一页按钮
$("#pre").css("display","block");
$("#next").css("display","block");
$("#staffList").empty();
$("#staffList").append("<tr><th>账号</th><th>员工号</th><th>姓名</th><th>年龄</th><th>职位</th><th>联系方式</th><th>操作</th></tr>")
// 遍历清洁工列表,生成表格内容
for(i in list){
btnStr="<input type=\"button\" id=\"delUser\" data-userid=\""+list[i].userid+"\" class=\"btn btn-danger\" value=\"删除\"/>"
htmlStr="<tr data-userid=\""+list[i].userid+"\"><td>"+list[i].useraccount+"</td><td>"+list[i].idnumber+"</td><td>"+list[i].username+"</td><td>"+list[i].age+"</td><td>"+"清洁工"+"</td><td>"+list[i].phonenumber+"</td><td>"+btnStr+"</td></tr>";
$("#staffList").append(htmlStr);
//console.log(htmlStr);
l++;
}
if(pageNum=="1") $("#pre").css("display","none");
if(pageSize>l) $("#next").css("display","none");
// 绑定操作按钮的点击事件
btnOn();
}
}
else{
// 后端返回失败状态,仍尝试渲染列表(兼容处理)
alert("获取员工列表失败");
var power=" ";
var htmlStr=" ";
var btnStr=" ";
list=data.List;
l=0;
$("#pre").css("display","block");
$("#next").css("display","block");
$("#staffList").empty();
$("#staffList").append("<tr><th>账号</th><th>员工号</th><th>姓名</th><th>年龄</th><th>职位</th><th>联系方式</th><th>操作</th></tr>")
for(i in list){
btnStr="<input type=\"button\" id=\"delUser\" data-userid=\""+list[i].userid+"\" class=\"btn btn-danger\" value=\"删除\"/>"
htmlStr="<tr data-userid=\""+list[i].userid+"\"><td>"+list[i].useraccount+"</td><td>"+list[i].idnumber+"</td><td>"+list[i].username+"</td><td>"+list[i].age+"</td><td>"+"清洁工"+"</td><td>"+list[i].phonenumber+"</td><td>"+btnStr+"</td></tr>";
$("#staffList").append(htmlStr);
//console.log(htmlStr);
l++;
}
if(pageNum=="1") $("#pre").css("display","none");
if(pageSize>l) $("#next").css("display","none");
btnOn();
}
},
error:function(){
alert("获取员工列表发生错误")
}
})
}
// 绑定操作按钮的点击事件
function btnOn(){
$("input").filter("#delUser").on('click',function(event){
delUser(event);
});
$("input").filter("#setPageBtn").on('click',function( ){
setPage( );
})
// 给"删除清洁工"按钮绑定点击事件,触发删除逻辑
$("input").filter("#delUser").on('click',function(event){
delUser(event);
});
// 给"跳转页码"按钮绑定点击事件,触发页码跳转
$("input").filter("#setPageBtn").on('click',function( ){
setPage( );
})
}
// 加载上一页数据
function getPre(){
pageNum=pageNum-1;
getStaffList();
pageNum=pageNum-1; // 页码减1
getStaffList();
}
// 加载下一页数据
function getNext(){
pageNum=pageNum+1;
getStaffList();
pageNum=pageNum+1;
getStaffList();
}
// 跳转到指定页码
function setPage(){
if($("#inputPage").val()<0 || $("#inputPage").val()==0)
alert("请输入正确页码");
else{
pageNum=$("#inputPage").val();
getStaffList();
}
}
if($("#inputPage").val()<0 || $("#inputPage").val()==0)
alert("请输入正确页码");
else{
pageNum=$("#inputPage").val();
getStaffList();
}
}
// 删除清洁工
function delUser(event){
var userid=$(event.target).data("userid");
$.ajax({
type:"POST",
url:"../user/delUser.do",
dataType:"JSON",
data:{
"userid":userid
},
success:function(data){
if(data.code==0){
alert("删除成功");
if(l==1)
pageNum=pageNum-1;
getStaffList();
}
else
alert("删除失败")
},
error:function(){
alert("删除出现错误");
}
})
var userid=$(event.target).data("userid");
$.ajax({
type:"POST",
url:"../user/delUser.do",
dataType:"JSON",
data:{
"userid":userid
},
success:function(data){
if(data.code==0){
alert("删除成功");
if(l==1)
pageNum=pageNum-1;
getStaffList();
}
else
alert("删除失败")
},
error:function(){
alert("删除出现错误");
}
})
}
// 添加新清洁工
function addUser(){
if(isEmptyString($("#inputAccount").val())||isEmptyString($("#inputPwd").val()))
alert("请填写全内容");
else{
$.ajax({
type:"POST",
url:"../user/addUser.do",
dataType:"JSON",
data:{
"useraccount":$("#inputAccount").val(),
"password":$("#inputPwd").val(),
"power":"3"
},
success:function(data){
if(data.code==0){
alert("添加成功");
$('#addUser').modal('toggle');
$("#inputAccount").val("");
$("#inputPwd").val("")
getStaffList();
}
else
alert("添加失败")
},
error:function(){
alert("添加用户出现错误");
}
})
}
if(isEmptyString($("#inputAccount").val())||isEmptyString($("#inputPwd").val()))
alert("请填写全内容");
else{
$.ajax({
type:"POST",
url:"../user/addUser.do",
dataType:"JSON",
data:{
"useraccount":$("#inputAccount").val(),// 清洁工账号
"password":$("#inputPwd").val(), // 清洁工密码
"power":"3" // 权限设置3表示清洁工
},
success:function(data){
if(data.code==0){
alert("添加成功");
$('#addUser').modal('toggle');
$("#inputAccount").val("");
$("#inputPwd").val("")
// 重新加载列表展示新添加的清洁工
getStaffList();
}
else
alert("添加失败")
},
error:function(){
alert("添加用户出现错误");
}
})
}
}

@ -3,193 +3,207 @@ var pageSize=8;
var l;
$(document).ready(function(){
getorderList();
$("#pre").on('click',function(){
getPre();
});
$("#next").on('click',function(){
getNext();
});
// 加载订单列表数据
getorderList();
$("#pre").on('click',function(){
getPre();
});
$("#next").on('click',function(){
getNext();
});
})
//判断对象/JSON是否为空 空返回1 非空返回0
function isEmptyObject(e) {
var t;
for (t in e)
return 0;
return 1;
var t;
// 遍历对象,若存在属性则非空
for (t in e)
return 0;
return 1;
}
// 全局变量:存储订单列表数据
var list;
// 从后端获取订单列表并展示
function getorderList(){
$.ajax({
type:"post",
url:"../order/getAllOrder.do",
dataType:"JSON",
data:{
"pageNum":pageNum,
"pageSize":pageSize
},
success:function(data){
if(isEmptyObject(data.List)&&pageNum>0){
pageNum=pageNum-1;
getorderList();
}
else{
list=data.List;
var htmlStr=" ";
var btnStr=" ";
var state=" ";
var sdate;
var edate;
l=0;
$("#pre").css("display","block");
$("#next").css("display","block");
$("#orderList").empty();
$("#orderList").append("<tr><th>入住人</th><th>身份证号</th><th>开始时间</th><th>结束时间</th><th>总金额</th><th>状态</th><th>操作</th></tr>")
for(i in list){
sdate=/\d{4}-\d{1,2}-\d{1,2}/g.exec(list[i].starttime);
edate=/\d{4}-\d{1,2}-\d{1,2}/g.exec(list[i].endtime);
if(list[i].state=="0"){
state="未付款";
btnStr="<input type=\"button\" class=\"btn btn-info\" data-roomid=\""+list[i].roomid+"\" id=\"showRoom\" data-toggle=\"modal\" data-target=\"#showRoomT\" value=\"查看房间\"> <input type=\"button\" class=\"btn btn-success\" data-orderid=\""+list[i].orderid+"\" id=\"setPaied\" value=\"已收款\"> <input type=\"button\" class=\"btn btn-danger\" data-orderid=\""+list[i].orderid+"\" id=\"setNone\" value=\"取消\">";
}
else if(list[i].state=="1"){
state="已付款";
btnStr="<input type=\"button\" class=\"btn btn-info\" data-roomid=\""+list[i].roomid+"\" id=\"showRoom\" data-toggle=\"modal\" data-target=\"#showRoomT\" value=\"查看房间\"> <input type=\"button\" class=\"btn btn-success\" data-orderid=\""+list[i].orderid+"\" id=\"setFinish\" value=\"退房\">";
}
else if(list[i].state=="2"){
state="已完成";
btnStr="<input type=\"button\" class=\"btn btn-info\" data-roomid=\""+list[i].roomid+"\" id=\"showRoom\" data-toggle=\"modal\" data-target=\"#showRoomT\" value=\"查看房间\">";
}
else{
state="已取消";
btnStr="<input type=\"button\" class=\"btn btn-info\" data-roomid=\""+list[i].roomid+"\" id=\"showRoom\" data-toggle=\"modal\" data-target=\"#showRoomT\" value=\"查看房间\">";
}
htmlStr="<tr data-orderid=\""+list[i].orderid+"\"><td>"+list[i].householdname+"</td><td>"+list[i].id+"</td><td>"+sdate+"</td><td>"+edate+"</td><td>"+list[i].money+"</td><td>"+state+"</td><td>"+btnStr+"</td></tr>";
$("#orderList").append(htmlStr);
l++;
}
if(pageNum=="1") $("#pre").css("display","none");
if(pageSize>l) $("#next").css("display","none");
btnOn();
}
$.ajax({
type:"post",
url:"../order/getAllOrder.do",
dataType:"JSON",
data:{
"pageNum":pageNum,
"pageSize":pageSize
},
// 请求成功的回调函数
success:function(data){
if(isEmptyObject(data.List)&&pageNum>0){
pageNum=pageNum-1;
getorderList();
}
else{
list=data.List;
var htmlStr=" ";
var btnStr=" ";
var state=" ";
var sdate;
var edate;
l=0;
// 默认显示上一页、下一页按钮
$("#pre").css("display","block");
$("#next").css("display","block");
$("#orderList").empty();
$("#orderList").append("<tr><th>入住人</th><th>身份证号</th><th>开始时间</th><th>结束时间</th><th>总金额</th><th>状态</th><th>操作</th></tr>")
// 遍历订单列表,生成表格内容
for(i in list){
sdate=/\d{4}-\d{1,2}-\d{1,2}/g.exec(list[i].starttime);
edate=/\d{4}-\d{1,2}-\d{1,2}/g.exec(list[i].endtime);
// 根据订单状态编码设置状态文本和操作按钮
if(list[i].state=="0"){
state="未付款";
btnStr="<input type=\"button\" class=\"btn btn-info\" data-roomid=\""+list[i].roomid+"\" id=\"showRoom\" data-toggle=\"modal\" data-target=\"#showRoomT\" value=\"查看房间\"> <input type=\"button\" class=\"btn btn-success\" data-orderid=\""+list[i].orderid+"\" id=\"setPaied\" value=\"已收款\"> <input type=\"button\" class=\"btn btn-danger\" data-orderid=\""+list[i].orderid+"\" id=\"setNone\" value=\"取消\">";
}
else if(list[i].state=="1"){
state="已付款";
btnStr="<input type=\"button\" class=\"btn btn-info\" data-roomid=\""+list[i].roomid+"\" id=\"showRoom\" data-toggle=\"modal\" data-target=\"#showRoomT\" value=\"查看房间\"> <input type=\"button\" class=\"btn btn-success\" data-orderid=\""+list[i].orderid+"\" id=\"setFinish\" value=\"退房\">";
}
else if(list[i].state=="2"){
state="已完成";
btnStr="<input type=\"button\" class=\"btn btn-info\" data-roomid=\""+list[i].roomid+"\" id=\"showRoom\" data-toggle=\"modal\" data-target=\"#showRoomT\" value=\"查看房间\">";
}
else{
state="已取消";
btnStr="<input type=\"button\" class=\"btn btn-info\" data-roomid=\""+list[i].roomid+"\" id=\"showRoom\" data-toggle=\"modal\" data-target=\"#showRoomT\" value=\"查看房间\">";
}
// 拼接表格行(包含订单信息和操作按钮)
htmlStr="<tr data-orderid=\""+list[i].orderid+"\"><td>"+list[i].householdname+"</td><td>"+list[i].id+"</td><td>"+sdate+"</td><td>"+edate+"</td><td>"+list[i].money+"</td><td>"+state+"</td><td>"+btnStr+"</td></tr>";
$("#orderList").append(htmlStr);
l++;
}
if(pageNum=="1") $("#pre").css("display","none");
if(pageSize>l) $("#next").css("display","none");
btnOn();
}
},
error:function(){
alert("获取订单列表发生错误")
}
})
},
error:function(){
alert("获取订单列表发生错误")
}
})
}
// 绑定页面中操作按钮的点击事件
function btnOn(){
$("input").filter("#setPageBtn").on('click',function( ){
setPage( );
});
$("input").filter("#showRoom").on('click',function(event){
showRoom(event);
})
$("input").filter("#setPaied").on('click',function(event){
setState(event,"1");
});
$("input").filter("#setFinish").on('click',function(event){
setState(event,"2");
});
$("input").filter("#setNone").on('click',function(event){
setState(event,"3");
});
// 给"跳转页码"按钮绑定点击事件,触发页码跳转
$("input").filter("#setPageBtn").on('click',function( ){
setPage( );
});
// 给"查看房间"按钮绑定点击事件,触发查看房间详情
$("input").filter("#showRoom").on('click',function(event){
showRoom(event);
})
// 给"已收款"按钮绑定点击事件,将订单状态改为"已付款"1
$("input").filter("#setPaied").on('click',function(event){
setState(event,"1");
});
// 给"退房"按钮绑定点击事件,将订单状态改为"已完成"2
$("input").filter("#setFinish").on('click',function(event){
setState(event,"2");
});
// 给"取消"按钮绑定点击事件,将订单状态改为"已取消"3
$("input").filter("#setNone").on('click',function(event){
setState(event,"3");
});
}
// 加载上一页数据
function getPre(){
pageNum=pageNum-1;
getorderList();
pageNum=pageNum-1;
getorderList();
}
// 加载下一页数据
function getNext(){
pageNum=pageNum+1;
getorderList();
pageNum=pageNum+1;
getorderList();
}
// 修改订单状态
function setState(event,alter){
var orderid=$(event.target).data("orderid");
$.ajax({
type:"POST",
url:"../order/updateOrderState.do",
dataType:"JSON",
data:{
"orderid":orderid,
"state":alter
},
success:function(data){
if(data.code==0){
alert("修改成功");
getorderList();
}
else
alert("修改失败")
},
error:function(){
alert("修改信息出现错误");
}
})
var orderid=$(event.target).data("orderid");
$.ajax({
type:"POST",
url:"../order/updateOrderState.do",
dataType:"JSON",
data:{
"orderid":orderid,
"state":alter
},
success:function(data){
if(data.code==0){
alert("修改成功");
getorderList();
}
else
alert("修改失败")
},
error:function(){
alert("修改信息出现错误");
}
})
}
// 跳转到指定页码
function setPage(){
if($("#inputPage").val()<0 || $("#inputPage").val()==0)
alert("请输入正确页码");
else{
pageNum=$("#inputPage").val();
getorderList();
}
}
if($("#inputPage").val()<0 || $("#inputPage").val()==0)
alert("请输入正确页码");
else{
pageNum=$("#inputPage").val();
getorderList();
}
}
// 查看订单对应的房间详情
function showRoom(event){
var roomid=$(event.target).data("roomid");
$.ajax({
type:"POST",
url:"../room/getRoomById.do",
dataType:"JSON",
data:{
"roomid":roomid
},
success:function(data){
if(data.code==0){
var htmlStr=" ";
var state=" ";
var type=" ";
var room=data.room;
$("#roomTable").empty();
if(room.state=="0")
state="停用";
else if(room.state=="1")
state="未预定";
else if(room.state=="2")
state="已预定(入住)";
else
state="待清扫";
if(room.type=="1")
type="单人间";
else if(room.type=="2")
type="双人间";
else if(room.type=="3")
type="大床房";
else
type="套房";
htmlStr="<tr><th>位置</th><td>"+room.local+"</td></tr><tr><th>价格</th><td>"+room.money+"</td></tr><tr><th>类型</th><td>"+type+"</td></tr><tr><th>状态</th><td>"+state+"</td></tr>"
$("#roomTable").append(htmlStr);
}
else
alert("获取失败")
},
error:function(){
alert("获取信息出现错误");
}
})
var roomid=$(event.target).data("roomid");
$.ajax({
type:"POST",
url:"../room/getRoomById.do",
dataType:"JSON",
data:{
"roomid":roomid
},
success:function(data){
if(data.code==0){
var htmlStr=" ";
var state=" ";
var type=" ";
var room=data.room;
$("#roomTable").empty();
if(room.state=="0")
state="停用";
else if(room.state=="1")
state="未预定";
else if(room.state=="2")
state="已预定(入住)";
else
state="待清扫";
// 转换房间类型编码为文本
if(room.type=="1")
type="单人间";
else if(room.type=="2")
type="双人间";
else if(room.type=="3")
type="大床房";
else
type="套房";
// 拼接房间详情表格内容(位置、价格、类型、状态)
htmlStr="<tr><th>位置</th><td>"+room.local+"</td></tr><tr><th>价格</th><td>"+room.money+"</td></tr><tr><th>类型</th><td>"+type+"</td></tr><tr><th>状态</th><td>"+state+"</td></tr>"
$("#roomTable").append(htmlStr);
}
else
alert("获取失败")
},
error:function(){
alert("获取信息出现错误");
}
})
}

@ -1,11 +1,12 @@
// 定义jQuery扩展方法从URL参数中获取指定名称的值
(function($){
$.getData=function(name){
var reg=new RegExp("(^|&)"+name+"=([^&]+)(&|$)?");
var result = window.location.search.substr(1).match(reg);
if (result!= null) return result[2]; return null;
}
$.getData=function(name){
var reg=new RegExp("(^|&)"+name+"=([^&]+)(&|$)?");
var result = window.location.search.substr(1).match(reg);
if (result!= null) return result[2]; return null;
}
})(jQuery);
// 从URL参数中获取员工ID当前登录员工
var staffid=$.getData("userid");
var pageNum=1;
var pageSize=8;
@ -13,36 +14,39 @@ var choose;
var l;
$(document).ready(function(){
getroomList();
$('#dateStart').datepicker({
language: 'zh-CN',
format: 'yyyy-mm-dd',
autoclose: true
}).on('changeDate',function(e){
var startTime = e.date;
$('#dateEnd').datepicker('setStartDate',startTime);
});
$('#dateEnd').datepicker({
language: 'zh-CN',
format: 'yyyy-mm-dd',
autoclose: true
}).on('changeDate',function(e){
var endTime = e.date;
$('#dateStart').datepicker('setEndDate',endTime);
});
$("#pre").on('click',function(){
getPre();
});
$("#next").on('click',function(){
getNext();
});
$("#addOrder").on('click',function(){
addOrder();
});
// 加载可预订的房间列表
getroomList();
// 初始化开始日期选择器datepicker插件
$('#dateStart').datepicker({
language: 'zh-CN',
format: 'yyyy-mm-dd',
autoclose: true
}).on('changeDate',function(e){
// 选择开始日期后,设置结束日期的最小可选值为开始日期
var startTime = e.date;
$('#dateEnd').datepicker('setStartDate',startTime);
});
// 初始化结束日期选择器datepicker插件
$('#dateEnd').datepicker({
language: 'zh-CN',
format: 'yyyy-mm-dd',
autoclose: true
}).on('changeDate',function(e){
// 选择结束日期后,设置开始日期的最大可选值为结束日期
var endTime = e.date;
$('#dateStart').datepicker('setEndDate',endTime);
});
// 绑定"上一页"按钮点击事件
$("#pre").on('click',function(){
getPre();
});
$("#next").on('click',function(){
getNext();
});
$("#addOrder").on('click',function(){
addOrder();
});
})
@ -50,149 +54,158 @@ $(document).ready(function(){
//判断对象/JSON是否为空 空返回1 非空返回0
function isEmptyObject(e) {
var t;
for (t in e)
return 0;
return 1;
var t;
for (t in e)
return 0;
return 1;
}
//判断字符串是否为空 空返回1 非空返回0
function isEmptyString(str){
if(str=='null'||str=='')
return 1;
return 0;
if(str=='null'||str=='')
return 1;
return 0;
}
var list;
// 从后端获取可预订的房间列表(状态为"未预定"
function getroomList(){
$.ajax({
type:"post",
url:"../room/getRoom.do",
dataType:"JSON",
data:{
"state":"1",
"type":"-1",
"pageNum":pageNum,
"pageSize":pageSize
},
success:function(data){
if(isEmptyObject(data.List)&&pageNum>0){
pageNum=pageNum-1;
getroomList();
}
else{
list=data.List;
var power=" ";
var htmlStr=" ";
var btnStr=" ";
var state=" ";
var type=" ";
l=0;
$("#pre").css("display","block");
$("#next").css("display","block");
$("#roomList").empty();
$("#roomList").append("<tr><th>位置</th><th>价格</th><th>状态</th><th>类型</th><th>操作</th></tr>");
state="未预定";
for(i in list){
if(list[i].type=="1")
type="单人间";
else if(list[i].type=="2")
type="双人间";
else if(list[i].type=="3")
type="大床房";
else
type="套房"
btnStr="<input type=\"button\" class=\"btn btn-success\" data-roomid=\""+list[i].roomid+"\" id=\"chooseRoomBtn\" data-toggle=\"modal\" data-target=\"#chooseRoom\" value=\"生成订单\">";
htmlStr="<tr data-roomid=\""+list[i].roomid+"\"><td>"+list[i].local+"</td><td>"+list[i].money+"</td><td>"+state+"</td><td>"+type+"</td><td>"+btnStr+"</td></tr>";
$("#roomList").append(htmlStr);
l++;
}
if(pageNum=="1") $("#pre").css("display","none");
if(pageSize>l) $("#next").css("display","none");
btnOn();
}
},
error:function(){
alert("获取房间列表发生错误")
}
})
$.ajax({
type:"post",
url:"../room/getRoom.do",
dataType:"JSON",
data:{
"state":"1",
"type":"-1",
"pageNum":pageNum,
"pageSize":pageSize
},
// 请求成功的回调函数
success:function(data){
if(isEmptyObject(data.List)&&pageNum>0){
pageNum=pageNum-1;
getroomList();
}
else{
list=data.List;
var power=" ";
var htmlStr=" ";
var btnStr=" ";
var state=" ";
var type=" ";
l=0;
// 默认显示分页按钮
$("#pre").css("display","block");
$("#next").css("display","block");
$("#roomList").empty();
$("#roomList").append("<tr><th>位置</th><th>价格</th><th>状态</th><th>类型</th><th>操作</th></tr>");
state="未预定";
// 遍历房间列表生成表格内容
for(i in list){
// 转换房间类型编码为文本
if(list[i].type=="1")
type="单人间";
else if(list[i].type=="2")
type="双人间";
else if(list[i].type=="3")
type="大床房";
else
type="套房"
// 操作按钮生成订单绑定房间ID点击打开弹窗
btnStr="<input type=\"button\" class=\"btn btn-success\" data-roomid=\""+list[i].roomid+"\" id=\"chooseRoomBtn\" data-toggle=\"modal\" data-target=\"#chooseRoom\" value=\"生成订单\">";
htmlStr="<tr data-roomid=\""+list[i].roomid+"\"><td>"+list[i].local+"</td><td>"+list[i].money+"</td><td>"+state+"</td><td>"+type+"</td><td>"+btnStr+"</td></tr>";
$("#roomList").append(htmlStr);
l++;// 累加记录数
}
// 分页按钮控制第1页隐藏上一页最后一页隐藏下一页
if(pageNum=="1") $("#pre").css("display","none");
if(pageSize>l) $("#next").css("display","none");
btnOn();
}
},
error:function(){
alert("获取房间列表发生错误")
}
})
}
// 绑定页面操作按钮的点击事件
function btnOn(){;
$("input").filter("#setPageBtn").on('click',function( ){
setPage( );
});
$("input").filter("#chooseRoomBtn").on('click',function(event){
chooseRoomBtn(event);
});
$("input").filter("#setPageBtn").on('click',function( ){
setPage( );
});
$("input").filter("#chooseRoomBtn").on('click',function(event){
chooseRoomBtn(event);
});
}
// 加载上一页数据
function getPre(){
pageNum=pageNum-1;
getroomList();
pageNum=pageNum-1;
getroomList();
}
// 加载下一页数据
function getNext(){
pageNum=pageNum+1;
getroomList();
pageNum=pageNum+1;
getroomList();
}
// 跳转到指定页码
function setPage(){
if($("#inputPage").val()<0 || $("#inputPage").val()==0)
alert("请输入正确页码");
else{
pageNum=$("#inputPage").val();
getroomList();
}
}
if($("#inputPage").val()<0 || $("#inputPage").val()==0)
alert("请输入正确页码");
else{
pageNum=$("#inputPage").val();
getroomList();
}
}
// 选择房间并填充订单弹窗信息
function chooseRoomBtn(event){
var roomid=$(event.target).data("roomid");
choose=roomid;
for(i in list){
if(list[i].roomid=roomid){
$("span").filter("#inputLocal").text(list[i].local);
}
}
var roomid=$(event.target).data("roomid");
choose=roomid;
for(i in list){
if(list[i].roomid=roomid){
$("span").filter("#inputLocal").text(list[i].local);
}
}
}
// 提交添加订单请求
function addOrder(){
if(isEmptyString($("#inputName").val())||isEmptyString($("#inputId").val())||isEmptyString($("#dateStart").val())||isEmptyString($("#dateEnd").val()))
alert("请填写全内容");
else{
$.ajax({
type:"POST",
url:"../order/addOrder.do",
dataType:"JSON",
data:{
"userid":staffid,
"roomid":choose,
"householdname":$("#inputName").val(),
"id":$("#inputId").val(),
"starttime":$("#dateStart").val(),
"endtime":$("#dateEnd").val()
},
success:function(data){
if(data.code==0){
alert("添加成功");
$("#inputRoom").val("");
$("#inputName").val("");
$("#inputId").val("");
$("#dateStart").val("");
$("#dateEnd").val("");
$('#chooseRoom').modal('toggle');
window.location.href="staff_order.html";
}
},
error:function(){
alert("添加订单出现错误");
}
})
}
if(isEmptyString($("#inputName").val())||isEmptyString($("#inputId").val())||isEmptyString($("#dateStart").val())||isEmptyString($("#dateEnd").val()))
alert("请填写全内容");
else{
$.ajax({
type:"POST",
url:"../order/addOrder.do",
dataType:"JSON",
data:{
"userid":staffid,
"roomid":choose,
"householdname":$("#inputName").val(),
"id":$("#inputId").val(),
"starttime":$("#dateStart").val(),
"endtime":$("#dateEnd").val()
},
success:function(data){
if(data.code==0){
alert("添加成功");
$("#inputRoom").val("");
$("#inputName").val("");
$("#inputId").val("");
$("#dateStart").val("");
$("#dateEnd").val("");
// 关闭订单弹窗
$('#chooseRoom').modal('toggle');
// 跳转到订单管理页面
window.location.href="staff_order.html";
}
},
error:function(){
alert("添加订单出现错误");
}
})
}
}

@ -1,42 +1,74 @@
<!--员工信息管理页面前端结构-->
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" Content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="../css/myCenter.css">
<link rel="stylesheet" type="text/css" href="../css/pages.css">
<!--指定页面的字符编码为 utf-8确保中文、特殊符号等能正常显示-->
<meta http-equiv="Content-Type" Content="text/html; charset=utf-8">
<!--适配移动端设备,控制页面在移动屏幕上的显示效果:
width=device-width让页面宽度等于设备屏幕宽度
initial-scale=1初始缩放比例为 1无缩放
maximum-scale=1禁止用户放大页面保证移动端布局稳定。-->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<!--引入 Bootstrap 框架的压缩版样式表,用于快速实现响应式布局(如表格、表单样式),避免重复编写基础 CSS。-->
<link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css">
<!--引入自定义样式表 myCenter.css 和 pages.css用于覆盖或补充 Bootstrap 样式-->
<link rel="stylesheet" type="text/css" href="../css/myCenter.css">
<link rel="stylesheet" type="text/css" href="../css/pages.css">
</head>
<body>
<!--定义员工列表的外层容器,使用 Bootstrap 栅格类和自定义样式控制布局:
col-md-11在中等屏幕≥992px下占 11 列Bootstrap 栅格共 12 列,留 1 列空白);
col-xs-11在超小屏幕<768px 11
nopadding自定义类前文 CSS 定义),清除左右内边距;
内联样式 padding-top:3rem顶部内边距 3rem与上方导航栏 / 页头拉开距离;
内联样式 padding-left: 3rem左侧内边距 3rem避免内容贴左边缘。-->
<div class="col-md-11 col-xs-11 nopadding" style="padding-top:3rem;padding-left: 3rem">
<div class="table-responsive">
<table class="table table-bordered table-hover" style="margin-top: 10px" id="staffList">
<tr><th>账号</th><th>员工号</th><th>姓名</th><th>年龄</th><th>职位</th><th>联系方式</th><th>操作</th></tr>
</table>
<div class="col-md-12">
<form class="form-inline">
<div class="form-group" style="margin-right: 10xp">
<a href="#" id="pre">上一页 </a>
<!--Bootstrap 内置类,让表格在小屏幕下可横向滚动-->
<div class="table-responsive">
<!--定义员工列表表格,通过类和属性控制样式与标识:
tableBootstrap 基础表格样式(默认边框、间距);
table-bordered为表格添加所有单元格的边框
table-hover鼠标悬停在表格行上时行背景色变化
内联样式 margin-top: 10px顶部外边距 10px与上方元素拉开微小距离
id="staffList":给表格设置唯一 ID方便后续 JavaScript 操作。-->
<table class="table table-bordered table-hover" style="margin-top: 10px" id="staffList">
<!--定义表格的表头行(<tr> 为表格行,<th> 为表头单元格)-->
<tr><th>账号</th><th>员工号</th><th>姓名</th><th>年龄</th><th>职位</th><th>联系方式</th><th>操作</th></tr>
</table>
<!--Bootstrap 栅格类,让分页控件在中等及以上屏幕下占 12 列(全屏宽度)-->
<div class="col-md-12">
<!--Bootstrap 行内表单类 form-inline让表单元素如下一页链接横向排列-->
<form class="form-inline">
<!--定义 “上一页” 分页按钮:
form-groupBootstrap 表单组类,用于统一表单元素的间距和样式;
内联样式 margin-right: 10xp疑似笔误应为 10px右侧外边距 10px与 “下一页” 拉开距离;
<a href="#">:空链接(默认不跳转),后续通过 JavaScript 绑定 “上一页” 点击事件;
id="pre":唯一 ID方便 JS 定位并添加分页逻辑。-->
<div class="form-group" style="margin-right: 10px">
<a href="#" id="pre">上一页 </a>
</div>
<!--<div class="form-group">
<input type="text" style="width: 5rem" class="form-control" id="inputPage">
<input type="button" id="setPageBtn" class="btn btn-default" value="跳转">
</div>-->
<!--定义 “下一页” 分页按钮,与 “上一页” 对称:
内联样式 margin-left: 10px左侧外边距 10px与 “上一页”(或注释的跳转功能)拉开距离;
id="next":唯一 ID方便 JS 绑定 “下一页” 点击事件。-->
<div class="form-group" style="margin-left: 10px">
<a href="#" id="next">下一页</a>
</div>
</form>
</div>
<!--<div class="form-group">
<input type="text" style="width: 5rem" class="form-control" id="inputPage">
<input type="button" id="setPageBtn" class="btn btn-default" value="跳转">
</div>-->
<div class="form-group" style="margin-left: 10px">
<a href="#" id="next">下一页</a>
</div>
</form>
</div>
</div>
<!--结束分页表单和外层容器标签。-->
</div>
</body>
</html>
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script type="text/javascript" src="../js/bootstrap.min.js"></script>
<script type="text/javascript" src="../js/ad_manage.js"></script>
<script type="text/javascript" src="../js/jquery.min.js"></script><!--入 jQuery 框架的压缩版,用于简化 DOM 操作(获取表格、发送 AJAX 请求(加载员工数据),是 Bootstrap JS 组件的依赖。-->
<script type="text/javascript" src="../js/bootstrap.min.js"></script><!--引入 Bootstrap 框架的 JS 组件,用于激活 Bootstrap 样式的交互功能-->
<script type="text/javascript" src="../js/ad_manage.js"></script><!--引入自定义的员工管理脚本-->

@ -1,3 +1,4 @@
<!--订单管理页面的前端结构-->
<!DOCTYPE html>
<html>
<head>

@ -1,63 +1,101 @@
<!--员工薪资配置管理页面的前端结构,-->
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" Content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="../css/myCenter.css">
<link rel="stylesheet" type="text/css" href="../css/pages.css">
<!--指定页面的字符编码为 utf-8确保中文、特殊符号等能正常显示-->
<meta http-equiv="Content-Type" Content="text/html; charset=utf-8">
<!--适配移动端设备,控制页面在移动屏幕上的显示效果:
width=device-width让页面宽度等于设备屏幕宽度
initial-scale=1初始缩放比例为 1无缩放
maximum-scale=1禁止用户放大页面保证移动端布局稳定。-->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<!--引入 Bootstrap 框架的压缩版样式表,用于快速实现响应式布局(如表格、表单样式),避免重复编写基础 CSS。-->
<link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css">
<!--引入自定义样式表 myCenter.css 和 pages.css用于覆盖或补充 Bootstrap 样式-->
<link rel="stylesheet" type="text/css" href="../css/myCenter.css">
<link rel="stylesheet" type="text/css" href="../css/pages.css">
</head>
<!--定义页面主容器,基于 Bootstrap 栅格系统实现响应式布局:
col-md-6中等屏幕≥992px下占 6 列(总 12 列),宽度为页面一半;
col-xs-11超小屏幕<768px 11
nopadding自定义类清除左右内边距
内联样式 padding-top:3rem顶部内边距 3rem与页头 / 导航栏拉开距离;
内联样式 padding-left: 3rem左侧内边距 3rem避免内容贴左边缘。-->
<body>
<div class="col-md-6 col-xs-11 nopadding" style="padding-top:3rem;padding-left: 3rem">
<div class="table-responsive" id="showConfigDiv">
<a href="#" id="showConfig" style="font-size:1.7rem">
<span class="glyphicon glyphicon-pencil"></span>
<span>更改配置</span>
</a>
<table class="table table-bordered table-hover" style="margin-top: 10px" id="configList">
<tr><th style="width: 100px">职位</th><th>底薪</th><th>提成</th></tr>
</table>
</div>
<div class="table-responsive" id="alterConfigDiv" style="display: none">
<a href="#" id="alterConfig" style="font-size:1.7rem">
<span class="glyphicon glyphicon-pencil"></span>
<span>返回</span>
</a>
<table class="table table-bordered table-hover" style="margin-top: 10px">
<tr><th style="width: 100px">职位</th><th>底薪</th><th>提成</th></tr>
<tr>
<th>经理</th>
<th>
<input type="text" class="form-control" id="inputMS">
</th>
<th>
<input type="text" class="form-control" id="inputM">
</th>
</tr>
<tr>
<th>员工</th>
<th>
<input type="text" class="form-control" id="inputSS">
</th>
<th>
<input type="text" class="form-control" id="inputS">
</th>
</tr>
<tr>
<th>清洁工</th>
<th>
<input type="text" class="form-control" id="inputCS">
</th>
<th>
<input type="text" class="form-control" id="inputC">
</th>
</tr>
</table>
<input style="float: right" type="button" id="alterConfigBtn" class="btn btn-success" value="确定"/>
</div>
<!--“查看配置” 状态的容器table-responsive 确保表格在小屏幕可横向滚动id="showConfigDiv" 用于 JS 控制显示 / 隐藏。-->
<div class="table-responsive" id="showConfigDiv">
<!--“切换到编辑模式” 的按钮:
glyphicon glyphicon-pencilBootstrap 图标(铅笔图标,暗示编辑功能);
文本 “更改配置” 明确功能;
id="showConfig"JS 绑定点击事件,用于切换到编辑状态。-->
<a href="#" id="showConfig" style="font-size:1.7rem">
<span class="glyphicon glyphicon-pencil"></span>
<span>更改配置</span>
</a>
<!--展示薪资配置的表格(查看模式):
table table-bordered table-hoverBootstrap 表格样式(带边框、悬停高亮);
表头包含 “职位”“底薪”“提成” 三列;
id="configList"JS 动态填充数据(从后端加载当前配置)。-->
<table class="table table-bordered table-hover" style="margin-top: 10px" id="configList">
<tr><th style="width: 100px">职位</th><th>底薪</th><th>提成</th></tr>
</table>
</div>
<!--结束 “查看配置” 区域容器。-->
<!--“编辑配置” 状态的容器,默认通过 display: none 隐藏id="alterConfigDiv" 用于 JS 控制显示 / 隐藏。-->
<div class="table-responsive" id="alterConfigDiv" style="display: none">
<!-- “返回查看模式” 的按钮:
图标与 “更改配置” 一致,文本改为 “返回”;
id="alterConfig"JS 绑定点击事件,用于切换回查看状态。-->
<a href="#" id="alterConfig" style="font-size:1.7rem">
<span class="glyphicon glyphicon-pencil"></span>
<span>返回</span>
</a>
<!--编辑模式的表格,表头与查看模式一致,确保布局统一。-->
<table class="table table-bordered table-hover" style="margin-top: 10px">
<tr><th style="width: 100px">职位</th><th>底薪</th><th>提成</th></tr>
<!--经理职位的薪资编辑行:
input 输入框用于修改底薪id="inputMS"和提成id="inputM"
form-controlBootstrap 输入框样式,确保美观和响应式。-->
<tr>
<th>经理</th>
<th>
<input type="text" class="form-control" id="inputMS">
</th>
<th>
<input type="text" class="form-control" id="inputM">
</th>
</tr>
<!--员工职位的薪资编辑行id="inputSS"员工底薪、id="inputS"(员工提成)。-->
<tr>
<th>员工</th>
<th>
<input type="text" class="form-control" id="inputSS">
</th>
<th>
<input type="text" class="form-control" id="inputS">
</th>
</tr>
<!--清洁工职位的薪资编辑行id="inputCS"清洁工底薪、id="inputC"(清洁工提成);结束表格标签。-->
<tr>
<th>清洁工</th>
<th>
<input type="text" class="form-control" id="inputCS">
</th>
<th>
<input type="text" class="form-control" id="inputC">
</th>
</tr>
</table>
<!--提交修改的按钮:
float: right右对齐符合操作习惯
btn btn-successBootstrap 成功样式按钮(绿色);
id="alterConfigBtn"JS 绑定点击事件,用于提交修改后的薪资配置。-->
<input style="float: right" type="button" id="alterConfigBtn" class="btn btn-success" value="确定"/>
</div>
<!--结束 “编辑配置” 区域容器。-->
</div>
@ -68,6 +106,11 @@
</body>
</html>
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script type="text/javascript" src="../js/bootstrap.min.js"></script>
<script type="text/javascript" src="../js/jquery.min.js"></script><!--结束 “编辑配置” 区域容器。-->
<script type="text/javascript" src="../js/bootstrap.min.js"></script><!--引入 Bootstrap JS 组件,激活图标、按钮等交互样式(确保 glyphicon 图标正常显示)。-->
<script type="text/javascript" src="../js/ad_salary.js"></script>
<!--自定义薪资配置脚本,核心逻辑包括:
页面加载时,向 configList 表格填充当前薪资配置数据;
绑定 showConfig 点击事件,隐藏查看区域、显示编辑区域,并向输入框填充当前值;
绑定 alterConfig 点击事件,隐藏编辑区域、显示查看区域;
绑定 alterConfigBtn 点击事件,获取输入框值并提交到后端保存,成功后更新查看区域数据。-->

@ -1,3 +1,4 @@
<!--用户信息管理页面的前端结构-->
<!DOCTYPE html>
<html>
<head>
@ -11,24 +12,42 @@
</head>
<body>
<!--页面最外层容器占满整行col-md-12/col-xs-12padding-top:4rem 与页头拉开距离nopadding 清除默认内边距。-->
<div class="col-md-12 col-xs-12 nopadding" style="padding-top:4rem;">
<!--左侧头像容器,响应式布局:
col-md-3中等屏幕占 3 列(宽度 25%
col-xs-4超小屏幕占 4 列宽度33%
margin-bottom:10px底部外边距避免内容拥挤。-->
<div class="col-md-3 col-xs-4 nopadding" style="margin-bottom:10px">
<!--显示用户头像id="userpic" 用于 JS 动态设置头像图片路径class="userpic" 关联自定义样式(如大小、边框)。-->
<img id="userpic" class="userpic" src=" "/>
<!--“修改头像” 按钮:
data-toggle="modal" data-target="#changePic"Bootstrap 模态框触发属性,点击打开 id="changePic" 的弹窗;
glyphicon glyphicon-pencil铅笔图标暗示编辑功能-->
<div class="col-md-12 col-xs-12 username">
<a href="#" data-toggle="modal" data-target="#changePic">
<span class="glyphicon glyphicon-pencil"></span>
<span>修改头像</span>
</a>
</div>
<!--结束左侧头像区域容器。-->
</div>
<!--右侧信息容器,与左侧头像形成左右布局:
col-md-6中等屏幕占 6 列(宽度 50%
col-xs-8超小屏幕占 8 列宽度67%
border-left:1px solid gray左侧灰色边框分隔头像与信息区域
padding-left: 20px左侧内边距避免内容贴边框。-->
<div class="col-md-6 col-xs-8 nopadding" style="border-left:1px solid gray;padding-left: 20px">
<!--“查看信息” 模式的容器display: block 默认显示id="showInfodiv" 用于 JS 控制显示 / 隐藏。-->
<div class="col-md-12 col-xs-12" style="font-size: 1.5rem;margin-bottom: 10px;display: block" id="showInfodiv">
<!--“切换到编辑模式” 的按钮id="showInfo" 绑定 JS 事件,点击后显示编辑视图。-->
<a href="#" id="showInfo">
<span class="glyphicon glyphicon-pencil"></span>
<span>修改信息</span>
</a>
<!--账号信息行:
id="account"显示账号用户名JS 动态填充;
嵌套 “修改密码” 链接,通过 data-target="#changePwd" 打开密码修改弹窗。-->
<div class="fdata">
<p>
<span>账号 Account </span>
@ -39,8 +58,7 @@
</a>
</p>
</div>
<!--工号信息行id="idnum" 用于 JS 填充工号数据。-->
<div class="fdata">
<p>
<span>工号 ID </span>
@ -65,6 +83,7 @@
<span class="value" id="commission"></span>
</p>
</div>
<!--年龄id="age"和手机号id="phone"信息行JS 动态填充数据;结束 “查看信息” 视图容器。-->
<div class="fdata">
<p>
<span>年龄 Age </span>
@ -78,17 +97,24 @@
</p>
</div>
</div>
<!--“编辑信息” 模式的容器display: none 默认隐藏id="showAlterdiv" 用于 JS 控制显示 / 隐藏。-->
<div class="col-md-12 col-xs-12" style="font-size:1.5rem;margin-bottom: 10px;display: none" id="showAlterdiv">
<!--“返回查看模式” 的按钮id="showAlter" 绑定 JS 事件,点击后隐藏编辑视图。-->
<a href="#" id="showAlter">
<span class="glyphicon glyphicon-chevron-left"></span>
<span>返回</span>
</a>
<!--编辑表单form-inline 使表单项横向排列小屏幕自动堆叠margin-top: 10px 与 “返回” 按钮拉开距离。-->
<form class="form-inline" style="margin-top: 10px">
<!--姓名编辑项:
form-groupBootstrap 表单组样式;
alterinfo自定义类控制编辑项样式
input 输入框 id="inputName"用于输入新姓名JS 会预先填充当前姓名。-->
<div class="form-group alterinfo col-xs-12 col-md-12">姓名:
<label for="name">Name</label>
<input type="text" name="name" class="form-control" id="inputName">
</div>
<!--年龄id="inputAge"和手机号id="inputPhone")编辑项,逻辑同姓名项。-->
<div class="form-group alterinfo col-xs-12 col-md-12">年龄:
<label for="age">Age</label>
<input type="text" name="age" class="form-control" id="inputAge">
@ -97,6 +123,7 @@
<label for="phone">Phone</label>
<input type="text" name="phone" class="form-control" id="inputPhone">
</div>
<!--“确认修改” 按钮id="alterInfoBtn" 绑定 JS 事件,点击后提交编辑的信息;结束编辑表单和视图容器。-->
<div class="form-group alterinfo col-xs-12 col-md-12">
<input type="button" id="alterInfoBtn" class="btn btn-success" value="确定"/>
</div>
@ -109,20 +136,25 @@
</div>
</body>
<!--:结束右侧信息区域和页面最外层容器。-->
<!--头像修改弹窗modal fade 是 Bootstrap 模态框基础样式带淡入淡出动画id="changePic" 用于触发显示。-->
<div class="modal fade" id="changePic" tabindex="-1" role="dialog">
<!--弹窗头部关闭按钮data-dismiss="modal" 内置关闭功能);标题 “修改头像”。-->
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">修改头像</h4>
</div>
<!--弹窗主体内的 JS 函数 saveReport()
使用 jquery-form 插件的 ajaxSubmit 异步提交表单(避免页面刷新);
根据后端返回的 data.code 判断成功 / 失败,显示提示并刷新页面。-->
<div class="modal-body">
<script type="text/javascript">
function saveReport(){
$("#uploadProfile").ajaxSubmit(function(data){
console.log(data);
if(data.code==0)
alert("修改头像成功!");
@ -134,7 +166,14 @@
//必须返回false否则表单会自己再做一次提交操作并且页面跳转
}
</script>
<!--头像上传表单:
action="../upFile/upFilePhoto.do":后端处理头像上传的接口;
enctype="multipart/form-data":支持文件上传的表单编码类型;
onsubmit="return saveReport()":提交时执行 saveReport() 函数。-->
<form action="../upFile/upFilePhoto.do" method="post" enctype="multipart/form-data" onsubmit="return saveReport()" id="uploadProfile">
<!--隐藏的 userid 输入框:传递当前用户 ID后端用于关联头像type="file" 输入框:用于选择本地图片文件;
“修改头像” 提交按钮:触发表单提交;
结束头像弹窗标签。-->
<input type="text" name="userid" class="form-control" id="inputNone" style="display: none;">文件大小1M以内
<input id="inputFile" name="file" class="btn-file-molding" type="file"><br/>
<input type="submit" id="alterProfile" class="btn btn-success" value="修改头像"/>
@ -144,7 +183,7 @@
</div>
</div>
</div>
<!--密码修改弹窗头部,结构同头像弹窗,标题为 “修改密码”。-->
<div class="modal fade" id="changePwd" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
@ -152,11 +191,13 @@
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">修改密码</h4>
</div>
<!--原密码输入项type="password" 隐藏输入内容id="inputoldPwd" 用于 JS 获取值。-->
<div class="modal-body" style="width: 80%;padding-left:20%">
<div class="form-group alterinfo">请输入原密码:
<label for="oldPwd">oldPwd</label>
<input type="password" name="oldPwd" class="form-control" id="inputoldPwd">
</div>
<!--新密码和确认密码输入项id="inputnewPwd" 和 id="inputrenewPwd" 用于 JS 验证两次输入是否一致。-->
<div class="form-group alterinfo">请输入新密码:
<label for="newPwd">newPwd</label>
<input type="password" name="newPwd" class="form-control" id="inputnewPwd">
@ -165,6 +206,7 @@
<label for="renewPwd">newPwd</label>
<input type="password" name="renewPwd" class="form-control" id="inputrenewPwd">
</div>
<!--“确认修改密码” 按钮id="alterPwdBtn" 绑定 JS 事件(验证密码格式、一致性后提交后端);结束密码弹窗标签。-->
<div class="form-group alterinfo">
<input type="button" id="alterPwdBtn" class="btn btn-success" value="确定"/>
</div>
@ -174,7 +216,7 @@
</div>
</div>
</html>
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script type="text/javascript" src="../js/bootstrap.min.js"></script>
<script type="text/javascript" src="../js/jquery-form.js"></script>
<script type="text/javascript" src="../js/all_infor.js"></script>
<script type="text/javascript" src="../js/jquery.min.js"></script><!--引入 jQuery 框架,简化 DOM 操作(如切换视图、获取输入值、绑定事件)。-->
<script type="text/javascript" src="../js/bootstrap.min.js"></script><!--引入 Bootstrap JS 组件,激活模态框、图标等交互功能(确保弹窗正常显示 / 隐藏)。-->
<script type="text/javascript" src="../js/jquery-form.js"></script><!--引入 jQuery Form 插件,提供 ajaxSubmit 方法实现表单异步提交(用于头像上传)-->
<script type="text/javascript" src="../js/all_infor.js"></script><!--自定义用户信息管理脚本-->

@ -1,35 +1,60 @@
<!--清洁工视角的房间管理页面 前端结构-->
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" Content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="../css/myCenter.css">
<link rel="stylesheet" type="text/css" href="../css/pages.css">
<!--指定页面的字符编码为 utf-8确保中文、特殊符号等能正常显示-->
<meta http-equiv="Content-Type" Content="text/html; charset=utf-8">
<!--适配移动端设备,控制页面在移动屏幕上的显示效果:
width=device-width让页面宽度等于设备屏幕宽度
initial-scale=1初始缩放比例为 1无缩放
maximum-scale=1禁止用户放大页面保证移动端布局稳定。-->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<!--引入 Bootstrap 框架的压缩版样式表,用于快速实现响应式布局(如表格、表单样式),避免重复编写基础 CSS。-->
<link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css">
<!--引入自定义样式表 myCenter.css 和 pages.css用于覆盖或补充 Bootstrap 样式-->
<link rel="stylesheet" type="text/css" href="../css/myCenter.css">
<link rel="stylesheet" type="text/css" href="../css/pages.css">
</head>
<!--定义页面主容器,基于 Bootstrap 栅格系统实现响应式布局:
col-md-8中等屏幕≥992px下占 8 列(总 12 列),宽度约为页面 2/3
col-xs-11超小屏幕<768px 11
nopadding自定义类清除容器默认左右内边距
内联样式 padding-top:3rem顶部内边距 3rem与上方导航栏 / 页头拉开距离;
内联样式 padding-left: 3rem左侧内边距 3rem避免列表贴左边缘。-->
<body>
<div class="col-md-8 col-xs-11 nopadding" style="padding-top:3rem;padding-left: 3rem">
<div class="table-responsive">
<table class="table table-bordered table-hover" style="margin-top: 10px" id="roomList">
<tr><th>位置</th><th>价格</th><th>状态</th><th>类型</th><th>操作</th></tr>
</table>
<div class="col-md-12">
<form class="form-inline">
<div class="form-group" style="margin-right: 10xp">
<a href="#" id="pre">上一页 </a>
</div>
<!--<div class="form-group">
<input type="text" style="width: 5rem" class="form-control" id="inputPage">
<input type="button" id="setPageBtn" class="btn btn-default" value="跳转">
</div>-->
<div class="form-group" style="margin-left: 10px">
<a href="#" id="next">下一页</a>
<!--Bootstrap 内置类,让表格在小屏幕下可横向滚动(避免房间信息列过多导致溢出,保证移动端可读性)。-->
<div class="table-responsive">
<!--定义房间列表表格,通过类和属性控制样式与标识:
tableBootstrap 基础表格样式(默认间距、轻量边框);
table-bordered为所有单元格添加完整边框清晰分隔行列
table-hover鼠标悬停在表格行上时背景色变化提升交互体验
内联样式 margin-top: 10px顶部外边距 10px与容器顶部轻微拉开距离
id="roomList":唯一 ID方便后续 JavaScript 动态填充房间数据(如从后端加载房间列表)。-->
<table class="table table-bordered table-hover" style="margin-top: 10px" id="roomList">
<!--定义表格表头行(<tr> 为行,<th> 为表头单元格),包含 5 个核心房间字段-->
<tr><th>位置</th><th>价格</th><th>状态</th><th>类型</th><th>操作</th></tr>
<!--Bootstrap 栅格类,让分页控件在中等及以上屏幕下占 12 列(全屏宽度),确保分页居中显示,与表格宽度匹配。-->
</table>
<div class="col-md-12">
<!--Bootstrap 行内表单类 form-inline让分页元素上一页、下一页链接横向排列节省空间且布局紧凑避免分页区域占用过多垂直空间。-->
<form class="form-inline">
<!--定义 “上一页” 按钮,用于加载前一页房间数据-->
<div class="form-group" style="margin-right: 10px">
<a href="#" id="pre">上一页 </a>
</div>
<!--<div class="form-group">
<input type="text" style="width: 5rem" class="form-control" id="inputPage">
<input type="button" id="setPageBtn" class="btn btn-default" value="跳转">
</div>-->
<!--定义 “下一页” 按钮-->
<div class="form-group" style="margin-left: 10px">
<a href="#" id="next">下一页</a>
</div>
</form>
</div>
</form>
</div>
</div>
</div>
@ -38,7 +63,7 @@
</html>
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script type="text/javascript" src="../js/bootstrap.min.js"></script>
<script type="text/javascript" src="../js/cleaner_room.js"></script>
<script type="text/javascript" src="../js/jquery.min.js"></script><!--引入 jQuery 框架,用于简化 DOM 操作(如获取表格 / 分页元素、绑定点击事件)、发送 AJAX 请求(如从后端加载房间数据、提交状态修改),是后续交互逻辑的基础依赖。-->
<script type="text/javascript" src="../js/bootstrap.min.js"></script><!--引入 Bootstrap JS 组件,激活 Bootstrap 样式的交互效果(如表格悬停、表单布局适配),确保页面视觉与交互一致性。-->
<script type="text/javascript" src="../js/cleaner_room.js"></script><!--引入清洁工房间管理的自定义脚本-->

@ -1,114 +1,151 @@
<!-- 管理员视角的房间管理页面 -->
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" Content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="../css/myCenter.css">
<link rel="stylesheet" type="text/css" href="../css/pages.css">
<meta http-equiv="Content-Type" Content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="../css/myCenter.css">
<link rel="stylesheet" type="text/css" href="../css/pages.css">
</head>
<!--定义页面主容器,基于 Bootstrap 栅格系统实现响应式布局:
col-md-10中等屏幕≥992px下占 10 列(总 12 列),留出两侧空白;
col-xs-11超小屏幕<768px 11
nopadding自定义类清除容器默认左右内边距
内联样式 padding-top:3rem顶部内边距 3rem与上方导航栏 / 页头拉开距离;
内联样式 padding-left: 3rem左侧内边距 3rem避免列表贴左边缘。-->
<body>
<div class="col-md-10 col-xs-11 nopadding" style="padding-top:3rem;padding-left: 3rem">
<div class="table-responsive">
<a href="#" style="font-size:1.7rem" data-toggle="modal" data-target="#addRoom" >
<span class="glyphicon glyphicon-pencil"></span>
<span>添加房间</span>
</a>
<table class="table table-bordered table-hover" style="margin-top: 10px" id="roomList">
<tr><th style="width:100px">位置</th><th style="width:100px">价格</th><th style="width:100px">状态</th><th style="width:100px">类型</th><th>操作</th></tr>
</table>
<div class="col-md-12">
<form class="form-inline">
<div class="form-group" style="margin-right: 10xp">
<a href="#" id="pre">上一页 </a>
</div>
<!--<div class="form-group">
<input type="text" style="width: 5rem" class="form-control" id="inputPage">
<input type="button" id="setPageBtn" class="btn btn-default" value="跳转">
</div>-->
<div class="form-group" style="margin-left: 10px">
<a href="#" id="next">下一页</a>
<!--Bootstrap 内置类,让表格在小屏幕下可横向滚动(避免房间信息列过多导致溢出,保证移动端可读性)。-->
<div class="table-responsive">
<!--触发 “添加房间” 弹窗的按钮:
data-toggle="modal" data-target="#addRoom"Bootstrap 模态框触发属性,点击打开 id="addRoom" 的弹窗;
font-size:1.7rem:按钮文字放大,突出 “添加” 核心操作;
glyphicon glyphicon-pencil铅笔图标暗示 “编辑 / 新增” 功能;
文本 “添加房间” 明确功能,符合管理员操作场景。-->
<a href="#" style="font-size:1.7rem" data-toggle="modal" data-target="#addRoom" >
<span class="glyphicon glyphicon-pencil"></span>
<span>添加房间</span>
</a>
<!--定义房间列表表格,通过类和属性控制样式与标识:
tableBootstrap 基础表格样式;
table-bordered为所有单元格添加边框清晰分隔行列
table-hover鼠标悬停行时背景色变化提升交互体验
内联样式 margin-top: 10px顶部外边距 10px与 “添加房间” 按钮拉开距离;
id="roomList":唯一 ID方便后续 JS 动态填充房间数据(如从后端加载列表)。-->
<table class="table table-bordered table-hover" style="margin-top: 10px" id="roomList">
<!--定义表头行5 列均设置固定宽度 100px除 “操作” 列)-->
<tr><th style="width:100px">位置</th><th style="width:100px">价格</th><th style="width:100px">状态</th><th style="width:100px">类型</th><th>操作</th></tr>
<!--实现分页查看房间列表form-inline让分页元素横向排列
id="pre"/id="next":“上一页”“下一页” 链接,后续 JS 绑定分页数据加载事件-->
</table>
<div class="col-md-12">
<form class="form-inline">
<div class="form-group" style="margin-right: 10px">
<a href="#" id="pre">上一页 </a>
</div>
<!--<div class="form-group">
<input type="text" style="width: 5rem" class="form-control" id="inputPage">
<input type="button" id="setPageBtn" class="btn btn-default" value="跳转">
</div>-->
<div class="form-group" style="margin-left: 10px">
<a href="#" id="next">下一页</a>
</div>
</form>
</div>
</form>
</div>
</div>
</div>
</body>
<!--结束表格容器和页面主容器。-->
<!--添加房间” 弹窗-->
<!--弹窗头部modal fadeBootstrap 弹窗基础样式 + 淡入淡出动画;
关闭按钮data-dismiss="modal" 内置关闭功能;
标题 “添加房间” 明确弹窗用途。-->
<div class="modal fade" id="addRoom" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">添加房间</h4>
</div>
<div class="modal-body" style="width: 80%;padding-left:20%">
<div class="form-group alterinfo">请输入位置:
<label for="inputLocal">inputPrice</label>
<input type="text" name="inputLocal" class="form-control" id="inputLocal">
</div>
<div class="form-group alterinfo">请输入价格:
<label for="inputPrice">inputPrice</label>
<input type="text" name="inputPrice" class="form-control" id="inputPrice">
</div>
<div class="form-group alterinfo">请选择类型:
<select class="form-control" id="inputType">
<option value="1">单人间</option>
<option value="2">双人间</option>
<option value="3">大床房</option>
<option value="4">套房</option>
</select>
</div>
<div class="form-group alterinfo">
<input type="button" id="addRoomBtn" class="btn btn-success" value="确定"/>
</div>
</div>
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">添加房间</h4>
</div>
<!--“房间位置” 输入项form-group alterinfo控制表单组样式间距、对齐-->
<div class="modal-body" style="width: 80%;padding-left:20%">
<div class="form-group alterinfo">请输入位置:
<label for="inputLocal">inputPrice</label>
<input type="text" name="inputLocal" class="form-control" id="inputLocal">
</div>
<!--“房间价格” 输入项id="inputPrice" 用于 JS 获取价格值。-->
<div class="form-group alterinfo">请输入价格:
<label for="inputPrice">inputPrice</label>
<input type="text" name="inputPrice" class="form-control" id="inputPrice">
</div>
<!--“房间类型” 下拉选择框:选项值 1-4 对应不同房型便于后端存储id="inputType"JS 获取选中的类型值。-->
<div class="form-group alterinfo">请选择类型:
<select class="form-control" id="inputType">
<option value="1">单人间</option>
<option value="2">双人间</option>
<option value="3">大床房</option>
<option value="4">套房</option>
</select>
</div>
<!--“确认添加” 按钮:
btn btn-successBootstrap 绿色成功样式按钮;
id="addRoomBtn"JS 绑定点击事件,提交新增房间数据。-->
<div class="form-group alterinfo">
<input type="button" id="addRoomBtn" class="btn btn-success" value="确定"/>
</div>
</div>
</div>
</div>
</div>
</div>
<!--弹窗头部,标题为 “修改房间”,结构同 “添加房间” 弹窗。-->
<div class="modal fade" id="alterRoom" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">修改房间</h4>
</div>
<div class="modal-body" style="width: 80%;padding-left:20%">
<div class="form-group alterinfo" style="display:none">
<input type="text" class="form-control" id="reinputid">
</div>
<div class="form-group alterinfo">请输入位置:
<label for="reinputLocal">inputPrice</label>
<input type="text" name="reinputLocal" class="form-control" id="reinputLocal">
</div>
<div class="form-group alterinfo">请输入价格:
<label for="reinputPrice">inputPrice</label>
<input type="text" name="reinputPrice" class="form-control" id="reinputPrice">
</div>
<div class="form-group alterinfo">请选择类型:
<select class="form-control" id="reinputType">
<option value="1">单人间</option>
<option value="2">双人间</option>
<option value="3">大床房</option>
<option value="4">套房</option>
</select>
</div>
<div class="form-group alterinfo">
<input type="button" id="setRoomBtn" class="btn btn-success" value="确定"/>
</div>
</div>
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">修改房间</h4>
</div>
<!--隐藏的 “房间 ID” 输入框:
display:none 隐藏,不显示给用户;
id="reinputid":存储待修改房间的 ID后端需通过 ID 定位房间JS 预先填充。-->
<div class="modal-body" style="width: 80%;padding-left:20%">
<div class="form-group alterinfo" style="display:none">
<input type="text" class="form-control" id="reinputid">
</div>
<!--:“位置”“价格”“类型” 输入项id 前缀为 reinput区别于 “添加” 弹窗JS 会预先填充待修改房间的当前值。-->
<div class="form-group alterinfo">请输入位置:
<label for="reinputLocal">inputPrice</label>
<input type="text" name="reinputLocal" class="form-control" id="reinputLocal">
</div>
<div class="form-group alterinfo">请输入价格:
<label for="reinputPrice">inputPrice</label>
<input type="text" name="reinputPrice" class="form-control" id="reinputPrice">
</div>
<div class="form-group alterinfo">请选择类型:
<select class="form-control" id="reinputType">
<option value="1">单人间</option>
<option value="2">双人间</option>
<option value="3">大床房</option>
<option value="4">套房</option>
</select>
</div>
<!--“确认修改” 按钮id="setRoomBtn" 绑定 JS 事件,提交修改后的房间数据。-->
<div class="form-group alterinfo">
<input type="button" id="setRoomBtn" class="btn btn-success" value="确定"/>
</div>
</div>
</div>
</div>
</div>
</div>
</html>
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script type="text/javascript" src="../js/bootstrap.min.js"></script>
<script type="text/javascript" src="../js/manage_room.js"></script>
<script type="text/javascript" src="../js/jquery.min.js"></script><!--引入 jQuery 框架,简化 DOM 操作(如获取输入值、绑定事件、发送 AJAX 请求)。-->
<script type="text/javascript" src="../js/bootstrap.min.js"></script><!--引入 Bootstrap JS 组件,激活弹窗的显示 / 隐藏、动画等交互效果。-->
<script type="text/javascript" src="../js/manage_room.js"></script><!--自定义房间管理脚本-->

@ -1,70 +1,90 @@
<!-- 管理员视角的员工管理页面前端结构-->
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" Content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="../css/myCenter.css">
<link rel="stylesheet" type="text/css" href="../css/pages.css">
<meta http-equiv="Content-Type" Content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="../css/myCenter.css">
<link rel="stylesheet" type="text/css" href="../css/pages.css">
</head>
<!--定义页面主容器,基于 Bootstrap 栅格系统实现响应式布局:
col-md-11中等屏幕≥992px下占 11 列(总 12 列),左右留少量空白;
col-xs-11超小屏幕<768px 11
nopadding自定义类清除容器默认左右内边距
内联样式 padding-top:3rem顶部内边距 3rem与上方导航栏 / 页头拉开距离;
内联样式 padding-left: 3rem左侧内边距 3rem避免列表贴左边缘。-->
<body>
<div class="col-md-11 col-xs-11 nopadding" style="padding-top:3rem;padding-left: 3rem">
<div class="table-responsive">
<a href="#" style="font-size:1.7rem" data-toggle="modal" data-target="#addUser" >
<span class="glyphicon glyphicon-pencil"></span>
<span>添加员工</span>
</a>
<table class="table table-bordered table-hover" style="margin-top: 10px" id="staffList">
<tr><th>账号</th><th>员工号</th><th>姓名</th><th>年龄</th><th>职位</th><th>联系方式</th><th>操作</th></tr>
</table>
<div class="col-md-12">
<form class="form-inline">
<div class="form-group" style="margin-right: 10xp">
<a href="#" id="pre">上一页 </a>
</div>
<!--<div class="form-group">
<input type="text" style="width: 5rem" class="form-control" id="inputPage">
<input type="button" id="setPageBtn" class="btn btn-default" value="跳转">
</div>-->
<div class="form-group" style="margin-left: 10px">
<a href="#" id="next">下一页</a>
<div class="table-responsive">
<!--触发 “添加员工” 弹窗的按钮:
data-toggle="modal" data-target="#addUser"Bootstrap 模态框触发属性,点击打开 id="addUser" 的弹窗-->
<a href="#" style="font-size:1.7rem" data-toggle="modal" data-target="#addUser" >
<span class="glyphicon glyphicon-pencil"></span>
<span>添加员工</span>
</a>
<!--定义员工列表表格-->
<table class="table table-bordered table-hover" style="margin-top: 10px" id="staffList">
<tr><th>账号</th><th>员工号</th><th>姓名</th><th>年龄</th><th>职位</th><th>联系方式</th><th>操作</th></tr>
<!--实现分页查看员工列表:
form-inline让分页元素横向排列
id="pre"/id="next":“上一页”“下一页” 链接,后续 JS 绑定分页数据加载事件-->
</table>
<div class="col-md-12">
<form class="form-inline">
<div class="form-group" style="margin-right: 10px">
<a href="#" id="pre">上一页 </a>
</div>
<!--<div class="form-group">
<input type="text" style="width: 5rem" class="form-control" id="inputPage">
<input type="button" id="setPageBtn" class="btn btn-default" value="跳转">
</div>-->
<div class="form-group" style="margin-left: 10px">
<a href="#" id="next">下一页</a>
</div>
</form>
</div>
</form>
</div>
</div>
</div>
</body>
<!--定义 “添加员工” 弹窗modal fade 是 Bootstrap 模态框基础样式带淡入淡出动画id="addUser" 用于触发显示。-->
<div class="modal fade" id="addUser" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">添加员工</h4>
</div>
<div class="modal-body" style="width: 80%;padding-left:20%">
<div class="form-group alterinfo">请输入账号:
<label for="newAcc">newAcc</label>
<input type="text" name="newAcc" class="form-control" id="inputAccount">
</div>
<div class="form-group alterinfo">请输入密码:
<label for="newPwd">newPwd</label>
<input type="text" name="newPwd" class="form-control" id="inputPwd">
</div>
<div class="form-group alterinfo">
<input type="button" id="addUserBtn" class="btn btn-success" value="确定"/>
</div>
</div>
<!--弹窗头部关闭按钮data-dismiss="modal" 是 Bootstrap 内置属性,点击关闭弹窗-->
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">添加员工</h4>
</div>
<!--弹窗主体区域width: 80%;padding-left:20% 让表单居中显示,避免内容贴左边缘。-->
<div class="modal-body" style="width: 80%;padding-left:20%">
<!--“员工账号” 输入项form-group alterinfo控制表单组样式间距、对齐
label 文本为 “newAcc”提示该字段含义
id="inputAccount"输入框唯一标识JS 后续获取账号值。-->
<div class="form-group alterinfo">请输入账号:
<label for="newAcc">newAcc</label>
<input type="text" name="newAcc" class="form-control" id="inputAccount">
</div>
<!--“员工密码” 输入项-->
<div class="form-group alterinfo">请输入密码:
<label for="newPwd">newPwd</label>
<input type="text" name="newPwd" class="form-control" id="inputPwd">
</div>
<!--“确认添加” 按钮btn btn-successBootstrap 绿色成功样式按钮,提示操作正向性;
id="addUserBtn"JS 绑定点击事件,验证并提交新增员工数据(账号、密码)。-->
<div class="form-group alterinfo">
<input type="button" id="addUserBtn" class="btn btn-success" value="确定"/>
</div>
</div>
</div>
</div>
</div>
</div>
</html>
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script type="text/javascript" src="../js/bootstrap.min.js"></script>
<script type="text/javascript" src="../js/manage_staff.js"></script>
<script type="text/javascript" src="../js/manage_staff.js"></script><!--自定义员工管理脚本-->

@ -1,50 +1,74 @@
<!-- 酒店管理系统的主框架页面-->
<!DOCTYPE html>
<html>
<head>
<title>酒店管理系统</title>
<meta http-equiv="Content-Type" Content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="../css/myCenter.css">
<link rel="stylesheet" type="text/css" href="../css/footer.css">
<title>酒店管理系统</title>
<meta http-equiv="Content-Type" Content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="../css/myCenter.css">
<link rel="stylesheet" type="text/css" href="../css/footer.css">
</head>
<!--定义系统顶部导航栏navbar navbar-default 是 Bootstrap 导航栏基础样式,后续通过自定义样式覆盖默认外观。-->
<body>
<nav class="navbar navbar-default">
<div class="container-fluid nav-con">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#" style="padding-top: 2rem;color: white">
<span style="font-size: 2.3rem;padding-right: 2rem;letter-spacing: 2px">酒店管理系统</span>
</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li class="navli"><a href="#">欢迎!</a></li>
<li class="navli"><a href="../index.html">退出</a></li>
</ul>
<!--导航栏容器container-fluid 使导航栏占满屏幕宽度nav-con 是自定义类(可能控制导航栏内边距,如大屏下左右留白)。-->
<div class="container-fluid nav-con">
<!--移动端 “汉堡按钮”折叠导航触发器navbar-toggle collapsedBootstrap 折叠按钮样式,默认折叠状态;
data-toggle="collapse" data-target="#bs-example-navbar-collapse-1":点击时展开 / 折叠目标导航菜单;
3 个 icon-bar 组成汉堡图标,适配移动端小屏幕。-->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<!--导航栏品牌标识系统名称navbar-brandBootstrap 品牌样式,通常放 logo 或系统名;
内联样式 padding-top: 2rem 调整名称垂直位置color: white 设为白色(配合导航栏深色背景);
文字放大2.3rem+ 字符间距2px突出系统名称。-->
<a class="navbar-brand" href="#" style="padding-top: 2rem;color: white">
<span style="font-size: 2.3rem;padding-right: 2rem;letter-spacing: 2px">酒店管理系统</span>
</a>
</div>
<!--导航栏右侧菜单collapse navbar-collapse与汉堡按钮联动控制菜单展开 / 折叠;
navbar-right菜单右对齐
navli自定义类控制菜单项间距如右侧留白
“欢迎!”:后续可通过 JS 动态填充当前登录用户(如 “欢迎!管理员”);
“退出”:点击跳转至登录页(../index.html实现退出登录。-->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li class="navli"><a href="#">欢迎!</a></li>
<li class="navli"><a href="../index.html">退出</a></li>
</ul>
</div>
</div>
</div>
</nav>
<!--主内容区外层容器col-md-12 占满整行main 是自定义类nopadding 清除默认内边距。-->
<div class="col-md-12 main nopadding">
<div class="col-md-2 navlist nopadding">
<div class="list-group" id="tagList">
</div>
<!--左侧功能导航栏:
col-md-2中等屏幕下占 2 列(总 12 列),宽度约 1/6为右侧内容区留空间
navlist自定义类控制导航栏样式如深色背景、最小高度
list-groupBootstrap 列表组样式,用于渲染导航项;
id="tagList":空容器,后续通过 JS 动态填充系统模块(如 “员工管理”“房间管理”“订单管理”),实现导航项的灵活加载。-->
<div class="col-md-2 navlist nopadding">
<div class="list-group" id="tagList">
</div>
</div>
<div class="col-md-10 nopadding">
<iframe frameborder="0" id="mainFrame" class="mainFrame" name="mainFrame" src=""></iframe>
</div>
</div>
<!--右侧内容展示区,通过 iframe 加载具体功能页面:
col-md-10中等屏幕下占 10 列,与左侧 col-md-2 合计 12 列,填满主内容区;
iframe嵌入式框架用于加载外部页面无需刷新主框架
frameborder="0":隐藏 iframe 边框,避免视觉割裂;
id="mainFrame"/name="mainFrame":标识 iframe方便 JS 控制跳转(如点击左侧导航,更新 iframe 的 src 加载对应页面);
mainFrame自定义类控制 iframe 尺寸,如 width:100%; min-height:60rem确保填满右侧区域
src="":初始为空,后续通过 JS 设置默认加载页面-->
<div class="col-md-10 nopadding">
<iframe frameborder="0" id="mainFrame" class="mainFrame" name="mainFrame" src=""></iframe>
</div>
</div>
<!--
@ -68,4 +92,4 @@
</html>
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script type="text/javascript" src="../js/bootstrap.min.js"></script>
<script type="text/javascript" src="../js/myCenter.js"></script>
<script type="text/javascript" src="../js/myCenter.js"></script><!--自定义主框架脚本-->

@ -1,70 +1,80 @@
<!-- 清洁工专项管理页面 的前端结构-->
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" Content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="../css/myCenter.css">
<link rel="stylesheet" type="text/css" href="../css/pages.css">
<meta http-equiv="Content-Type" Content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="../css/myCenter.css">
<link rel="stylesheet" type="text/css" href="../css/pages.css">
</head>
<!--定义页面主容器-->
<body>
<div class="col-md-11 col-xs-11 nopadding" style="padding-top:3rem;padding-left: 3rem">
<div class="table-responsive">
<a href="#" style="font-size:1.7rem" data-toggle="modal" data-target="#addUser" >
<span class="glyphicon glyphicon-pencil"></span>
<span>添加清洁工</span>
</a>
<table class="table table-bordered table-hover" style="margin-top: 10px" id="staffList">
<tr><th>账号</th><th>员工号</th><th>姓名</th><th>年龄</th><th>职位</th><th>联系方式</th><th>操作</th></tr>
</table>
<div class="col-md-12">
<form class="form-inline">
<div class="form-group" style="margin-right: 10xp">
<a href="#" id="pre">上一页 </a>
</div>
<!--<div class="form-group">
<input type="text" style="width: 5rem" class="form-control" id="inputPage">
<input type="button" id="setPageBtn" class="btn btn-default" value="跳转">
</div>-->
<div class="form-group" style="margin-left: 10px">
<a href="#" id="next">下一页</a>
<div class="table-responsive">
<!--触发 “添加清洁工” 弹窗的核心操作按钮-->
<a href="#" style="font-size:1.7rem" data-toggle="modal" data-target="#addUser" >
<span class="glyphicon glyphicon-pencil"></span>
<span>添加清洁工</span>
</a>
<!--展示清洁工信息的核心表格-->
<table class="table table-bordered table-hover" style="margin-top: 10px" id="staffList">
<tr><th>账号</th><th>员工号</th><th>姓名</th><th>年龄</th><th>职位</th><th>联系方式</th><th>操作</th></tr>
<!--实现清洁工列表的分页查看-->
</table>
<div class="col-md-12">
<form class="form-inline">
<div class="form-group" style="margin-right: 10px">
<a href="#" id="pre">上一页 </a>
</div>
<!--<div class="form-group">
<input type="text" style="width: 5rem" class="form-control" id="inputPage">
<input type="button" id="setPageBtn" class="btn btn-default" value="跳转">
</div>-->
<div class="form-group" style="margin-left: 10px">
<a href="#" id="next">下一页</a>
</div>
</form>
</div>
</form>
</div>
</div>
</div>
</body>
<!--定义 “添加清洁工” 的弹窗-->
<div class="modal fade" id="addUser" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">添加清洁工</h4>
</div>
<div class="modal-body" style="width: 80%;padding-left:20%">
<div class="form-group alterinfo">请输入账号:
<label for="newAcc">newAcc</label>
<input type="text" name="newAcc" class="form-control" id="inputAccount">
</div>
<div class="form-group alterinfo">请输入密码:
<label for="newPwd">newPwd</label>
<input type="text" name="newPwd" class="form-control" id="inputPwd">
</div>
<div class="form-group alterinfo">
<input type="button" id="addUserBtn" class="btn btn-success" value="确定"/>
</div>
</div>
<!--弹窗头部区域包含关闭按钮和标题关闭按钮data-dismiss="modal" 是 Bootstrap 内置属性,点击后直接关闭弹窗;&times; 是 “×” 符号,直观表示关闭功能;
标题 “添加清洁工”:明确弹窗用途,与按钮文字呼应-->
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">添加清洁工</h4>
</div>
<div class="modal-body" style="width: 80%;padding-left:20%">
<!--“清洁工账号” 输入项-->
<div class="form-group alterinfo">请输入账号:
<label for="newAcc">newAcc</label>
<input type="text" name="newAcc" class="form-control" id="inputAccount">
</div>
<!--“清洁工密码” 输入项-->
<div class="form-group alterinfo">请输入密码:
<label for="newPwd">newPwd</label>
<input type="text" name="newPwd" class="form-control" id="inputPwd">
</div>
<!--“确认添加” 按钮-->
<div class="form-group alterinfo">
<input type="button" id="addUserBtn" class="btn btn-success" value="确定"/>
</div>
</div>
</div>
</div>
</div>
</div>
</html>
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script type="text/javascript" src="../js/bootstrap.min.js"></script>
<script type="text/javascript" src="../js/staff_cleaner.js"></script>
<script type="text/javascript" src="../js/staff_cleaner.js"></script><!--清洁工专项管理的自定义脚本-->

@ -1,60 +1,65 @@
<!--员工视角的订单管理页面前端结构-->
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" Content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="../css/myCenter.css">
<link rel="stylesheet" type="text/css" href="../css/pages.css">
<meta http-equiv="Content-Type" Content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="../css/myCenter.css">
<link rel="stylesheet" type="text/css" href="../css/pages.css">
</head>
<body>
<div class="col-md-8 col-xs-11 nopadding" style="padding-top:3rem;padding-left: 3rem">
<div class="table-responsive">
<table class="table table-bordered table-hover" style="margin-top: 10px" id="orderList">
<tr><th>入住人</th><th>身份证号</th><th>开始时间</th><th>结束时间</th><th>总金额</th><th>状态</th><th>操作</th></tr>
</table>
<div class="col-md-12">
<form class="form-inline">
<div class="form-group" style="margin-right: 10xp">
<a href="#" id="pre">上一页 </a>
</div>
<!--<div class="form-group">
<input type="text" style="width: 5rem" class="form-control" id="inputPage">
<input type="button" id="setPageBtn" class="btn btn-default" value="跳转">
</div>-->
<div class="form-group" style="margin-left: 10px">
<a href="#" id="next">下一页</a>
<div class="table-responsive">
<!--定义订单列表表格-->
<table class="table table-bordered table-hover" style="margin-top: 10px" id="orderList">
<tr><th>入住人</th><th>身份证号</th><th>开始时间</th><th>结束时间</th><th>总金额</th><th>状态</th><th>操作</th></tr>
<!--实现订单列表的分页查看-->
</table>
<div class="col-md-12">
<form class="form-inline">
<div class="form-group" style="margin-right: 10px">
<a href="#" id="pre">上一页 </a>
</div>
<!--<div class="form-group">
<input type="text" style="width: 5rem" class="form-control" id="inputPage">
<input type="button" id="setPageBtn" class="btn btn-default" value="跳转">
</div>-->
<div class="form-group" style="margin-left: 10px">
<a href="#" id="next">下一页</a>
</div>
</form>
</div>
</form>
</div>
</div>
</div>
</body>
</html>
<!--定义 “查看房间详情” 的弹窗-->
<div class="modal fade" id="showRoomT" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">房间详情</h4>
</div>
<div class="modal-body">
<table class="table table-bordered table-hover" style="margin-top: 10px" id="roomTable">
</table>
</div>
<!--弹窗头部区域-->
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">房间详情</h4>
</div>
<!--弹窗主体区域,用于展示订单关联的房间信息-->
<div class="modal-body">
<table class="table table-bordered table-hover" style="margin-top: 10px" id="roomTable">
</table>
</div>
</div>
</div>
</div>
</div>
<!--结束弹窗内容、容器和模态框整体标签。-->
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script type="text/javascript" src="../js/bootstrap.min.js"></script>
<script type="text/javascript" src="../js/staff_order.js"></script>
<script type="text/javascript" src="../js/staff_order.js"></script><!--自定义员工订单管理脚本-->

@ -1,85 +1,97 @@
<!--员工视角的房间管理与订单生成页面 前端结构-->
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" Content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="../css/myCenter.css">
<link rel="stylesheet" type="text/css" href="../css/pages.css">
<meta http-equiv="Content-Type" Content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="../css/myCenter.css">
<link rel="stylesheet" type="text/css" href="../css/pages.css">
</head>
<body>
<div class="col-md-8 col-xs-11 nopadding" style="padding-top:3rem;padding-left: 3rem">
<div class="table-responsive">
<table class="table table-bordered table-hover" style="margin-top: 10px" id="roomList">
<tr><th>位置</th><th>价格</th><th>状态</th><th>类型</th><th>操作</th></tr>
</table>
<div class="col-md-12">
<form class="form-inline">
<div class="form-group" style="margin-right: 10xp">
<a href="#" id="pre">上一页 </a>
<div class="table-responsive">
<!--id="roomList":唯一 ID方便后续 JavaScript 动态填充房间数据(如从后端加载房间列表,区分 “空闲”“已入住” 等状态)-->
<table class="table table-bordered table-hover" style="margin-top: 10px" id="roomList">
<tr><th>位置</th><th>价格</th><th>状态</th><th>类型</th><th>操作</th></tr>
<!--实现房间列表的分页查看-->
</table>
<div class="col-md-12">
<form class="form-inline">
<div class="form-group" style="margin-right: 10px">
<a href="#" id="pre">上一页 </a>
</div>
<!--<div class="form-group">
<input type="text" style="width: 5rem" class="form-control" id="inputPage">
<input type="button" id="setPageBtn" class="btn btn-default" value="跳转">
</div>-->
<div class="form-group" style="margin-left: 10px">
<a href="#" id="next">下一页</a>
</div>
</form>
</div>
<!--<div class="form-group">
<input type="text" style="width: 5rem" class="form-control" id="inputPage">
<input type="button" id="setPageBtn" class="btn btn-default" value="跳转">
</div>-->
<div class="form-group" style="margin-left: 10px">
<a href="#" id="next">下一页</a>
</div>
</form>
</div>
</div>
</div>
</body>
<!--定义 “为房间生成订单” 的弹窗-->
<div class="modal fade" id="chooseRoom" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">生成订单</h4>
</div>
<div class="modal-body" style="width: 80%;padding-left:20%">
<div class="form-group alterinfo">位置:
<span id="inputLocal"></span>
</div>
<div class="form-group alterinfo">入住人姓名:
<label for="inputName">inputName</label>
<input type="text" name="inputName" class="form-control" id="inputName">
</div>
<div class="form-group alterinfo">身份证号:
<label for="inputId">inputId</label>
<input type="text" name="inputId" class="form-control" id="inputId">
</div>
<div class="form-group alterinfo">开始日期:
<label for="inputStart">inputId</label>
<input type="text" name="inputStart" class="form-control" data-provide="datepicker" id="dateStart">
</div>
<div class="form-group alterinfo">结束日期:
<label for="inputEnd">inputId</label>
<input type="text" name="inputEnd" class="form-control" data-provide="datepicker" id="dateEnd">
</div>
<div class="form-group alterinfo">
<input type="button" id="addOrder" class="btn btn-success" value="确定"/>
</div>
</div>
<!--弹窗头部区域:
关闭按钮data-dismiss="modal" 是 Bootstrap 内置属性,点击关闭弹窗;&times; 为 “×” 符号,直观表示关闭;
标题 “生成订单”:明确弹窗用途,与房间列表 “操作” 列功能呼应。-->
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">生成订单</h4>
</div>
<div class="modal-body" style="width: 80%;padding-left:20%">
<!--房间位置显示项:非输入框,通过 id="inputLocal" 由 JS 动态填充当前选中房间的位置。-->
<div class="form-group alterinfo">位置:
<span id="inputLocal"></span>
</div>
<!--入住人姓名输入项-->
<div class="form-group alterinfo">入住人姓名:
<label for="inputName">inputName</label>
<input type="text" name="inputName" class="form-control" id="inputName">
</div>
<!--入住人身份证号输入项-->
<div class="form-group alterinfo">身份证号:
<label for="inputId">inputId</label>
<input type="text" name="inputId" class="form-control" id="inputId">
</div>
<!--入住开始日期选择项-->
<div class="form-group alterinfo">开始日期:
<label for="inputStart">inputId</label>
<input type="text" name="inputStart" class="form-control" data-provide="datepicker" id="dateStart">
</div>
<!--入住结束日期选择项-->
<div class="form-group alterinfo">结束日期:
<label for="inputEnd">inputId</label>
<input type="text" name="inputEnd" class="form-control" data-provide="datepicker" id="dateEnd">
</div>
<!--“确认生成订单” 按钮-->
<div class="form-group alterinfo">
<input type="button" id="addOrder" class="btn btn-success" value="确定"/>
</div>
</div>
</div>
</div>
</div>
</div>
</html>
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script type="text/javascript" src="../js/bootstrap.min.js"></script>
<script type="text/javascript" src="../js/bootstrap-datepicker.js"></script>
<script type="text/javascript" src="../js/bootstrap-datepicker.zh-CN.min.js"></script>
<script type="text/javascript" src="../js/staff_room.js"></script>
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script type="text/javascript" src="../js/bootstrap.min.js"></script>
<script type="text/javascript" src="../js/bootstrap-datepicker.js"></script><!--引入 Bootstrap Datepicker 日期选择器插件-->
<script type="text/javascript" src="../js/bootstrap-datepicker.zh-CN.min.js"></script>
<script type="text/javascript" src="../js/staff_room.js"></script><!--自定义房间管理与订单生成脚本-->

Loading…
Cancel
Save