<%@ Page Title="" Language="C#" ClientIDMode="Static" EnableEventValidation="false"  MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="UserLists.aspx.cs" Inherits="ServiceDesk.Admin.UserLists" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">


    <style>
        img.avtor { width:30px; height:30px;
        }
    </style>


     <div class="layui-fluid">
    <div class="layui-card">
      <div class=" layui-card-header layuiadmin-card-header-auto">
        <div  >

          
            <!-- search start -->

              <asp:UpdatePanel runat="server" ID="pn1"  UpdateMode="Conditional">
                <ContentTemplate>

             

             <div class="layui-inline">
            <label class="layui-form-label">ID</label>
            <div class="layui-input-block">
              <asp:TextBox runat="server" ID="txt_id" placeholder="请输入"  autocomplete="off" class="layui-input"></asp:TextBox>
            </div>
          </div>

      
             <div class="layui-inline">
            <label class="layui-form-label">姓名</label>
            <div class="layui-input-block">
                <asp:TextBox runat="server" ID="txt_username" placeholder="请输入"  autocomplete="off" class="layui-input"></asp:TextBox>
            
            </div>
          </div>

         
              <div class="layui-inline">
            <label class="layui-form-label">手机</label>
            <div class="layui-input-block">
          <asp:TextBox runat="server" ID="txt_tel" placeholder="请输入"  autocomplete="off" class="layui-input"></asp:TextBox>
            </div>
          </div>


             <div class="layui-inline">
            <label class="layui-form-label">邮箱</label>
            <div class="layui-input-block">
            <asp:TextBox runat="server" ID="txt_email" placeholder="请输入"  autocomplete="off" class="layui-input"></asp:TextBox>
            </div>
          </div>


            
           



             <div class="layui-inline">
            <label class="layui-form-label">部门</label>
            <div class="layui-input-block">

                <asp:DropDownList runat="server" AutoPostBack="true"
                    lay-ignore  CssClass="form-control"  Width="186px"
                     ID="ddl_dept">

                </asp:DropDownList>
              
            </div>
          </div>
        

         
          
            
             <div class="layui-inline">
                 <asp:LinkButton runat="server" ID="lb_search"  class="layui-btn layuiadmin-btn-useradmin">
                     <i class='layui-icon layui-icon-search layuiadmin-button-btn'></i>

                 </asp:LinkButton>
                 
          
          </div>
      
               </ContentTemplate>
            </asp:UpdatePanel>

             <!-- search end -->
            
         </div>
      </div>
      








        
          <!-- use list -->

            <asp:UpdatePanel runat="server" ID="UpdatePanel1"   >

                <ContentTemplate>
                   

      <div class="layui-card-body">


        <div style="padding-bottom: 10px;">

             <asp:Button runat="server" ID="btn_del" 
               OnClientClick=" if(!isselect()) { return false;} "
               Text="批量删除" 
              class="layui-btn layui-btn-danger"
               OnClick="btn_del_Click" />

          
            
              <a class="layui-btn layuiadmin-btn-useradmin"
             onclick="Pop('UserEditUser.aspx',990,550,'添加新用户'); return false;"
              
              >添加</a>


                            &nbsp; &nbsp;  &nbsp; &nbsp;| &nbsp; &nbsp;
              <a class="layui-btn   layui-btn-normal"
             onclick="Pop('UserImportsFromAD.aspx',500,380,'导入用户'); return false;"
              
              >从AD域导入</a>


              &nbsp; &nbsp;  &nbsp; &nbsp;| &nbsp; &nbsp;
              <a href="#" onclick="if(isselect()) openRole(); return false; " class="layui-btn layui-btn-warm"  >批量修改角色</a>
       <a  href="#"  onclick="if(isselect()) moveDept(); return false; "     class="layui-btn layui-btn-normal" >批量转移部门</a>
             

              <a href="###"  onclick='ept("UserExportData.aspx?types=users");return false;'  class="layui-btn layui-btn-default  "> Excel导出</a> 

                 <a href="###"  onclick='ept("UserImportData.aspx?types=users");return false;'  class="layui-btn layui-btn-primary "> Excel导入</a> 

                 &nbsp; &nbsp; &nbsp; &nbsp;| &nbsp; &nbsp;
                  <a href="###" class=" layui-btn layui-btn-warm"  
    onclick="Pop('usertb.aspx',500,380,'同步人员');return false;" 
       > 一键同步</a> 

          &nbsp; &nbsp; &nbsp; &nbsp;| &nbsp; &nbsp; 共有人员：<asp:Label runat="server" ID="lbl_total"></asp:Label> 名



        </div>
        


    

          
    <asp:ListView EnableViewState="false"  ID="lv_lists" runat="server" 
        DataKeyNames="uid" DataSourceID="SqlDataSource1">
            

           <LayoutTemplate>
              
                       <table    class="layui-table" >
                           <thead>

                        <tr>
                         <th width=90px >   
                             <input type="checkbox"   id="chk_all" lay-skin="primary"  lay-filter="chk_all" > ID
                        </th>

                        <th width="60px">头像</th>
                        <th width="90px">用户名</th>
                        <th  width="100px">显示名</th>
                        <th  width="150px">部门</th> 
                        <th width="130px">电话</th>
                        <th width="180px">邮件</th>

                         <th width="100px">最后登录</th>
                         <th width="80px">角色</th>
                        <th width="150px">操作</th>
                  </tr>


                           </thead>

                           <tbody>

                         

                        <tr id="itemPlaceholder" runat="server">
                        </tr>
              </tbody>
                           
             </table>
                     
            
         </LayoutTemplate>


         <ItemTemplate>
             <tr>
               <td>  
                     <input type="checkbox" class="chk_item" value="<%# Eval("uid") %>"  name="chk_item" lay-skin="primary" > <%# Eval("uid") %> 

               </td>
               <td>   <img  class="avtor"  onerror="imgerrorfun(this);" id='img<%#Eval("uid") %>'  src='<%#Eval("avtor") %>'>    </td> 
               <td><%#Eval("username") %></td>
               <td><%#Eval("displayname") %></td>
               <td><%#Eval("department") %></td>
               <td><%#Eval("tel") %></td>
               <td><%#Eval("email") %></td>
              
              <td>
                 
                       <%#DtHelper.GetDay(Eval("lastlogin") )%> 
               </td>

                 <td>
                        
                             <a href="###" 
                                class="layui-btn layui-btn-primary  layui-btn-xs" 
                                 onclick="Pop('UserSetRight.aspx?id=<%#Eval("uid") %>',500,400,'角色设置');return false;" >
                             
                             
                             <i class="layui-icon layui-icon-util"></i>角色</a>
                 </td>
                <td>
                
                     <a href="###" class="layui-btn layui-btn-normal layui-btn-xs"
                          onclick="Pop('UserEditUser.aspx?id=<%#Eval("uid") %>',980,540,'用户详情');"  >
                    <i class="layui-icon layui-icon-edit"></i>编辑</a>



                            <asp:LinkButton runat="server" ID="DeleteButton" 
                                               OnClientClick="return confirm('确定删除吗？')"
                                              CommandName="Delete"
                                        class="layui-btn layui-btn-danger layui-btn-xs"
                                       > <i class="layui-icon layui-icon-delete"></i> 删除</asp:LinkButton>


 
                </td>  
           </tr>
         </ItemTemplate>
      
          
     </asp:ListView>
   

      
   



          



 
  
  
  



 <div  class="paging"  >

 <asp:DataPager ID="DataPager1" 
      class="layui-box layui-laypage layui-laypage-default"  
       
     PagedControlID="lv_lists" runat="server" PageSize=10>
 <Fields>
            
        <asp:NextPreviousPagerField 
                PreviousPageText="上一页" 
                FirstPageText="|<" 
                ShowPreviousPageButton="true"
                ShowFirstPageButton="false" 
                ShowNextPageButton="false" 
                ShowLastPageButton="false"
                ButtonCssClass="btn btn-default" 
                RenderNonBreakingSpacesBetweenControls="false" 
                RenderDisabledButtonsAsLabels="false" />


           <asp:NumericPagerField  
                ButtonType="Link" 
                CurrentPageLabelCssClass="currentpage"  
                RenderNonBreakingSpacesBetweenControls="false" 
              
                ButtonCount="10" 
                NextPageText="..." 
               />

     

     <asp:NextPreviousPagerField  
               NextPageText="下一页" 
               LastPageText=">|" 
               ShowNextPageButton="true"
               ShowLastPageButton="false" 
               ShowPreviousPageButton="false" 
               ShowFirstPageButton="false"
              
               RenderNonBreakingSpacesBetweenControls="false" 
               RenderDisabledButtonsAsLabels="false"/>
      

  </Fields> 
</asp:DataPager>
</div>

  
  
  
  
  
  
  
  
  
    <asp:SqlDataSource ID="SqlDataSource1" 
    
    ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
    runat="server"  
         DeleteCommand="delete from users_users where uid=@uid "
       
        SelectCommand=" SELECT uid, avtor, username, displayname, tel, email,department, lastlogin FROM [users_users]   where  1=1    and (@uid='' or uid=@uid)    and (@username='' or username+displayname like '%'+@username+'%')      and (@tel='' or tel like '%'+@tel+'%')  and  (@dept='' or department=@dept) and (@email='' or email like '%'+@tel+'%')  order by uid desc  "
   OnSelected="SqlDataSource1_Selected"  
        >
       
      <SelectParameters> 
            <asp:ControlParameter ControlID="txt_id" ConvertEmptyStringToNull=false Name="uid" /> 
           <asp:ControlParameter ControlID="txt_username" ConvertEmptyStringToNull=false Name="username" /> 
         <asp:ControlParameter ControlID="txt_tel" ConvertEmptyStringToNull=false Name="tel" /> 
         <asp:ControlParameter ControlID="txt_email" ConvertEmptyStringToNull=false Name="email" /> 
         <asp:ControlParameter ControlID="ddl_dept" ConvertEmptyStringToNull=false Name="dept" /> 
 
        </SelectParameters>


    </asp:SqlDataSource>
   

           




      </div>

       
                </ContentTemplate>
                </asp:UpdatePanel>


            <!-- /use list -->





    </div>
  </div>




    
          
      <script src="../layuiadmin/layui/layui.all.js"></script> 

     

    <script>

        chkAll();

    </script>





    

   <script>



       function openRole() {
           var _uid = $("#hf_ids").val();
           Pop("UserSetRight.aspx?uids=" + _uid, "500", "400", "设置角色");

       }

       function moveDept() {
           var _uid = $("#hf_ids").val();
           Pop("UserMoveDept.aspx?uids=" + _uid, "500", "400", "修改部门");


       }




   </script>
      

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






      <script>


          $(document).ready(function () {
              $("body").keydown(function (e) {
                  var curKey = e.which;
                  if (curKey == 13) {
                      document.getElementById("<%=lb_search.ClientID%>").click();
                      return false;
                  }
              });
          });

 </script>

    
    
    
          
    <script type="text/javascript">
        function imgerrorfun(obj) {
            var theimg = document.getElementById(obj.id);
            theimg.src = "images/nopic.png";
            theimg.onerror = null;
        }
</script> 


</asp:Content>
