From fde54cd39d99d6b087301a9d0b38c5a5291ce3d4 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 5 Mar 2020 00:41:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=AA=E8=83=BD=E6=8C=89=E7=9C=81=E4=BB=BD?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admins/user_schools_statistics/index.js | 10 ++++++++-- .../admins/user_schools_statistics_controller.rb | 2 +- app/queries/admins/user_schools_statistic_query.rb | 1 - 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/admins/user_schools_statistics/index.js b/app/assets/javascripts/admins/user_schools_statistics/index.js index b65318f83..1d084ff25 100644 --- a/app/assets/javascripts/admins/user_schools_statistics/index.js +++ b/app/assets/javascripts/admins/user_schools_statistics/index.js @@ -63,12 +63,18 @@ $(document).on('turbolinks:load', function() { // 导出 $('.export-action').on('click', function(){ - var form = $(".user-schools-statistic-list-form .search-form") + var form = $(".user-schools-statistic-list-form") var exportLink = $(this); var date = form.find("select[name='date']").val(); var schoolId = form.find('input[name="school_id"]').val(); + var province = form.find('input[name="province"]').val(); + console.log(province) + if(province == "" || province == null){ + alert("只能按省份导出"); + return; + } - var url = exportLink.data("url").split('?')[0] + "?date=" + date + "&school_id=" + schoolId; + var url = exportLink.data("url").split('?')[0] + "?date=" + date + "&school_id=" + schoolId + "&province=" + province; window.open(url); }); } diff --git a/app/controllers/admins/user_schools_statistics_controller.rb b/app/controllers/admins/user_schools_statistics_controller.rb index 38e966880..4269804df 100644 --- a/app/controllers/admins/user_schools_statistics_controller.rb +++ b/app/controllers/admins/user_schools_statistics_controller.rb @@ -1,7 +1,7 @@ class Admins::UserSchoolsStatisticsController < Admins::BaseController def export - params[:per_page] = 50 + params[:per_page] = 500 _count, @schools = Admins::UserSchoolsStatisticQuery.call(params) filename = ['用户运营统计', Time.zone.now.strftime('%Y%m%d%H%M%S')].join('-') << '.xlsx' diff --git a/app/queries/admins/user_schools_statistic_query.rb b/app/queries/admins/user_schools_statistic_query.rb index 25551fc77..a29f07afd 100644 --- a/app/queries/admins/user_schools_statistic_query.rb +++ b/app/queries/admins/user_schools_statistic_query.rb @@ -80,7 +80,6 @@ class Admins::UserSchoolsStatisticQuery < ApplicationQuery user_active_count: user_e_map.fetch(school.id, 0) } end - schools end