数据的调整

This commit is contained in:
cxt 2018-05-08 16:25:59 +08:00
parent 5dd5192822
commit 2a8aad92d6
7 changed files with 19 additions and 2 deletions

View File

@ -2,6 +2,8 @@
class StatisticsController < ApplicationController
# GET /statistics
# GET /statistics.json
include StatisticsHelper
layout 'base_statistic'
before_filter :get_date, :only => [:index, :new]
before_filter :require_login
@ -23,6 +25,7 @@ class StatisticsController < ApplicationController
end
end
@statistics_count = @statistics.count
@data_size = data_format_string @statistics.map{|s| s.file_size}.sum
@limit = 10
@is_remote = true
@statistics_pages = Paginator.new @statistics_count, @limit, params['page'] || 1

View File

@ -1,3 +1,12 @@
module StatisticsHelper
include AttachmentsHelper
def data_format_string num
result = num
if num < 1024 * 1024
result = format("%0.3f", (num/1024)) + " GB"
else
result = format("%0.3f", (num/(1024*1024))) + " TB"
end
end
end

View File

@ -32,7 +32,7 @@
</div>
<div class="field line_field">
<label class="field_lab">数据大小:</label>
<%= f.text_field :file_size, :class => "fl with30" %><span class="fl ml10 mt10 color-grey" style="color:#888!important">Mb</span>
<%= f.text_field :file_size, :class => "fl with30" %><span class="fl ml10 mt10 color-grey" style="color:#888!important">MB</span>
<p class="cl" style="padding-left: 10%;color: red;height: 20px"><span id="input_file_size_notice" class="none">请输入正数</span></p>
</div>

View File

@ -26,6 +26,10 @@
<div class="postSort" id="popu"><a href="javascript:void(0);" class="linkGrey2 fl">大小</a><a href="javascript:void(0);" id="reorder_popu" class=""></a></div>
</div>
</div>
<div class="fr data_name" style="width: 150px;">
<span class="fl">数据总量:</span>
<span id="data_size" class="fl numRed"><%= @data_size %></span>
</div>
<!--<div class="fr hw_search_box">
<div class="mr30"><input type="text" placeholder="请输入关键字进行搜索" id="search_input"/><a class="f20 fr" onclick="clear_search();">×</a></div>
<a href="javascript:void(0);" class="hw_btn_search mt3" onclick="remote_function();"></a>

View File

@ -2,4 +2,5 @@
$("#sub_categories_list").html('<%= j(render :partial => "sub_categories_list") %>');
<% end %>
$("#search_count").html(<%= @statistics_count %>);
$("#data_size").html(<%= @data_size %>);
$("#statistics_list").html("<%= j(render :partial => "statistics_list") %>");

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 46 KiB

View File

@ -976,7 +976,7 @@ a.syllabusbox_a_blue{ color:#3b94d6;}
.data_line span.active{background: #3B94D6;color: #FFFFFF}
.data_line a.arrary{height: 30px;line-height: 30px;font-size: 14px;margin-right: 20px;margin-top: 5px;float: left;width: 40px;color: #333}
.data_line a.active{color:#3B94D6 }
.send_statistic{background: #60B25E;border-radius: 4px;padding: 5px 15px;color: #FFFFFF!important;font-size: 15px}
.send_statistic{background: #3B94D6;border-radius: 4px;padding: 5px 15px;color: #FFFFFF!important;font-size: 15px}
.data_list_item{background: #FFFFFF;margin-bottom: 10px;padding: 15px 15px;border: 1px solid #DDDDDD;display: flex;position: relative}
.data_list_item img{border-radius: 50%;height: 50px;margin-right: 20px}
.data_itemMain{flex: 1}