<%@ Page Title="" Language="C#" MasterPageFile="~/helpdesk/Reporting.master" AutoEventWireup="true" CodeBehind="Reporting_Trending_Cat.aspx.cs" Inherits="helpdesk.helpdesk.Reporting_Trending_Cat" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">

  
     

    请选择时间段：从<input type="text" id="dt1" value="<%=DateTime.Now.AddMonths(-2).ToString("yyyy-MM-dd") %>"  class="_dt form-control" style="display:inline-block; width:200px" /> 
    
   到<input type="text"  id="dt2" class="_dt form-control" style="display:inline-block; width:200px" /> 
    
    
  
  <button class="btn btn-default dropdown-toggle" type="button"  onclick="$('#div_cat').toggle();"
       >
    选择指标
    <span class="caret"></span>
  </button>


   




     <div style="display:none; background-color:#e6d7d7" id="div_cat">

  
    <asp:GridView runat="server" ID="gv_cat"  AutoGenerateColumns="false"  CssClass="table" GridLines="None">
        <Columns>

            <asp:TemplateField>

                <ItemTemplate>

                 <b>   <%#Eval("catname") %></b> <br />


                   

                    <asp:Repeater runat="server" DataSource='<%#GetSub(Eval("id")) %>'   ID="rpt_subcat">
                       <ItemTemplate>
                           <input type="checkbox" class="selitem" value="<%#Eval("id") %>" /><%#Eval("catname") %> &nbsp;&nbsp;&nbsp;&nbsp;

                       </ItemTemplate>

                    </asp:Repeater>









                </ItemTemplate>

            </asp:TemplateField>

        </Columns>
    </asp:GridView>

         
         
         
         
         

        &nbsp;&nbsp;&nbsp;&nbsp; <input type="button" class="btn bg-green" onclick="$('#div_cat').hide();   redraw();"  value="确定"/>
          <input type="button" class="btn btn-danger" onclick=" $('.selitem').prop('checked', false);"  value="取消选择"/>
          <br /> <br />
         
         
         
         
          </div>

    <script src="../javascript/last.js"></script>


   











    
    <div id="echart" style="width:95%; height:440px; margin:20px;">
  <img src="Images/loading.gif" />  报表加载中
 
 </div>

 
















    <script>

        function init5()
        {

           var count= $(".selitem").length;
           if (count <= 5) {
               $(".selitem").prop("checked", true);
           }
           else
           {
               //大于5，只取前5个
               $(".selitem").each(

                   function (index)
                   {
                       if (index < 5)
                       {
                           $(this).prop("checked",true);
                       }

                   }

                   );

           } 

        }

        init5();

        function redraw()
        {

            var c = $(".selitem:checked").length

            if (c == 0)
            {
                alert("请至少选择一个类别");
                return false;
            }

           if (c > 5)
           {
               alert("您已经选择了"+c+"个类别,\n一次最多只能选择5个类别");
               return false;
           }

            //get ids
           ids = "";
           $(".selitem:checked").each(

               function ()
               {

                   ids+=$(this).val()+";"
               } 

               )

        
           $.ajax({
               url: "ajax/ajax_ticket_reports_treading_cat_data.aspx",
               data: { ids:ids, dt1:$("#dt1").val(), dt2:$("#dt2").val() },
               cache: false,
               async: false,
               dataType: 'json',
               success: function (data) {
                   DrawBars(data, "echart", "", true, false, "line");

               }
           });


          

        }

        redraw();

    </script>

</asp:Content>
