educode_sales 1.10.26 → 1.10.29

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/educode_sales/businesses_controller.rb +8 -1
  3. data/app/controllers/educode_sales/contracts_controller.rb +33 -12
  4. data/app/controllers/educode_sales/follow_ups_controller.rb +1 -1
  5. data/app/controllers/educode_sales/ideas_controller.rb +20 -1
  6. data/app/controllers/educode_sales/money_plan_records_controller.rb +6 -2
  7. data/app/controllers/educode_sales/money_plans_controller.rb +5 -1
  8. data/app/controllers/educode_sales/plans_controller.rb +43 -1
  9. data/app/models/educode_sales/idea.rb +13 -1
  10. data/app/models/educode_sales/idea_follow.rb +7 -0
  11. data/app/views/educode_sales/businesses/index.html.erb +62 -4
  12. data/app/views/educode_sales/businesses/index.json.jbuilder +5 -0
  13. data/app/views/educode_sales/businesses/key_person.html.erb +5 -0
  14. data/app/views/educode_sales/businesses/new_follow_record.html.erb +56 -6
  15. data/app/views/educode_sales/businesses/show_follow_record.html.erb +40 -2
  16. data/app/views/educode_sales/ideas/_index.html.erb +70 -17
  17. data/app/views/educode_sales/ideas/edit.html.erb +3 -3
  18. data/app/views/educode_sales/ideas/new.html.erb +4 -4
  19. data/app/views/educode_sales/ideas/new_follow_up.html.erb +47 -10
  20. data/app/views/educode_sales/plans/_monthPlan.html.erb +2 -0
  21. data/app/views/educode_sales/plans/_monthly.html.erb +1 -1
  22. data/app/views/educode_sales/plans/_weekly.html.erb +1 -0
  23. data/app/views/educode_sales/plans/_yearPlan.html.erb +1 -1
  24. data/app/views/educode_sales/plans/index.html.erb +57 -30
  25. data/app/views/educode_sales/plans/month_plan.js.erb +1 -0
  26. data/app/views/educode_sales/plans/monthly.js.erb +1 -0
  27. data/app/views/educode_sales/plans/weekly.js.erb +1 -0
  28. data/app/views/educode_sales/plans/year_plan.js.erb +1 -0
  29. data/app/views/educode_sales/teachers/add_keys.html.erb +0 -1
  30. data/app/views/layouts/educode_sales/application.html.erb +384 -338
  31. data/config/routes.rb +5 -0
  32. data/db/migrate/20230704124921_add_plan_a_date_to_follow_ups.rb +9 -0
  33. data/lib/educode_sales/version.rb +1 -1
  34. metadata +7 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0b5943ba3342b717b15aae35d1f7924a361af064491e015a553cc9f0e7b47586
4
- data.tar.gz: 37f21daa33a22073f98454512b4488bf39757ed93e471b62c4ef16380ab09453
3
+ metadata.gz: b133a8fca27810c1c165bdab01c812af7c4ee76a0f80b02be3fcc064a353e4f9
4
+ data.tar.gz: 3631d821e73722d263dc9f724f09b19abd7dc0a9559a114f41f5bf204a334cb2
5
5
  SHA512:
6
- metadata.gz: d2c8a7277e685e6a73ad129275bb4b75d041bdfe870760f2833be8a8f0a387dbc41aacaafb3acb52530b941baced2bf02823cc71b313620423c3cd510f94fa85
7
- data.tar.gz: 99ecbbc2a8626d0ba99289a499008b7dcc8591154907cbdcab6abf427c3e49ce7b223dc9052df77ef30fcbcb2356b25edd91055267df6df739efecf3fc61ea62
6
+ metadata.gz: b3f72cb4af3f4f343fefc8438d08bc041d3f3526e639a0714196fbd63c91b9a322e03d2fc2548632b97aeed7cd6a7425a2bc5c9e798563b10be870124e504539
7
+ data.tar.gz: 40fbf3c2c51e50c8eaac57940279e8ec16708b1bfddc6d3673aed16033aa07aaadfaa8f69a28f9f527987afe515e77f565272298ac1f915deeb883535d27a048
@@ -115,7 +115,7 @@ module EducodeSales
115
115
  end
116
116
  end
117
117
  format.json do
118
- if params[:q] && (params[:q][:clazz] == 'area' || params[:q][:clazz] == 'special' || params[:q][:clazz] == 'delete_list')
118
+ if params[:q] && (params[:q][:clazz] == 'area' || params[:q][:clazz] == 'special' || params[:q][:clazz] == 'delete_list' || params[:q][:clazz] == 'plan_year')
119
119
  if params[:q][:clazz] == 'special'
120
120
  school_ids = []
121
121
  # 专项商机
@@ -132,6 +132,8 @@ module EducodeSales
132
132
  @businesses = Business.joins("JOIN departments AS dp ON educode_sales_businesses.department_id = dp.id").where("dp.school_id in (?)", school_ids)
133
133
  elsif params[:q][:clazz] == 'delete_list'
134
134
  @businesses = Business.unscoped.where(state_id: [1, 3])
135
+ elsif params[:q][:clazz] == 'plan_year'
136
+ @businesses = Business.joins(:last_follow_up).where("educode_sales_follow_ups.plan_a_date > :year OR educode_sales_follow_ups.plan_return_date > :year OR educode_sales_follow_ups.invitation_at > :year", year: Time.now.beginning_of_year)
135
137
  end
136
138
  else
137
139
  if @current_admin.is_admin?
@@ -390,6 +392,11 @@ module EducodeSales
390
392
  @businesses = @businesses.select("
391
393
  distinct
392
394
  educode_sales_businesses.*,
395
+ last_follow.plan_a_date,
396
+ last_follow.plan_a_money,
397
+ last_follow.invitation_money,
398
+ last_follow.plan_return_date,
399
+ last_follow.plan_return_money,
393
400
  last_follow.invitation_at,
394
401
  last_follow.budget_amount,
395
402
  last_follow.o_business_deployment,
@@ -54,7 +54,12 @@ module EducodeSales
54
54
  business_ids = @businesses.joins(last_follow_up: :assign_follow_ups).where("educode_sales_assign_follow_ups.staff_id = ?", @current_admin.id).pluck(:id)
55
55
  assign_business_ids = EducodeSales::Business.joins(:assign_staffs).where("educode_sales_assign_staffs.staff_id = ?", @current_admin.id).pluck(:id)
56
56
 
57
- @businesses = @businesses.joins("JOIN departments ON educode_sales_businesses.department_id = departments.id").where("departments.school_id in (?) OR educode_sales_businesses.staff_id = #{@current_admin.id} OR educode_sales_businesses.id in (?)", school_ids, business_ids + assign_business_ids)
57
+ if @current_admin.staff_school_tags.present?
58
+ # 如果设置专项客户类型,则视为专项经理,根据专项客户查看对应商机
59
+ school_ids += School.joins(:school_tags).where("school_tags.id in (?)", @current_admin.staff_school_tags.pluck(:school_tag_id)).pluck(:id)
60
+ end
61
+ @businesses = @businesses.joins("JOIN departments ON educode_sales_businesses.department_id = departments.id").where("departments.school_id in (?) OR educode_sales_businesses.staff_id = #{@current_admin.id} OR educode_sales_businesses.id in (?)", school_ids.uniq, business_ids + assign_business_ids)
62
+
58
63
  end
59
64
  end
60
65
 
@@ -365,20 +370,36 @@ module EducodeSales
365
370
  current_2_actual = v
366
371
  end
367
372
 
368
- if i == 1 && last_follow_up
369
- # 验收时间
370
- last_follow_up.reception_at = v
371
- elsif i == 0 && last_follow_up
372
- # 合同部署时间
373
- last_follow_up.deploy_time = v
374
- @business.p_deploy_time = v
375
- end
373
+ # if i == 1 && last_follow_up
374
+ # # 验收时间
375
+ # last_follow_up.reception_at = v
376
+ # elsif i == 0 && last_follow_up
377
+ # # 合同部署时间
378
+ # last_follow_up.deploy_time = v
379
+ # @business.p_deploy_time = v
380
+ # end
376
381
  end
377
382
 
378
383
  end
379
- # data.each do |d|
380
- # d.select! { |d| d.delete_if{|f| f == ''}.present? }
381
- # end
384
+ data.each do |row|
385
+ # 全部为空的值去掉选项
386
+ row.select! do |d|
387
+ s = d.uniq
388
+ s.size == 1 && s[0].blank? ? false : true
389
+ end
390
+ end
391
+ if last_follow_up
392
+ if data[0].present?
393
+ # 合同部署时间
394
+ last_follow_up.deploy_time = data[0][-1][-1]
395
+ @business.p_deploy_time = data[0][-1][-1]
396
+ end
397
+ if data[1].present?
398
+ # 验收时间
399
+ last_follow_up.reception_at = data[1][-1][-1]
400
+ end
401
+ end
402
+
382
403
  current_week = Time.now.strftime('%W')
383
404
  staff_manage_ids = @business&.last_follow_up&.assign_follow_ups.present? ? @business.last_follow_up.assign_follow_ups.pluck(:staff_id) : [@business.staff_id]
384
405
  if current_1_plan && current_1_plan.to_date.strftime('%W') == current_week
@@ -409,7 +409,7 @@ module EducodeSales
409
409
  end
410
410
 
411
411
  def follow_up_params
412
- params.permit(:clazz_id, :stage_id, :invitation_at, :reception_at, :total_amount, :actual_amount, :divide_amount, :divide_rate, :budget_amount, :description, :advise, :place_id, :bidded_date, :signed_date, :year, :o_business_deployment, :deploy_time, :rival)
412
+ params.permit(:clazz_id, :stage_id, :invitation_at, :reception_at, :total_amount, :actual_amount, :divide_amount, :divide_rate, :budget_amount, :description, :advise, :place_id, :bidded_date, :signed_date, :year, :o_business_deployment, :deploy_time, :rival, :plan_a_date, :plan_a_money, :invitation_money, :plan_return_date, :plan_return_money)
413
413
  end
414
414
 
415
415
  # 更新部门和部门下老师用户的状态
@@ -42,6 +42,8 @@ module EducodeSales
42
42
  @creator_arr = EducodeSales::Staff.joins(:user).where(id: creator_ids).pluck("concat(users.lastname,users.firstname)", :id)
43
43
  @staff_arr = EducodeSales::Staff.joins(:user).where(id: staff_ids).pluck("concat(users.lastname,users.firstname)", :id)
44
44
  @sale_staff_arr = EducodeSales::Staff.joins(:user).where(id: sale_staff_ids).pluck("concat(users.lastname,users.firstname)", :id)
45
+ filter = Filter.find_or_create_by(staff_id: @current_admin.id, clazz: "ideas")
46
+ gon.filter = filter.extras || {}
45
47
  end
46
48
  format.json do
47
49
  @ideas = params[:is_deleted].to_s == "true" ? Idea.deleted : Idea.not_deleted
@@ -142,9 +144,16 @@ module EducodeSales
142
144
  idea.department_id = idea.business&.department_id
143
145
  end
144
146
  idea.attachment_ids = attachment_ids
147
+
145
148
  # idea.assist_staff_ids = assist_staff_ids
146
149
  # idea.other_staff_ids = other_staff_ids
147
150
  idea.save
151
+ attachment_ids.each do |a|
152
+ attachment = Attachment.find_by_id(a)
153
+ attachment.container_id = idea.id
154
+ attachment.container_type = 'EducodeSales::Idea'
155
+ attachment.save
156
+ end
148
157
  render_success
149
158
  end
150
159
 
@@ -217,7 +226,9 @@ module EducodeSales
217
226
 
218
227
  def new_follow_up
219
228
  @idea = Idea.find(params[:id])
220
- gon.staffs = Staff.where.not(role_id: 11).includes(:user).map { |d| { name: d.user.real_name, value: d.id } }
229
+ staffs = Staff.where.not(role_id: 11).includes(:user)
230
+ gon.sale_staffs = staffs.map { |d| { name: d.user.real_name, value: d.id, selected: d.id == @idea.sale_staff_id } }
231
+ gon.idea_staffs = staffs.map { |d| { name: d.user.real_name, value: d.id, selected: d.id == @idea.staff_id } }
221
232
  render layout: false
222
233
  end
223
234
 
@@ -264,6 +275,14 @@ module EducodeSales
264
275
  if follow_up.save
265
276
  idea.last_idea_follow_id = follow_up.id
266
277
  idea.save
278
+ attachment_ids = Array(params[:attachment_ids].to_s.split(","))
279
+ attachment_ids.each do |a|
280
+ attachment = Attachment.find_by_id(a)
281
+ attachment.container_id = idea.id
282
+ attachment.container_type = 'EducodeSales::Idea'
283
+ attachment.description = follow_up.id.to_s
284
+ attachment.save
285
+ end
267
286
  render_success
268
287
  else
269
288
  render_failure follow_up
@@ -25,8 +25,12 @@ module EducodeSales
25
25
  @money_plan_records = @money_plan_records.where(staff_id: @current_admin.id)
26
26
  when '区域'
27
27
  school_ids = School.where(province: @current_admin.areas.pluck(:name)).pluck(:id) + StaffSchool.where(staff_id: @current_admin.id).pluck(:school_id)
28
- b_ids = Business.where(school_id: school_ids).pluck(:id)
29
- @money_plan_records = @money_plan_records.joins(:business).where("educode_sales_businesses.id in (?) OR educode_sales_money_plans.staff_id = ?", b_ids, @current_admin.id)
28
+ if @current_admin.staff_school_tags.present?
29
+ # 如果设置专项客户类型,则视为专项经理,根据专项客户查看对应商机
30
+ school_ids += School.joins(:school_tags).where("school_tags.id in (?)", @current_admin.staff_school_tags.pluck(:school_tag_id)).pluck(:id)
31
+ end
32
+ b_ids = Business.where(school_id: school_ids.uniq).pluck(:id)
33
+ @money_plan_records = @money_plan_records.joins(:business).where("educode_sales_businesses.id in (?) OR educode_sales_money_plan_records.staff_id = ?", b_ids, @current_admin.id)
30
34
  end
31
35
  end
32
36
 
@@ -20,7 +20,11 @@ module EducodeSales
20
20
  @money_plans = @money_plans.where(staff_id: @current_admin.id)
21
21
  when '区域'
22
22
  school_ids = School.where(province: @current_admin.areas.pluck(:name)).pluck(:id) + StaffSchool.where(staff_id: @current_admin.id).pluck(:school_id)
23
- b_ids = Business.where(school_id: school_ids).pluck(:id)
23
+ if @current_admin.staff_school_tags.present?
24
+ # 如果设置专项客户类型,则视为专项经理,根据专项客户查看对应商机
25
+ school_ids += School.joins(:school_tags).where("school_tags.id in (?)", @current_admin.staff_school_tags.pluck(:school_tag_id)).pluck(:id)
26
+ end
27
+ b_ids = Business.where(school_id: school_ids.uniq).pluck(:id)
24
28
  @money_plans = @money_plans.where("educode_sales_businesses.id in (?) OR educode_sales_money_plans.staff_id = ?", b_ids, @current_admin.id)
25
29
  end
26
30
  end
@@ -22,7 +22,14 @@ module EducodeSales
22
22
  @sale_plans = SalePlan.where(staff_id: @current_admin.id)
23
23
  when '区域'
24
24
  staff_ids = Staff.joins(user: [user_extension: [department: :school]]).where("schools.province in (?)", @current_admin.areas.pluck(:name)).pluck(:id)
25
- business_ids = Business.where(school_id: StaffSchool.where(staff_id: @current_admin.id).pluck(:school_id)).pluck(:id)
25
+
26
+ school_ids = StaffSchool.where(staff_id: @current_admin.id).pluck(:school_id)
27
+ if @current_admin.staff_school_tags.present?
28
+ # 如果设置专项客户类型,则视为专项经理,根据专项客户查看对应商机
29
+ school_ids += School.joins(:school_tags).where("school_tags.id in (?)", @current_admin.staff_school_tags.pluck(:school_tag_id)).pluck(:id)
30
+ end
31
+
32
+ business_ids = Business.where(school_id: school_ids.uniq).pluck(:id)
26
33
  @sale_plans = SalePlan.where("staff_id in (?) OR educode_sales_sale_plans.staff_id = ? OR educode_sales_sale_plans.business_id in (?)", staff_ids, @current_admin.id,business_ids)
27
34
  else
28
35
  @sale_plans = SalePlan
@@ -468,6 +475,41 @@ module EducodeSales
468
475
  render layout: false
469
476
  end
470
477
 
478
+ def week_plan
479
+ common = Common.find_by(clazz: 'staff_type', name: '销售')
480
+ @staffs = Staff.includes(:user).where(job_type: common.id).map { |d| [d.user.real_name, d.id] }
481
+ @years = (1..(Time.now.year - 2020)).map { |d| 2020 + d }
482
+ @months = (1..12).map { |d| d }
483
+ end
484
+
485
+ def weekly
486
+ common = Common.find_by(clazz: 'staff_type', name: '销售')
487
+ @staffs = Staff.includes(:user).where(job_type: common.id).map { |d| [d.user.real_name, d.id] }
488
+ @years = (1..(Time.now.year - 2020)).map { |d| 2020 + d }
489
+ @months = (1..12).map { |d| d }
490
+ end
491
+
492
+ def monthly
493
+ common = Common.find_by(clazz: 'staff_type', name: '销售')
494
+ @staffs = Staff.includes(:user).where(job_type: common.id).map { |d| [d.user.real_name, d.id] }
495
+ @years = (1..(Time.now.year - 2020)).map { |d| 2020 + d }
496
+ @months = (1..12).map { |d| d }
497
+ end
498
+
499
+ def month_plan
500
+ common = Common.find_by(clazz: 'staff_type', name: '销售')
501
+ @staffs = Staff.includes(:user).where(job_type: common.id).map { |d| [d.user.real_name, d.id] }
502
+ @years = (1..(Time.now.year - 2020)).map { |d| 2020 + d }
503
+ @months = (1..12).map { |d| d }
504
+ end
505
+
506
+ def year_plan
507
+ common = Common.find_by(clazz: 'staff_type', name: '销售')
508
+ @staffs = Staff.includes(:user).where(job_type: common.id).map { |d| [d.user.real_name, d.id] }
509
+ @years = (1..(Time.now.year - 2020)).map { |d| 2020 + d }
510
+ @months = (1..12).map { |d| d }
511
+ end
512
+
471
513
  private
472
514
 
473
515
  def plan_params
@@ -25,7 +25,7 @@ module EducodeSales
25
25
  enum model: %w[本地版 线上版 混合版]
26
26
  enum idea_type: %w[建设方案 申报论证 市场调研 课程建设 报价清单 交流汇报 招标参数 资质申报 产品手册 宣传海报 课题论文 投标支持 其他类]
27
27
 
28
- serialize :assist_staff_ids,Array
28
+ serialize :assist_staff_ids, Array
29
29
  serialize :attachment_ids, Array
30
30
  serialize :other_staff_ids, Array
31
31
 
@@ -35,6 +35,18 @@ module EducodeSales
35
35
  self.update(deleted_at: nil, deleter_id: nil, is_deleted: false)
36
36
  end
37
37
 
38
+ def sync_data
39
+ # {"content"=>"123", "idea_id"=>15, "school_id"=>nil, "money"=>123.0, "advise"=>"123", "sale_staff_id"=>8, "idea_staff_id"=>12, "staff_id"=>2, "comment"=>nil, "created_at"=>Mon, 01 May 2023 11:12:48 CST +08:00, "updated_at"=>Mon, 01 Ma023 11:14:06 CST +08:00}
40
+ # {"school_id"=>38739, "name"=>"java项目", "level"=>"高", "staff_id"=>24,"types"=>"低定制", "model"=>"本地版", "hardware"=>111.011, "project"=>333.011, "money"=>222.01, "creator_id"=>2, "end_time"=>Sat, 08 Apr 2023, "history_type"=>n"=>"4441111", "deleter_id"=>nil, "is_deleted"=>false, "deleted_at"=>nil, "department_id"=>35794, "manager_name"=>"王旭11111", "manager_phone"=>"131011111111111", "history_record"=>nil, "created_at"=>Thu, 23 Mar 2023 11:27:22 CST +08:00, "updated_at"=>Tue, 04 Jul 20217:57:32 CST +08:00, "school_name"=>"湖南科技大学1111", "department_name"=>"计算机科学与技术11111", "sale_staff_id"=>53, "idea_staff_id"=>nil, "assist_staff_ids"=>["10"], "attachment_id"=>nil, "attachment_ids"=>["4390068"], "idea_type"=>"建设方案", "other_staff_ids" "12", "13", "14", "16", "17", "18"], "idea_follows_count"=>2, "last_idea_follow_id"=>11, "advise"=>"123123", "business_id"=>nil}
41
+
42
+ last_follow = self.idea_follows.order(created_at: :desc).first
43
+ if last_follow
44
+ self.update(status: last_follow.status, last_idea_follow_id: last_follow.id, staff_id: last_follow.idea_staff_id, sale_staff_id: last_follow.sale_staff_id)
45
+ else
46
+ self.update(last_idea_follow_id: nil)
47
+ end
48
+ end
49
+
38
50
  def assist_staffs
39
51
  Staff.where(id: self.assist_staff_ids)
40
52
  end
@@ -7,5 +7,12 @@ module EducodeSales
7
7
  belongs_to :school, optional: true
8
8
 
9
9
  enum status: %w[未完成 已完成]
10
+
11
+ after_save :update_idea_status
12
+ after_destroy :update_idea_status
13
+
14
+ def update_idea_status
15
+ idea.sync_data
16
+ end
10
17
  end
11
18
  end
@@ -170,6 +170,7 @@
170
170
  <% if can?(:audit_business, EducodeSales::Business) %>
171
171
  <button class="layui-btn layui-btn-primary layui-border-green layui-btn-sm pull-right delete-btn" lay-event="delete_list">审核商机</button>
172
172
  <% end %>
173
+ <button class="layui-btn layui-btn-primary layui-border-green layui-btn-sm pull-right plan_year" lay-event="plan_year">本年计划</button>
173
174
  </div>
174
175
  </script>
175
176
  <script type="text/html" id="delete_bar">
@@ -522,6 +523,20 @@
522
523
  sort: true,
523
524
  hide: gon.filter.latest_time
524
525
  },
526
+ {
527
+ field: 'plan_a_date',
528
+ width: 150,
529
+ title:'计划A类时间',
530
+ sort: true,
531
+ hide: gon.filter.plan_a_date
532
+ },
533
+ {
534
+ field: 'plan_a_money',
535
+ width: 150,
536
+ title: '计划A类金额',
537
+ sort: true,
538
+ hide: gon.filter.plan_a_money
539
+ },
525
540
  {
526
541
  field: 'invitation_at',
527
542
  width: 150,
@@ -530,11 +545,25 @@
530
545
  hide: gon.filter.invitation_at
531
546
  },
532
547
  {
533
- field: 'bidded_date',
534
- width: 105,
535
- title: '中标时间',
548
+ field: 'invitation_money',
549
+ width: 150,
550
+ title: '计划投标金额',
536
551
  sort: true,
537
- hide: gon.filter.bidded_date
552
+ hide: gon.filter.invitation_money
553
+ },
554
+ {
555
+ field: 'plan_return_date',
556
+ width: 135,
557
+ title: '计划回款时间',
558
+ sort: true,
559
+ hide: gon.filter.plan_return_date
560
+ },
561
+ {
562
+ field: 'plan_return_money',
563
+ width: 135,
564
+ title: '计划回款金额',
565
+ sort: true,
566
+ hide: gon.filter.plan_return_money
538
567
  },
539
568
  {
540
569
  field: 'budget_amount',
@@ -544,6 +573,13 @@
544
573
  sort: true,
545
574
  hide: gon.filter.budget_amount
546
575
  },
576
+ {
577
+ field: 'bidded_date',
578
+ width: 105,
579
+ title: '中标时间',
580
+ sort: true,
581
+ hide: gon.filter.bidded_date
582
+ },
547
583
  {
548
584
  field: 'total_amount',
549
585
  width: 100,
@@ -1067,6 +1103,8 @@
1067
1103
  $(".area-btn").addClass("selected-btn");
1068
1104
  } else if (search['clazz'] == 'delete_list') {
1069
1105
  $(".delete-btn").addClass("selected-btn");
1106
+ } else if (search['clazz'] == 'plan_year') {
1107
+ $(".plan_year").addClass("selected-btn");
1070
1108
  } else {
1071
1109
  $(".all-btn").addClass("selected-btn");
1072
1110
  }
@@ -1249,6 +1287,26 @@
1249
1287
 
1250
1288
  return false;
1251
1289
  }
1290
+ else if (obj.event === 'plan_year') {
1291
+ search = {"clazz": "plan_year"}
1292
+ business_type_list.setValue([])
1293
+ table.reload('businesses_table', {
1294
+ url: '/missions/businesses',
1295
+ cols: cols_table,
1296
+ page: {
1297
+ curr: 1
1298
+ },
1299
+ where: {q: search, sort: sort}
1300
+ }, 'data');
1301
+
1302
+ form.val('search_form', {
1303
+ name: '', department: '', staff_id: '', business_type: '', business_step: '',
1304
+ place_id: '', date: '', area: ''
1305
+ })
1306
+ $(".plan_year").addClass("selected-btn");
1307
+
1308
+ return false;
1309
+ }
1252
1310
  else if (obj.event === 'delete') {
1253
1311
  var checkStatus = table.checkStatus('currentTableId'),
1254
1312
  data = checkStatus.data;
@@ -76,6 +76,11 @@ json.data do
76
76
  json.self_flag (d.staff_id == @current_admin.id) || (d.last_follow_up_id.in? follow_up_ids)
77
77
  json.followed d.users.pluck(:user_id).include?(@current_admin.user.id) ? 1 : 0 # d.users.where(user_id:@current_admin.user.id).first ? 1 : 0
78
78
  json.p_deploy_time d.p_deploy_time
79
+ json.plan_a_date d.last_follow_up&.plan_a_date&.to_s
80
+ json.plan_a_money d.last_follow_up&.plan_a_money&.round(6)
81
+ json.invitation_money d.last_follow_up&.invitation_money&.to_s
82
+ json.plan_return_date d.last_follow_up&.plan_return_date&.to_s
83
+ json.plan_return_money d.last_follow_up&.plan_return_money&.round(6)
79
84
  end
80
85
  end
81
86
 
@@ -43,6 +43,11 @@
43
43
  width: 200,
44
44
  title: '生日',
45
45
  },
46
+ {
47
+ field: 'tel',
48
+ width: 200,
49
+ title: '联系方式',
50
+ },
46
51
  {
47
52
  field: 'remark',
48
53
  width: 300,
@@ -37,6 +37,21 @@
37
37
  <%= select_tag "stage_id", options_for_select(@stages, @last_follow_up&.stage_id), { 'lay-filter': 'stage_id', class: 'required', } %>
38
38
  </div>
39
39
  </div>
40
+ </br>
41
+ <div class="layui-inline">
42
+ <label class="layui-form-label">计划A类时间</label>
43
+ <div class="layui-input-inline">
44
+ <input type="text" class="layui-input" name="plan_a_date" autocomplete="off" id="plan_a_date"
45
+ value="<%= @last_follow_up&.plan_a_date %>"
46
+ placeholder="请选择日期">
47
+ </div>
48
+ </div>
49
+ <div class="layui-inline">
50
+ <label class="layui-form-label">计划A类金额(万)</label>
51
+ <div class="layui-input-inline">
52
+ <input name="plan_a_money" class="layui-input" value="<%= @last_follow_up&.plan_a_money.to_f.round(6) %>">
53
+ </div>
54
+ </div>
40
55
  <br>
41
56
  <div class="layui-inline">
42
57
  <label class="layui-form-label">计划投标时间</label>
@@ -46,14 +61,29 @@
46
61
  placeholder="请选择日期">
47
62
  </div>
48
63
  </div>
49
- <div class="layui-inline">
50
- <label class="layui-form-label">中标时间</label>
64
+ <div class="layui-inline">
65
+ <label class="layui-form-label">计划投标金额(万)</label>
51
66
  <div class="layui-input-inline">
52
- <input type="text" class="layui-input" name="bidded_date" autocomplete="off" id="invitation_at_add"
53
- value="<%= @last_follow_up&.bidded_date %>"
54
- placeholder="请选择日期">
67
+ <input name="invitation_money" class="layui-input" value="<%= @last_follow_up&.invitation_money.to_f.round(6) %>">
55
68
  </div>
56
69
  </div>
70
+ </br>
71
+ <div class="layui-inline">
72
+ <label class="layui-form-label">计划回款时间</label>
73
+ <div class="layui-input-inline">
74
+ <input type="text" class="layui-input" name="plan_return_date" autocomplete="off" id="plan_return_date"
75
+ value="<%= @last_follow_up&.plan_return_date %>"
76
+ placeholder="请选择日期">
77
+ </div>
78
+ </div>
79
+ <div class="layui-inline">
80
+ <label class="layui-form-label">计划回款金额(万)</label>
81
+ <div class="layui-input-inline">
82
+ <input name="plan_return_money" class="layui-input" value="<%= @last_follow_up&.plan_return_money.to_f.round(6) %>">
83
+ </div>
84
+ </div>
85
+
86
+
57
87
  <br>
58
88
  <!--
59
89
  <div class="layui-inline">
@@ -88,6 +118,14 @@
88
118
  </div> -->
89
119
 
90
120
  <br class="service_show layui-hide">
121
+ <div class="layui-inline">
122
+ <label class="layui-form-label">中标时间</label>
123
+ <div class="layui-input-inline">
124
+ <input type="text" class="layui-input" name="bidded_date" autocomplete="off" id="invitation_at_add"
125
+ value="<%= @last_follow_up&.bidded_date %>"
126
+ placeholder="请选择日期">
127
+ </div>
128
+ </div>
91
129
  <div class="layui-inline">
92
130
  <label class="layui-form-label">中标额(万)</label>
93
131
  <div class="layui-input-inline">
@@ -247,6 +285,14 @@
247
285
  laydate.render({
248
286
  elem: '#reception_at_add'
249
287
  });
288
+
289
+ laydate.render({
290
+ elem: '#plan_a_date'
291
+ })
292
+
293
+ laydate.render({
294
+ elem: '#plan_return_date'
295
+ })
250
296
  var sales_list = xmSelect.render({
251
297
  el: '#assign_follow',
252
298
  remoteSearch: true,
@@ -358,6 +404,10 @@
358
404
  <style>
359
405
  .new_place_select xm-select > .xm-body {
360
406
  width: 300px;
361
- !important;
407
+ !important;
408
+ }
409
+
410
+ .layui-form-label {
411
+ width: 120px;
362
412
  }
363
413
  </style>
@@ -35,6 +35,19 @@
35
35
  </div>
36
36
  </div>
37
37
  <br>
38
+ <div class="layui-inline">
39
+ <label class="layui-form-label">计划A类时间:</label>
40
+ <div class="layui-input-inline">
41
+ <%= @follow_up.plan_a_date.to_s %>
42
+ </div>
43
+ </div>
44
+ <div class="layui-inline">
45
+ <label class="layui-form-label">计划A类金额:</label>
46
+ <div class="layui-input-inline">
47
+ <%= @follow_up.plan_a_money&.round(6) %>
48
+ </div>
49
+ </div>
50
+ </br>
38
51
  <div class="layui-inline">
39
52
  <label class="layui-form-label">计划投标时间:</label>
40
53
  <div class="layui-input-inline">
@@ -42,9 +55,22 @@
42
55
  </div>
43
56
  </div>
44
57
  <div class="layui-inline">
45
- <label class="layui-form-label">中标时间:</label>
58
+ <label class="layui-form-label">计划投标金额:</label>
46
59
  <div class="layui-input-inline">
47
- <%= @follow_up.bidded_date.to_s %>
60
+ <%= @follow_up.invitation_money&.round(6) %>
61
+ </div>
62
+ </div>
63
+ </br>
64
+ <div class="layui-inline">
65
+ <label class="layui-form-label">计划回款时间:</label>
66
+ <div class="layui-input-inline">
67
+ <%= @follow_up.plan_return_date.to_s %>
68
+ </div>
69
+ </div>
70
+ <div class="layui-inline">
71
+ <label class="layui-form-label">计划回款金额:</label>
72
+ <div class="layui-input-inline">
73
+ <%= @follow_up.plan_return_money&.round(6) %>
48
74
  </div>
49
75
  </div>
50
76
  <br>
@@ -86,6 +112,12 @@
86
112
  <%= @follow_up.total_amount.to_f.round(6) %>万
87
113
  </div>
88
114
  </div>
115
+ <div class="layui-inline">
116
+ <label class="layui-form-label">中标时间:</label>
117
+ <div class="layui-input-inline">
118
+ <%= @follow_up.bidded_date.to_s %>
119
+ </div>
120
+ </div>
89
121
  <div class="layui-inline">
90
122
  <label class="layui-form-label">合同额:</label>
91
123
  <div class="layui-input-inline">
@@ -222,3 +254,9 @@
222
254
  });
223
255
  }
224
256
  </script>
257
+ <style>
258
+
259
+ .layui-form-label {
260
+ width: 120px;
261
+ }
262
+ </style>