educode_sales 0.9.16 → 0.9.17

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: 25adbf60cef4844eae70e6e5bc5dc4756989309574883b2fccb71a20e39a50f3
4
+ data.tar.gz: 1a341b258119a4f3b0ca9a86b7d9692597dd8c864f1e1088b09e37328ce0b76b
5
5
  SHA512:
6
- metadata.gz: 8f8f2febaa9f93c3ce44766b4ddc45930db17c21c405ebe542f0e7c4ca862c6f3c7840c5b02b5e06efdea128411ef8ab40cb64105f3f32cde31aeafe35e9afea
7
- data.tar.gz: 8556d4243ffc1208725c7ec4e7a59f83b11088d9b064b20d36ba238a05e90536ac885cc53c76dd8e1b9f79f3e5290fa00ff9b9c20bfcb0b4d104d6fa8adb496d
6
+ metadata.gz: c0a73d5ee2658c4ae2060bd13fe73c7b1fa3241f3dcb916ba1a6f72635f2b84f5da13da60ecb9aac42d89f37939a8ba6cb5473a8bf9ed80d84efa4b5e6970988
7
+ data.tar.gz: 8162a366501a3c35816c51ee1ec0415548a46e45d6800db1d27d9bd7634a7d5511f4a99d44e8b359654caf09d35abb19be18a9b6b357cfec7d4c08218ce29f00
@@ -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,
@@ -867,6 +867,9 @@
867
867
  data.field.place_id = index_place_list.getValue('valueStr');
868
868
  data.field.business_type = business_type.toString();
869
869
  data.field.business_step = business_step.toString();
870
+ if (search['clazz']) {
871
+ data.field['clazz'] = search['clazz']
872
+ }
870
873
  search = data.field
871
874
  table.reload('businesses_table', {
872
875
  url: '/missions/businesses',
@@ -884,6 +887,13 @@
884
887
  form.val('search_follows', {
885
888
  name: data.field.name, department: data.field.department, staff_id: data.field.staff_id, area: data.field.area
886
889
  })
890
+ if (search['clazz'] == 'me') {
891
+ $(".my-btn").addClass("selected-btn");
892
+ } else if (search['clazz'] == 'followes') {
893
+ $(".at-btn").addClass("selected-btn");
894
+ } else {
895
+ $(".all-btn").addClass("selected-btn");
896
+ }
887
897
  return false;
888
898
  });
889
899
 
@@ -966,11 +976,13 @@
966
976
  name: '', department: '', staff_id: '', business_type: '', business_step: '',
967
977
  place_id: '', date: '', area: ''
968
978
  })
979
+ $(".all-btn").addClass("selected-btn");
969
980
  return false;
970
981
  } else if (obj.event === 'followes') {
971
- search = {"all":"1"}
982
+ search = {"all":"1", clazz: 'followes'}
983
+ business_type_list.setValue([])
972
984
  table.reload('businesses_table', {
973
- url: '/missions/businesses/following_businesses',
985
+ url: '/missions/businesses',
974
986
  page: {
975
987
  curr: 1
976
988
  },
@@ -980,10 +992,12 @@
980
992
  name: '', department: '', staff_id: '', business_type: '', business_step: '',
981
993
  place_id: '', date: '', area: ''
982
994
  })
995
+ $(".at-btn").addClass("selected-btn");
983
996
  return false;
984
997
  }
985
998
  else if (obj.event === 'mine') {
986
- search = {"mine":"1"}
999
+ search = {"clazz":"me"}
1000
+ business_type_list.setValue([])
987
1001
  table.reload('businesses_table', {
988
1002
  url: '/missions/businesses',
989
1003
  page: {
@@ -995,6 +1009,7 @@
995
1009
  name: '', department: '', staff_id: '', business_type: '', business_step: '',
996
1010
  place_id: '', date: '', area: ''
997
1011
  })
1012
+ $(".my-btn").addClass("selected-btn");
998
1013
  return false;
999
1014
  }
1000
1015
  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.17'
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.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - anke1460
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-22 00:00:00.000000000 Z
11
+ date: 2022-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -478,6 +478,7 @@ files:
478
478
  - db/migrate/20220920080302_add_column_number_to_educode_sales_businesses.rb
479
479
  - db/migrate/20220921131116_add_change_clazz_to_follow_up.rb
480
480
  - db/migrate/20220923084102_create_table_to_busines_number_recoreds.rb
481
+ - db/migrate/20221025094655_delete_business_number.rb
481
482
  - lib/educode_sales.rb
482
483
  - lib/educode_sales/engine.rb
483
484
  - lib/educode_sales/version.rb