educode_sales 0.9.10 → 0.9.11

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: e55869ffcc832dfac95ed169a94adac8b8fbcb634bb8aa5c3aec6b6b706f6c56
4
- data.tar.gz: 81fa68ebe5aa56782e95ff35ae4583250259efb701cf4f65495e9ed189fd11d7
3
+ metadata.gz: 7d534830cae9ef959ed6e065bb7a22a2053fdf5f6468b419cd6b2aa9d722510d
4
+ data.tar.gz: dc65d43f30d446b7fe4d2a22af6d18a165fd0e5b14625919ef8232e6491a3916
5
5
  SHA512:
6
- metadata.gz: 899de281abd3f1d782caa15f6a0db901781f4a3d370f31897816b7f44f83a07d11dbb2e9ba8830bd3428acdfdf2c028dc19c03f93fd5bfd1ca0a07f1e7b81843
7
- data.tar.gz: 7c4f9d48a48aace21df084e359843a6de29189d31c54d4e828bd0cf6c6c65c7e93713e2510303ede0cc959edf5b9dcb6d1248c5c5614778837569d9957eefbff
6
+ metadata.gz: b37037787d835f6abc6d78f58f56ec5344779090f68583b04ff16f3f2e2946fdd53a043f1fcb829152c9c6402e90b610cf6e08b3d0f456053b8d3a553ae69063
7
+ data.tar.gz: 8ad3b95b4c49d649a43ea1b7135dd9c8f1a2ea7761657471cb235e1b9ec3b9f8dc26ef5cbf83643e0140d7eba5bd5f6d899a631bc8b84a15885197041b5daac6
@@ -294,4 +294,24 @@ td .layui-table-cell .layui-form-select {
294
294
  height: 6px;
295
295
  border-radius: 6px;
296
296
  background-color: red;
297
+ }
298
+
299
+ .gray-text {
300
+ color: #888;
301
+ }
302
+ .red-tips {
303
+ margin-left: 15px;
304
+ position: relative;
305
+ color: #888;
306
+ }
307
+
308
+ .red-tips::before {
309
+ width: 6px;
310
+ height: 6px;
311
+ border-radius: 3px;
312
+ content: " ";
313
+ background-color: red;
314
+ position: absolute;
315
+ top: 5px;
316
+ left: -10px;
297
317
  }
@@ -26,6 +26,7 @@ module EducodeSales
26
26
  end
27
27
 
28
28
  if can?(:create, EducodeSales::SalePlan)
29
+ # gon.menus << { title: '添加团队建议', event: 'suggest' }
29
30
  gon.menus << { title: '添加周计划', event: 'week' }
30
31
  gon.menus << { title: '添加月计划', event: 'month' }
31
32
  end
@@ -48,9 +49,15 @@ module EducodeSales
48
49
  gon.export_menus << { title: '导出记录', event: 'export_records' }
49
50
  filter = Filter.find_or_create_by(staff_id: @current_admin.id, clazz: "businesses_list")
50
51
  if filter.extras.present?
52
+ if filter.extras['area'].nil?
53
+ filter.extras['area'] = 1
54
+ filter.extras['property'] = 1
55
+ filter.extras['sale_way'] = 1
56
+ end
57
+ filter.save
51
58
  gon.filter = filter.extras
52
59
  else
53
- gon.filter = {}
60
+ gon.filter = {'area': 1, 'property': 1, 'sale_way': 1}
54
61
  end
55
62
  end
56
63
  format.json do
@@ -46,8 +46,12 @@ module EducodeSales
46
46
  @service_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.signed_date >= ? AND educode_sales_follow_ups.signed_date <= ? AND educode_sales_follow_ups.stage_id IN (?)", "#{@year}-01-01", "#{@year}-12-31", s_stage_ids).sum(:total_amount).round(2)
47
47
  @actual_service_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.signed_date >= ? AND educode_sales_follow_ups.signed_date <= ? AND educode_sales_follow_ups.stage_id IN (?)", "#{@year}-01-01", "#{@year}-12-31", s_stage_ids).sum(:actual_amount).round(2)
48
48
  @return_amount = Business.joins(last_follow_up: :money_plans).where("educode_sales_follow_ups.clazz_id != ?", x).where.not("educode_sales_money_plans.clazz!= ?", 1).where("educode_sales_money_plans.date_at >= ? AND educode_sales_money_plans.date_at <= ? ", year_time, year_over_time).sum(:amount).round(2)
49
- # @return_amount = total_return[0]['return_money']&.round(2) || 0
50
- @receivable_amount = @goal_amount - @return_amount
49
+
50
+ # 往年累计已中标合同
51
+ @former_goal_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.bidded_date <= ? AND educode_sales_follow_ups.stage_id IN (?)", "#{@year}-12-31", stage_ids).sum(:actual_amount).round(2)
52
+ # 往年累计已回款
53
+ @former_return_amount = Business.joins(last_follow_up: :money_plans).where("educode_sales_follow_ups.clazz_id != ?", x).where.not("educode_sales_money_plans.clazz!= ?", 1).where("educode_sales_money_plans.date_at <= ? ", year_over_time).sum(:amount).round(2)
54
+ @receivable_amount = @former_goal_amount - @former_return_amount
51
55
 
52
56
  a = Common.where(clazz: '商机类型', name: Common.find_by(extras: EducodeSales::Common::ATYPE)&.name).pluck(:id)
53
57
  @a_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id IN (?)", a).where("educode_sales_follow_ups.year = ?", @year).sum(:total_amount).round(2)
@@ -85,7 +89,7 @@ module EducodeSales
85
89
  end
86
90
  format.js do
87
91
  default_dates = (30.day.ago.to_date..Date.today).map { |d| d.strftime("%Y-%W") }.uniq #默认时间范围
88
- @follow_count_data = business_followup_charts(default_dates, names, x_business_ids, SaleTrend::COLORS, [30.day.ago.to_date.beginning_of_week, Date.today], "%Y-%u") do |default_dates|
92
+ @follow_count_data = business_followup_charts(default_dates, names, x_business_ids, SaleTrend::COLORS, [30.day.ago.to_date.beginning_of_week, Date.today], "%Y%u") do |default_dates|
89
93
  default_dates.map { |date|
90
94
  d = date.split("-")
91
95
  year = d[0].to_i
@@ -172,7 +176,7 @@ module EducodeSales
172
176
 
173
177
  goal_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
174
178
  sale_names = ['已中标', '已签单', '已回款']
175
- @goal_count_data = month_sale_chart(goal_default_dates, sale_names, SaleTrend::COLORS, x, stage_ids, s_stage_ids, count_type)
179
+
176
180
  if params[:goal_count_range].present?
177
181
  case params[:goal_count_range]
178
182
  when "week"
@@ -180,16 +184,23 @@ module EducodeSales
180
184
  if params[:goal_date_month].present?
181
185
  date = params[:goal_date_month].split(" - ")
182
186
  dates = ((date[0] + "-01").to_date..(date[1] + "-01").to_date).map { |d| d.strftime("%Y-%m") }.uniq
183
- @goal_count_data = month_sale_chart(dates, sale_names, SaleTrend::COLORS, x, stage_ids, s_stage_ids, count_type)
187
+ @goal_count_data = month_sale_chart(dates, sale_names, SaleTrend::COLORS, x, stage_ids, s_stage_ids, count_type, date)
188
+ else
189
+ @goal_count_data = month_sale_chart(goal_default_dates, sale_names, SaleTrend::COLORS, x, stage_ids, s_stage_ids, count_type, ["#{Time.now.year}-01", "#{Time.now.year}-#{Time.now.month}"])
184
190
  end
185
191
  else
186
192
  #按年
187
193
  if params[:goal_date_year].present?
188
194
  date = params[:goal_date_year].split(" - ")
189
195
  dates = (date[0]..date[1]).to_a
190
- @goal_count_data = year_sale_chart(dates, sale_names, SaleTrend::COLORS, x, stage_ids, s_stage_ids, count_type)
196
+ @goal_count_data = year_sale_chart(dates, sale_names, SaleTrend::COLORS, x, stage_ids, s_stage_ids, count_type, date)
197
+ else
198
+ goal_default_dates = ("#{Time.now.year}-01-01".to_date.."#{Time.now.year}-#{Time.now.month}-01".to_date).map { |d| d.strftime("%Y") }.uniq
199
+ @goal_count_data = year_sale_chart(goal_default_dates, sale_names, SaleTrend::COLORS, x, stage_ids, s_stage_ids, count_type, ["#{Time.now.year}", "#{Time.now.year}"])
191
200
  end
192
201
  end
202
+ else
203
+ @goal_count_data = month_sale_chart(goal_default_dates, sale_names, SaleTrend::COLORS, x, stage_ids, s_stage_ids, count_type, ["#{Time.now.year}-01", "#{Time.now.year}-#{Time.now.month}"])
193
204
  end
194
205
  end
195
206
  end
@@ -351,9 +362,9 @@ module EducodeSales
351
362
  hidden: name[2] == 11, #role_id:11 离职角色
352
363
  data: dates.map { |date| data["#{name[1]}-#{ date.gsub("-", '')}"]&.[](0)&.[]('counts') || 0 },
353
364
  backgroundColor: "#fff",
354
- pointBorderColor: colors[i % 15 + 1],
355
- borderColor: colors[i % 15 + 1],
356
- pointBackgroundColor: colors[i % 15 + 1],
365
+ pointBorderColor: colors[i % 50 + 1],
366
+ borderColor: colors[i % 50 + 1],
367
+ pointBackgroundColor: colors[i % 50 + 1],
357
368
  borderWidth: 2
358
369
  }
359
370
  end
@@ -361,7 +372,88 @@ module EducodeSales
361
372
  end
362
373
 
363
374
 
364
- def month_sale_chart(dates, names, colors, x, stage_ids, s_stage_ids, count_type)
375
+ def month_sale_chart(dates, names, colors, x, stage_ids, s_stage_ids, count_type, range)
376
+ begin_at = range[0].split("-")
377
+ end_at = range[1].split("-")
378
+
379
+ begin_at = DateTime.new begin_at[0].to_i, begin_at[1].to_i
380
+ end_at = DateTime.new end_at[0].to_i, end_at[1].to_i
381
+ data_1 = EducodeSales::Business.joins(:last_follow_up).
382
+ where("educode_sales_follow_ups.clazz_id != ?", x).
383
+ where("educode_sales_follow_ups.stage_id IN (?)", stage_ids).
384
+ where("educode_sales_follow_ups.bidded_date >= ? AND educode_sales_follow_ups.bidded_date <= ?", begin_at, end_at).
385
+ select("SUM(#{count_type}) AS count_type, DATE_FORMAT(bidded_date, '%Y-%m') AS month").
386
+ group("DATE_FORMAT(bidded_date, '%Y-%m')").
387
+ order("DATE_FORMAT(bidded_date, '%Y-%m')")
388
+ data_1_hash = {}
389
+ data_1_total_hash = {}
390
+ data_1.each do |d|
391
+ data_1_hash[d.month] = d.count_type.round(2)
392
+ end
393
+
394
+ last_month = 0
395
+ last_sum = 0
396
+ dates.each do |month|
397
+ # 只累计当前年份
398
+ if last_month != month.split("-")[0]
399
+ last_sum = 0
400
+ end
401
+ data_1_total_hash[month] = (data_1_hash[month] || 0) + last_sum
402
+ last_sum += data_1_hash[month] || 0
403
+ last_month = month.split("-")[0]
404
+ end
405
+
406
+ data_2 = EducodeSales::Business.joins(:last_follow_up).
407
+ where("educode_sales_follow_ups.clazz_id != ?", x).
408
+ where("educode_sales_follow_ups.stage_id IN (?)", s_stage_ids).
409
+ where("educode_sales_follow_ups.signed_date >= ? AND educode_sales_follow_ups.signed_date <= ?", begin_at, end_at).
410
+ select("SUM(#{count_type}) AS count_type, DATE_FORMAT(signed_date, '%Y-%m') AS month").
411
+ group("DATE_FORMAT(signed_date, '%Y-%m')").
412
+ order("DATE_FORMAT(signed_date, '%Y-%m')")
413
+ data_2_hash = {}
414
+ data_2_total_hash = {}
415
+ data_2.each do |d|
416
+ data_2_hash[d.month] = d.count_type.round(2)
417
+ end
418
+
419
+ last_month = 0
420
+ last_sum = 0
421
+ dates.each do |month|
422
+ # 只累计当前年份
423
+ if last_month != month.split("-")[0]
424
+ last_sum = 0
425
+ end
426
+ data_2_total_hash[month] = (data_2_hash[month] || 0) + last_sum
427
+ last_sum += data_2_hash[month] || 0
428
+ last_month = month.split("-")[0]
429
+ end
430
+
431
+ data_3 = EducodeSales::Business.joins(last_follow_up: :money_plans).
432
+ where("educode_sales_follow_ups.clazz_id != ?", x).
433
+ where.not("educode_sales_money_plans.clazz!= ?", 1).
434
+ where("educode_sales_money_plans.date_at >= ? AND educode_sales_money_plans.date_at <= ?", begin_at, end_at).
435
+ select("SUM(amount) AS count_type, DATE_FORMAT(date_at, '%Y-%m') AS month").
436
+ group("DATE_FORMAT(date_at, '%Y-%m')").
437
+ order("DATE_FORMAT(date_at, '%Y-%m')")
438
+ data_3_hash = {}
439
+ data_3.each do |d|
440
+ data_3_hash[d.month] = d.count_type.round(2)
441
+ end
442
+
443
+ data_3_total_hash = {}
444
+ last_month = 0
445
+ last_sum = 0
446
+ dates.each do |month|
447
+ # 只累计当前年份
448
+ if last_month != month.split("-")[0]
449
+ last_sum = 0
450
+ end
451
+ data_3_total_hash[month] = (data_3_hash[month] || 0) + last_sum
452
+ last_sum += data_3_hash[month] || 0
453
+ last_month = month.split("-")[0]
454
+ end
455
+
456
+
365
457
  {
366
458
  labels: dates,
367
459
  datasets: names.map.with_index do |name, i|
@@ -370,11 +462,21 @@ module EducodeSales
370
462
  data: dates.map { |d|
371
463
  case i
372
464
  when 0
373
- Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.bidded_date >= ? AND educode_sales_follow_ups.bidded_date <= ? AND educode_sales_follow_ups.stage_id IN (?)", "#{d}-01", "#{d}-31", stage_ids).sum(count_type).round(2)
465
+ data_1_hash[d] || 0
374
466
  when 1
375
- Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.signed_date >= ? AND educode_sales_follow_ups.signed_date <= ? AND educode_sales_follow_ups.stage_id IN (?)", "#{d}-01", "#{d}-31", s_stage_ids).sum(count_type).round(2)
467
+ data_2_hash[d] || 0
376
468
  else
377
- Business.joins(last_follow_up: :money_plans).where("educode_sales_follow_ups.clazz_id != ?", x).where.not("educode_sales_money_plans.clazz!= ?", 1).where("educode_sales_money_plans.date_at >= ? AND educode_sales_money_plans.date_at <= ? ", "#{d}-01", "#{d}-31").sum(:amount).round(2)
469
+ data_3_hash[d] || 0
470
+ end
471
+ },
472
+ data1: dates.map { |d|
473
+ case i
474
+ when 0
475
+ data_1_total_hash[d] || 0
476
+ when 1
477
+ data_2_total_hash[d] || 0
478
+ else
479
+ data_3_total_hash[d] || 0
378
480
  end
379
481
  },
380
482
  backgroundColor: colors[i],
@@ -385,7 +487,90 @@ module EducodeSales
385
487
  }
386
488
  end
387
489
 
388
- def year_sale_chart(dates, names, colors, x, stage_ids, s_stage_ids, count_type)
490
+ def year_sale_chart(dates, names, colors, x, stage_ids, s_stage_ids, count_type, range)
491
+ begin_at = range[0].split("-")
492
+ end_at = range[1].split("-")
493
+ begin_at = DateTime.new(begin_at[0].to_i).beginning_of_year
494
+ end_at = DateTime.new(end_at[0].to_i).end_of_year
495
+
496
+ data_1 = EducodeSales::Business.joins(:last_follow_up).
497
+ where("educode_sales_follow_ups.clazz_id != ?", x).
498
+ where("educode_sales_follow_ups.stage_id IN (?)", stage_ids).
499
+ where("educode_sales_follow_ups.bidded_date >= ? AND educode_sales_follow_ups.bidded_date <= ?", begin_at, end_at).
500
+ select("SUM(#{count_type}) AS count_type, DATE_FORMAT(bidded_date, '%Y') AS year").
501
+ group("DATE_FORMAT(bidded_date, '%Y')").
502
+ order("DATE_FORMAT(bidded_date, '%Y')")
503
+ data_1_hash = {}
504
+ data_1.each do |d|
505
+ data_1_hash[d.year] = d.count_type.round(2)
506
+ end
507
+
508
+ data_1_total_hash = {}
509
+ last_month = 0
510
+ last_sum = 0
511
+ dates.each do |month|
512
+ # 只累计当前年份
513
+ if last_month != month.split("-")[0]
514
+ last_sum = 0
515
+ end
516
+ data_1_total_hash[month] = (data_1_hash[month] || 0) + last_sum
517
+ last_sum += data_1_hash[month] || 0
518
+ last_month = month.split("-")[0]
519
+ end
520
+
521
+ data_2 = EducodeSales::Business.joins(:last_follow_up).
522
+ where("educode_sales_follow_ups.clazz_id != ?", x).
523
+ where("educode_sales_follow_ups.stage_id IN (?)", s_stage_ids).
524
+ where("educode_sales_follow_ups.signed_date >= ? AND educode_sales_follow_ups.signed_date <= ?", begin_at, end_at).
525
+ select("SUM(#{count_type}) AS count_type, DATE_FORMAT(signed_date, '%Y') AS year").
526
+ group("DATE_FORMAT(signed_date, '%Y')").
527
+ order("DATE_FORMAT(signed_date, '%Y')")
528
+ data_2_hash = {}
529
+ data_2.each do |d|
530
+ data_2_hash[d.year] = d.count_type.round(2)
531
+ end
532
+
533
+ data_2_total_hash = {}
534
+ last_month = 0
535
+ last_sum = 0
536
+ dates.each do |month|
537
+ # 只累计当前年份
538
+ if last_month != month.split("-")[0]
539
+ last_sum = 0
540
+ end
541
+ data_2_total_hash[month] = (data_2_hash[month] || 0) + last_sum
542
+ last_sum += data_2_hash[month] || 0
543
+ last_month = month.split("-")[0]
544
+ end
545
+
546
+ data_3 = EducodeSales::Business.joins(last_follow_up: :money_plans).
547
+ where("educode_sales_follow_ups.clazz_id != ?", x).
548
+ where.not("educode_sales_money_plans.clazz!= ?", 1).
549
+ where("educode_sales_money_plans.date_at >= ? AND educode_sales_money_plans.date_at <= ?", begin_at, end_at).
550
+ select("SUM(amount) AS count_type, DATE_FORMAT(date_at, '%Y') AS year").
551
+ group("DATE_FORMAT(date_at, '%Y')").
552
+ order("DATE_FORMAT(date_at, '%Y')")
553
+ data_3_hash = {}
554
+ data_3.each do |d|
555
+ data_3_hash[d.year] = d.count_type.round(2)
556
+ end
557
+
558
+ data_3_total_hash = {}
559
+ last_month = 0
560
+ last_sum = 0
561
+ dates.each do |month|
562
+ # 只累计当前年份
563
+ if last_month != month.split("-")[0]
564
+ last_sum = 0
565
+ end
566
+
567
+ data_3_total_hash[month] = (data_3_hash[month] || 0) + last_sum
568
+ last_sum += data_3_hash[month] || 0
569
+ last_month = month.split("-")[0]
570
+ end
571
+
572
+
573
+
389
574
  {
390
575
  labels: dates,
391
576
  datasets: names.map.with_index do |name, i|
@@ -394,12 +579,22 @@ module EducodeSales
394
579
  data: dates.map { |d|
395
580
  case i
396
581
  when 0
397
- Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.bidded_date >= ? AND educode_sales_follow_ups.bidded_date <= ? AND educode_sales_follow_ups.stage_id IN (?)", "#{d}-01-01", "#{d}-12-31", stage_ids).sum(count_type).round(2)
582
+ data_1_hash[d] || 0
398
583
  when 1
399
- Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.signed_date >= ? AND educode_sales_follow_ups.signed_date <= ? AND educode_sales_follow_ups.stage_id IN (?)", "#{d}-01-01", "#{d}-12-31", s_stage_ids).sum(count_type).round(2)
584
+ data_2_hash[d] || 0
400
585
  else
401
- Business.joins(last_follow_up: :money_plans).where("educode_sales_follow_ups.clazz_id != ?", x).where.not("educode_sales_money_plans.clazz!= ?", 1).where("educode_sales_money_plans.date_at >= ? AND educode_sales_money_plans.date_at <= ? ", "#{d}-01-01", "#{d}-12-31").sum(:amount).round(2)
586
+ data_3_hash[d]|| 0
402
587
  end },
588
+ data1: dates.map { |d|
589
+ case i
590
+ when 0
591
+ data_1_total_hash[d] || 0
592
+ when 1
593
+ data_2_total_hash[d] || 0
594
+ else
595
+ data_3_total_hash[d] || 0
596
+ end
597
+ },
403
598
  backgroundColor: colors[i],
404
599
  borderColor: colors[i],
405
600
  borderWidth: 1
@@ -1,6 +1,13 @@
1
1
  module EducodeSales
2
2
  class SaleTrend < ApplicationRecord
3
3
 
4
- COLORS = ['#44D7B6', '#4CACFF', '#F7B500', '#FF0000', '#FF7F00', '#FFFF00', '#00FF00', '#00FFFF', '#0000FF', '#8B00FF', 'rgba(255, 99, 132, 1)', 'rgba(54, 162, 235, 1)', 'rgba(255, 206, 86, 1)', 'rgba(75, 192, 192, 1)', 'rgba(153, 102, 255, 1)', 'rgba(255, 159, 64, 1)', 'rgba(255, 0, 250, 1)']
4
+ COLORS = [
5
+ '#44D7B6', '#4CACFF', '#F7B500', '#FF0000', '#FF7F00', '#FFFF00', '#00FF00', '#00FFFF', '#0000FF',
6
+ '#8B00FF', 'rgba(255, 99, 132, 1)', 'rgba(54, 162, 235, 1)', 'rgba(255, 206, 86, 1)', 'rgba(75, 192, 192, 1)',
7
+ 'rgba(153, 102, 255, 1)', 'rgba(255, 159, 64, 1)', 'rgba(255, 0, 250, 1)', '#A2D9CE', '#D6EAF8', '#E8DAEF', '#FADBD8',
8
+ '#F5B7B1', '#E6B0AA', '#FCF3CF', '#FDEBD0', '#F6DDCC', '#D98880', '#EC7063', '#A569BD', '#85C1E9', '#45B39D', '#F7DC6F',
9
+ '#DC7633', '#839192', '#6C3483', '#B03A2E', '#7B7D7D', '#4D5656', '#28B463', '#0E6655', '#F39C12', '#0E6251', '#1B4F72',
10
+ '#FAE5D3', '#82E0AA', '#FF00FF', '#663399', '#4B0082', '#7CFC00', '#48D1CC'
11
+ ]
5
12
  end
6
13
  end
@@ -23,6 +23,18 @@ json.data do
23
23
  break
24
24
  end
25
25
  end
26
+ json.area d.department.school.province
27
+ school_property = d.department.school.school_property
28
+ property = []
29
+
30
+ if school_property.present?
31
+ property << '本科地方院校' if school_property.regular_college || school_property.project_985 || school_property.project_211
32
+ property << '高职' if school_property.junior_college || school_property.secondary_school
33
+ property << '本科军校' if school_property.military_school
34
+ property << '企业' if school_property.enterprise
35
+ end
36
+ json.property property.join("、")
37
+ json.sale_way d.last_follow_up&.place&.name.present? ? '渠道' : '直销'
26
38
  json.actual_amount d.last_follow_up&.actual_amount.to_f.round(2)
27
39
  json.return_money d.return_money
28
40
  json.wait_return_money d.wait_return_money.to_f.round(2)
@@ -100,6 +100,8 @@
100
100
  <script type="text/html" id="bussinessBar">
101
101
  <div class="layui-btn-container">
102
102
  <span class="table-label">商机列表</span>
103
+ <span class="table-label gray-text">(</span>
104
+ <span class="table-label red-tips">标记该商机类型已被更改过)</span>
103
105
  <% if can?(:export_business, EducodeSales::Business) %>
104
106
  <button class="layui-btn layui-btn-primary layui-border-green layui-btn-sm data-count-edit export_more-btn pull-right" style="color: #0000ff;" data-name="export" data-id="export">导出<i class="layui-icon layui-icon-down layui-nav-more" style="font-size: 12px"></i></button>
105
107
  <% end %>
@@ -259,8 +261,8 @@
259
261
 
260
262
 
261
263
  var data = form.val("search_form");
262
- data.business_type = <%=params[:clazz_id] %>
263
- console.log(data);
264
+ data.business_type = "<%=params[:clazz_id] %>";
265
+
264
266
 
265
267
  table = layui.table;
266
268
  var cols_table = [
@@ -283,10 +285,16 @@
283
285
  field: 'name',
284
286
  width: 170,
285
287
  title: '商机名称',
286
- templet: '<div><span title="{{d.name}}">{{d.name}}</span></div>',
288
+ templet: '<div><a href="javascript:void(0);" class="layui-table-link" lay-event="show_business"><span title="{{d.name}}">{{d.name}}</span></a></div>',
287
289
  fixed: 'left',
288
290
  hide: gon.filter.name
289
291
  },
292
+ {
293
+ field: 'area',
294
+ width: 100,
295
+ title: '地域',
296
+ hide: gon.filter.area
297
+ },
290
298
  {
291
299
  field: 'school',
292
300
  width: 150,
@@ -294,6 +302,12 @@
294
302
  templet: '#school_name',
295
303
  hide: gon.filter.school
296
304
  },
305
+ {
306
+ field: 'property',
307
+ width: 150,
308
+ title: '客户类型',
309
+ hide: gon.filter.property
310
+ },
297
311
  {
298
312
  field: 'department',
299
313
  width: 150,
@@ -433,6 +447,12 @@
433
447
  title: '渠道',
434
448
  hide: gon.filter.place
435
449
  },
450
+ {
451
+ field: 'sale_way',
452
+ width: 160,
453
+ title: '销售方式',
454
+ hide: gon.filter.sale_way
455
+ },
436
456
  {
437
457
  field: 'year',
438
458
  width: 105,
@@ -480,7 +500,6 @@
480
500
  skin: 'line',
481
501
  done: function (res) {
482
502
  exportData=res.data;
483
- console.log(exportData);
484
503
  drowpdwonRender()
485
504
  export_drowpdwonRender()
486
505
  }
@@ -903,7 +922,6 @@
903
922
  });
904
923
  }
905
924
 
906
-
907
925
  if (obj.event === 'add') { // 监听添加操作
908
926
  var content = miniPage.getHrefContent('/missions/businesses/new');
909
927
  var openWH = miniPage.getOpenWidthHeight();
@@ -1095,24 +1113,27 @@
1095
1113
  layer.full(index);
1096
1114
  });
1097
1115
  } else if (obj.event === 'show_follow') {
1098
- self_flag = data.self_flag
1099
- business_id = obj.data.id
1100
- business_name = data.name
1101
- content = miniPage.getHrefContent('/missions/businesses/show_follow?id=' + id);
1102
- openWH = miniPage.getOpenWidthHeight();
1103
- index = layer.open({
1104
- title: '商机列表/' + data.name + '的跟进记录',
1105
- type: 1,
1106
- shade: 0.2,
1107
- maxmin: true,
1108
- shadeClose: true,
1109
- area: [openWH[0] + 'px', openWH[1] + 'px'],
1110
- offset: [openWH[2] + 'px', openWH[3] + 'px'],
1111
- content: content
1112
- });
1113
- $(window).on("resize", function () {
1114
- layer.full(index);
1115
- });
1116
+ time_line(obj.data.id, obj.data.name);
1117
+ // self_flag = data.self_flag
1118
+ // business_id = obj.data.id
1119
+ // business_name = data.name
1120
+ // content = miniPage.getHrefContent('/missions/businesses/show_follow?id=' + id);
1121
+ // openWH = miniPage.getOpenWidthHeight();
1122
+ // index = layer.open({
1123
+ // title: '商机列表/' + data.name + '的跟进记录',
1124
+ // type: 1,
1125
+ // shade: 0.2,
1126
+ // maxmin: true,
1127
+ // shadeClose: true,
1128
+ // area: [openWH[0] + 'px', openWH[1] + 'px'],
1129
+ // offset: [openWH[2] + 'px', openWH[3] + 'px'],
1130
+ // content: content
1131
+ // });
1132
+ // $(window).on("resize", function () {
1133
+ // layer.full(index);
1134
+ // });
1135
+ } else if (obj.event == 'show_business') {
1136
+ time_line(obj.data.id, obj.data.name)
1116
1137
  }
1117
1138
  });
1118
1139
  });
@@ -26,6 +26,19 @@ json.data do
26
26
  break
27
27
  end
28
28
  end
29
+
30
+ json.area d.department.school.province
31
+ school_property = d.department.school.school_property
32
+ property = []
33
+
34
+ if school_property.present?
35
+ property << '本科地方院校' if school_property.regular_college || school_property.project_985 || school_property.project_211
36
+ property << '高职' if school_property.junior_college || school_property.secondary_school
37
+ property << '本科军校' if school_property.military_school
38
+ property << '企业' if school_property.enterprise
39
+ end
40
+ json.property property.join("、")
41
+ json.sale_way d.last_follow_up&.place&.name.present? ? '渠道' : '直销'
29
42
  json.year d.last_follow_up&.year.to_s
30
43
  json.total_amount d.last_follow_up&.total_amount.to_f.round(2)
31
44
  json.actual_amount d.last_follow_up&.actual_amount.to_f.round(2)
@@ -73,7 +73,8 @@
73
73
  datasets.push({
74
74
  label: d.label,
75
75
  type: 'line',
76
- data: d.data,borderColor: color[i],
76
+ data: d.data1,
77
+ borderColor: color[i],
77
78
  pointRadius: 1,
78
79
  fill: false,
79
80
  lineTension: 0
@@ -1,3 +1,3 @@
1
1
  module EducodeSales
2
- VERSION = '0.9.10'
2
+ VERSION = '0.9.11'
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.10
4
+ version: 0.9.11
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-09-23 00:00:00.000000000 Z
11
+ date: 2022-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -105,7 +105,6 @@ 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
109
108
  - app/assets/images/educode_sales/loading-0.gif
110
109
  - app/assets/images/educode_sales/loading-1.gif
111
110
  - app/assets/images/educode_sales/loading-2.gif
@@ -486,7 +485,7 @@ homepage: https://www.educoder.net
486
485
  licenses:
487
486
  - MIT
488
487
  metadata: {}
489
- post_install_message:
488
+ post_install_message:
490
489
  rdoc_options: []
491
490
  require_paths:
492
491
  - lib
@@ -501,8 +500,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
501
500
  - !ruby/object:Gem::Version
502
501
  version: '0'
503
502
  requirements: []
504
- rubygems_version: 3.0.9
505
- signing_key:
503
+ rubygems_version: 3.0.0
504
+ signing_key:
506
505
  specification_version: 4
507
506
  summary: Summary of EducodeSales.
508
507
  test_files: []