SelectDepartment1.jsp
资源名称:OA.rar [点击查看]
上传用户:mingda
上传日期:2017-06-20
资源大小:27691k
文件大小:10k
源码类别:
OA系统
开发平台:
Java
- <%@ page contentType="text/html; charset=gb2312"%>
- <%@ page import="com.gforce.gfoa.*,com.gforce.currency.*,java.util.*" %>
- <% Session m_session = new Session(session); %>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312"><meta http-equiv="pragma" content="no-cache">
- <title>部门选择页面 -- GForce OA 2.0</title>
- <link href="/css/txt.jsp" rel="stylesheet" type="text/css">
- <style type="text/css">
- <!--
- div {
- font-size: 12px;
- line-height: normal;
- }
- a {
- font-size: 12px;
- line-height: normal;
- color: #000000;
- }
- td {
- font-size: 12px;
- }
- -->
- </style>
- </head>
- <SCRIPT LANGUAGE="JavaScript">
- <!--
- var jsArray = new Array();
- <%
- Vector vt = DepartmentManager.getDepartmentTreeData();
- int i=0;
- for(int j=0;j<vt.size();j++,i++)
- {
- String strFartherID = ((Vector)vt.get(j)).get(2).toString();
- strFartherID = strFartherID.substring(0,strFartherID.length()-1);
- strFartherID = strFartherID.substring(strFartherID.lastIndexOf("_")+1);
- out.println("jsArray[" + i+ "] = new Array("" + ((Vector)vt.get(j)).get(0).toString() + "","" + ((Vector)vt.get(j)).get(1).toString() + "","" + strFartherID + "","" + ((Vector)vt.get(j)).get(2).toString() + "");");
- }
- out.println("var maxdept=" + i);
- %>
- function isfilesallchecked(shangjiid)
- {
- var foundfile=false;
- for(var i = 0;i<jsArray.length;i++)
- {
- if(jsArray[i][3].indexOf("_" + shangjiid.toString() + "_" )>=0)
- {
- foundfile=true;
- if(eval("document.selectdepart.dept_" + jsArray[i][0] + ".checked==false"))
- {
- return false;
- }
- }
- }
- return foundfile;
- }
- function showtree(jibie,shangjiid,bline)
- {
- if(jibie==0)
- {
- document.write("<div id="t" + jibie + "_" + shangjiid +"" style="display:">");
- }
- else
- {
- document.write("<div id="t" + jibie + "_" + shangjiid +"" style="display:none">");
- }
- var i,notislast,j,haschild;
- notislast=false;
- haschild=false;
- for(i=0;i<jsArray.length;i++)
- {
- if(jsArray[i][2]==shangjiid.toString())
- {
- var j,maxorder=0;
- haschild=false;
- for(j=0;j<jsArray.length;j++)
- {
- if((jsArray[j][2]==shangjiid.toString())&&maxorder<j)
- {
- maxorder=j;
- }
- }
- if(i<maxdept)
- {
- for(j=0;j<jsArray.length;j++)
- {
- if(jsArray[j][2]==jsArray[i][0])
- {
- haschild=true;
- break;
- }
- }
- }
- bline = bline.substr(0,jibie);
- for(j=0;j<bline.length;j++)
- if(bline.substr(j,1)=="1")
- document.write("<img align="absbottom" src="/images/tree/i.gif" border=0>");
- else
- document.write("<img align="absbottom" src="/images/tree/white.gif" border=0>");
- if(maxorder>i)
- {
- if(haschild)
- {
- document.write("<a href="" onclick="javascript:clicktree(" + (jibie + 1).toString() +"," + jsArray[i][0] + ");return false;" target="_self"><img align="absbottom" src="/images/tree/tplus.gif" border=0 name="n" + (jibie + 1).toString() +"_" + jsArray[i][0] + ""><img align="absbottom" src="/images/tree/folderclosed.gif" border=0 name="f" + (jibie + 1).toString() +"_" + jsArray[i][0] + ""></a><input type="checkbox" name="dept_" + jsArray[i][0] +"" value="" onclick="clickdept(" + jsArray[i][0] + ",this.checked);unselect('" + jsArray[i][3] + "',this.checked);">" + jsArray[i][1] + "<br>");
- bline += "1".toString();
- showtree(jibie + 1,jsArray[i][0],bline);
- }
- else
- {
- document.write("<img align="absbottom" src="/images/tree/t.gif" border=0 name="n" + (jibie + 1).toString() +"_" + jsArray[i][0] + ""><img align="absbottom" src="/images/tree/folderclosed.gif" border=0 name="f" + (jibie + 1).toString() +"_" + jsArray[i][0] + ""><input type="checkbox" name="dept_" + jsArray[i][0] +"" value="" onclick="unselect('" + jsArray[i][3] + "',this.checked);">" + jsArray[i][1] + "<br>");
- }
- }
- else
- {
- if(haschild)
- {
- document.write("<a href="" onclick="javascript:clicktree(" + (jibie + 1).toString() +"," + jsArray[i][0] + ");return false;" target="_self"><img align="absbottom" src="/images/tree/lplus.gif" border=0 name="n" + (jibie + 1).toString() +"_" + jsArray[i][0] + ""><img align="absbottom" src="/images/tree/folderclosed.gif" border=0 name="f" + (jibie + 1).toString() +"_" + jsArray[i][0] + ""></a><input type="checkbox" name="dept_" + jsArray[i][0] +"" value="" onclick="clickdept(" + jsArray[i][0] + ",this.checked);unselect('" + jsArray[i][3] + "',this.checked);">" + jsArray[i][1] + "<br>");
- bline += "1".toString();
- showtree(jibie + 1,jsArray[i][0],bline);
- }
- else
- {
- document.write("<img align="absbottom" src="/images/tree/l.gif" border=0 name="n" + (jibie + 1).toString() +"_" + jsArray[i][0] + ""><img align="absbottom" src="/images/tree/folderclosed.gif" border=0 name="f" + (jibie + 1).toString() +"_" + jsArray[i][0] + ""><input type="checkbox" name="dept_" + jsArray[i][0] +"" value="" onclick="unselect('" + jsArray[i][3] + "',this.checked);">" + jsArray[i][1] + "<br>");
- }
- }
- }
- }
- document.write("</div>");
- }
- function clicktree(jibie,shangjiID)
- {
- if(shangjiID>0)
- if(eval("t" + jibie + "_" + shangjiID).style.display=="none")
- {
- eval("t" + jibie + "_" + shangjiID).style.display="";
- if(eval("document.n" + jibie + "_" + shangjiID).src.toLowerCase().indexOf("/images/tree/tplus.gif")>=0)
- eval("document.n" + jibie + "_" + shangjiID).src="/images/tree/tminus.gif";
- else
- eval("document.n" + jibie + "_" + shangjiID).src="/images/tree/lminus.gif";
- eval("document.f" + jibie + "_" + shangjiID).src="/images/tree/folderopen.gif";
- }
- else
- {
- eval("t" + jibie + "_" + shangjiID).style.display="none";
- if(eval("document.n" + jibie + "_" + shangjiID).src.toLowerCase().indexOf("/images/tree/tminus.gif")>=0)
- eval("document.n" + jibie + "_" + shangjiID).src="/images/tree/tplus.gif";
- else
- eval("document.n" + jibie + "_" + shangjiID).src="/images/tree/lplus.gif";
- eval("document.f" + jibie + "_" + shangjiID).src="/images/tree/folderclosed.gif";
- }
- }
- function clickdept(deptid,isselected)
- {
- with(document.selectdepart)
- {
- for(var i=0;i<jsArray.length;i++)
- {
- if(jsArray[i][3].indexOf("_"+deptid.toString()+"_")>=0)
- {
- eval("dept_" + jsArray[i][0] + "").checked = isselected;
- }
- }
- }
- }
- function selectcurrentdept(deptidstring)
- {
- with(document.selectdepart)
- {
- for(var i=0;i<jsArray.length;i++)
- {
- if(deptidstring.indexOf(","+jsArray[i][0]+",")>=0)
- {
- eval("dept_" + jsArray[i][0]).checked=true;
- clickdept(jsArray[i][0],true);
- }
- }
- selectall.checked = isfilesallchecked(0);
- }
- }
- function unselect(fatherids,isselected)
- {
- var fatherArray = new Array();
- fatherArray = (fatherids+"").split("_");
- document.selectdepart.selectall.checked = isfilesallchecked("0");
- for(var i=1;i<fatherArray.length-1;i++)
- {
- if(i==1)
- {
- document.selectdepart.selectall.checked = isfilesallchecked(fatherArray[i]);
- }
- else
- {
- eval("document.selectdepart.dept_" + fatherArray[i]).checked = isfilesallchecked(fatherArray[i]);
- }
- }
- }
- function ckeckall()
- {
- clickdept(0,document.selectdepart.selectall.checked);
- }
- function getFatherNames(fatherIDsString)
- {
- var fatherNames = "";
- if(fatherIDsString.length>3)
- {
- fatherNames = fatherIDsString.replace("_0_","_");
- for(var i = 0;i<maxdept;i++)
- {
- if(fatherNames.indexOf("_" + jsArray[i][0] + "_")>=0)
- fatherNames=fatherNames.replace("_" + jsArray[i][0] + "_" ,"_" + jsArray[i][1] + "→" + "_");
- }
- while(fatherNames.indexOf("_")>=0)
- fatherNames=fatherNames.replace("_","");
- }
- return fatherNames;
- }
- function returnvalue()
- {
- var deptids="",deptnames="";
- for(var i = 0;i<maxdept;i++)
- {
- if(eval("document.selectdepart.dept_" + jsArray[i][0] + ".checked==true"))
- {
- if(jsArray[i][2]=="0" || !isfilesallchecked(jsArray[i][2]))
- {
- deptids+="," + jsArray[i][0];
- deptnames += "n" + getFatherNames(jsArray[i][3]) + jsArray[i][1];
- }
- }
- }
- if(deptids.length>0)
- {
- deptids=deptids.substr(1);
- deptnames=deptnames.substr(1);
- window.returnValue=deptids + "|!|" + deptnames;
- window.close();
- return false;
- }
- else
- {
- alert("请选择部门!");
- return false;
- }
- }
- //-->
- </SCRIPT>
- <BODY BGCOLOR='<%=m_session.GetString("BackColor")%>' LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
- <table width="100%" border="0" cellspacing="0" cellpadding="0">
- <form name="selectdepart" method="post" action="" onsubmit="return returnvalue();">
- <tr>
- <td>
- <img src="/images/tree/folderopen.gif" width="18" height="18" align="absbottom"><input type="checkbox" name="selectall" value="" onclick="ckeckall();">全部选择/取消<br>
- <script language="JavaScript">
- showtree(0,0,"");
- selectcurrentdept(window.dialogArguments);
- </script>
- </td>
- </tr>
- <tr>
- <td align="center">
- <input type="submit" value="确定"> <input type="reset" value="重选"> <input type="button" value="清空" onclick="window.returnValue='';window.close();"> <input type="button" value="取消" onclick="window.close();">
- </td>
- </tr>
- </form>
- </table>
- </body>
- </html>