Commit bcf13e3c authored by 马超's avatar 马超

值班管理

parent d92229f0
......@@ -14,11 +14,11 @@
type="text/css">
<div class="page-container">
<div class="left-tree">
<button class="btn btn-success" onclick="optMx('add');" style="text-align:center;float:left;">
<button class="btn btn-success" onclick="optMx('add');" style="text-align:center;float:left;margin-left: 30px;">
新建</button>
<button class="btn btn-success" onclick="updateMx();" style="text-align:center;float:left;margin-left: 20px;">
修改</button>
<button class="btn btn-success" onclick="delMx();" style="text-align:center;float:right;">
<%--<button class="btn btn-success" onclick="updateMx();" style="text-align:center;float:left;margin-left: 20px;">
修改</button>--%>
<button class="btn btn-success" onclick="delMx();" style="text-align:center;float:left;margin-left: 20px;">
删除</button>
<input type="hidden" name="check_mx_id" id="check_mx_id">
<input type="hidden" name="check_mx_day" id="check_mx_day">
......
This diff is collapsed.
<%--
Created by IntelliJ IDEA.
User: Administrator
Date: 2020/9/11
Time: 12:54
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.util.*" %>
<%@ page import="com.censoft.common.db.ConnectionFactory" %>
<%@ page import="com.censoft.common.base.Pub" %>
<%
ConnectionFactory cf = new ConnectionFactory();
Pub pub = new Pub();
Connection conn = null;
Vector v_list = null;
Vector v_list_day = null;
String login_id = (String) session.getAttribute("session_login_id");
if ("".equals(login_id)) {
System.out.println("当前没有用户信息");
}
String mx_id = pub.trimNull(request.getParameter("mx_id"));
String Mxday = pub.trimNull(request.getParameter("day"));
int divCount=30;
if(!"".equals(Mxday)){
divCount=Integer.parseInt(Mxday);
}
String divWidth=(divCount+2)*140-80+"px";
StringBuffer sql = new StringBuffer();
StringBuffer sql_day = new StringBuffer();
sql.append("select * from zb_type where mx_id=? order by order_num asc ");
sql_day.append("select * from zb_mx_day where mx_id=? and zb_type=? order by day asc ");
try {
conn = com.censoft.db.DBUtil.getConnection();
v_list = cf.doQuery(conn, sql.toString(), null, new Object[]{mx_id});
if (v_list != null && v_list.size()>0) {
}
%>
<div style="border: solid 1px #eee;margin-top: 20px;height:550px;width:1100px;overflow: auto;">
<%
for(int i=0;i<v_list.size();i++){
Hashtable ht = (Hashtable) v_list.get(i);
String id=pub.trimNull((String)ht.get("id"));
String zb_type=pub.trimNull((String)ht.get("zb_type"));
String b_time=pub.trimNull((String)ht.get("b_time"));
String e_time=pub.trimNull((String)ht.get("e_time"));
%>
<%
if(i==0){%>
<div style="width:<%=divWidth%>;height:40px;float:left;white-space: nowrap;">
<div style="width:140px;height:40px;float:left;border:0.5px solid #000;">
</div>
<%
for(int n=0;n<30;n++){
%>
<div style="width:140px;height:40px;line-height:40px;text-align:center;color:#fff;float:left;border:0.5px solid #000;background-color: #00b7ee">
<%=n+1%>
</div>
<% }%>
</div>
<%}%>
<div style="width:<%=divWidth%>;height:160px;float:left;">
<div style="width:140px;height:160px;float:left;border:0.5px solid #000;text-align: center;line-height: 120px;">
<p style="height:30px;"> <%=zb_type%></p>
<p style="height:30px;">(<%=b_time%>-<%=e_time%>)</p>
</div>
<%
for(int n=0;n<30;n++){
%>
<div style="text-align:center;width:140px;height:160px;float:left;border:0.5px solid #000;position: relative">
<p style="height:10px;display:none;">
</p>
<button class="btn btn-success" style="display:none;text-align:center;position:absolute; right:0; bottom:0;">
修改</button>
</div>
<%}%>
</div>
<%}%>
</div>
<script type="text/javascript">
function deleteUser(user_id){
layer.confirm('确认要删除吗?', function (index) {
$.ajax({
type: "POST",
url: "./action.jsp?user_id="+user_id+"&action=delete",
success: function (msg) {
if (msg.indexOf("success") >= 0) {
layer.msg('操作成功!', {icon: 1, time: 1000},
function () {
searchModel();
});
} else {
layer.msg('操作失败', {
icon: 5,
time: 2000 //2秒关闭(如果不配置,默认是3秒)
}, function () {
// console.log("********************8")
});
}
}
});
})
}
function optOrder(opt,user_id){
$.ajax({
type: "post",
url: "opt_order.jsp",
data:{"user_id":user_id,"opt":opt},
success: function (data) {
if (data.indexOf("success") >= 0) {
layer.msg('操作成功!', {icon: 1, time: 1000},
function () {
searchModel();
});
} else {
layer.msg('操作失败,'+data, {
icon: 5,
time: 2000 //2秒关闭(如果不配置,默认是3秒)
}, function () {
// console.log("********************8")
});
}
}
});
}
</script>
<%
} catch (Exception e) {
out.println("查询用户信息异常" + e);
return;
} finally {
if (conn != null) {
try {
conn.close();
} catch (Exception e) {
}
}
}
%>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<style>
.col-sm-2{
width:100px;
}
.btn-green{ background-color:green;border: green}
</style>
<div class="">
<form class="form form-horizontal" method="post" id="form1" name="form1" action="exportWeek.jsp" >
<div style="height:450px;overflow: hidden;text-align: center">
<div style="width:45%;height:90%;float:left;border: solid 1px #eee;margin-left: 40px">
<div class="row cl">
<label class="form-label col-xs-2 col-sm-2" style="width:100px;">
日期&nbsp;
</label>
<div class="formControls col-xs-8 col-sm-5">
<input type="text" class="input-text Wdate" autocomplete="off" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',onpicked:refrashTask})" name="b_time" id="b_time" value="" >
</div>
</div>
<div id="leftUserList" >
</div>
</div>
<div style="width:45%;height:90%;float:left;border: solid 1px #eee;margin-left: 20px">
<div class="row cl">
<label class="form-label col-xs-2 col-sm-2" style="width:100px;">
日期&nbsp;
</label>
<div class="formControls col-xs-8 col-sm-5">
<input type="text" class="input-text Wdate" autocomplete="off" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',onpicked:refrashTask2})" name="e_time" id="e_time" value="" >
</div>
</div>
<div id="rightUserList" >
</div>
</div>
<div class="cl mb-10 " style="height: 50px;">
<div class="col-sm-3 pd-10" style="width:100%;text-align: center;">
<input class="btn btn-primary radius btn-green" type="button" onclick="javascript:saveForm();" value="&nbsp;&nbsp;换班&nbsp;&nbsp;">
</div>
</div>
</div>
</form>
</div>
<script>
function saveForm() {
var date_left=$("#b_time").val();
var date_right=$("#e_time").val();
var user_left=$("input[name='leftUserList_1']:checked").val();
var zb_type_left=user_left.substring(user_left.indexOf("_")+1,user_left.length);
user_left=user_left.substring(0,user_left.indexOf("_"));
var user_right=$("input[name='rightUserList_1']:checked").val();
var zb_type_right=user_right.substring(user_right.indexOf("_")+1,user_right.length);
user_right=user_right.substring(0,user_right.indexOf("_"));
$.ajax({
type: "post",
url: "action.jsp?action=changeUser&date_left="+date_left+"&date_right="+date_right
+"&user_left="+user_left+"&user_right="+user_right+"&zb_type_left="+zb_type_left+"&zb_type_right="+zb_type_right,
success: function (msg) {
if (msg.indexOf("success") >= 0) {
layer.msg('操作成功!', {icon: 1, time: 1000},
function () {
window.parent.location.reload();
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
});
} else {
layer.msg('操作失败', {
icon: 5,
time: 2000 //2秒关闭(如果不配置,默认是3秒)
}, function () {
// console.log("********************8")
});
}
}
});
}
function refrashTask() {
var value=$("#b_time").val();
$.ajax({
type: "post",
url: "getUserBydate-t.jsp?year="+value+"&divId=leftUserList",
success: function (msg) {
$("#leftUserList").html(msg);
}
});
}
function refrashTask2() {
var value=$("#e_time").val();
$.ajax({
type: "post",
url: "getUserBydate-t.jsp?year="+value+"&divId=rightUserList",
success: function (msg) {
$("#rightUserList").html(msg);
}
});
}
</script>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<style>
.col-sm-2{
width:14%;
}
.col-sm-3{
width:19%;
}
.btn-red{ background-color:red;border: red}
.btn-green{ background-color:green;border: green}
</style>
<div class="">
<form class="form form-horizontal" id="form-admin-add">
<input type="hidden" value="add" name="action" id="action">
<div id="content" class="cl pd-5 bk-gray divOverflow" style="overflow:hidden;margin-bottom: 20px;">
<div class="row cl">
<label class="form-label col-xs-4 col-sm-2">
<span class="c-red">*</span>开始时间&nbsp;
</label>
<div class="formControls col-xs-8 col-sm-10">
<input type="text" class="input-text Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" name="b_time" id="b_time" value="" >
</div>
</div>
<div class="row cl" >
<label class="form-label col-xs-4 col-sm-2">
<span class="c-red">*</span>结束时间&nbsp;
</label>
<div class="formControls col-xs-8 col-sm-10">
<input type="text" class="input-text Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" name="e_time" id="e_time" value="" >
</div>
</div>
<div class="row cl" >
<label class="form-label col-xs-4 col-sm-2">
<span class="c-red">*</span>选择模型&nbsp;
</label>
<div class="formControls col-xs-8 col-sm-10" id="mx_id">
<script>
$.post("./zd_view_list.jsp?name_id=mx_id&math="+Math.random(),function(data){
document.getElementById("mx_id").innerHTML=data;
}
);
</script>
</div>
</div>
<div class="row cl" >
<label class="form-label col-xs-4 col-sm-2" >
</label>
<div class="formControls col-xs-8 col-sm-10" style="color: red;">
所选时间应为模型天数的整数倍
</div>
</div>
</div>
</form>
</div>
<div class="cl mb-10 bk-gray " style="height: 50px;">
<div class="col-sm-3 pd-10" style="width:100%;text-align: center;">
<input class="btn btn-primary radius btn-green" type="button" onclick="javascript:saveForm();" value="&nbsp;&nbsp;保存&nbsp;&nbsp;">
<input class="btn btn-primary radius btn-red" type="button" onclick="javascript:deleteForm();" value="&nbsp;&nbsp;重置排班&nbsp;&nbsp;">
</div>
</div>
<script>
function saveForm() {
if($("#b_time").val()==''||$("#e_time").val()==''){
layer.alert("时间不能为空",{icon:5,title:"提示"});
return false;
}
if($("#mx_id option:selected").val()==''){
layer.alert("请选择模型",{icon:5,title:"提示"});
return false;
}
$.ajax({
type: "POST",
url: "./action.jsp",
data: $('#form-admin-add').serialize(),
success: function (msg) {
if (msg.indexOf("success") >= 0) {
layer.msg('操作成功!', {icon: 1, time: 1000},
function () {
window.parent.location.reload();
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
});
} else {
layer.msg('操作失败', {
icon: 5,
time: 2000 //2秒关闭(如果不配置,默认是3秒)
}, function () {
// console.log("********************8")
});
}
}
});
}
function deleteForm(){
if($("#b_time").val()==''||$("#e_time").val()==''){
layer.alert("时间不能为空",{icon:5,title:"提示"});
return false;
}
layer.confirm('确认要重置吗?', function (index) {
$.ajax({
type: "POST",
url: "./action.jsp?b_time="+$("#b_time").val()+"&e_time="+$("#e_time").val()+"&action=delete",
success: function (msg) {
if (msg.indexOf("success") >= 0) {
layer.msg('操作成功!', {icon: 1, time: 1000},
function () {
window.parent.location.reload();
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
});
} else {
layer.msg('操作失败', {
icon: 5,
time: 2000 //2秒关闭(如果不配置,默认是3秒)
}, function () {
// console.log("********************8")
});
}
}
});
});
}
</script>
\ No newline at end of file
<%--
Created by IntelliJ IDEA.
User: mc
Date: 2021/7/7
Time: 15:12
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import=" java.io.BufferedInputStream" %>
<%@ page import=" java.io.BufferedOutputStream" %>
<%@ page import=" java.io.File" %>
<%@ page import=" java.io.FileInputStream" %>
<%@ page import=" java.io.FileOutputStream" %>
<%@ page import=" java.io.IOException" %>
<%@ page import=" java.io.InputStream" %>
<%@ page import=" java.io.OutputStream" %>
<%@ page import=" java.text.SimpleDateFormat" %>
<%@ page import=" javax.servlet.http.HttpServletResponse" %>
<%@ page import="com.censoft.common.base.Pub" %>
<%@ page import="com.censoft.common.db.ConnectionFactory" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.util.*" %>
<%@ page import="org.apache.poi.xssf.usermodel.*" %>
<%@ page import="org.apache.poi.ss.util.CellRangeAddress" %>
<%!
private void download(String path, HttpServletResponse response) {
try {
// path是指欲下载的文件的路径。
File file = new File(path);
// 取得文件名。
String filename = file.getName();
// 以流的形式下载文件。
InputStream fis = new BufferedInputStream(new FileInputStream(path));
byte[] buffer = new byte[fis.available()];
fis.read(buffer);
fis.close();
// 清空response
response.reset();
// 设置response的Header
response.addHeader("Content-Disposition", "attachment;filename="+ new String(filename.getBytes()));
response.addHeader("Content-Length", "" + file.length());
OutputStream toClient = new BufferedOutputStream(response.getOutputStream());
response.setContentType("application/vnd.ms-excel;charset=utf-8");
toClient.write(buffer);
toClient.flush();
toClient.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
public static String getTel(ConnectionFactory cf,Connection conn,String user_name) {
String tel="";
Vector userList = cf.doQuery(conn,"select tel from zb_bgs_user where user_name=? "
,null,new Object[]{user_name});
if(userList!=null && userList.size()>0){
Hashtable ht1 = (Hashtable) userList.get(0);
tel = (String) ht1.get("tel");
}
return tel;
}
%>
<%
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
ConnectionFactory cf = new ConnectionFactory();
Pub pub = new Pub();
Connection conn = null;
String year = pub.trimNull(request.getParameter("exportDate"));
System.out.println(year);
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
String fileName = sdf.format(new Date()) + ".xlsx";
// 文件路径
String filePath = fileName;
try {
conn = com.censoft.db.DBUtil.getConnection();
if(!"".equals(year)){
year=year.substring(0,year.length()-1);
}
String[] years=year.split(",");
StringBuffer sb = new StringBuffer();
sb.append("select * from zb_user_gl_bgs where 1=1 ");
sb.append(" and year in ( ");
if(years!=null&&years.length>0){
for(int m=0;m<years.length;m++){
if(m==years.length-1){
sb.append("'" + years[m] + "'");
}else{
sb.append("'" + years[m] + "',");
}
}
}
sb.append(" )");
sb.append(" order by year asc,id asc");
Vector v_list = cf.doQuery(conn, sb.toString(), null, new Object[]{});
if (v_list == null) {
System.out.println("查询出错"+cf.getMsg());
return;
}
// 输出流
OutputStream os = new FileOutputStream(filePath);
// 工作区
XSSFWorkbook wb = new XSSFWorkbook();
// 工作区名
XSSFSheet sheet = wb.createSheet(year+"值班统计");
XSSFCellStyle style=wb.createCellStyle();
style.setAlignment(XSSFCellStyle.ALIGN_CENTER);
style.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER);//水平垂直
XSSFCellStyle cs=wb.createCellStyle();
cs.setWrapText(true);
// 创建表头
String values="日期,班种,姓名及电话";
XSSFRow row = sheet.createRow(0);
String[] value=values.split(",");
for(int i=0;i<3;i++){
XSSFCell row_0=row.createCell(i);
row_0.setCellValue(value[i]);
row_0.setCellStyle(style);
}
// 遍历数据装进table
for (int i = 0; i < v_list.size(); i++) {
// sheet.createRow(i+1) 因为表头是0
Hashtable ht = (Hashtable) v_list.get(i);
String user_name=(String)ht.get("zb_user");
String[] user_names=user_name.split(",");
XSSFRow rows = sheet.createRow(i + 1);
String id = pub.trimNull((String) ht.get("id"));
rows.createCell(0).setCellValue((String)ht.get("year"));
rows.createCell(1).setCellValue((String)ht.get("zb_type"));
String userTel="";
for(int n=0;n<user_names.length;n++) {
String telphone = getTel(cf, conn, user_names[n]);
userTel=userTel+user_names[n]+":"+telphone+"\n";
}
rows.createCell(2).setCellValue(userTel);
}
for(int i=1;i<=v_list.size();i=i+3){
sheet.addMergedRegion(new CellRangeAddress(i,i+2,0,0));//合并单元格
}
wb.write(os);
// 关闭输出流
os.close();
} catch (Exception e) {
e.printStackTrace();
}finally {
if (conn != null) {
try {
conn.close();
} catch (Exception e) {
}
}
}
download(filePath, response);
%>
\ No newline at end of file
<%--
Created by IntelliJ IDEA.
User: mc
Date: 2021/7/7
Time: 15:12
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import=" java.io.BufferedInputStream" %>
<%@ page import=" java.io.BufferedOutputStream" %>
<%@ page import=" java.io.File" %>
<%@ page import=" java.io.FileInputStream" %>
<%@ page import=" java.io.FileOutputStream" %>
<%@ page import=" java.io.IOException" %>
<%@ page import=" java.io.InputStream" %>
<%@ page import=" java.io.OutputStream" %>
<%@ page import=" java.text.SimpleDateFormat" %>
<%@ page import=" javax.servlet.http.HttpServletResponse" %>
<%@ page import="com.censoft.common.base.Pub" %>
<%@ page import="com.censoft.common.db.ConnectionFactory" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.util.*" %>
<%@ page import="org.apache.poi.xssf.usermodel.*" %>
<%@ page import="org.apache.poi.ss.util.CellRangeAddress" %>
<%!
private void download(String path, HttpServletResponse response) {
try {
// path是指欲下载的文件的路径。
File file = new File(path);
// 取得文件名。
String filename = file.getName();
// 以流的形式下载文件。
InputStream fis = new BufferedInputStream(new FileInputStream(path));
byte[] buffer = new byte[fis.available()];
fis.read(buffer);
fis.close();
// 清空response
response.reset();
// 设置response的Header
response.addHeader("Content-Disposition", "attachment;filename="+ new String(filename.getBytes()));
response.addHeader("Content-Length", "" + file.length());
OutputStream toClient = new BufferedOutputStream(response.getOutputStream());
response.setContentType("application/vnd.ms-excel;charset=utf-8");
toClient.write(buffer);
toClient.flush();
toClient.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
public static String getTel(ConnectionFactory cf,Connection conn,String user_name) {
String tel="";
Vector userList = cf.doQuery(conn,"select tel from zb_bgs_user where user_name=? "
,null,new Object[]{user_name});
if(userList!=null && userList.size()>0){
Hashtable ht1 = (Hashtable) userList.get(0);
tel = (String) ht1.get("tel");
}
return tel;
}
%>
<%
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
ConnectionFactory cf = new ConnectionFactory();
Pub pub = new Pub();
Connection conn = null;
String year = pub.trimNull(request.getParameter("exportDate"));
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
String fileName = sdf.format(new Date()) + ".xlsx";
// 文件路径
String filePath = fileName;
try {
conn = com.censoft.db.DBUtil.getConnection();
StringBuffer sb = new StringBuffer();
sb.append("select * from zb_user_gl_bgs where year=? ");
sb.append(" order by order_num asc");
Vector v_list = cf.doQuery(conn, sb.toString(), null, new Object[]{year});
if (v_list == null) {
System.out.println("查询出错"+cf.getMsg());
return;
}
// 输出流
OutputStream os = new FileOutputStream(filePath);
// 工作区
XSSFWorkbook wb = new XSSFWorkbook();
// 工作区名
XSSFSheet sheet = wb.createSheet(year+"值班统计");
XSSFCellStyle style=wb.createCellStyle();
style.setAlignment(XSSFCellStyle.ALIGN_CENTER);
style.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER);//水平垂直
XSSFCellStyle cs=wb.createCellStyle();
cs.setWrapText(true);
// 创建表头
String values="日期,班种,姓名及电话";
XSSFRow row = sheet.createRow(0);
String[] value=values.split(",");
for(int i=0;i<3;i++){
XSSFCell row_0=row.createCell(i);
row_0.setCellValue(value[i]);
row_0.setCellStyle(style);
}
// 遍历数据装进table
for (int i = 0; i < v_list.size(); i++) {
// sheet.createRow(i+1) 因为表头是0
Hashtable ht = (Hashtable) v_list.get(i);
String user_name=(String)ht.get("zb_user");
String[] user_names=user_name.split(",");
XSSFRow rows = sheet.createRow(i + 1);
String id = pub.trimNull((String) ht.get("id"));
rows.createCell(0).setCellValue((String)ht.get("year"));
rows.createCell(1).setCellValue((String)ht.get("zb_type"));
String userTel="";
for(int n=0;n<user_names.length;n++) {
String telphone = getTel(cf, conn, user_names[n]);
userTel=user_names[n]+":"+telphone+"\n"+userTel;
}
rows.createCell(2).setCellValue(userTel);
}
for(int i=1;i<=v_list.size();i=i+3){
sheet.addMergedRegion(new CellRangeAddress(i,i+2,0,0));//合并单元格
}
wb.write(os);
// 关闭输出流
os.close();
} catch (Exception e) {
e.printStackTrace();
}finally {
if (conn != null) {
try {
conn.close();
} catch (Exception e) {
}
}
}
download(filePath, response);
%>
\ No newline at end of file
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="com.censoft.common.base.Pub" %>
<%@ page import="com.censoft.common.db.ConnectionFactory" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.util.Hashtable" %>
<%@ page import="java.util.Vector" %>
<%
ConnectionFactory cf = new ConnectionFactory();
Pub pub = new Pub();
Connection conn = null;
Vector v_list = null;
String year = pub.trimNull(request.getParameter("year"));
String divId = pub.trimNull(request.getParameter("divId"));
Hashtable ht = new Hashtable();
StringBuffer sb = new StringBuffer();
try {
conn = com.censoft.db.DBUtil.getConnection();
sb.append("select t1.zb_user,t1.zb_type from zb_user_gl_bgs t1 where 1=1 ");
sb.append(" and t1.year=? ");
sb.append(" order by t1.id asc");
v_list=cf.doQuery(conn,sb.toString(),null,new Object[]{year});
if(v_list==null){
System.out.println("查询该日期值班人员出错"+cf.getMsg());
}
%>
<div class="">
<form class="form form-horizontal" method="post" id="form1" name="form1" action="export_query.jsp" >
<div id="content" class="cl pd-5 divOverflow" style="overflow:hidden;margin-top: 10px;">
<%
if(v_list.size()>0){
for(int i=0;i<v_list.size();i++){
ht = (Hashtable)v_list.get(i);
String zb_type= pub.trimNull((String) ht.get("zb_type"));
String user_name= pub.trimNull((String) ht.get("zb_user"));
%>
<div style="height:110px;float:left;margin-left: 50px;border:0.5px solid #000;">
<div style="width:120px;height:110px;float:left;border-right:0.5px solid #000;text-align: center;line-height: 80px;">
<p style="height:30px;"> <%=zb_type%></p>
</div>
<div style="text-align:center;width:180px;height:110px;line-height:30px;float:left;position: relative">
<%
String[] user_names=user_name.split(",");
for(int n=0;n<user_names.length;n++){
%>
<div style="height:20px;margin:0px;">
<input type="radio" name="<%=divId%>_1" value="<%=user_names[n]%>_<%=zb_type%>" />
<%=user_names[n]%>
</div>
<%
}
%>
</div>
</div>
<%
}
}
%>
</div>
</form>
</div>
<%
} catch (Exception e) {
out.println("查询用户信息异常" + e);
return;
} finally {
if (conn != null) {
try {
conn.close();
} catch (Exception e) {
}
}
}
%>
\ No newline at end of file
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/simple-calendar.css">
<script src="<%=request.getContextPath()%>/js/simple-calendar-es.js"></script>
<style>
#container{
margin: 0 auto;
float: none;
width: 95%;
height: 600px;
}
</style>
<div style="margin-top: 10px;display: none;">
<a class="btn btn-primary radius" onclick="operList();" >
导出
</a>
</div>
<div style="margin-top: 10px;text-align: right;margin-right: 40px;">
<a class="btn btn-primary radius" onclick="zdPb();" >
自动排班
</a>
<a class="btn btn-primary radius" onclick="viewUserWeek();" >
周排班表
</a>
<a class="btn btn-primary radius" onclick="changeZb();" >
换班
</a>
</div>
<div id="container"></div>
<form method="post" id="form1" name="form1" action="export_query.jsp" >
<input type="hidden" value="" id="nowDays" name="nowDays">
<input type="hidden" value="" id="nowYear" name="nowYear">
<input type="hidden" value="" id="nowMonth" name="nowMonth">
</form>
<script>
let myCalendar = new SimpleCalendar('#container');
//刷新日历
function addData(year, month) {
var totalDays="";
var now = new Date();//当前日期
var nowDay = now.getDate();// 当天
var nowYear = now.getFullYear();// 年份
var nowMonth = now.getMonth() + 1;// 月份
let daysElement = arrayfrom(this.container.querySelectorAll('.sc-item'));
let day = new Date(year, month - 1, 0);
let week = day.getDay();
if (week == 0) week = 7;
if (week == 7) week = 0;
//计算得到第一个格子的日期
let thispageStart = new Date(Date.parse(day) - (week - 1) * 24 * 3600 * 1000);
//对每一个格子遍历
for (let i = 0; i < 35; i++) {
daysElement[i].className = 'sc-item';
let theday = new Date(Date.parse(thispageStart) + (i-1) * 24 * 3600 * 1000);
let writeyear = theday.getFullYear();
let writeday = theday.getDate();
let writemonth = theday.getMonth() + 1;
if (writemonth != month) {
daysElement[i].classList.add('sc-othermenth');
}
daysElement[i].querySelector('.day').innerHTML = writeday;
getZbUser(writeyear,writemonth,writeday,i);
//daysElement[i].querySelector('.zb_user_button').innerHTML = '<span onclick="editUser('+writeyear+','+writemonth+','+writeday+');" style="text-align:center;position:absolute; right:0; bottom:0;"><img src="../../images/edit.png" width="20" height="15" /></span>';
//判断是否添加阴历
if (true) {
daysElement[i].querySelector('.lunar-day').innerHTML = (new LunarHelp(writeyear, writemonth, writeday)).getLunarDayName();
} else {
daysElement[i].querySelector('.lunar-day').innerHTML = '';
daysElement[i].classList.add('item-nolunar');
}
//console.log(writeyear+""+writemonth+""+writeday);
//添加today样式
if (nowYear == writeyear && nowDay == writeday && nowMonth == writemonth) {
this.selectDay = daysElement[i];
daysElement[i].classList.add("sc-today");
}
if (year == writeyear && month == writemonth) {
totalDays+=writeday+",";
}
}
$("#nowYear").val(year);
$("#nowMonth").val(month);
$("#nowDays").val(totalDays.substring(0,totalDays.length-1));
}
function getZbUser(year,month,day,index) {
let daysElement = arrayfrom(this.container.querySelectorAll('.sc-item'));
$.ajax({
type: "post",
url: "list_ajax.jsp?year="+year+"&month="+month+"&day="+day,
success: function (msg) {
daysElement[index].querySelector('.zb_user').innerHTML = msg;
daysElement[index].querySelector('.zb_user').setAttribute("onclick","viewUser("+year+","+month+","+day+")");
}
});
}
function arrayfrom(nidelist) {
let array = [];
[].forEach.call(nidelist, function(v) {
array.push(v);
});
return array;
}
function viewUser(year,month,day) {
var url = './viewUser-t.jsp?year='+year+'&month='+month+'&day='+day;
viewDeptOrUserInfo(year+''+month+''+day+'日值班表', url, '1100', '550');
}
function changeZb() {
var url = './changeZb-t.jsp';
viewDeptOrUserInfo('换班', url, '1000', '500');
}
function viewUserWeek() {
var url = './viewUserWeek-t.jsp';
viewUserWeekFull('周值班表', url, '1000', '500');
}
function viewUserWeekFull(title, url, w, h) {
var abc = layer.open({
title: title,
type: 2,
content: url,
area: [w, h],
maxmin: true
});
layer.full(abc);
}
function zdPb() {
var url = './edit-t.jsp';
viewDeptOrUserInfo('自动排班', url, '1000', '500');
}
function viewDeptOrUserInfo(title, url, w, h) {
var abc = layer.open({
title: title,
type: 2,
content: url,
area: [w+'px', h+'px'],
maxmin: true
});
//layer.full(abc);
}
</script>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.util.*" %>
<%@ page import="com.censoft.common.db.ConnectionFactory" %>
<%@ page import="com.censoft.common.base.Pub" %>
<%!
public static String getMxId(ConnectionFactory cf,Connection conn,String date) {
String mx_id="";
Vector userList = cf.doQuery(conn,"select mx_id from zb_zdpb_bgs where b_time<=? and e_time>=? order by add_time desc limit 1",null,new Object[]{date,date});
if(userList!=null && userList.size()>0){
Hashtable ht1 = (Hashtable) userList.get(0);
mx_id = (String) ht1.get("mx_id");
}
return mx_id;
}
%>
<%
ConnectionFactory cf = new ConnectionFactory();
Pub pub = new Pub();
Connection conn = null;
Vector v_list = null;
String year = pub.trimNull(request.getParameter("year"));
String month = pub.trimNull(request.getParameter("month"));
String day = pub.trimNull(request.getParameter("day"));
if(month.length()==1){
month="0"+month;
}
month="-"+month;
if(day.length()==1){
day="0"+day;
}
day="-"+day;
List list_s = new ArrayList();
String result="";
try {
StringBuffer sb = new StringBuffer();
sb.append("select t1.zb_user from zb_user_gl_bgs t1 where 1=1 ");
sb.append(" and t1.year=? ");
list_s.add(year+month+day);
conn = com.censoft.db.DBUtil.getConnection();
sb.append(" order by t1.id asc");
v_list = cf.doQuery(conn, sb.toString(), null, list_s.toArray());
if (v_list == null) {
out.println("查询出错" + cf.getMsg());
return;
}
if (v_list != null && v_list.size() > 0) {
for (int i = 0; i < v_list.size(); i++) {
Hashtable ht = (Hashtable) v_list.get(i);
String zb_user = pub.trimNull((String) ht.get("zb_user"));
result=result+zb_user+"</br>";
}
}
out.println(result);
} catch (Exception e) {
out.println("查询异常" + e);
return;
} finally {
if (conn != null) {
try {
conn.close();
} catch (Exception e) {
}
}
}
%>
\ No newline at end of file
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.util.*" %>
<%@ page import="com.censoft.common.db.ConnectionFactory" %>
<%@ page import="com.censoft.common.base.Pub" %>
<%@ page import="com.censoft.db.Logger" %>
<%
ConnectionFactory cf = new ConnectionFactory();
Pub pub = new Pub();
Connection conn = null;
Vector v_list = null;
Vector v_list_day = null;
String user_names ="";
String login_id = (String) session.getAttribute("session_login_id");
if ("".equals(login_id)) {
System.out.println("当前没有用户信息");
}
String year = pub.trimNull(request.getParameter("year"));
String zb_type = pub.trimNull(request.getParameter("zb_type"));
String action = pub.trimNull(request.getParameter("action"));
StringBuffer sql = new StringBuffer();
List list = new ArrayList();
sql.append("select t2.id,t2.user_name,t2.tel,t2.gh,t2.order_num from zb_role_user t1 join zb_bgs_user t2 on " +
"t1.user_id=t2.id join zb_role t3 on t1.role_id=t3.id where t3.role_name=? order by t2.id desc ");
list.add(zb_type);
try {
conn = com.censoft.db.DBUtil.getConnection();
conn.setAutoCommit(false);
if("update".equals(action)){
String[] userids = request.getParameterValues("userids");
String get_user_names="";
if(userids!=null && userids.length>0) {
for (int i = 0; i < userids.length; i++) {
get_user_names+=userids[i]+",";
}
}
if(!"".equals(get_user_names)){
get_user_names=get_user_names.substring(0,get_user_names.length()-1);
}
//System.out.println("get_user_names="+get_user_names+year+zb_type);
boolean is_oper = cf.executeUpdate(conn, "update zb_user_gl_bgs set zb_user=? where year=? and zb_type=?",
new Object[]{get_user_names,year,zb_type});
if (!is_oper) {
conn.rollback();
System.out.println("修改zb_user_gl表出错了" + cf.getMsg());
return;
}
conn.commit();
}
v_list = cf.doQuery(conn, sql.toString(), null, list.toArray());
if (v_list == null) {
out.println("查询用户出错");
return;
}
v_list_day = cf.doQuery(conn, "select zb_user from zb_user_gl_bgs where year=? and zb_type=?", null, new Object[]{year,zb_type});
if (v_list_day != null && v_list_day.size()>0) {
Hashtable ht1= (Hashtable) v_list_day.get(0);
user_names = pub.trimNull((String) ht1.get("zb_user"));
}
%>
<div style="margin-top: 10px;">
<a class="btn btn-primary radius" onclick="saveGroupForm();" >
确定
</a>
</div>
<div style="width:100%;height:90%;overflow-y: auto">
<form action="selectUser-t.jsp" method="post" id="groupUser" name="groupUser">
<input type="hidden" name="action" id="action" value="update">
<input type="hidden" name="year" id="year" value="<%=year%>">
<input type="hidden" name="zb_type" id="zb_type" value="<%=zb_type%>">
<table class="table table-border table-bordered table-hover table-bg table-sort">
<thead>
<tr class="text-c">
<th width="30">序号</th>
<th width="30">
<input id="checkboxAll" type="checkbox" onclick="checkAll(this);"></input>
</th>
<th width="100">人员姓名</th>
<th width="100">联系电话</th>
<th width="100">工号</th>
</tr>
</thead>
<tbody id="groupUserInfo">
<%
Hashtable ht_1 =null;
if (v_list != null && v_list.size() > 0) {
for (int i = 0; i < v_list.size(); i++) {
Hashtable ht = (Hashtable) v_list.get(i);
String user_name = pub.trimNull((String) ht.get("user_name"));
String tel = pub.trimNull((String) ht.get("tel"));
String gh = pub.trimNull((String) ht.get("gh"));
%>
<tr class="text-c">
<td><%=i+1%>
</td>
<td >
<input type="checkbox" class="info" id="userids" name="userids" value="<%=user_name%>"
<%if(user_names.indexOf(user_name)>=0){%>checked="checked"<%}%>/>
</td>
<td><%=user_name%>
</td>
<td><%=tel%>
</td>
<td><%=gh%>
</td>
</tr>
<%
}
}
%>
</tbody>
</table>
</form>
</div>
<script type="text/javascript">
var checkAll = function (checkbox) {
$(".info").prop("checked", checkbox.checked);
}
function saveGroupForm(){
var isChecked=false;
var us = document.getElementsByName("userids");
for(var i=0;i<us.length;i++){
if(us[i].checked){
isChecked = true;
}
}
if(!isChecked){
layer.alert("请勾选用户",{icon:5,title:"提示"});
return false;
}
$.ajax({
type: "POST",
url: "./selectUser-t.jsp",
data: $('#groupUser').serialize(),
success: function (msg) {
if (msg.indexOf("success") >= 0) {
layer.msg('操作成功!', {icon: 1, time: 1000},
function () {
//window.parent.location.reload();
window.parent.parent.location.reload();
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
});
} else {
layer.msg('操作失败', {
icon: 5,
time: 2000 //2秒关闭(如果不配置,默认是3秒)
}, function () {
// console.log("********************8")
});
}
}
});
}
</script>
<%
} catch (Exception e) {
out.println("查询用户信息异常" + e);
return;
} finally {
if (conn != null) {
try {
conn.close();
} catch (Exception e) {
}
}
}
%>
\ No newline at end of file
<%--
Created by IntelliJ IDEA.
User: Administrator
Date: 2020/9/11
Time: 12:54
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="com.censoft.common.base.Pub" %>
<%@ page import="com.censoft.common.db.ConnectionFactory" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.util.Hashtable" %>
<%@ page import="java.util.Vector" %>
<%!
public static String getMxId(ConnectionFactory cf,Connection conn,String date) {
String mx_id="";
Vector userList = cf.doQuery(conn,"select mx_id from zb_zdpb_bgs where b_time<=? and e_time>=? order by add_time desc limit 1",null,new Object[]{date,date});
if(userList!=null && userList.size()>0){
Hashtable ht1 = (Hashtable) userList.get(0);
mx_id = (String) ht1.get("mx_id");
}
return mx_id;
}
public static String getZbTyTime(ConnectionFactory cf,Connection conn,String mx_id,String zb_type) {
String time="";
Vector userList = cf.doQuery(conn,"select b_time,e_time from zb_type_bgs where mx_id=? and zb_type=?"
,null,new Object[]{mx_id,zb_type});
if(userList!=null && userList.size()>0){
Hashtable ht1 = (Hashtable) userList.get(0);
time = (String) ht1.get("b_time")+"-"+(String) ht1.get("e_time");
}
return time;
}
public static String getTel(ConnectionFactory cf,Connection conn,String user_name) {
String tel="";
Vector userList = cf.doQuery(conn,"select tel from zb_bgs_user where user_name=? "
,null,new Object[]{user_name});
if(userList!=null && userList.size()>0){
Hashtable ht1 = (Hashtable) userList.get(0);
tel = (String) ht1.get("tel");
}
return tel;
}
%>
<%
ConnectionFactory cf = new ConnectionFactory();
Pub pub = new Pub();
Connection conn = null;
Vector v_list = null;
String year = pub.trimNull(request.getParameter("year"));
String month = pub.trimNull(request.getParameter("month"));
String day = pub.trimNull(request.getParameter("day"));
if(month.length()==1){
month="0"+month;
}
month="-"+month;
if(day.length()==1){
day="0"+day;
}
day="-"+day;
Hashtable ht = new Hashtable();
StringBuffer sb = new StringBuffer();
try {
conn = com.censoft.db.DBUtil.getConnection();
sb.append("select t1.zb_user,t1.zb_type from zb_user_gl_bgs t1 where 1=1 ");
sb.append(" and t1.year=? ");
sb.append(" order by t1.id asc");
String mxId=getMxId(cf,conn,year+month+day);
v_list=cf.doQuery(conn,sb.toString(),null,new Object[]{year+month+day});
if(v_list==null){
System.out.println("查询该日期值班人员出错"+cf.getMsg());
}
%>
<div >
<a class="btn btn-primary radius" onclick="operList();" >
导出
</a>
</div>
<div class="">
<form class="form form-horizontal" method="post" id="form1" name="form1" action="export_query.jsp" >
<input type="hidden" value="<%=year+month+day%>" name="exportDate" id="exportDate">
<div id="content" class="cl pd-5 bk-gray divOverflow" style="overflow:hidden;margin-bottom: 20px;height: 400px;">
<%
if(v_list.size()>0){
for(int i=0;i<v_list.size();i++){
ht = (Hashtable)v_list.get(i);
String zb_type= pub.trimNull((String) ht.get("zb_type"));
String user_name= pub.trimNull((String) ht.get("zb_user"));
String time=getZbTyTime(cf,conn,mxId,zb_type);
%>
<div style="width:1000px;height:120px;float:left;margin-left: 50px;border:0.5px solid #000;position:relative;">
<div style="width:140px;height:120px;float:left;border-right:0.5px solid #000;text-align: center;line-height: 80px;">
<p style="height:30px;"> <%=zb_type%></p>
<p style="height:30px;">(<%=time%>)</p>
</div>
<%
String[] user_names=user_name.split(",");
for(int n=0;n<user_names.length;n++){
String telphone=getTel(cf,conn,user_names[n]);
%>
<div style="text-align:center;width:140px;height:120px;line-height:120px;float:left;position: relative">
<p style="height:70px;line-height: 80px;margin:0px;">
<img src="../../images/user.png"/>
</p>
<div style="height:50px;margin:0px;">
<div style="height:30px;line-height: 20px;">
<%=user_names[n]%>
</div>
<div style="height:20px;line-height: 10px;">
<%=telphone%>
</div>
</div>
</div>
<%
}
%>
<span onclick="editUser('<%=year+month+day%>','<%=zb_type%>');" style="text-align:center;position:absolute; right:0; bottom:0;">
<img src="../../images/edit.png" width="20" height="15" />
</span>
</div>
<%
}
}
%>
</div>
</form>
</div>
<script>
function operList() {
document.form1.submit();
}
function editUser(year,zb_type) {
var url = './selectUser-t.jsp?year='+year+"&zb_type="+zb_type;
var abc = layer.open({
title: '选择人员',
type: 2,
content: url,
area: ['1000px', '500px'],
maxmin: true,
end:function () {
//searchModel1($("#check_mx_id").val());
}
});
}
</script>
<%
} catch (Exception e) {
out.println("查询用户信息异常" + e);
return;
} finally {
if (conn != null) {
try {
conn.close();
} catch (Exception e) {
}
}
}
%>
\ No newline at end of file
This diff is collapsed.
<%--
Created by IntelliJ IDEA.
User: mc
Date: 2021/1/15
Time: 10:48
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.util.*" %>
<%@ page import="com.censoft.common.db.ConnectionFactory" %>
<%@ page import="com.censoft.common.base.Pub" %>
<%
ConnectionFactory cf = new ConnectionFactory();
Pub pub = new Pub();
Connection conn = null;
Vector v_list = null;
String value = pub.trimNull(request.getParameter("value"));
value=java.net.URLDecoder.decode(value,"UTF-8");
String name_id = pub.trimNull(request.getParameter("name_id"));
String reg_id = pub.trimNull(request.getParameter("reg_id"));
List list_s = new ArrayList();
Hashtable ht=null;
String first_name="请选择";
String col_name_all="";
try {
StringBuffer sb = new StringBuffer();
sb.append("select * from zb_mx_bgs order by add_time desc");
conn = com.censoft.db.DBUtil.getConnection();
v_list = cf.doQuery(conn, sb.toString(),null, list_s.toArray());
if (v_list == null) {
out.println("查询出错" + cf.getMsg());
return;
}
%>
<select class="input-text" name="<%=name_id%>" id="<%=name_id%>" >
<option value=""><%=first_name%></option>
<%
if(v_list!=null && v_list.size()>0){
for(int i=0;i<v_list.size();i++){
ht=(Hashtable)v_list.get(i);
String col_name=pub.trimNull((String)ht.get("name"));
String day=pub.trimNull((String)ht.get("day"));
String id=pub.trimNull((String)ht.get("id"));
%>
<option value="<%=id%>_<%=day%>"><%=col_name%></option>
<%
}
}
%>
</select>
<%
} catch (Exception e) {
out.println("查询异常" + e);
return;
} finally {
if (conn != null) {
try {
conn.close();
} catch (Exception e) {
}
}
}
%>
......@@ -14,12 +14,10 @@
sql.append("select t2.user_name from zb_role_user t1 join zb_bgs_user t2 on " +
"t1.user_id=t2.id join zb_role t3 on t1.role_id=t3.id where t3.role_name=? ");
sql.append(" and t2.role_num in(");
//StringBuffer sql=new StringBuffer("select user_name from zb_bgs_user where 1=1 and order_num in(");
List list= new ArrayList();
list.add(zb_type);
String user_names="";
int startIndex_2=startIndex;
System.out.println(zb_type+"---"+startIndex);
for(int i=0;i<n;i++){
startIndex=startIndex+1;
if(startIndex==userListSize.size()+1){
......
......@@ -25,7 +25,6 @@
StringBuffer sql = new StringBuffer();
sql.append("select t2.id,t2.user_name,t2.tel,t2.gh,t2.order_num from zb_role_user t1 join zb_bgs_user t2 on " +
"t1.user_id=t2.id where t1.role_id=? order by t2.order_num asc ");
//System.out.println(role_id+sql.toString());
try {
conn = com.censoft.db.DBUtil.getConnection();
v_list = cf.doQuery(conn, sql.toString(), null, new Object[]{role_id});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment