<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Dept_User.aspx.cs" Inherits="Appform.Admin.Dept_User" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="../bootstrap/css/bootstrap.min.css" rel="stylesheet" /> 
     <script src="../javascript/jquery-1.9.1.min.js"></script>
    <script src="../bootstrap/js/bootstrap.min.js"></script>  
    <link href="../Javascript/datatable/css/jquery.dataTables.min.css" rel="stylesheet" />
    <script src="../Javascript/datatable/js/jquery.dataTables.min.js"></script>
    <script src="../Javascript/common.js"></script>
    
       <style>
           
ul.tree_menu {
	margin-left: 0px;
	padding-left: 0px;
	list-style: none;
}

ul.tree_menu a {
	display: block;
	width: 100%;
	height: 32px;
    color:#000000;
	line-height: 32px;
}

ul.tree_menu a:hover {
	background: #eee;
	display: block;
	width: 100%;
	height: 32px;
	line-height: 32px;
}

ul.tree_menu a.active {
	background: #ccc;
	display: block;
	width: 100%;
	height: 32px;
	line-height: 32px;
	color: #fff;
	z-index: 2;
	background-color: #5dade2;
}
ul.tree_menu a.active i {
	color: #fff;
}

ul.tree_menu i {
	cursor: pointer;
	font-weight: bold;
	font-style: normal;
	text-align: center;
	color: #0099ff;
	font-family: FontAwesome;
	font-size: 16px;
	height: 20px;
	position: relative;
	padding-right:1px;
	padding-left:1px;
	margin-right:2px;
	width: 10px;
}

.tree_menu .level1 {
	margin-left:6px;
}

.tree_menu .level2 {
	margin-left:10px;
}

        li.deptitem {
           height:32px;
            width:180px;  
            overflow:hidden;
            text-overflow:ellipsis;
           }
 
       </style>
    <link href="style/book.css" rel="stylesheet" />

</head>
<body style="font-size:12px;  ">
    <form id="form1" runat="server">
     
         
   <div class="content">

  
       
<div   >
	<div class="well" style="height:70px; width:105%; margin-top:0px;">
		<div class="pull-left"> 
             <asp:RadioButtonList runat="server" ID="rbl_types" RepeatColumns="3" 
               
                   Width="200px" AutoPostBack="True" OnSelectedIndexChanged="rbl_types_SelectedIndexChanged">
                 <asp:ListItem Text="部门" Value="dept"  ></asp:ListItem>
                    <asp:ListItem Text="职位" Value="title"></asp:ListItem>
                  <asp:ListItem Text="办公室" Value="office"></asp:ListItem> 
             </asp:RadioButtonList>  
               
          </div> 
             

   <div class="pull-right input-group form-group form-inline" style="  ">  
         
       <button class="btn  btn-success btn-flat" id="btnSelect"
              onclick="select(); return false; "
              >全选/反选</button>

       <button class="btn btn-primary btn-flat" id="btnOK"
              onclick="submitAndClose(); "
              > 提交</button>
     
  <button class="btn btn-danger btn-flat" onclick=" parent.layer.close(parent.layer.getFrameIndex(window.name));"> 关闭</button>
       <div class="form-group">
       <div class="input-group ">
      <input class="form-control" id="txt_key" type="text" placeholder="Search">
          <a href="#" id="search" class="input-group-addon">
            <i class="fa fa-search"></i>
        </a>
        </div>
      </div>
  </div>
            

		 
	</div>
</div>




        




<div class="row">
	<div class="col-sm-3">
         
         
           <div class="panel panel-info">
 

 <div class="panel-body">

 <ul class="tree_menu">
<li>
    <a   href="#" class="node_level_1 active">
        <i class="fa fa-angle-right level1"></i><span>所有类别</span>
    </a>
    


    
<ul class="tree_menu"> 
      <asp:Repeater runat="server" ID="rpt_cat"   >
          <ItemTemplate>
           <li class="deptitem">
               <a  node='<%#Eval("name") %>'  href="#" class="node_level_2">
        <i class="fa fa-angle-right level2"></i><span><%#Eval("name") %>   </span>
    </a>
            
                 
          
 
         </li>
          </ItemTemplate> 
      </asp:Repeater>
    </ul>

     
    </li>
     </ul>


     </div>
                 </div>

             

   



 
        
        
         </div>

        	<div class="col-sm-9">









 
<asp:Repeater runat="server" ID="rpt_lists"   >
    <HeaderTemplate>
         
        <table class="table table-hover table-condensed" style="width:650px; line-height:22px; margin:0px; padding:0px;" id="tbl_users">
             
                <thead>
                    <tr>
                        <th>  
                        </th>
                        <th></th>
                        <th></th>
                        <th></th>
                        <th></th>
                        <th></th>  
                         <th style="display:none"></th>  
                         <th style="display:none"></th>  
                       <th style="display:none"></th>  
                    </tr>
                </thead>
           <tbody>

    </HeaderTemplate>
    <ItemTemplate>
        
        <tr>
              <td> 

  <input type="checkbox" class="ck_item" value='<%# Eval("uid") %>' />
        
              </td>
            <td><%#Eval("keys") %></td>
             <td><%#Eval("displayname") %></td>
               <td><%#Eval("username") %></td>
                <td><%#Eval("email") %></td>
              <td><%#Eval("tel") %></td>
              <td  style="display:none"><%# Eval("uid") %></td>
              <td style="display:none" ><%#Eval("dept") %></td>
             <td style="display:none" ><%#Eval("staffcode") %></td>
        </tr>


    </ItemTemplate>

    <FooterTemplate>
        
           </tbody>
        </table>

    </FooterTemplate>
</asp:Repeater>











 

 

        	</div> 

    </div>





                 
 
    
 
 <script>

     

     $(document).ready(function () {

         $('#tbl_users').dataTable({ stateSave: false, "sDom": '<"top">rt<"bottom"p><"clear">' });
          

         var table = $('#tbl_users').DataTable();

         $('.node_level_1').on('click', function () {
             table.column(1).search("").draw(); 
             $(".tree_menu a").each(function () {
                 $(this).attr("class", "");
             }); 
             $(this).attr("class", "active");

         });

         $('.node_level_2').on('click', function () { 
             table.column(1).search($(this).attr("node")).draw();
             $(".tree_menu a").each(function () {
                 $(this).attr("class", "");
             });
             $(this).attr("class", "active");

         });
          

         $("#txt_key").keyup( 
             function () {
                 table.search($(this).val()).draw();
             }
             ); 
     });


     function select()
     {

       var item0=$(".ck_item")[0];
       var status = $(item0).prop("checked");

       $(".ck_item").each(
         function () {
             $(this).prop("checked", !status);
         }
         );

          

     }



     function submitAndClose() {  
         var checked = 0;
         var result = '';

         var _c = 0;
         $(".ck_item").each( 
          function () {
              if ($(this).is(':checked')) {
                  checked++;

                  var row = $(this).parent().parent();
                  var tds = row.children();

                  var uid = $(tds[6]).html();
                  var display = $(tds[2]).html();
                  var login = $(tds[3]).html();
                  var email = $(tds[4]).html();
                  var tel = $(tds[5]).html();
                  var dept = $(tds[7]).html();
                  var staffcode = $(tds[8]).html();
                  result =result+ uid + "$" + login + "$" + display + "$" + dept + "$" + tel + "$" + email + "$" + staffcode+"!";
                  
              }
          }

         );

          
         
         if (checked > 0) {
              
         }
         else {
             //layer.alert('请至少选择一条记录', 12);
             alert('请至少选择一条记录');
             return false;
         }
         

         <% if(Request.QueryString["t"]=="attend") {%>

         parent.setPopAttend(result);
         <%} else  {%>
         parent.setPopUser(result);
         <%}%>
         parent.layer.close(parent.layer.getFrameIndex(window.name));

         }

 </script>


        

            <input type="hidden" name="hf_ids" id="hf_ids" />
       
 

         </div>


     
    </form>
</body>
</html>