educode_sales 1.10.37 → 1.10.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/educode_sales/application_controller.rb +13 -0
  3. data/app/controllers/educode_sales/contracts_controller.rb +33 -3
  4. data/app/controllers/educode_sales/ideas_controller.rb +17 -7
  5. data/app/controllers/educode_sales/money_plan_records_controller.rb +14 -7
  6. data/app/controllers/educode_sales/money_plans_controller.rb +5 -1
  7. data/app/controllers/educode_sales/plans_controller.rb +14 -0
  8. data/app/controllers/educode_sales/sale_trends_controller.rb +82 -9
  9. data/app/controllers/educode_sales/teachers_controller.rb +7 -2
  10. data/app/helpers/educode_sales/sale_trends_helper.rb +410 -0
  11. data/app/views/educode_sales/businesses/index.html.erb +2 -2
  12. data/app/views/educode_sales/contracts/_list.html.erb +26 -2
  13. data/app/views/educode_sales/contracts/index.json.jbuilder +3 -1
  14. data/app/views/educode_sales/ideas/_index.html.erb +23 -2
  15. data/app/views/educode_sales/ideas/index.json.jbuilder +1 -1
  16. data/app/views/educode_sales/ideas/new.html.erb +11 -6
  17. data/app/views/educode_sales/money_plan_records/_index.html.erb +20 -7
  18. data/app/views/educode_sales/money_plan_records/index.json.jbuilder +3 -1
  19. data/app/views/educode_sales/money_plans/_index.html.erb +56 -42
  20. data/app/views/educode_sales/money_plans/index.json.jbuilder +3 -1
  21. data/app/views/educode_sales/plans/_target_track.html.erb +178 -0
  22. data/app/views/educode_sales/plans/index.html.erb +5 -0
  23. data/app/views/educode_sales/plans/target_track.js.erb +1 -0
  24. data/app/views/educode_sales/sale_trends/_return_money_forecast.html.erb +176 -0
  25. data/app/views/educode_sales/sale_trends/return_money_forecast.js.erb +1 -0
  26. data/app/views/educode_sales/sale_trends/trends.html.erb +6 -0
  27. data/app/views/educode_sales/teachers/_index.html.erb +21 -9
  28. data/config/routes.rb +2 -0
  29. data/lib/educode_sales/version.rb +1 -1
  30. metadata +10 -7
  31. data/app/assets/images/educode_sales/indexlogo.png +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b46b08f02fd4495dc7dcbe644409b09c38fd9936ce81c574d8747eadeb935dab
4
- data.tar.gz: 874c54125a516d0631812e60fb439418cf050550dfd40166777762d4e6b48221
3
+ metadata.gz: ee0e4fc5519c5e1dc171f8d0402f6f3e681e9b89636a7f424a642aaf88a23ce9
4
+ data.tar.gz: c060d33dfc08508f868182e5c3b8f8d780a20c03d8c300631a7a7c39316bfccc
5
5
  SHA512:
6
- metadata.gz: 6e3f554a6a434861cc05e461b6a7c9b9af265917f2fce21cc947fcf51d206de976fe8d7abe7f2684eaa075cc8f045d601535885dd0b64dbf61db7d9ae1552a8a
7
- data.tar.gz: aa3c405230daa0c34902d42a4d6e3fabfeea3b7c6be4611a4535a5dbdcf57f1921e906da9397e7fc3c1d6e0ef60985ef3bc39e632c2f0f190ef703d93c54413e
6
+ metadata.gz: 5d82966240ed50554d5525c93254d1f282fe9a604e350f9ae81309726187f43d419e9849b1047f6b996bd6bebd91c12d57b0ea1c9691e5913eb41a29da0df206
7
+ data.tar.gz: 433b7c1181791a6a47a5d35ff5df90363607e9d8c1592056d9fbf546b373c42a29d0bc67d92bdfc67b7f6f504970ff61edf55a2b5b992e3d993dc2fe3861cc14
@@ -41,6 +41,19 @@ module EducodeSales
41
41
  end
42
42
  end
43
43
 
44
+ def paginate(relation)
45
+ limit = params[:limit] || params[:per_page]
46
+ limit = (limit.to_i.zero? || limit.to_i > 100) ? 20 : limit.to_i
47
+ page = params[:page].to_i.zero? ? 1 : params[:page].to_i
48
+ offset = (page - 1) * limit
49
+
50
+ if relation.is_a?(Array)
51
+ relation[offset, limit]
52
+ else
53
+ relation.limit(limit).offset(offset)
54
+ end
55
+ end
56
+
44
57
 
45
58
 
46
59
  rescue_from CanCan::AccessDenied do |exception|
@@ -206,8 +206,8 @@ module EducodeSales
206
206
  @businesses = @businesses.order("educode_sales_businesses.created_at desc")
207
207
  end
208
208
 
209
-
210
- @businesses = @businesses.select("
209
+ if params[:page].present?
210
+ @businesses = @businesses.select("
211
211
  distinct
212
212
  educode_sales_businesses.*,
213
213
  last_follow.invitation_at,
@@ -237,8 +237,38 @@ module EducodeSales
237
237
  GROUP BY educode_sales_follow_ups.business_id
238
238
  ) AS total_follow_ups ON educode_sales_businesses.id = total_follow_ups.business_id
239
239
  ").includes(:users, last_follow_up: [:clazz, :assign_follow_ups]).page(params[:page]).per(params[:limit])
240
+ end
240
241
 
241
-
242
+ @businesses = @businesses.select("
243
+ distinct
244
+ educode_sales_businesses.*,
245
+ last_follow.invitation_at,
246
+ last_follow.budget_amount,
247
+ last_follow.o_business_deployment,
248
+ last_follow.service_time_long,
249
+ last_follow.service_end_time,
250
+ last_follow.service_start_time,
251
+ last_follow.reception_at,
252
+ last_follow.bidded_date,
253
+ last_follow.signed_date,
254
+ last_follow.year,
255
+ last_follow.created_at as latest_time,
256
+ last_follow.actual_amount,
257
+ last_follow.divide_rate,
258
+ last_follow.divide_amount,
259
+ (last_follow.total_amount - last_follow.actual_amount) as divide_money,
260
+ (last_follow.actual_amount - educode_sales_businesses.return_money) as wait_return_money,
261
+ last_follow.total_amount,
262
+ total_follow_ups.follow_ups_counts
263
+ ").joins("
264
+ LEFT JOIN educode_sales_follow_ups AS last_follow ON educode_sales_businesses.last_follow_up_id = last_follow.id AND last_follow.deleted_at IS NULL
265
+ LEFT JOIN (
266
+ SELECT COUNT(*) AS follow_ups_counts, educode_sales_follow_ups.business_id
267
+ FROM educode_sales_follow_ups
268
+ WHERE educode_sales_follow_ups.deleted_at IS NULL
269
+ GROUP BY educode_sales_follow_ups.business_id
270
+ ) AS total_follow_ups ON educode_sales_businesses.id = total_follow_ups.business_id
271
+ ").includes(:users, last_follow_up: [:clazz, :assign_follow_ups])
242
272
  end
243
273
  end
244
274
  end
@@ -44,6 +44,9 @@ module EducodeSales
44
44
  @sale_staff_arr = EducodeSales::Staff.joins(:user).where(id: sale_staff_ids).pluck("concat(users.lastname,users.firstname)", :id)
45
45
  filter = Filter.find_or_create_by(staff_id: @current_admin.id, clazz: "ideas")
46
46
  gon.filter = filter.extras || {}
47
+
48
+ #协助人
49
+ @assist_staffs = Staff.where.not(role_id: 11).includes(:user).map{ |d| {name: d.user.real_name, value: d.id}}
47
50
  end
48
51
  format.json do
49
52
  @ideas = params[:is_deleted].to_s == "true" ? Idea.deleted : Idea.not_deleted
@@ -54,14 +57,14 @@ module EducodeSales
54
57
  level = @current_admin.role.role_areas.find_by(clazz: '方案管理').try(:level)
55
58
  case level
56
59
  when '自己'
57
- idea_ids = @ideas.select { |d| Array(d.other_staff_ids).include?(@current_admin.id) || d.sale_staff_id == @current_admin.id || Array(d.assist_staff_ids).include?(@current_admin.id) || d.staff_id == @current_admin.id }.map { |d| d.id }
60
+ idea_ids = @ideas.select { |d| Array(d.other_staff_ids).include?(@current_admin.id.to_s) || d.sale_staff_id == @current_admin.id || Array(d.assist_staff_ids).include?(@current_admin.id.to_s) || d.staff_id == @current_admin.id }.map { |d| d.id }
58
61
  @ideas = @ideas.where("educode_sales_ideas.creator_id = ? OR educode_sales_ideas.id in (?)", @current_admin.id, idea_ids)
59
62
  when '区域'
60
63
  # 查看区域商机,需要排除掉其它人员手上的监管学校
61
64
  other_staff_school_id = EducodeSales::StaffSchool.where.not(staff_id: @current_admin.id).where("school_id IN (SELECT school_id FROM educode_sales_staff_schools WHERE staff_id = #{@current_admin.id}) IS NOT TRUE").distinct.pluck :school_id
62
65
 
63
66
  school_ids = School.where(province: @current_admin.areas.pluck(:name)).pluck(:id) + StaffSchool.where(staff_id: @current_admin.id).pluck(:school_id) - other_staff_school_id
64
- idea_ids = @ideas.select { |d| Array(d.other_staff_ids).include?(@current_admin.id) || d.sale_staff_id == @current_admin.id || Array(d.assist_staff_ids).include?(@current_admin.id) || d.staff_id == @current_admin.id }.map { |d| d.id }
67
+ idea_ids = @ideas.select { |d| Array(d.other_staff_ids).include?(@current_admin.id.to_s) || d.sale_staff_id == @current_admin.id || Array(d.assist_staff_ids).include?(@current_admin.id.to_s) || d.staff_id == @current_admin.id }.map { |d| d.id }
65
68
  @ideas = @ideas.left_joins(department: :school).where("schools.id in (?) OR educode_sales_ideas.creator_id = ? OR educode_sales_ideas.id in (?)", school_ids, @current_admin.id, idea_ids)
66
69
  else
67
70
  @ideas = @ideas
@@ -74,7 +77,7 @@ module EducodeSales
74
77
  @ideas = @ideas.where("educode_sales_ideas.created_at >= ? AND educode_sales_ideas.created_at <= ?", date[0] + " 00:00:00", date[1] + " 23:59:59")
75
78
  end
76
79
  if params[:q].present? && params[:q][:name].present?
77
- @ideas = @ideas.where("educode_sales_ideas.name like ?", "%#{params[:q][:name]}%")
80
+ @ideas = @ideas.joins(:business).where("educode_sales_ideas.name like ? or educode_sales_businesses.name like ?", "%#{params[:q][:name]}%", "%#{params[:q][:name]}%")
78
81
  end
79
82
  if params[:q].present? && params[:q][:school].present?
80
83
  @ideas = @ideas.left_joins(:school).where("schools.name like ?", "%#{params[:q][:school]}%")
@@ -109,7 +112,12 @@ module EducodeSales
109
112
  @ideas = @ideas.where(level: params[:q][:level])
110
113
  end
111
114
 
112
- @ideas = @ideas.page(params[:page]).per(params[:limit])
115
+ if params[:q].present? && params[:q][:assist_staffs].present?
116
+ @ideas = @ideas.select{|d| d&.assist_staff_ids.include?(params[:q][:assist_staffs])}
117
+ end
118
+ @ideas_count = @ideas.count
119
+
120
+ @ideas = paginate @ideas
113
121
  end
114
122
  end
115
123
  end
@@ -141,10 +149,11 @@ module EducodeSales
141
149
  other_staff_ids = Array(params[:other_staff_ids].to_s.split(","))
142
150
  if params[:business_id].present?
143
151
  idea.business_id = params[:business_id]
152
+ idea.school_id = idea.business&.department&.school_id
144
153
  elsif params[:school_id].present?
145
154
  idea.name = params[:project_name]
146
155
  end
147
- if params[:school_id].present?
156
+ if idea.school_id.blank?
148
157
  idea.school_id = params[:school_id]
149
158
  end
150
159
  idea.attachment_ids = attachment_ids
@@ -180,10 +189,11 @@ module EducodeSales
180
189
  # @idea.other_staff_ids = other_staff_ids
181
190
  if params[:business_id].present?
182
191
  @idea.business_id = params[:business_id]
192
+ @idea.school_id = @idea.business&.department&.school_id
183
193
  elsif params[:school_id].present?
184
194
  @idea.name = params[:project_name]
185
195
  end
186
- if params[:school_id].present?
196
+ if @idea.school_id.blank?
187
197
  @idea.school_id = params[:school_id]
188
198
  end
189
199
  check_changes
@@ -357,7 +367,7 @@ module EducodeSales
357
367
  params.permit(:name, :level, :staff_id,
358
368
  :status, :types, :model, :hardware, :project,
359
369
  :money, :end_time, :content, :department_id,
360
- :manager_name, :manager_phone, :school_name, :department_name, :attachment_id, :idea_type)
370
+ :manager_name, :manager_phone, :school_name, :department_name, :attachment_id, :idea_type, :school_id, :business_id)
361
371
  end
362
372
 
363
373
  def find_idea
@@ -18,6 +18,7 @@ module EducodeSales
18
18
  format.json do
19
19
  @money_plan_records = MoneyPlanRecord.left_joins(:money_plan_claims).group("educode_sales_money_plan_records.id").select("educode_sales_money_plan_records.*, COUNT(educode_sales_money_plan_claims.id) AS claim_num")
20
20
  if @current_admin.is_admin?
21
+ @money_plan_records = @money_plan_records
21
22
  else
22
23
  level = @current_admin.role.role_areas.find_by(clazz: '回款管理').level
23
24
  case level
@@ -79,7 +80,11 @@ module EducodeSales
79
80
  else
80
81
  @money_plan_records = @money_plan_records.order(created_at: :desc)
81
82
  end
82
- @money_plan_records = @money_plan_records.page(params[:page]).per(params[:limit])
83
+
84
+ if params[:page].present?
85
+ @money_plan_records = @money_plan_records.page(params[:page]).per(params[:limit])
86
+ end
87
+ @money_plan_records = @money_plan_records
83
88
  end
84
89
  end
85
90
  end
@@ -195,12 +200,14 @@ module EducodeSales
195
200
  key_person.save
196
201
  end
197
202
 
198
- last_follow_up.money_plans.each do |d|
199
- money = d.dup
200
- money.staff = @current_admin
201
- money.follow_up_id = follow_up.id
202
- money.save
203
- end
203
+ # last_follow_up.money_plans.each do |d|
204
+ # money = d.dup
205
+ # money.staff = @current_admin
206
+ # money.follow_up_id = follow_up.id
207
+ # money.save
208
+ # end
209
+ # 上次的回款计划的跟进也要同步到最新的跟进id,不然回款计划列表会找不到
210
+ EducodeSales::MoneyPlan.where(business_id: d.id, id: params[:money_plan_ids]).update_all(follow_up_id: follow_up.id)
204
211
 
205
212
  # 合同里签到日期全同步到最新跟进
206
213
  last_follow_up.contract_date_lists.update_all(follow_up_id: follow_up.id)
@@ -59,7 +59,11 @@ module EducodeSales
59
59
  else
60
60
  @money_plans = @money_plans.order(date_at: :desc)
61
61
  end
62
- @money_plans = @money_plans.page(params[:page]).per(params[:limit])
62
+
63
+ if params[:page].present?
64
+ @money_plans = @money_plans.page(params[:page]).per(params[:limit])
65
+ end
66
+ @money_plans = @money_plans
63
67
  end
64
68
  end
65
69
  end
@@ -510,6 +510,20 @@ module EducodeSales
510
510
  @months = (1..12).map { |d| d }
511
511
  end
512
512
 
513
+
514
+ def target_track
515
+ respond_to do |format|
516
+ format.html do
517
+
518
+ end
519
+ format.js do
520
+ common = Common.find_by(clazz: 'staff_type', name: '销售')
521
+ @staffs = Staff.joins(:user).where(job_type: common.id).map { |d| [d.user.real_name, d.id]}
522
+ gon.school_tags = SchoolTag.where(for_missions: true).map { |d| {value: d.id, name: d.name } }
523
+ end
524
+ end
525
+ end
526
+
513
527
  private
514
528
 
515
529
  def plan_params
@@ -418,6 +418,15 @@ module EducodeSales
418
418
  end
419
419
  end
420
420
 
421
+ #回款预测图
422
+ def return_money_forecast
423
+ respond_to do |format|
424
+ format.js do
425
+ return_forecast_by_money
426
+ end
427
+ end
428
+ end
429
+
421
430
  def user_stat
422
431
  respond_to do |format|
423
432
  format.html do
@@ -537,7 +546,7 @@ module EducodeSales
537
546
  data_1_hash = {}
538
547
  data_1_total_hash = {}
539
548
  data_1.each do |d|
540
- data_1_hash[d.month] = d.count_type.round(2)
549
+ data_1_hash[d.month] = d.count_type ? d.count_type.round(2) : 0
541
550
  end
542
551
 
543
552
  last_month = 0
@@ -577,10 +586,14 @@ module EducodeSales
577
586
  last_month = month.split("-")[0]
578
587
  end
579
588
 
580
- data_3 = business.joins(last_follow_up: :money_plans).
581
- where("educode_sales_follow_ups.clazz_id != ?", x).
582
- where.not("educode_sales_money_plans.clazz!= ?", 1).
583
- where("educode_sales_money_plans.date_at >= ? AND educode_sales_money_plans.date_at <= ?", begin_at, end_at).
589
+ data_3 = EducodeSales::MoneyPlanRecord.from("(
590
+ SELECT distinct(educode_sales_money_plan_records.id), educode_sales_money_plan_records.amount, date_at
591
+ FROM educode_sales_money_plan_records
592
+ JOIN educode_sales_money_plan_claims ON educode_sales_money_plan_claims.money_plan_record_id = educode_sales_money_plan_records.id
593
+ GROUP BY educode_sales_money_plan_records.id
594
+ ) AS educode_sales_money_plan_records
595
+ ").
596
+ where("educode_sales_money_plan_records.date_at >= ? AND educode_sales_money_plan_records.date_at <= ? ", begin_at, end_at).
584
597
  select("SUM(amount) AS count_type, DATE_FORMAT(date_at, '%Y-%m') AS month").
585
598
  group("DATE_FORMAT(date_at, '%Y-%m')").
586
599
  order("DATE_FORMAT(date_at, '%Y-%m')")
@@ -692,10 +705,14 @@ module EducodeSales
692
705
  last_month = month.split("-")[0]
693
706
  end
694
707
 
695
- data_3 = EducodeSales::Business.joins(last_follow_up: :money_plans).
696
- where("educode_sales_follow_ups.clazz_id != ?", x).
697
- where.not("educode_sales_money_plans.clazz!= ?", 1).
698
- where("educode_sales_money_plans.date_at >= ? AND educode_sales_money_plans.date_at <= ?", begin_at, end_at).
708
+ data_3 = EducodeSales::MoneyPlanRecord.from("(
709
+ SELECT distinct(educode_sales_money_plan_records.id), educode_sales_money_plan_records.amount, date_at
710
+ FROM educode_sales_money_plan_records
711
+ JOIN educode_sales_money_plan_claims ON educode_sales_money_plan_claims.money_plan_record_id = educode_sales_money_plan_records.id
712
+ GROUP BY educode_sales_money_plan_records.id
713
+ ) AS educode_sales_money_plan_records
714
+ ").
715
+ where("educode_sales_money_plan_records.date_at >= ? AND educode_sales_money_plan_records.date_at <= ? ", begin_at, end_at).
699
716
  select("SUM(amount) AS count_type, DATE_FORMAT(date_at, '%Y') AS year").
700
717
  group("DATE_FORMAT(date_at, '%Y')").
701
718
  order("DATE_FORMAT(date_at, '%Y')")
@@ -919,5 +936,61 @@ module EducodeSales
919
936
 
920
937
  visit_analysis_charts(visit_count_year, visit_count_season, visit_count_month, visit_count_week, visit_type, title_names)
921
938
  end
939
+
940
+
941
+ def return_forecast_by_money
942
+ property = params[:property] || nil
943
+ staff_id = params[:staff_id] || nil
944
+ @forecast_count_range = params[:forecast_count_range] || "month"
945
+ forecast_default_dates = ("#{Time.now.year}-01-01".to_date.."#{Time.now.year}-#{Time.now.month}-01".to_date).map { |d| d.strftime("%Y-%m") }.uniq
946
+ sale_names = %w[实际回款额 计划回款额 实际回款 计划回款额-全部 计划回款额-o类]
947
+ case @forecast_count_range
948
+ when "week"
949
+ # 年初第一天周数是0会导致周数重复计算
950
+ if params[:forecast_date_day].present?
951
+ date = params[:forecast_date_day].split(" - ")
952
+ dates = (date[0].to_date..date[1].to_date).map { |d| d.strftime("%Y-%W") }.uniq.select { |d| d.split("-")[1] != '00' }
953
+ @return_forecast_count_data = return_money_forecast_week(dates, sale_names, staff_id, property)
954
+ else
955
+ forecast_default_dates = ("#{Time.now.year}-01-01".to_date.."#{Time.now.year}-#{Time.now.month}-01".to_date).map { |d| d.strftime("%Y-%W") }.uniq.select { |d| d.split("-")[1] != '00' }
956
+ @return_forecast_count_data = return_money_forecast_week(forecast_default_dates, sale_names, staff_id, property)
957
+ end
958
+ when "quarter"
959
+ # 按年
960
+ if params[:forecast_date_year].present?
961
+ date = params[:forecast_date_year].split(" - ")
962
+ dates = (date[0]..date[1]).to_a
963
+ dates = dates.map { |d| [d.to_s + "-" + "1", d.to_s + "-" + "2", d.to_s + "-" + "3", d.to_s + "-" + "4"] }.flatten
964
+ @return_forecast_count_data = return_money_forecast_quarter(dates, sale_names, staff_id, property)
965
+ else
966
+ forecast_default_dates = ("#{Time.now.year}-01-01".to_date.."#{Time.now.year}-#{Time.now.month}-01".to_date).map { |d| d.strftime("%Y") }.uniq
967
+ forecast_default_dates = forecast_default_dates.map { |d| [d.to_s + "-" + "1", d.to_s + "-" + "2", d.to_s + "-" + "3", d.to_s + "-" + "4"] }.flatten
968
+ @return_forecast_count_data = return_money_forecast_quarter(forecast_default_dates, sale_names, staff_id, property)
969
+ end
970
+ when "month" # 按月
971
+ if params[:forecast_date_month].present?
972
+ date = params[:forecast_date_month].split(" - ")
973
+ date[0] = (date[0] + "-01").to_date.to_s
974
+ date[1] = (date[1] + "-01").to_date.end_of_month.to_s
975
+ dates = ((date[0] + "-01").to_date..(date[1] + "-01").to_date).map { |d| d.strftime("%Y-%m") }.uniq
976
+ @return_forecast_count_data = return_money_forecast_month(dates, sale_names, staff_id, property)
977
+ else
978
+ @return_forecast_count_data = return_money_forecast_month(forecast_default_dates, sale_names, staff_id, property)
979
+ end
980
+ else
981
+ # 按年
982
+ if params[:forecast_date_year].present?
983
+ date = params[:forecast_date_year].split(" - ")
984
+ dates = (date[0]..date[1]).to_a
985
+ @return_forecast_count_data = return_money_forecast_year(dates, sale_names, staff_id, property)
986
+ else
987
+ forecast_default_dates = ("#{Time.now.year}-01-01".to_date.."#{Time.now.year}-#{Time.now.month}-01".to_date).map { |d| d.strftime("%Y") }.uniq
988
+ @return_forecast_count_data = return_money_forecast_year(forecast_default_dates, sale_names, staff_id, property)
989
+ end
990
+ end
991
+ @return_forecast_count_data_0 = @return_forecast_count_data[0]
992
+ @return_forecast_count_data_1 = @return_forecast_count_data[1]
993
+ end
994
+
922
995
  end
923
996
  end
@@ -204,7 +204,7 @@ module EducodeSales
204
204
  end
205
205
 
206
206
  if params[:q].present? && params[:q][:is_contact].present?
207
- @teachers = @teachers.where("last_follow.is_contact = ?" , params[:q][:is_contact].to_i)
207
+ @teachers = @teachers.where("last_follow.is_contact = ?", params[:q][:is_contact].to_i)
208
208
  end
209
209
 
210
210
  if params[:sort].present? && params[:sort][:field]
@@ -212,7 +212,12 @@ module EducodeSales
212
212
  else
213
213
  @teachers = @teachers.order("educode_sales_teachers.created_at desc")
214
214
  end
215
- @teachers = @teachers.page(params[:page]).per(params[:limit])
215
+ @teachers = @teachers.includes(:teacher_assign_follows, :department, :user, :follow_up, :activity_teachers, [assign_staffs: :staff])
216
+ if params[:type].to_s == 'export'
217
+ @teachers = @teachers.page(1).per(1000)
218
+ else
219
+ @teachers = @teachers.page(params[:page]).per(params[:limit])
220
+ end
216
221
  end
217
222
 
218
223
  end