From 102b9f04fac207682cc6c822d82bdc666cb86d7e Mon Sep 17 00:00:00 2001 From: CFF <1730422060@qq.com> Date: Sun, 26 Oct 2025 23:37:44 +0800 Subject: [PATCH 1/2] =?UTF-8?q?html=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/static/index.html | 143 ++++---- src/main/resources/static/js/staff_cleaner.js | 328 +++++++++--------- .../resources/static/pages/ad_manage.html | 84 +++-- src/main/resources/static/pages/ad_order.html | 1 + .../resources/static/pages/ad_salary.html | 151 +++++--- .../resources/static/pages/all_infor.html | 64 +++- .../resources/static/pages/cleaner_room.html | 77 ++-- .../resources/static/pages/manage_room.html | 217 +++++++----- .../resources/static/pages/manage_staff.html | 118 ++++--- src/main/resources/static/pages/myCenter.html | 94 +++-- .../resources/static/pages/staff_cleaner.html | 108 +++--- .../resources/static/pages/staff_order.html | 77 ++-- .../resources/static/pages/staff_room.html | 130 +++---- 13 files changed, 934 insertions(+), 658 deletions(-) diff --git a/src/main/resources/static/index.html b/src/main/resources/static/index.html index 808ed54..6c8aae9 100644 --- a/src/main/resources/static/index.html +++ b/src/main/resources/static/index.html @@ -1,78 +1,93 @@ + - 酒店管理系统 - - - - - + 酒店管理系统 + + + + + - +
- -
-
- - + @@ -80,5 +95,5 @@ - + diff --git a/src/main/resources/static/js/staff_cleaner.js b/src/main/resources/static/js/staff_cleaner.js index 842f931..50ef377 100644 --- a/src/main/resources/static/js/staff_cleaner.js +++ b/src/main/resources/static/js/staff_cleaner.js @@ -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("账号员工号姓名年龄职位联系方式操作") - for(i in list){ - btnStr="" - htmlStr=""+list[i].useraccount+""+list[i].idnumber+""+list[i].username+""+list[i].age+""+"清洁工"+""+list[i].phonenumber+""+btnStr+""; - $("#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("账号员工号姓名年龄职位联系方式操作") - for(i in list){ - btnStr="" - htmlStr=""+list[i].useraccount+""+list[i].idnumber+""+list[i].username+""+list[i].age+""+"清洁工"+""+list[i].phonenumber+""+btnStr+""; - $("#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("账号员工号姓名年龄职位联系方式操作") + // 遍历清洁工列表,生成表格内容 + for(i in list){ + btnStr="" + htmlStr=""+list[i].useraccount+""+list[i].idnumber+""+list[i].username+""+list[i].age+""+"清洁工"+""+list[i].phonenumber+""+btnStr+""; + $("#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("账号员工号姓名年龄职位联系方式操作") + for(i in list){ + btnStr="" + htmlStr=""+list[i].useraccount+""+list[i].idnumber+""+list[i].username+""+list[i].age+""+"清洁工"+""+list[i].phonenumber+""+btnStr+""; + $("#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("添加用户出现错误"); + } + }) + } + } diff --git a/src/main/resources/static/pages/ad_manage.html b/src/main/resources/static/pages/ad_manage.html index 067f7fc..9b7cf86 100644 --- a/src/main/resources/static/pages/ad_manage.html +++ b/src/main/resources/static/pages/ad_manage.html @@ -1,42 +1,74 @@ + - - - - - + + + + + + + + + +
-
- - -
账号员工号姓名年龄职位联系方式操作
-
-
-
- 上一页 + +
+ + + + +
账号员工号姓名年龄职位联系方式操作
+ +
+ + + + + + +
+ +
+
- -
- -
-
-
- +
- - - + + + diff --git a/src/main/resources/static/pages/ad_order.html b/src/main/resources/static/pages/ad_order.html index 96db0e7..f346361 100644 --- a/src/main/resources/static/pages/ad_order.html +++ b/src/main/resources/static/pages/ad_order.html @@ -1,3 +1,4 @@ + diff --git a/src/main/resources/static/pages/ad_salary.html b/src/main/resources/static/pages/ad_salary.html index b368e47..941969a 100644 --- a/src/main/resources/static/pages/ad_salary.html +++ b/src/main/resources/static/pages/ad_salary.html @@ -1,63 +1,101 @@ + - - - - - + + + + + + + + + - +
-
- - - 更改配置 - - - -
职位底薪提成
-
- + +
+ + + + 更改配置 + + + + +
职位底薪提成
+
+ + + +
@@ -68,6 +106,11 @@ - - + + + diff --git a/src/main/resources/static/pages/all_infor.html b/src/main/resources/static/pages/all_infor.html index 6bc6df5..7ae9372 100644 --- a/src/main/resources/static/pages/all_infor.html +++ b/src/main/resources/static/pages/all_infor.html @@ -1,3 +1,4 @@ + @@ -11,24 +12,42 @@ +
+
- + + - +
+
+
+ 修改信息 +

账号 Account : @@ -39,8 +58,7 @@

- - +

工号 ID : @@ -65,6 +83,7 @@

+

年龄 Age : @@ -78,17 +97,24 @@

- + + +