educode_sales 0.9.16 → 0.9.18

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6356a47918d891333b14e6db67f9e7fbf45ff008c04cb06ec89f7a5ea1dd34cf
4
- data.tar.gz: 55aaca16b358087288298d0abbaf579340b4dd5dc2b53b39c4a6d1cb80b31c26
3
+ metadata.gz: 401a52833b246003026eafddf61ee59f1303a01632bb6f57ac9453a962599eec
4
+ data.tar.gz: 7553aae8c2a7158ed0e4326faa7377fc015bb2312fe42dfab7e796cc50f6218b
5
5
  SHA512:
6
- metadata.gz: 8f8f2febaa9f93c3ce44766b4ddc45930db17c21c405ebe542f0e7c4ca862c6f3c7840c5b02b5e06efdea128411ef8ab40cb64105f3f32cde31aeafe35e9afea
7
- data.tar.gz: 8556d4243ffc1208725c7ec4e7a59f83b11088d9b064b20d36ba238a05e90536ac885cc53c76dd8e1b9f79f3e5290fa00ff9b9c20bfcb0b4d104d6fa8adb496d
6
+ metadata.gz: 42f17f4136cb57ff0b3811bd7d1e938421918eb7bb9708760b7adea13a38e3c4c29a0ca5874abf6c2a7d2d61df7ae6c30aae3e38ce3279a989f1d190055ed0eb
7
+ data.tar.gz: ede1c33e7159390055a461a2fb1c726ce467004c52094457562590ffee6b2b80da8630cd27b33bd5c489c0a82dc0806714048b299a7e4fb88e0c5171fdc90406
@@ -314,4 +314,9 @@ td .layui-table-cell .layui-form-select {
314
314
  position: absolute;
315
315
  top: 5px;
316
316
  left: -10px;
317
+ }
318
+
319
+ .layui-btn.selected-btn {
320
+ color: #fff !important;
321
+ background: #009688;
317
322
  }
@@ -10,7 +10,7 @@ module EducodeSales
10
10
  respond_to do |format|
11
11
  format.html do
12
12
  common = Common.find_by(clazz: 'staff_type', name: '销售')
13
- @staffs = Staff.joins(:user).where(job_type: common.id).map { |d| [d.user.real_name, d.id]} # [[], [], ............]
13
+ @staffs = Staff.joins(:user).where(job_type: common.id).where.not(role_id: 11).map { |d| [d.user.real_name, d.id]} # [[], [], ............]
14
14
  # @more = can?(:create, EducodeSales::SalePlan) || can?(:update, EducodeSales::Business) || can?(:destroy, EducodeSales::Business) || can?(:show_file, EducodeSales::Business)
15
15
  @more = true
16
16
  gon.menus = []
@@ -155,13 +155,6 @@ module EducodeSales
155
155
  @businesses = @businesses
156
156
  end
157
157
 
158
- if params[:q].present? && params[:q][:mine].present?
159
- ids = AssignFollowUp.where(staff_id: @current_admin.id).pluck(:follow_up_id)
160
- ids1 = FollowUp.where(id: ids).pluck(:business_id)
161
- @businesses =@businesses.where("educode_sales_businesses.id in (?) or educode_sales_businesses.staff_id = ?", ids1, @current_admin.id)
162
- end
163
-
164
- @businesses = @businesses
165
158
  if params[:q].present? && params[:q][:name].present? && params[:q][:name] != "(销售态势-" + @year + "-已中标商机)" && params[:q][:name] != "(销售态势-" + @year + "-已签单商机)" && params[:q][:name] != "(销售态势-" + @year + "-已回款商机)" && params[:q][:name] != "(销售态势-" + @year + "-现有商机)" && params[:q][:name] != "(销售态势-" + @year + "-应收款商机)"
166
159
  @businesses = @businesses.where("educode_sales_businesses.name like ?", "%#{params[:q][:name]}%")
167
160
  end
@@ -237,8 +230,19 @@ module EducodeSales
237
230
  @businesses = @businesses.where("number like :data", data: "%#{params[:q][:number].strip}%")
238
231
  end
239
232
 
233
+ if params[:q][:clazz].present?
234
+ # 我的关注
235
+ if params[:q][:clazz] == 'followes'
236
+ my_ids = BusinessRelationShip.where(user_id:@current_admin.user_id).pluck(:business_id)
237
+ @businesses = @businesses.where(id: my_ids)
238
+ elsif params[:q][:clazz] == 'me'
239
+ ids = AssignFollowUp.joins("JOIN educode_sales_follow_ups ON educode_sales_follow_ups.id = educode_sales_assign_follow_ups.follow_up_id").where(staff_id: @current_admin.id).pluck(:business_id)
240
+ @businesses = @businesses.where("educode_sales_businesses.id in (?) or educode_sales_businesses.staff_id = ?", ids, @current_admin.id)
241
+ end
242
+ end
243
+
240
244
  if params[:sort].present? && params[:sort][:field]
241
- if params[:sort][:field] = "service_end_time"
245
+ if params[:sort][:field] == "service_end_time"
242
246
  @businesses = @businesses.order("service_time_long #{params[:sort][:order]}")
243
247
  else
244
248
  @businesses = @businesses.order("#{params[:sort][:field]} #{params[:sort][:order]}")
@@ -274,6 +278,17 @@ module EducodeSales
274
278
 
275
279
  def daily_paper
276
280
  @followups = EducodeSales::FollowUp.where(staff_id: @current_admin.id).where("updated_at > ?", Time.now.beginning_of_day).order("updated_at")
281
+ ab = EducodeSales::Common.where(extras: [EducodeSales::Common::ATYPE, EducodeSales::Common::BTYPE]).pluck(:id)
282
+ business = EducodeSales::FollowUp.joins("
283
+ JOIN educode_sales_businesses ON educode_sales_businesses.id = educode_sales_follow_ups.business_id
284
+ JOIN educode_sales_follow_ups AS last_up ON last_up.id = educode_sales_businesses.last_follow_up_id
285
+ ").where("educode_sales_businesses.staff_id = ? AND educode_sales_follow_ups.staff_id = ? AND last_up.clazz_id IN (?)", @current_admin.id, @current_admin.id, ab)
286
+
287
+
288
+ @month = business.where("educode_sales_follow_ups.created_at >= ?", Time.now.beginning_of_month).group("educode_sales_follow_ups.business_id").select("COUNT(DISTINCT(educode_sales_follow_ups.business_id)) AS num")
289
+ @quarter = business.where("educode_sales_follow_ups.created_at >= ?", Time.now.beginning_of_quarter).group("educode_sales_follow_ups.business_id").select("COUNT(DISTINCT(educode_sales_follow_ups.business_id)) AS num")
290
+ @year = business.where("educode_sales_follow_ups.created_at >= ?", Time.now.beginning_of_year).group("educode_sales_follow_ups.business_id").select("COUNT(DISTINCT(educode_sales_follow_ups.business_id)) AS num")
291
+
277
292
  render layout: false
278
293
  end
279
294
 
@@ -243,7 +243,7 @@ module EducodeSales
243
243
  # o类商机增加编号
244
244
  def add_business_number
245
245
  # test数据库中 o类商机id=74 pre与线上o类商机=77
246
- if ( @business.number.blank?) && Common.find_by(extras: "o_class")
246
+ if ( @business.number.blank?) && params[:clazz_id].to_i == Common.find_by(extras: "o_class").id
247
247
  totual_count = EducodeSales::Business.unscoped.where("number like :data",data: "#{Time.now.year}%").count + 1 + Time.now.year*1000.to_i
248
248
  @business_number_record = BusinessNumberRecord.find_or_create_by(id: 1)
249
249
  while @business_number_record.value.include?(totual_count) || Business.pluck(:number).include?(totual_count.to_s)
@@ -414,7 +414,7 @@ module EducodeSales
414
414
  if last_month != month.split("-")[0]
415
415
  last_sum = 0
416
416
  end
417
- data_1_total_hash[month] = (data_1_hash[month] || 0) + last_sum
417
+ data_1_total_hash[month] = ((data_1_hash[month] || 0) + last_sum).round(2)
418
418
  last_sum += data_1_hash[month] || 0
419
419
  last_month = month.split("-")[0]
420
420
  end
@@ -439,7 +439,7 @@ module EducodeSales
439
439
  if last_month != month.split("-")[0]
440
440
  last_sum = 0
441
441
  end
442
- data_2_total_hash[month] = (data_2_hash[month] || 0) + last_sum
442
+ data_2_total_hash[month] = ((data_2_hash[month] || 0) + last_sum).round(2)
443
443
  last_sum += data_2_hash[month] || 0
444
444
  last_month = month.split("-")[0]
445
445
  end
@@ -464,7 +464,7 @@ module EducodeSales
464
464
  if last_month != month.split("-")[0]
465
465
  last_sum = 0
466
466
  end
467
- data_3_total_hash[month] = (data_3_hash[month] || 0) + last_sum
467
+ data_3_total_hash[month] = ((data_3_hash[month] || 0) + last_sum).round(2)
468
468
  last_sum += data_3_hash[month] || 0
469
469
  last_month = month.split("-")[0]
470
470
  end
@@ -529,7 +529,7 @@ module EducodeSales
529
529
  if last_month != month.split("-")[0]
530
530
  last_sum = 0
531
531
  end
532
- data_1_total_hash[month] = (data_1_hash[month] || 0) + last_sum
532
+ data_1_total_hash[month] = ((data_1_hash[month] || 0) + last_sum).round(2)
533
533
  last_sum += data_1_hash[month] || 0
534
534
  last_month = month.split("-")[0]
535
535
  end
@@ -554,7 +554,7 @@ module EducodeSales
554
554
  if last_month != month.split("-")[0]
555
555
  last_sum = 0
556
556
  end
557
- data_2_total_hash[month] = (data_2_hash[month] || 0) + last_sum
557
+ data_2_total_hash[month] = ((data_2_hash[month] || 0) + last_sum).round(2)
558
558
  last_sum += data_2_hash[month] || 0
559
559
  last_month = month.split("-")[0]
560
560
  end
@@ -580,7 +580,7 @@ module EducodeSales
580
580
  last_sum = 0
581
581
  end
582
582
 
583
- data_3_total_hash[month] = (data_3_hash[month] || 0) + last_sum
583
+ data_3_total_hash[month] = ((data_3_hash[month] || 0) + last_sum).round(2)
584
584
  last_sum += data_3_hash[month] || 0
585
585
  last_month = month.split("-")[0]
586
586
  end
@@ -1,15 +1,23 @@
1
1
  <div style="padding: 15px;" id="day_content">
2
- <h2>今日跟进动态</h2>
2
+ <h2>今日工作报告</h2>
3
3
  <hr>
4
- <div style="height: 480px;overflow: auto;">
4
+ <div style="height: 450px;overflow: auto;">
5
5
  <% text = "\n" %>
6
6
  <% @followups.each_with_index do |d, i| %>
7
7
  <% text += "#{i+1}、**学校--**商机:#{d .description}\n" %>
8
8
  <p style="margin-bottom: 10px;"><%= i+1 %>、**学校--**商机:<%= d .description%></p>
9
9
  <% end %>
10
+ <% text += "本月开拓A、B类商机数:#{@month[0]&.[]('num') || 0 } \n"%>
11
+ <% text += "本季开拓A、B类商机数:#{@quarter[0]&.[]('num') || 0 } \n"%>
12
+ <% text += "本年开拓A、B类商机数:#{@year[0]&.[]('num') || 0 } \n"%>
13
+ <p style="margin-bottom: 10px;">本月开拓A、B类商机数:<span style="color: rgb(56, 150, 243);font-weight: bold;"><%= @month[0]&.[]('num') || 0 %></span></p>
14
+ <p style="margin-bottom: 10px;">本季开拓A、B类商机数:<span style="color: rgb(56, 150, 243);font-weight: bold;"><%= @quarter[0]&.[]('num') || 0 %></span></p>
15
+ <p style="margin-bottom: 10px;">本年开拓A、B类商机数:<span style="color: rgb(56, 150, 243);font-weight: bold;"><%= @year[0]&.[]('num') || 0 %></span></p>
10
16
  </div>
11
17
 
12
18
  <div id="content" style="display: none;" data-content="今日跟进动态<%=text %>"></div>
19
+ <p>头歌营销系统</p>
20
+ <p><%= Time.now.to_s %></p>
13
21
  <button type="button" onclick="copy()" style=" margin-right: 20px; float: right;" class="layui-btn layui-btn-primary">复制</button>
14
22
  </div>
15
23
  <script>
@@ -110,9 +110,9 @@
110
110
  <% if can? :create, EducodeSales::Business %>
111
111
  <button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="add"> 添加商机</button>
112
112
  <% end %>
113
- <button class="layui-btn layui-btn-primary layui-border-green layui-btn-sm pull-right" lay-event="followes"> 我的关注</button>
114
- <button class="layui-btn layui-btn-primary layui-border-green layui-btn-sm pull-right" lay-event="mine"> 我的商机</button>
115
- <button class="layui-btn layui-btn-primary layui-border-green layui-btn-sm pull-right" lay-event="all"> 全部商机</button>
113
+ <button class="layui-btn layui-btn-primary layui-border-green layui-btn-sm pull-right at-btn" lay-event="followes"> 我的关注</button>
114
+ <button class="layui-btn layui-btn-primary layui-border-green layui-btn-sm pull-right my-btn" lay-event="mine"> 我的商机</button>
115
+ <button class="layui-btn layui-btn-primary layui-border-green layui-btn-sm pull-right all-btn" lay-event="all"> 全部商机</button>
116
116
  </div>
117
117
  </script>
118
118
  <script type="text/html" id="currentTableBar">
@@ -375,13 +375,6 @@
375
375
  sort: true,
376
376
  hide: gon.filter.bidded_date
377
377
  },
378
- {
379
- field: 'budget_money',
380
- width: 105,
381
- title: '预算金额',
382
- sort: true,
383
- hide: gon.filter.budget_money
384
- },
385
378
  {
386
379
  field: 'signed_date',
387
380
  width: 105,
@@ -410,6 +403,13 @@
410
403
  sort: true,
411
404
  hide: gon.filter.o_business_deployment
412
405
  },
406
+ {
407
+ field: 'budget_money',
408
+ width: 105,
409
+ title: '预算金额',
410
+ sort: true,
411
+ hide: gon.filter.budget_money
412
+ },
413
413
  {
414
414
  field: 'total_amount',
415
415
  width: 100,
@@ -776,6 +776,7 @@
776
776
  }
777
777
  function time_line(id,name) {
778
778
  business_id = id
779
+ business_name = name;
779
780
  var content = miniPage.getHrefContent('/missions/businesses/time_line?business_id=' + id);
780
781
  var openWH = miniPage.getOpenWidthHeight();
781
782
  sindex = layer.open({
@@ -867,6 +868,9 @@
867
868
  data.field.place_id = index_place_list.getValue('valueStr');
868
869
  data.field.business_type = business_type.toString();
869
870
  data.field.business_step = business_step.toString();
871
+ if (search['clazz']) {
872
+ data.field['clazz'] = search['clazz']
873
+ }
870
874
  search = data.field
871
875
  table.reload('businesses_table', {
872
876
  url: '/missions/businesses',
@@ -884,6 +888,13 @@
884
888
  form.val('search_follows', {
885
889
  name: data.field.name, department: data.field.department, staff_id: data.field.staff_id, area: data.field.area
886
890
  })
891
+ if (search['clazz'] == 'me') {
892
+ $(".my-btn").addClass("selected-btn");
893
+ } else if (search['clazz'] == 'followes') {
894
+ $(".at-btn").addClass("selected-btn");
895
+ } else {
896
+ $(".all-btn").addClass("selected-btn");
897
+ }
887
898
  return false;
888
899
  });
889
900
 
@@ -966,11 +977,13 @@
966
977
  name: '', department: '', staff_id: '', business_type: '', business_step: '',
967
978
  place_id: '', date: '', area: ''
968
979
  })
980
+ $(".all-btn").addClass("selected-btn");
969
981
  return false;
970
982
  } else if (obj.event === 'followes') {
971
- search = {"all":"1"}
983
+ search = {"all":"1", clazz: 'followes'}
984
+ business_type_list.setValue([])
972
985
  table.reload('businesses_table', {
973
- url: '/missions/businesses/following_businesses',
986
+ url: '/missions/businesses',
974
987
  page: {
975
988
  curr: 1
976
989
  },
@@ -980,10 +993,12 @@
980
993
  name: '', department: '', staff_id: '', business_type: '', business_step: '',
981
994
  place_id: '', date: '', area: ''
982
995
  })
996
+ $(".at-btn").addClass("selected-btn");
983
997
  return false;
984
998
  }
985
999
  else if (obj.event === 'mine') {
986
- search = {"mine":"1"}
1000
+ search = {"clazz":"me"}
1001
+ business_type_list.setValue([])
987
1002
  table.reload('businesses_table', {
988
1003
  url: '/missions/businesses',
989
1004
  page: {
@@ -995,6 +1010,7 @@
995
1010
  name: '', department: '', staff_id: '', business_type: '', business_step: '',
996
1011
  place_id: '', date: '', area: ''
997
1012
  })
1013
+ $(".my-btn").addClass("selected-btn");
998
1014
  return false;
999
1015
  }
1000
1016
  else if (obj.event === 'delete') {
@@ -0,0 +1,5 @@
1
+ class DeleteBusinessNumber < ActiveRecord::Migration[5.2]
2
+ def change
3
+ EducodeSales::Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != 77").update_all("educode_sales_businesses.number = null")
4
+ end
5
+ end
@@ -1,3 +1,3 @@
1
1
  module EducodeSales
2
- VERSION = '0.9.16'
2
+ VERSION = '0.9.18'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: educode_sales
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.16
4
+ version: 0.9.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - anke1460
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-22 00:00:00.000000000 Z
11
+ date: 2022-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -105,6 +105,7 @@ files:
105
105
  - app/assets/images/educode_sales/icon-login.png
106
106
  - app/assets/images/educode_sales/icon.png
107
107
  - app/assets/images/educode_sales/indexLogo.png
108
+ - app/assets/images/educode_sales/indexlogo.png
108
109
  - app/assets/images/educode_sales/loading-0.gif
109
110
  - app/assets/images/educode_sales/loading-1.gif
110
111
  - app/assets/images/educode_sales/loading-2.gif
@@ -478,6 +479,7 @@ files:
478
479
  - db/migrate/20220920080302_add_column_number_to_educode_sales_businesses.rb
479
480
  - db/migrate/20220921131116_add_change_clazz_to_follow_up.rb
480
481
  - db/migrate/20220923084102_create_table_to_busines_number_recoreds.rb
482
+ - db/migrate/20221025094655_delete_business_number.rb
481
483
  - lib/educode_sales.rb
482
484
  - lib/educode_sales/engine.rb
483
485
  - lib/educode_sales/version.rb
@@ -486,7 +488,7 @@ homepage: https://www.educoder.net
486
488
  licenses:
487
489
  - MIT
488
490
  metadata: {}
489
- post_install_message:
491
+ post_install_message:
490
492
  rdoc_options: []
491
493
  require_paths:
492
494
  - lib
@@ -501,8 +503,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
501
503
  - !ruby/object:Gem::Version
502
504
  version: '0'
503
505
  requirements: []
504
- rubygems_version: 3.0.0
505
- signing_key:
506
+ rubygems_version: 3.0.9
507
+ signing_key:
506
508
  specification_version: 4
507
509
  summary: Summary of EducodeSales.
508
510
  test_files: []