统计页面JS实现

This commit is contained in:
huang 2016-10-28 18:04:49 +08:00
parent df47c09fa4
commit d76ce0706e
6 changed files with 152 additions and 163 deletions

View File

@ -624,9 +624,17 @@ class IssuesController < ApplicationController
@project_sort = 'issues.updated_on asc' @project_sort = 'issues.updated_on asc'
end end
end end
# 搜索结果
@issues_filter = @query.issues(:order => @project_sort) @issues_filter = @query.issues(:order => @project_sort)
# if params[:type] == 1 || params[:type].nil?
# @results = @issues_filter
# elsif params[:type] == "2"
# @results = @issues_filter.collect{|result| result.status_id !=5 }
# elsif params[:type] == "3"
# @results = @issues_filter.collect{|result| result.status_id !=5 }
# end
#统计 #统计
@results = {} @results = {}

View File

@ -1,164 +1,36 @@
<div class="myissues_head mb5"> <div class="myissues_head mb5">
<h2 class="ml15">issue统计</h2> <h2 class="ml15">issue统计</h2>
</div> </div>
<div class="clear"> <div class="clear">
<div> <div>
<!-- <ul> <ul class="new_roadmap_nav fl" >
<li>所有<a style="cursor: pointer;" onclick="showResultAll();" class="issues_greycirbg_btn "><%#= @issues_filter.count %></a></li> <li class="new_roadmap_nav_hover" id="new_roadmap_nav_1" onclick="HoverLi(1);">
<li>开启<a style="cursor: pointer;" onclick="showResultOpen();" class="issues_greycirbg_btn "><%#= @issue_open_count %></a></li> <%= link_to "所有<span class='new_roadmap_nav_taghover ml5' id='new_roadmap_num_1'>#{@issues_filter.count}</span>".html_safe, "", :remote => true, :class => "new_roadmap_type_nomal", :id => "new_roadmap_type_1", :id => "new_roadmap_type_1" %>
<li>关闭<a style="cursor: pointer;" onclick="showResultClose();" class="issues_greycirbg_btn "><%#= @issue_close_count %></a></li> </li>
</ul>--> <li id="new_roadmap_nav_2" onclick="HoverLi(2);">
<ul class="new_roadmap_nav fl" > <%= link_to "打开<span class='new_roadmap_nav_tagnomal ml5' id='new_roadmap_num_2'>#{@issue_open_count}</span>".html_safe, "", :remote => true, :class => "new_roadmap_type_nomal", :id => "new_roadmap_type_1", :id => "new_roadmap_type_2" %>
<li class="new_roadmap_nav_hover" id="new_roadmap_nav_1" onclick="HoverLi(1);"> </li>
<%= link_to "所有<span class='new_roadmap_nav_taghover ml5' id='new_roadmap_num_1' onclick='showResultAll();'>#{@issues_filter.count}</span>".html_safe, "", :remote => true, :class => "new_roadmap_type_nomal", :id => "new_roadmap_type_1", :id => "new_roadmap_type_1" %> <li id="new_roadmap_nav_3" onclick="HoverLi(3);">
</li> <%= link_to "锁定<span class='new_roadmap_nav_tagnomal ml5' id='new_roadmap_num_3'>#{@issue_close_count}</span>".html_safe, "", :remote => true, :class => "new_roadmap_type_nomal", :id => "new_roadmap_type_1", :id => "new_roadmap_type_3" %>
<li id="new_roadmap_nav_2" onclick="HoverLi(2);"> </li>
<%= link_to "打开<span class='new_roadmap_nav_tagnomal ml5' id='new_roadmap_num_2' onclick='showResultOpen();'>#{@issue_open_count}</span>".html_safe, "", :remote => true, :class => "new_roadmap_type_nomal", :id => "new_roadmap_type_1", :id => "new_roadmap_type_2" %> </ul>
</li> </div><!--issues_statistics end-->
<li id="new_roadmap_nav_3" onclick="HoverLi(3);"> <a href="<%= new_project_issue_path(@project)%>" class="sy_btn_green fr mt10" >新建</a>
<%= link_to "锁定<span class='new_roadmap_nav_tagnomal ml5' id='new_roadmap_num_3'onclick='showResultClose();'>#{@issue_close_count}</span>".html_safe, "", :remote => true, :class => "new_roadmap_type_nomal", :id => "new_roadmap_type_1", :id => "new_roadmap_type_3" %> </div>
</li> <div id="merge_record_1" class="">
</ul> <%= render "issues/statistics_all" %>
</div><!--issues_statistics end--> </div>
<a href="<%= new_project_issue_path(@project)%>" class="sy_btn_green fr mt10" >新建</a> <div id="merge_record_2" class="undis">
</div> <%= render "issues/statistics_open" %>
<div id="result_all" class=""> </div>
<table class="sy_new_table " cellpadding="0" cellspacing="0"> <div id="merge_record_3" class="undis">
<thead> <%= render "issues/statistics_lock" %>
<tr> </div>
<td class="dis p10" style="width:166px;">指派给</td>
<td class="w130">所有</td>
<td class="w130">需求</td>
<td class="w130">任务</td>
<td class="w130">缺陷</td>
<td class="w130">支持</td>
<td class="w130">周报</td>
</tr>
</thead>
<tbody>
<% @results.each do |k,v|%>
<tr>
<td class="hidden dis p10" style="width:166px;"><%= v[:name] %></td>
<td class="w130"><%= v[0] %></td>
<td class="w130"><%= v[2] %></td>
<td class="w130"><%= v[4] %></td>
<td class="w130"><%= v[1] %></td>
<td class="w130"><%= v[3] %></td>
<td class="w130"><%= v[5] %></td>
</tr>
<% end %>
<tr>
<td class="hidden dis p10" style="width:166px;">Total</td>
<td class="w130"><%= @alltotal[0] %></td>
<td class="w130"><%= @alltotal[2] %></td>
<td class="w130"><%= @alltotal[4] %></td>
<td class="w130"><%= @alltotal[1] %></td>
<td class="w130"><%= @alltotal[3] %></td>
<td class="w130"><%= @alltotal[5] %></td>
</tr>
</tbody>
</table>
</div>
<div id="result_open" style="display: none"> <script>
<table class="sy_new_table " cellpadding="0" cellspacing="0">
<thead>
<tr>
<td class="dis p10" style="width:166px;">指派给</td>
<td class="w130">所有</td>
<td class="w130">需求</td>
<td class="w130">任务</td>
<td class="w130">缺陷</td>
<td class="w130">支持</td>
<td class="w130">周报</td>
</tr>
</thead>
<tbody>
<% @results.each do |k,v|%>
<% if v[6] > 0 %>
<tr>
<td class="hidden dis p10" style="width:166px;"><%= v[:name] %></td>
<td class="w130"><%= v[6] %></td>
<td class="w130"><%= v[8] %></td>
<td class="w130"><%= v[10] %></td>
<td class="w130"><%= v[7] %></td>
<td class="w130"><%= v[9] %></td>
<td class="w130"><%= v[11] %></td>
</tr>
<% end %>
<% end %>
<tr>
<td class="hidden dis p10" style="width:166px;">Total</td>
<td class="w130"><%= @opentotal[0] %></td>
<td class="w130"><%= @opentotal[2] %></td>
<td class="w130"><%= @opentotal[4] %></td>
<td class="w130"><%= @opentotal[1] %></td>
<td class="w130"><%= @opentotal[3] %></td>
<td class="w130"><%= @opentotal[5] %></td>
</tr>
</tbody>
</table>
</div>
<div id="result_close" style="display: none"> // 导航选择效果
<table class="sy_new_table " cellpadding="0" cellspacing="0">
<thead>
<tr>
<td class="dis p10" style="width:166px;">指派给</td>
<td class="w130">所有</td>
<td class="w130">需求</td>
<td class="w130">任务</td>
<td class="w130">缺陷</td>
<td class="w130">支持</td>
<td class="w130">周报</td>
</tr>
</thead>
<tbody>
<% @results.each do |k,v|%>
<% if v[12] > 0 %>
<tr>
<td class="hidden dis p10" style="width:166px;"><%= v[:name] %></td>
<td class="w130"><%= v[12] %></td>
<td class="w130"><%= v[14] %></td>
<td class="w130"><%= v[16] %></td>
<td class="w130"><%= v[13] %></td>
<td class="w130"><%= v[15] %></td>
<td class="w130"><%= v[17] %></td>
</tr>
<% end %>
<% end %>
<tr>
<td class="hidden dis p10" style="width:166px;">Total</td>
<td class="w130"><%= @closetotal[0] %></td>
<td class="w130"><%= @closetotal[2] %></td>
<td class="w130"><%= @closetotal[4] %></td>
<td class="w130"><%= @closetotal[1] %></td>
<td class="w130"><%= @closetotal[3] %></td>
<td class="w130"><%= @closetotal[5] %></td>
</tr>
</tbody>
</table>
</div>
<script>
function showResultAll(){
$("#result_all").show();
$("#result_open").hide();
$("#result_close").hide();
}
function showResultOpen(){
$("#result_all").hide();
$("#result_open").show();
$("#result_close").hide();
}
function showResultClose(){
$("#result_all").hide();
$("#result_open").hide();
$("#result_close").show();
}
//issues列表
function g(o){ function g(o){
return document.getElementById(o); return document.getElementById(o);
} }
@ -168,12 +40,12 @@
g('new_roadmap_nav_'+i).className='new_roadmap_nav_nomal'; g('new_roadmap_nav_'+i).className='new_roadmap_nav_nomal';
g('new_roadmap_type_'+i).className='new_roadmap_type_nomal'; g('new_roadmap_type_'+i).className='new_roadmap_type_nomal';
g('new_roadmap_num_'+i).className='new_roadmap_nav_tagnomal'; g('new_roadmap_num_'+i).className='new_roadmap_nav_tagnomal';
g('new_roadmap_content_'+i).className='undis'; g('merge_record_'+i).className='undis';
} }
g('new_roadmap_nav_'+n).className='new_roadmap_nav_hover'; g('new_roadmap_nav_'+n).className='new_roadmap_nav_hover';
g('new_roadmap_type_'+n).className='new_roadmap_type_hover'; g('new_roadmap_type_'+n).className='new_roadmap_type_hover';
g('new_roadmap_num_'+n).className='new_roadmap_nav_taghover'; g('new_roadmap_num_'+n).className='new_roadmap_nav_taghover';
g('new_roadmap_content_'+n).className='dis'; g('merge_record_'+n).className='dis';
} }
</script> </script>

View File

@ -0,0 +1,35 @@
<table class="sy_new_table " cellpadding="0" cellspacing="0">
<thead>
<tr>
<td class="dis p10" style="width:166px;">指派给</td>
<td class="w130">所有</td>
<td class="w130">需求</td>
<td class="w130">任务</td>
<td class="w130">缺陷</td>
<td class="w130">支持</td>
<td class="w130">周报</td>
</tr>
</thead>
<tbody>
<% @results.each do |k,v|%>
<tr>
<td class="hidden dis p10" style="width:166px;"><%= v[:name] %></td>
<td class="w130"><%= v[0] %></td>
<td class="w130"><%= v[2] %></td>
<td class="w130"><%= v[4] %></td>
<td class="w130"><%= v[1] %></td>
<td class="w130"><%= v[3] %></td>
<td class="w130"><%= v[5] %></td>
</tr>
<% end %>
<tr>
<td class="hidden dis p10" style="width:166px;">Total</td>
<td class="w130"><%= @alltotal[0] %></td>
<td class="w130"><%= @alltotal[2] %></td>
<td class="w130"><%= @alltotal[4] %></td>
<td class="w130"><%= @alltotal[1] %></td>
<td class="w130"><%= @alltotal[3] %></td>
<td class="w130"><%= @alltotal[5] %></td>
</tr>
</tbody>
</table>

View File

@ -0,0 +1,37 @@
<table class="sy_new_table " cellpadding="0" cellspacing="0">
<thead>
<tr>
<td class="dis p10" style="width:166px;">指派给</td>
<td class="w130">所有</td>
<td class="w130">需求</td>
<td class="w130">任务</td>
<td class="w130">缺陷</td>
<td class="w130">支持</td>
<td class="w130">周报</td>
</tr>
</thead>
<tbody>
<% @results.each do |k,v|%>
<% if v[12] > 0 %>
<tr>
<td class="hidden dis p10" style="width:166px;"><%= v[:name] %></td>
<td class="w130"><%= v[12] %></td>
<td class="w130"><%= v[14] %></td>
<td class="w130"><%= v[16] %></td>
<td class="w130"><%= v[13] %></td>
<td class="w130"><%= v[15] %></td>
<td class="w130"><%= v[17] %></td>
</tr>
<% end %>
<% end %>
<tr>
<td class="hidden dis p10" style="width:166px;">Total</td>
<td class="w130"><%= @closetotal[0] %></td>
<td class="w130"><%= @closetotal[2] %></td>
<td class="w130"><%= @closetotal[4] %></td>
<td class="w130"><%= @closetotal[1] %></td>
<td class="w130"><%= @closetotal[3] %></td>
<td class="w130"><%= @closetotal[5] %></td>
</tr>
</tbody>
</table>

View File

@ -0,0 +1,37 @@
<table class="sy_new_table " cellpadding="0" cellspacing="0">
<thead>
<tr>
<td class="dis p10" style="width:166px;">指派给</td>
<td class="w130">所有</td>
<td class="w130">需求</td>
<td class="w130">任务</td>
<td class="w130">缺陷</td>
<td class="w130">支持</td>
<td class="w130">周报</td>
</tr>
</thead>
<tbody>
<% @results.each do |k,v|%>
<% if v[6] > 0 %>
<tr>
<td class="hidden dis p10" style="width:166px;"><%= v[:name] %></td>
<td class="w130"><%= v[6] %></td>
<td class="w130"><%= v[8] %></td>
<td class="w130"><%= v[10] %></td>
<td class="w130"><%= v[7] %></td>
<td class="w130"><%= v[9] %></td>
<td class="w130"><%= v[11] %></td>
</tr>
<% end %>
<% end %>
<tr>
<td class="hidden dis p10" style="width:166px;">Total</td>
<td class="w130"><%= @opentotal[0] %></td>
<td class="w130"><%= @opentotal[2] %></td>
<td class="w130"><%= @opentotal[4] %></td>
<td class="w130"><%= @opentotal[1] %></td>
<td class="w130"><%= @opentotal[3] %></td>
<td class="w130"><%= @opentotal[5] %></td>
</tr>
</tbody>
</table>

View File

@ -203,7 +203,7 @@
</script> </script>
<!--缺陷列表开始--> <!--缺陷列表开始-->
<div id="myissues_con" class="myissues_con "> <div id="myissues_con" class="myissues_con mb10">
<div class="clear mb5"> <div class="clear mb5">
<div class="issues_statistics fl clear"> <div class="issues_statistics fl clear">
<ul> <ul>