Org.aspx
上传用户:tiancihang
上传日期:2014-03-12
资源大小:21387k
文件大小:17k
源码类别:

.net编程

开发平台:

C#

  1. <%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Org.aspx.cs" Inherits="_Default" %>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" >
  4. <head runat="server">
  5. <base target="_self" />
  6.     <title>组织机构</title>
  7.     <link href="style/treeStyle.css" type="text/css" rel="stylesheet"/>
  8. <%--    <link href="style/menuStyle.css" type="text/css" rel="stylesheet"/>--%>
  9.     <link href="style/portal.css" type="text/css" rel="stylesheet" />
  10.     
  11.     <style type="text/css">
  12.     <!--
  13.         .MenuGroup
  14.         {
  15.           background-image:url(style/menu_images/group_background.gif);
  16.           background-color:white;
  17.           border:solid 1px #7E7E81;
  18.           text-align:left;
  19.           font-family: Arial, Helvetica, sans-serif;
  20.           font-size: 12pt;
  21.           width:90px; 
  22.           cursor:default;
  23.           font:menutext;
  24.           position:absolute;
  25.           visibility:hidden;
  26.           border:2 outset buttonhighlight; 
  27.         }
  28.         .MenuItem
  29.         {
  30.           color:black; 
  31.           font-family:tahoma; 
  32.           font-size:12px; 
  33.           margin:4px; 
  34.           cursor:default;
  35.           padding-left:0px;
  36.           padding-right:2px;
  37.         }
  38.         .MenuItemHover 
  39.         {
  40.           background-color:#FFEEC2; 
  41.           color:black; 
  42.           font-family:tahoma; 
  43.           font-size:11px; 
  44.           border:solid 1px #4B4B6F; 
  45.           cursor:default; 
  46.         }
  47.         .MenuBreak
  48.         {
  49.           background-image:url(menu_images/break_bg.gif);
  50.           width:100%;
  51.           height:1px;
  52.         }
  53.         .skin1 {
  54.             cursor:default;
  55.             font:menutext;
  56.             position:absolute;
  57.             text-align:left;
  58.             font-family: Arial, Helvetica, sans-serif;
  59.             font-size: 10pt;
  60.             width:120px;
  61.             background-color:menu;
  62.             border:1 solid buttonface;
  63.             visibility:hidden;
  64.             border:2 outset buttonhighlight;
  65.         }
  66.         .menuitems {
  67.             padding-left:15px;
  68.             padding-right:10px;
  69.     }
  70.     -->
  71.     </style>
  72. <%--<script type="text/javascript"> 
  73. <!-- Begin 
  74. function verScroll(dir, spd, loop) { 
  75.     loop = true; 
  76.     direction = "up"; 
  77.     speed = 10; 
  78.     scrolltimer = null; 
  79.     if (document.layers) 
  80.     { 
  81.         var page = eval(document.MenuID5); 
  82.     } 
  83.     else 
  84.     { 
  85.         if (document.getElementById)
  86.         { 
  87.             var page= eval("document.getElementById(MenuID5).style"); 
  88.         }
  89.         else 
  90.         { 
  91.             if (document.all) 
  92.             {
  93.                 var page = eval(document.all.MenuID5.style); 
  94.             } 
  95.         } 
  96.     } 
  97.     direction = dir; 
  98.     speed = parseInt(spd); 
  99.     var y_pos = parseInt(page.top); 
  100.     if (loop == true) 
  101.     { 
  102.         if (direction == "dn") 
  103.         { 
  104.             page.top = (y_pos - (speed)); 
  105.         } else 
  106.         { 
  107.             if (direction == "up" && y_pos < 10) 
  108.             { 
  109.                 page.top = (y_pos + (speed)); 
  110.             } else 
  111.             { 
  112.                 if (direction == "top") 
  113.                 { 
  114.                     page.top = 10; 
  115.                 } 
  116.             } 
  117.         } 
  118.         scrolltimer = setTimeout("verScroll(direction,speed)", 1); 
  119.     } 
  120. }
  121. function stopScroll() { 
  122.     loop = false; 
  123.     clearTimeout(scrolltimer); 
  124. // End --> 
  125. </script> --%>
  126.     
  127. <script type="text/javascript" >
  128.     var StrValue,StrParent,Level=0,OrgPath;
  129.     function ShowMenu() {
  130.         var nowEvenObj = event.srcElement;
  131.         if (nowEvenObj.type != undefined)
  132.         {
  133. //            alert(MenuID5.childNodes.length);
  134.             if(nowEvenObj.nodeName == "A"){
  135.                 var strHrefs = nowEvenObj.href.split(",");
  136.                 if(strHrefs.length == 2){
  137.                     var StrPold;
  138.                     var j;
  139.                     StrPold = strHrefs[1].split("'")[1];
  140.                     StrPold = StrPold.split("\\");
  141.                     Level = StrPold.length;
  142.                     OrgPath ="";
  143.                     StrValue ="";
  144.                     StrParent ="";
  145.                     for ( j=0;j<Level;j++) {
  146.                         if (StrValue=="") {
  147.                             OrgPath ="1";
  148.                             StrValue = StrPold[j];
  149.                             StrParent = "-1";
  150.                         }
  151.                         else {
  152.                             if (StrValue == "s1") {StrParent="1";}
  153.                             else {StrParent =StrValue;}
  154.                             StrValue = StrPold[j];
  155.                             OrgPath = OrgPath +"/" + StrPold[j];
  156.                         }
  157.                         
  158.                     }
  159. //                    if (StrParent == undefined) {
  160. //                        StrValue ="1";
  161. //                        StrParent = "-1";
  162. //                        OrgPath ="1";
  163. //                    }
  164.                     if (StrParent == "-1") {StrValue ="1";}
  165. //                    alert(StrParent);
  166. //                    alert(StrValue);
  167. //                    if(strHrefs[1].split("'").length == 3)
  168. //                        alert(strHrefs[1].split("'")[1])
  169.                 }
  170.                 
  171.             }
  172. //            alert(OrgPath);
  173. //            alert(StrParent);
  174. //            alert(StrValue);
  175. //            var s  = event.srcElement.id;
  176. //            var ind = s.replace("t1", "");
  177. //            s = s.replace("t1", "t2"); 
  178.             var imgurl1= new Array(5);
  179.             imgurl1[0]="style/menu_images/icon_bullets.gif";
  180.             imgurl1[1]="style/menu_images/icon_copy.gif";
  181.             imgurl1[2]="style/menu_images/icon_copy.gif";
  182.             imgurl1[3]="style/menu_images/icon_open.gif";
  183.             imgurl1[4]="style/menu_images/icon_cut.gif";
  184.             imgurl1[5]="style/menu_images/icon_properties.gif";
  185.             var ToolTextName = new Array(5);
  186.             ToolTextName[0]="展开所有节点";
  187.             ToolTextName[1]="在当前机构中增加一个子级机构";
  188.             ToolTextName[2]="在当前机构中增加一个职工";
  189.             ToolTextName[3]="修改当前选中的信息";
  190.             ToolTextName[4]="删除当前选中的信息";
  191.             ToolTextName[5]="转移到新的组织机构";
  192.             var UrlName = new Array(5);
  193.             UrlName[0] ="";
  194.             UrlName[1] = "";
  195.             UrlName[2] ="";
  196.             //UrlName[1] ="AddNewOrg.aspx?StrValue=" + StrValue + "&StrParent=" +StrParent + "&StrLevel=" + Level + "&StrPath=" + OrgPath;
  197.             //UrlName[2] ="AddEmployee.aspx?StrValue=" + StrValue + "&StrParent=" + StrParent;
  198.             UrlName[3]="";
  199.             UrlName[4] ="";
  200. //          alert(UrlName[2]);
  201.             var i;
  202.             for (i=1;i<=MenuID5.childNodes.length;i++) {
  203.                 document.getElementById(i).url = UrlName[i-1];
  204.                 var nowCenter = document.getElementById(i).innerText;
  205.                 document.getElementById(i).innerHTML = "<img align=absbottom src='"+imgurl1[i-1]+"' />&nbsp;"+nowCenter;
  206.                 document.getElementById(i).title=ToolTextName[i-1];
  207.             }
  208.             
  209. //            var ch = document.getElementById(s);
  210. //            if (ch != null){
  211. //                document.getElementById('2').url = "style/menu_images/icon_cut.gif";    
  212. //                document.getElementById('2').innerText = "新增机构";
  213. //            }
  214. ////            else        
  215. ////                document.getElementById('2').outerHTML="<div id=2 class=MenuItem url=''>111</div>"
  216.             var rightedge = document.body.clientWidth-event.clientX;
  217.             var bottomedge = document.body.clientHeight-event.clientY;
  218.             
  219. //            alert(bottomedge);
  220. //            alert(document.body.scrollTop);
  221. //            alert(MenuID5.offsetHeight);
  222.             if (rightedge < MenuID5.offsetWidth)
  223.                 MenuID5.style.left = document.body.scrollLeft + event.clientX - MenuID5.offsetWidth;
  224.             else
  225.                 MenuID5.style.left = document.body.scrollLeft + event.clientX + 5;
  226. //     alert(MenuID5.style.top);           
  227.                 
  228.             if (bottomedge < MenuID5.offsetHeight)
  229.                 if (event.clientY>100)
  230.                     MenuID5.style.top = document.body.scrollTop + event.clientY - MenuID5.offsetHeight;
  231.                 else
  232.                     MenuID5.style.top = document.body.scrollTop + event.clientY;
  233.             else
  234.                 MenuID5.style.top = document.body.scrollTop + event.clientY;
  235.             MenuID5.style.visibility = "visible";
  236.         }
  237.         else
  238.         {
  239.                MenuID5.style.visibility = "hidden";
  240.         }
  241.         return false;
  242.     }
  243.     function hidemenuie5() {
  244.         MenuID5.style.visibility = "hidden";
  245.     }
  246.     function highlightie5() {
  247.         if (event.srcElement.className == "MenuItem") {
  248.             event.srcElement.style.backgroundColor = "#FFEEC2";
  249.             event.srcElement.style.border="solid 1px #4B4B6F";
  250. //        if (display_url)
  251. //            window.status = event.srcElement.url;
  252.         }
  253.     }
  254.     function lowlightie5() {
  255.         if (event.srcElement.className == "MenuItem") {
  256.             event.srcElement.style.backgroundColor = "";
  257.             event.srcElement.style.color = "black";
  258.             event.srcElement.style.border="";
  259.             window.status = "";
  260.         }
  261.     }
  262.     
  263.     function MenuClick() {
  264.         var nowObj = event.srcElement;
  265.         if (nowObj.className == "MenuItem") {
  266.             switch (nowObj.id) {
  267.                 case '1':
  268. //                    form1.SMenuID.value = "1";
  269. //                    document.all('Button1').click();
  270.                    var n,m;                    n =form1.TreeCount.value;                    var TObj;                    for (m=0;m<n;m++)                     {                       TObj =document.getElementById("TreeOrgn" + m +"Nodes");                        if (TObj != null)                         {                            TObj.style.display ="block";                            var TObjNext;                            TObjNext = document.getElementById("TreeOrgn" + m);                            var altname;                            altname = TObjNext.innerHTML.split("alt");                            altname = altname[1].split(" ");                            altname = altname[1].substring(0,altname[1].length -1);                            if (TObjNext != null) TObjNext.innerHTML ="<img align=absbottom src='image/dashminus.gif' style='border-width:0;' alt='" + altname +"'/>"; //                           TObj.innerHTML = "<img align=absbottom src='image/dashminus.gif' />" + TObj.href; //                           TObj.src ="../image/dashminus.gif"; //                           TObj.scr = "..image/dashplus.gif";                         }                      } 
  271.                     break;
  272.                 case '2':
  273.                     if (StrValue.substring(0,2)=="职工")
  274.                     {
  275.                         alert("系统提示:请选择组织机构");
  276.                         return
  277.                     }
  278.                     if (Level > 2) {
  279.                         alert("系统提示:系统不支持4级组织机构");
  280.                         return
  281.                     }
  282.                     var SUrl ="AddNewOrg.aspx?StrValue=" + StrValue + "&StrParent=" +StrParent + "&StrLevel=" + Level + "&StrPath=" + OrgPath + "&StrM=N";
  283. //                    window.open(SUrl);
  284.                     window.showModalDialog(SUrl,"新增组织机构","dialogWidth=450px;scroll=no;help=no;dialogHeight=300px;");
  285.                     window.location.reload();
  286.                     break;
  287.                 case '3':
  288.                     if (StrValue.substring(0,2)=="职工")
  289.                     {
  290.                         alert("系统提示:请选择组织机构");
  291.                         return
  292.                     }
  293.                     var SUrl3 ="AddEmployee.aspx?StrValue=" + StrValue + "&StrParent=" + StrParent + "&StrM=N";
  294. //                    window.location = event.srcElement.url;
  295. //                    window.open(event.srcElement.url,"新增职工","channelmode=1,fullscreen=0");
  296.                     window.showModalDialog(SUrl3,"新增职工","dialogWidth=540px;scroll=no;help=no;dialogHeight=350px;");
  297.                     window.location.reload();
  298.                     break;
  299.                 case '4':
  300.                     var MUrl="";
  301.                     if (StrValue.substring(0,2)=="职工") {
  302.                         StrValue = StrValue.substring(2,StrValue.length);
  303.                         MUrl="AddEmployee.aspx?StrValue=" + StrValue + "&StrParent=" + StrParent + "&StrM=M";
  304.                         window.showModalDialog(MUrl,"修改职工","dialogWidth=540px;scroll=no;help=no;dialogHeight=350px;");
  305.                         window.location.reload();
  306.                         return
  307.                     }
  308.                     if (Level==1) {
  309.                         alert("系统提示:对不起,此组织机构不允许修改!");
  310.                         return
  311.                     }
  312.                     MUrl ="AddNewOrg.aspx?StrValue=" + StrValue + "&StrParent=" +StrParent + "&StrLevel=" + Level + "&StrPath=" + OrgPath + "&StrM=M";
  313.                     window.showModalDialog(MUrl,"修改组织机构","dialogWidth=450px;scroll=no;help=no;dialogHeight=300px;");
  314.                     window.location.reload();
  315.                     break;
  316.                 case '5':
  317.                     if (confirm('你确实要删除该条信息吗?')== true) 
  318.                     {
  319.                         form1.dellValue.value = StrValue;
  320.                         document.all('Button1').click();
  321.                     }
  322.                     break;
  323.                 case '6':
  324.                     if (StrValue.substring(0,2)=="职工") {
  325.                         StrValue = StrValue.substring(2,StrValue.length);
  326.                         var MUrl ="OrganzationTree.aspx?StrValue=" + StrValue;
  327. //                        window.open(MUrl);
  328.                         window.showModalDialog(MUrl,"修改组织机构","dialogWidth=450px;help=no;dialogHeight=300px;");
  329.                         window.location.reload();
  330.                     }
  331.                     else {
  332.                         alert("系统提示:请选择职工!");
  333.                     }
  334.                     break;
  335.                 default:
  336.                     break;
  337.             }
  338.         }
  339.     }
  340.         
  341.     function jumptoie5() {
  342.         if (event.srcElement.className == "MenuItem") {
  343. //        alert(event.srcElement.getAttribute("target"));
  344. //        alert(event.srcElement.url);
  345.             alert(document.getElementById.childNodes);
  346.         
  347.             if (event.srcElement.getAttribute("target") != null)
  348.                 window.open(event.srcElement.url, event.srcElement.getAttribute("target"));
  349.             else
  350.                 window.location = event.srcElement.url;
  351.         }
  352.     }
  353. //  End -->
  354. function TreeOnClientClick()     {         var nowEvenObj = event.srcElement;         if (nowEvenObj.nodeName != "IMG") return false;         var sherf =nowEvenObj.href;         if (sherf.indexOf("user.gif") != "-1") return false;     }
  355.     
  356.  
  357. </script>
  358. </head>
  359. <body style="height:100%">
  360.     <form id="form1" runat="server" method="post">
  361.     <input type="hidden" name="dellValue" id="dellValue"/>
  362.     <input type="hidden" id="SMenuID" name="SMenuID" />
  363.     <input type="hidden" id ="TreeCount" name ="TreeCount" runat="server" /> 
  364.     <table style="height:18;" cellspacing="0" cellpadding="0" width="100%" border="0" >
  365.     <tr>
  366.         <td style="background-color:#f7f7f7; height:21px;">&nbsp;<strong>组织机构和职工信息</strong></td>
  367.     </tr>
  368.     <tr>
  369.     <td valign="top">
  370.         <asp:TreeView ID="TreeOrg" runat="server" CollapseImageUrl="image/dashminus.gif" ExpandImageUrl="image/dashplus.gif" CssClass="TreeView" NoExpandImageUrl="image/user.gif" ShowLines="True">
  371.             <%--<SelectedNodeStyle CssClass="SelectedTreeNode"/>--%>
  372.         </asp:TreeView> 
  373.         <asp:Button ID="Button1" runat="server" Text="Button" style="display:none" OnClick="Button1_Click"/>
  374.     <div id="MenuID5" class="MenuGroup" onmouseover="highlightie5()" onmouseout="lowlightie5()" onclick="MenuClick();">
  375.             <div id="1" class="MenuItem">全部展开
  376.             </div>
  377.             <div id="2" class="MenuItem" >新增机构
  378.             </div>
  379.             <div id="3" class="MenuItem">新增职工
  380.             </div> 
  381.             <div id="4" class="MenuItem">修  改
  382.             </div>
  383.             <div id="5" class="MenuItem">删  除
  384.             </div>
  385.            <div id="6" class="MenuItem">转移机构
  386.             </div>
  387.         </div>
  388. </td> 
  389. </tr> 
  390. </table> 
  391. </form>
  392. <script type="text/javascript">
  393.        if (document.all) {
  394.           MenuID5.className = "MenuGroup";
  395.           document.getElementById('treeorg').oncontextmenu = ShowMenu;
  396.           document.body.onclick = hidemenuie5;
  397.       }
  398.     </script>
  399.     
  400. </body>
  401. </html>