educode_sales 0.9.68 → 0.9.70

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 (41) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/educode_sales/indexlogo.png +0 -0
  3. data/app/assets/javascripts/educode_sales/extent/treeTable.js +235 -0
  4. data/app/controllers/educode_sales/customers_controller.rb +112 -0
  5. data/app/controllers/educode_sales/follow_ups_controller.rb +6 -0
  6. data/app/controllers/educode_sales/projects_controller.rb +423 -0
  7. data/app/controllers/educode_sales/roles_controller.rb +4 -1
  8. data/app/controllers/educode_sales/teachers_controller.rb +42 -14
  9. data/app/helpers/educode_sales/application_helper.rb +1 -0
  10. data/app/models/educode_sales/business.rb +21 -5
  11. data/app/models/educode_sales/business_history.rb +8 -0
  12. data/app/models/educode_sales/eco_staff.rb +6 -0
  13. data/app/models/educode_sales/permission.rb +2 -1
  14. data/app/models/educode_sales/project.rb +53 -0
  15. data/app/models/educode_sales/role_area.rb +2 -1
  16. data/app/views/educode_sales/activities/show_teachers.html.erb +1 -1
  17. data/app/views/educode_sales/businesses/index.html.erb +13 -0
  18. data/app/views/educode_sales/businesses/index.json.jbuilder +5 -1
  19. data/app/views/educode_sales/businesses/time_line.html.erb +10 -5
  20. data/app/views/educode_sales/customers/edit_major.html.erb +876 -0
  21. data/app/views/educode_sales/customers/list.html.erb +601 -0
  22. data/app/views/educode_sales/customers/list.json.jbuilder +33 -0
  23. data/app/views/educode_sales/follow_ups/index.json.jbuilder +2 -2
  24. data/app/views/educode_sales/projects/detail.html.erb +273 -0
  25. data/app/views/educode_sales/projects/edit.html.erb +246 -0
  26. data/app/views/educode_sales/projects/history.html.erb +41 -0
  27. data/app/views/educode_sales/projects/index.html.erb +718 -0
  28. data/app/views/educode_sales/projects/index.json.jbuilder +69 -0
  29. data/app/views/educode_sales/teachers/_index.html.erb +28 -1
  30. data/app/views/educode_sales/teachers/edit.html.erb +10 -3
  31. data/app/views/educode_sales/teachers/index.json.jbuilder +3 -0
  32. data/app/views/layouts/educode_sales/application.html.erb +25 -0
  33. data/config/routes.rb +12 -0
  34. data/db/migrate/20230412083510_add_p_staff_id_to_businesses.rb +20 -0
  35. data/db/migrate/20230412092000_create_business_histories.rb +10 -0
  36. data/db/migrate/20230413015619_add_permissions_to_projects.rb +11 -0
  37. data/db/migrate/20230413031029_add_pre_time_to_businesses.rb +5 -0
  38. data/db/migrate/20230414031409_add_major_educode_sales_customer_follows.rb +12 -0
  39. data/db/migrate/20230414035655_create_educode_sales_eco_staffs.rb +11 -0
  40. data/lib/educode_sales/version.rb +1 -1
  41. metadata +26 -6
@@ -0,0 +1,53 @@
1
+ module EducodeSales
2
+ class Project < ApplicationRecord
3
+ self.table_name = "educode_sales_businesses"
4
+
5
+ enum p_stage: %w[合同阶段 验收阶段 回款阶段]
6
+ enum p_difficulty: %w[困难 适中 容易]
7
+ enum p_special: %w[是 否]
8
+ enum p_status: %w[未完成 已完成]
9
+
10
+ def self.save_history(attr, old_value, new_value)
11
+ # old_value = St.find_by(id: old_value)&.name
12
+ # new_value = Department.find_by(id: new_value)&.name
13
+ case attr
14
+ when "p_stage"
15
+ "项目阶段由“#{old_value}”变更为“#{new_value}”"
16
+ when "p_difficulty"
17
+ "项目难度由“#{old_value}”变更为“#{new_value}”"
18
+ when "p_special"
19
+ "定制由“#{old_value}”变更为“#{new_value}”"
20
+ when "p_status"
21
+ "交付由“#{old_value}”变更为“#{new_value}”"
22
+ when "p_staff_id"
23
+ old_value = Staff.find_by(id: old_value)&.user&.real_name
24
+ new_value = Staff.find_by(id: new_value)&.user&.real_name
25
+ "指派人由“#{old_value}”变更为“#{new_value}”"
26
+ when "p_sale_staff_id"
27
+ old_value = Staff.find_by(id: old_value)&.user&.real_name
28
+ new_value = Staff.find_by(id: new_value)&.user&.real_name
29
+ "销售经理由“#{old_value}”变更为“#{new_value}”"
30
+ when "p_course_time"
31
+ "课程交付时间由“#{old_value}”变更为“#{new_value}”"
32
+ when "p_platform_time"
33
+ "平台交付时间由“#{old_value}”变更为“#{new_value}”"
34
+ when "p_deploy_time"
35
+ "现场部署时间由“#{old_value}”变更为“#{new_value}”"
36
+ when "p_accept_time"
37
+ "实际验收时间由“#{old_value}”变更为“#{new_value}”"
38
+ when "p_pre_money_time"
39
+ "拟定回款时间由“#{old_value}”变更为“#{new_value}”"
40
+ when "p_actual_money_time"
41
+ "实际回款时间由“#{old_value}”变更为“#{new_value}”"
42
+ when "p_money"
43
+ "回款由“#{old_value}”变更为“#{new_value}”"
44
+ when "p_content"
45
+ "问题备注由“#{old_value}”变更为“#{new_value}”"
46
+ when "p_pre_accept_time"
47
+ "预计验收时间由“#{old_value}”变更为“#{new_value}”"
48
+ else
49
+ nil
50
+ end
51
+ end
52
+ end
53
+ end
@@ -11,7 +11,8 @@ module EducodeSales
11
11
  '客户管理': 'Customer',
12
12
  '回款管理': 'MoneyPlan',
13
13
  '绩效考核': 'AssessmentsSetting',
14
- '方案管理': 'Idea'
14
+ '方案管理': 'Idea',
15
+ '项目管理': 'Project'
15
16
  }
16
17
  end
17
18
  end
@@ -65,7 +65,7 @@
65
65
  {
66
66
  field: 'name',
67
67
  width: 90,
68
- title: '姓名',
68
+ title: '用户名',
69
69
  templet: "#name"
70
70
  },
71
71
  {
@@ -416,6 +416,11 @@
416
416
  templet: '<div><span title="{{d.department}}">{{d.department}}</span></div>',
417
417
  hide: gon.filter.department
418
418
  },
419
+ {
420
+ field: 'majors',
421
+ width: 160,
422
+ title: '专业',
423
+ },
419
424
  {
420
425
  field: 'follow_ups_count',
421
426
  title: '跟进',
@@ -523,6 +528,14 @@
523
528
  sort: true,
524
529
  hide: gon.filter.o_business_deployment
525
530
  },
531
+ {
532
+ field: 'p_deploy_time',
533
+ width: 150,
534
+ title: '部署时间',
535
+ sort: true,
536
+ hide: gon.filter.p_deploy_time
537
+ },
538
+
526
539
  {
527
540
  field: 'budget_amount',
528
541
  width: 105,
@@ -31,6 +31,9 @@ json.data do
31
31
  json.divide_money d.divide_amount.to_f.round(2)
32
32
  json.budget_amount d.budget_amount.to_f.round(2) #d.follow_ups.where(stage_id: @budget_stage_ids).order("created_at desc").first&.total_amount&.round(2) || 0
33
33
  json.area d.department&.school&.province
34
+
35
+ json.majors d.department&.department_majors&.pluck(:name).present? ? d.department&.department_majors&.pluck(:name).join(",") : ""
36
+
34
37
  # school_property = d.department.school.school_property
35
38
  # property = []
36
39
 
@@ -64,7 +67,8 @@ json.data do
64
67
  json.latest_time d.last_follow_up.present? ? d.last_follow_up.created_at.to_s : ''
65
68
  json.self_flag (d.staff_id == @current_admin.id) || (d.last_follow_up_id.in? follow_up_ids)
66
69
  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
67
- end
70
+ json.p_deploy_time d.p_deploy_time
71
+ end
68
72
  end
69
73
 
70
74
  json.totalRow do
@@ -24,7 +24,7 @@
24
24
  <a href="javascript:;" class="add_key" data-is_latest="<%= f.id == @latest&.id %>" data-id=<%= f.id %> data-flag="<%= f.created_at.present? ? (Time.now - f.created_at).to_f/3600 < 24 : false %>">添加关键人</a>
25
25
  <% end %>
26
26
  <br/>
27
- 评论: <span></span> <a href="javascript:;" class="add_comment" data-id=<%= f.id %>>评论</a>
27
+ 评论: <span><%= f.comment %></span> <a href="javascript:;" class="add_comment" data-id=<%= f.id %>>评论</a>
28
28
  </p>
29
29
  </div>
30
30
  </li>
@@ -44,7 +44,7 @@
44
44
  miniPage = layui.miniPage;
45
45
  form = layui.form;
46
46
 
47
- });
47
+
48
48
  $(".add_key").on("click", function(e) {
49
49
  var data = e.currentTarget.dataset;
50
50
  follow_up_id = data.id;
@@ -86,9 +86,12 @@
86
86
  if (l.find("textarea").val().trim() == '') {
87
87
  layer.msg('内容不能为空')
88
88
  return false;
89
- } else {
90
- e.currentTarget.previousElementSibling.innerHTML = l.find("textarea").val().trim();
91
- layer.close(index);
89
+ } else {
90
+ var comment = l.find("textarea").val().trim();
91
+ request.put('missions/follow_ups/' + follow_up_id + "/comment", {comment: comment}, function (res) {
92
+ e.currentTarget.previousElementSibling.innerHTML = comment;
93
+ layer.close(index);
94
+ })
92
95
  }
93
96
  return false
94
97
  },
@@ -98,6 +101,7 @@
98
101
  });
99
102
 
100
103
  })
104
+ });
101
105
  function demo(){
102
106
  layer.closeAll()
103
107
  business_id = parent.business_id
@@ -117,4 +121,5 @@
117
121
  layer.full(sindex);
118
122
  });
119
123
  }
124
+
120
125
  </script>