📄 list.jsp
字号:
<%@page language="java" contentType="text/html;charset=GBK"%>
<%@page import="java.util.*,java.text.*,oa.main.*"%>
<jsp:useBean id="pb" class="oa.main.ParentBean" scope="page"/>
<link href="../../css/person.css" type=text/css rel=stylesheet>
<%
oa.bean.RightBean rtBean =null;
oa.bean.PersonBean personBean =null;
try{
DealString ds = new DealString();
String uid = (String)session.getAttribute("zgbh");
if(uid==null)
{
response.sendRedirect("../../session_oa.htm");
return;
}
rtBean=new oa.bean.RightBean();
rtBean.setUID(uid);
//取出当前人的职工编号
String person_ID = ds.toString((String)session.getAttribute("zgbh"));
if (pb.getConn() == null){
%>
数据库无法响应,请<a href="javascript:window.history.back(-1);">返回</a>重试
<%out.close();
}
final int num_per_page = 15; //临时设置,每页记录数
int recsum = 0; //记录总数
int sum = 1; //总页数
int cur=1;
String str_cur = ds.toString(request.getParameter("cur")); //翻页时传递页码
//out.print("str_cur======"+str_cur);
if(str_cur!=null && !str_cur.equals(""))
cur = Integer.parseInt(str_cur);
// 设置查询的 SQL 语句
String sql = "",sqlcount="";
if(person_ID!=null && person_ID.equals("1"))
{
sql = "select A.ID,A.ISDEL,A.TITLE,A.SENDER,D.XM,A.TIME,A.TIMESTART,A.TIMEEND,count(distinct(B.id)) as count1,count(distinct(C.id)) as count2 from HG2_MEET_NOTICE A,HG2_MEET_NOTICEMEN B,HG2_MEET_NOTICEMEN C,ZZ_ZGB D where A.SENDER=D.ZGBH and A.ID=B.NOTICEID and B.NOTICEID=C.NOTICEID and A.ID=C.NOTICEID and C.ISREAD=1 group by A.ID,A.ISDEL,A.TITLE,A.SENDER,A.TIME,A.TIMESTART,A.TIMEEND,D.XM union select A.ID,A.ISDEL,A.TITLE,A.SENDER,D.XM,A.TIME,A.TIMESTART,A.TIMEEND,count(distinct(B.id)) as count1,0 from HG2_MEET_NOTICE A,HG2_MEET_NOTICEMEN B,ZZ_ZGB D where A.SENDER=D.ZGBH and A.ID=B.NOTICEID and not exists(select id from HG2_MEET_NOTICEMEN C where NOTICEID=A.ID and ISREAD=1) group by A.ID,A.ISDEL,A.TITLE,A.SENDER,A.TIME,A.TIMESTART,A.TIMEEND,D.XM union select A.ID,A.ISDEL,A.TITLE,A.SENDER,D.XM,A.TIME,A.TIMESTART,A.TIMEEND,0,0 from HG2_MEET_NOTICE A,ZZ_ZGB D where A.SENDER=D.ZGBH and not exists (select id from HG2_MEET_NOTICEMEN where NOTICEID=A.ID)";
}
else
{
sql = "select A.ID,A.ISDEL,A.TITLE,A.SENDER,D.XM,A.TIME,A.TIMESTART,A.TIMEEND,count(distinct(B.id)) as count1,count(distinct(C.id)) as count2 from HG2_MEET_NOTICE A,HG2_MEET_NOTICEMEN B,HG2_MEET_NOTICEMEN C,ZZ_ZGB D where A.SENDER=D.ZGBH and ((A.ISDEL=0 and (SENDER='"+person_ID+"' or exists (select id from HG2_MEET_NOTICEMEN where NOTICEID=A.ID and ISDEL=0 and RECEIVER='"+person_ID+"'))) or (A.ISDEL=1 and exists (select id from HG2_MEET_NOTICEMEN where NOTICEID=A.ID and ISDEL=0 and RECEIVER='"+person_ID+"'))) and A.ID=B.NOTICEID and B.NOTICEID=C.NOTICEID and A.ID=C.NOTICEID and C.ISREAD=1 group by A.ID,A.ISDEL,A.TITLE,A.SENDER,A.TIME,A.TIMESTART,A.TIMEEND,D.XM union select A.ID,A.ISDEL,A.TITLE,A.SENDER,D.XM,A.TIME,A.TIMESTART,A.TIMEEND,count(distinct(B.id)) as count1,0 from HG2_MEET_NOTICE A,HG2_MEET_NOTICEMEN B,ZZ_ZGB D where A.SENDER=D.ZGBH and ((A.ISDEL=0 and (SENDER='"+person_ID+"' or exists (select id from HG2_MEET_NOTICEMEN where NOTICEID=A.ID and ISDEL=0 and RECEIVER='"+person_ID+"'))) or (A.ISDEL=1 and exists (select id from HG2_MEET_NOTICEMEN where NOTICEID=A.ID and ISDEL=0 and RECEIVER='"+person_ID+"'))) and A.ID=B.NOTICEID and not exists(select id from HG2_MEET_NOTICEMEN C where NOTICEID=A.ID and ISREAD=1) group by A.ID,A.ISDEL,A.TITLE,A.SENDER,A.TIME,A.TIMESTART,A.TIMEEND,D.XM union select A.ID,A.ISDEL,A.TITLE,A.SENDER,D.XM,A.TIME,A.TIMESTART,A.TIMEEND,0,0 from HG2_MEET_NOTICE A,ZZ_ZGB D where A.SENDER=D.ZGBH and ((A.ISDEL=0 and (SENDER='"+person_ID+"' or exists (select id from HG2_MEET_NOTICEMEN where NOTICEID=A.ID and ISDEL=0 and RECEIVER='"+person_ID+"'))) or (A.ISDEL=1 and exists (select id from HG2_MEET_NOTICEMEN where NOTICEID=A.ID and ISDEL=0 and RECEIVER='"+person_ID+"'))) and not exists (select id from HG2_MEET_NOTICEMEN where NOTICEID=A.ID)";
}
/*old:
sql = "select A.ID,A.TITLE,A.SENDER,D.XM,A.TIME,A.TIMESTART,A.TIMEEND,count(distinct(B.id)) as count1,count(distinct(C.id)) as count2 from HG2_MEET_NOTICE A,HG2_MEET_NOTICEMEN B,HG2_MEET_NOTICEMEN C,ZZ_ZGB D where A.SENDER=D.ZGBH and A.ISDEL=0 and A.ID=B.NOTICEID and B.NOTICEID=C.NOTICEID and A.ID=C.NOTICEID and C.ISREAD=1 group by A.ID,A.TITLE,A.SENDER,A.TIME,A.TIMESTART,A.TIMEEND,D.XM union select A.ID,A.TITLE,A.SENDER,D.XM,A.TIME,A.TIMESTART,A.TIMEEND,count(distinct(B.id)) as count1,0 from HG2_MEET_NOTICE A,HG2_MEET_NOTICEMEN B,ZZ_ZGB D where A.SENDER=D.ZGBH and A.ISDEL=0 and A.ID=B.NOTICEID and not exists(select id from HG2_MEET_NOTICEMEN C where NOTICEID=A.ID and ISREAD=1) group by A.ID,A.TITLE,A.SENDER,A.TIME,A.TIMESTART,A.TIMEEND,D.XM union select A.ID,A.TITLE,A.SENDER,D.XM,A.TIME,A.TIMESTART,A.TIMEEND,0,0 from HG2_MEET_NOTICE A,ZZ_ZGB D where A.SENDER=D.ZGBH and A.ISDEL=0 and not exists (select id from HG2_MEET_NOTICEMEN where NOTICEID=A.ID)";
**/
String order_condition = "order by TIME desc";
Vector vect = null;
Vector vectsum = null;
//生成SQL语句
sql = sql + " " + order_condition ;
//取得一页记录
vect = pb.getOnePage(sql,cur,num_per_page,false);
//取得所有记录
vectsum = pb.getDataBySql(sql);
//总页数
sum = Integer.parseInt((String)vect.get(0));
//取得总记录数
/// sql = "select count(*) as count from HG2_MEET_NOTICE where ISDEL=0";
/// Vector v1 = pb.getDataBySql(sql);
//总记录数
/// String str_record_sum = (String)((Hashtable)v1.get(0)).get("COUNT");
/// recsum = Integer.parseInt(str_record_sum);
///if(sum==1) recsum = vect.size()-1;
/*if(sum>1){
Vector vect1 = pb.getOnePage(sql,cur,sum,false);
recsum =(sum-1)*num_per_page+(vect1.size());
}*/
recsum = vectsum.size();
%>
<HTML>
<head><title>会议通知</title>
<link href="../../css/person.css" type=text/css rel=stylesheet>
<script>
<!--
function isDigit(str)
{
var bool = true;
for(var i=0;i<str.length;i++)
{
if(!(str.charAt(i)>=0&&str.charAt(i)<=9))
{
bool = false;
break;
}
}
return bool;
}
function isPrice(str)
{
var bool = true;
for(var i=0;i<str.length;i++)
{
var c = str.charAt(i);
if( !( c >= '0' && c <= '9') && (c != '.') )
{
bool = false;
break;
}
}
return bool;
}
function chkdata() {
if(!isDigit(document.all.cur.value)) {
alert("输入的页码不是数字!");
document.all.cur.value="";
document.all.cur.focus();
return false;
}
if(document.all.cur.value==""){
alert("请输入页码!");
document.all.cur.focus();
return false;
}
else{
var t = document.all.cur.value;
var curpage = <%=cur%>;
var sum = <%=sum%>;
while(t.length>curpage.length) {
alert("请跳至1和"+sum+"之间!");
document.all.cur.value="";
document.all.cur.focus();
return false;
}
if (t == curpage) {
return false;
}
if(t.length>sum.length) {
alert("请跳至1和"+sum+"之间!");
document.all.cur.value="";
document.all.cur.focus();
return false;
}
if(t<1||t>sum){
alert("请跳至1和"+sum+"之间!");
document.all.cur.value="";
document.all.cur.focus();
return false;
}
}
document.all.form1.action = "list.jsp";
//return true;
}
function firsrpg() {
document.all.form1.action = "list.jsp?cur=1";
document.all.form1.submit();
}
function lastpg() {
document.all.form1.action = "list.jsp?cur=<%=cur-1%>";
document.all.form1.submit();
}
function nextpg() {
document.all.form1.action = "list.jsp?cur=<%=cur+1%>";
document.all.form1.submit();
}
function finalpg() {
document.all.form1.action = "list.jsp?cur=<%=sum%>";
document.all.form1.submit();
}
function ondele(id)
{
if(confirm("是否真的删除?"))
{
document.all.form1.action="action.jsp?id="+id+"&action=del&cur=<%=cur%>";
document.all.form1.submit();
}
}
function alldel(id,sender,bm,title){
if(confirm("是否真的清除"+bm+sender+"发布的通知:''"+title+"''?"))
{
document.all.form1.action="action.jsp?id="+id+"&action=alldel&cur=<%=cur%>";
document.all.form1.submit();
}
}
//-->
</script>
<script src="Popup.js"></script>
</head>
<BODY leftMargin=0 topMargin=0 >
<form name="form1" method="post">
<br> <font color="#505050" size=2>当前位置:会议管理>><a href="list.jsp" >会议通知</a></font>
<div align=center>
<font color="#666666" size=3><b>通知列表<b></font>
</div>
<br>
<TABLE class="tab" cellSpacing=1 cellPadding=3 width="95%" align=center bgColor=#A5BEE0 style="word-break:break-all;">
<TBODY>
<TR bgColor="#666666" height=25>
<font color="#ffffff">
<TD>
<CENTER><B><font color="#FFFFFF">通知标题</font></B></CENTER></TD>
<TD>
<CENTER><B><font color="#FFFFFF">发布人</font></B></CENTER></TD>
<TD>
<CENTER><B><font color="#FFFFFF">发布时间</font></B></CENTER></TD>
<TD>
<CENTER><B><font color="#FFFFFF">开始时间</font></B></CENTER></TD>
<TD>
<CENTER><B><font color="#FFFFFF">结束时间</font></B></CENTER></TD>
<TD>
<CENTER><B><font color="#FFFFFF">通知</font></B></CENTER></TD>
<TD>
<CENTER><B><font color="#FFFFFF">接到</font></B></CENTER></TD>
<TD>
<CENTER><B><font color="#FFFFFF">操作</font></B></CENTER></TD>
</font>
</TR>
<TR bgColor=#ffffff height=25>
<TD colSpan=7 height=25 ></TD>
<TD align="center" ><%if(rtBean.isRightMode("会议通知","发布通知")){%><A href="edit.jsp?action=add" style="cursor:hand;color:#0000FF">[发布通知]</A><%}%>
</TD>
</TR>
<%
personBean=new oa.bean.PersonBean();
String[] bgcolor={"#ffffff","#E0E0E0"};
int k = vect.size();
for(int i=1;i<k;i++){
Hashtable hash = (Hashtable)vect.get(i);
String ID = (String)hash.get("ID");
String isdel = (String)hash.get("ISDEL");
String TITLE = (String)hash.get("TITLE");
// String keyword = (String)hash.get("KEYWORD");'
// String content = (String)hash.get("WORD");
String SENDER = (String)hash.get("XM");
String SENDERBH = (String)hash.get("SENDER");
String TIME = (String)hash.get("TIME");
String TIMESTART = (String)hash.get("TIMESTART");
String TIMEEND = (String)hash.get("TIMEEND");
String count1 = (String)hash.get("COUNT1");
String count2 = (String)hash.get("COUNT2");
if(TIME!=null && !TIME.equals(""))TIME = TIME.substring(0,16);
if(TIMESTART!=null && !TIMESTART.equals(""))TIMESTART = TIMESTART.substring(0,16);
if(TIMEEND!=null && !TIMEEND.equals(""))TIMEEND = TIMEEND.substring(0,16);
//TIME = TIME.replaceAll(" ","<br>");
//TIMESTART = TIMESTART.replaceAll(" ","<br>");
//TIMEEND = TIMEEND.replaceAll(" ","<br>");
String bmbh=personBean.toName("ZZ_ZGB","ZGBH","BMBH",SENDERBH);
String bm=ds.toString(personBean.getFatherName(bmbh))+ds.toString(personBean.getApartName(bmbh));
%>
<TR bgColor="<%=bgcolor[i%2]%>" height=25>
<TD align=left title="通知标题"><a style="cursor:hand;color:#000000" onmouseover="this.style.color = 'red';" onmouseout = "this.style.color = 'black';" href="read.jsp?id=<%=ID%>&cur=<%=cur%>"><%=TITLE%></a></TD>
<TD align=center title="<%=SENDER%>:<%=bm%>"><%=SENDER%></TD>
<TD align=center width=100><%=TIME%></TD>
<TD align=center width=100><%=TIMESTART%></TD>
<TD align=center width=100><%=TIMEEND%></TD>
<TD align=center width=30><%=count1%>人</TD>
<TD align=center width=30><%=count2%>人</TD>
<TD align=center width=120>
<%
sql = "select RECEIVER from HG2_MEET_NOTICEMEN where NOTICEID="+ID+" and RECEIVER='"+person_ID+"' and ISDEL=0";
Vector vt = pb.getDataBySql(sql);
String strRECEIVER = "";
if(vt.size()!=0)
strRECEIVER = (String)((Hashtable)vt.get(0)).get("RECEIVER");
sql = "select RECEIVER from HG2_MEET_NOTICEMEN where NOTICEID="+ID+" and ISREAD=1";
vt = pb.getDataBySql(sql);
boolean isread=false;
if(vt.size()!=0)
isread = true;
%>
<%if(person_ID.equals(SENDERBH) && !isdel.equals("1") && !isread)
{%>
<A href="edit.jsp?action=mod&id=<%=ID%>" style="cursor:hand;color:#0000FF">[修改]</A>
<%}%>
<%
if((person_ID.equals(SENDERBH) && !isdel.equals("1") ) || person_ID.equals(strRECEIVER))
{%>
<A onclick="ondele(<%=ID%>);" style="cursor:hand;color:#0000FF">[删除]
<%}%>
</A>
<%if(person_ID.equals("1")){%><a onclick="alldel(<%=ID%>,'<%=SENDER%>','<%=bm%>','<%=TITLE%>');" style="cursor:hand;color:#0000FF">[清除]</a><%}%>
</TD>
</tr>
<%
}
%>
<TD align=right colspan=8 bgColor=#E0E0E0>
共有记录数:<%=recsum%>
<%if(vect.size()>=2){%>
当前<%=cur%>/<%=sum%>页  <a onclick="firsrpg()" style="cursor:hand">第一页   </a>
<%if(cur>1){%>
<a onclick="lastpg()" style="cursor:hand">上一页   </a><%}%>
<%if(cur<sum){%>
<a onclick="nextpg()" style="cursor:hand">下一页  </a><%}%>  
<a onclick="finalpg()" style="cursor:hand">最后页   </a>
直接<input type=image src="../../images/hand.gif" name="gotof" onclick="return chkdata()">
<input type=text size=5 name="cur" class=formcolor >页</TD>
<%}%>
</tr>
</tbody>
</table>
</form>
</BODY>
</HTML>
<script>
document.all.form1.onsubmit=chkdata;
</script>
<%}finally{
if(pb!=null)
pb.closeConn();
if(rtBean!=null)rtBean.closeConn();
if(personBean!=null)personBean.closeConn();
}%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -