educode_sales 0.6.8 → 0.7.2

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 (56) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/educode_sales/businesses_controller.rb +191 -7
  3. data/app/controllers/educode_sales/customers_controller.rb +48 -15
  4. data/app/controllers/educode_sales/follow_ups_controller.rb +2 -2
  5. data/app/controllers/educode_sales/home_controller.rb +6 -0
  6. data/app/controllers/educode_sales/money_plans_controller.rb +3 -3
  7. data/app/controllers/educode_sales/operation_plans_controller.rb +4 -1
  8. data/app/controllers/educode_sales/plans_controller.rb +2 -1
  9. data/app/controllers/educode_sales/sale_trends_controller.rb +118 -116
  10. data/app/controllers/educode_sales/staffs_controller.rb +12 -0
  11. data/app/controllers/educode_sales/teachers_controller.rb +1 -1
  12. data/app/helpers/educode_sales/follow_up_helper.rb +7 -0
  13. data/app/models/educode_sales/customer_add.rb +4 -0
  14. data/app/models/educode_sales/money_plan.rb +3 -3
  15. data/app/models/educode_sales/staff.rb +1 -0
  16. data/app/models/educode_sales/staff_school.rb +6 -0
  17. data/app/views/educode_sales/businesses/edit_plan.html.erb +4 -4
  18. data/app/views/educode_sales/businesses/export_records.json.jbuilder +1 -2
  19. data/app/views/educode_sales/businesses/get_export_data.json.jbuilder +30 -0
  20. data/app/views/educode_sales/businesses/index.html.erb +209 -100
  21. data/app/views/educode_sales/businesses/index.json.jbuilder +6 -32
  22. data/app/views/educode_sales/businesses/show_follow.html.erb +49 -8
  23. data/app/views/educode_sales/businesses/show_follow.json.jbuilder +2 -0
  24. data/app/views/educode_sales/customers/index.html.erb +30 -1
  25. data/app/views/educode_sales/customers/index.json.jbuilder +12 -0
  26. data/app/views/educode_sales/customers/new.html.erb +106 -53
  27. data/app/views/educode_sales/customers/show_follow.html.erb +1 -1
  28. data/app/views/educode_sales/follow_ups/index.json.jbuilder +1 -1
  29. data/app/views/educode_sales/follow_ups/money_plans.json.jbuilder +2 -4
  30. data/app/views/educode_sales/home/staff_schools.json.jbuilder +9 -0
  31. data/app/views/educode_sales/money_plans/index.html.erb +1 -1
  32. data/app/views/educode_sales/operation_plans/_monthPlan.html.erb +8 -3
  33. data/app/views/educode_sales/operation_plans/_monthly.html.erb +2 -2
  34. data/app/views/educode_sales/operation_plans/_weekPlan.html.erb +2 -2
  35. data/app/views/educode_sales/operation_plans/_weekly.html.erb +2 -2
  36. data/app/views/educode_sales/plans/_monthPlan.html.erb +8 -3
  37. data/app/views/educode_sales/plans/_monthly.html.erb +2 -2
  38. data/app/views/educode_sales/plans/_weekPlan.html.erb +2 -2
  39. data/app/views/educode_sales/plans/_weekly.html.erb +2 -2
  40. data/app/views/educode_sales/roles/edit.html.erb +17 -11
  41. data/app/views/educode_sales/sale_reports/audit.html.erb +2 -0
  42. data/app/views/educode_sales/sale_reports/edit.html.erb +2 -0
  43. data/app/views/educode_sales/sale_reports/show.html.erb +2 -0
  44. data/app/views/educode_sales/sale_trends/trends.html.erb +1 -1
  45. data/app/views/educode_sales/sales/index.html.erb +7 -7
  46. data/app/views/educode_sales/sales/index.json.jbuilder +1 -1
  47. data/app/views/educode_sales/staffs/edit.html.erb +46 -5
  48. data/app/views/educode_sales/staffs/index.html.erb +6 -0
  49. data/app/views/educode_sales/staffs/index.json.jbuilder +1 -0
  50. data/app/views/educode_sales/teachers/show_follow.html.erb +1 -1
  51. data/config/routes.rb +2 -0
  52. data/db/migrate/20210902064109_create_educode_sales_role_permissions.rb +5 -0
  53. data/db/migrate/20220125013811_create_educode_sales_staff_schools.rb +10 -0
  54. data/db/migrate/20220125033552_create_educode_sales_customer_adds.rb +9 -0
  55. data/lib/educode_sales/version.rb +1 -1
  56. metadata +9 -2
@@ -7,7 +7,7 @@
7
7
  <span style="float: right;padding-right: 10px">年度</span>
8
8
  </form>
9
9
  <hr>
10
- <table class="layui-hide" id="table" lay-filter="table" ></table>
10
+ <table class="layui-hide" id="table" lay-filter="table"></table>
11
11
  </div>
12
12
  <script type="text/html" id="toolbarDemo">
13
13
  <div class="layui-btn-container">
@@ -16,32 +16,32 @@
16
16
  </script>
17
17
  <script type="text/html" id="business_a">
18
18
  <div class="layui-text">
19
- <a href="/missions/businesses?clazz_id={{d.a_clazz_id}}&staff_id={{d.id}}">{{d.business_a}}</a>
19
+ <a href="/missions/businesses?clazz_id={{d.a_clazz_id}}&staff_id={{d.id}}&business_year=<%= @year %>">{{d.business_a}}</a>
20
20
  </div>
21
21
  </script>
22
22
  <script type="text/html" id="business_b">
23
23
  <div class="layui-text">
24
- <a href="/missions/businesses?clazz_id={{d.b_clazz_id}}&staff_id={{d.id}}">{{d.business_b}}</a>
24
+ <a href="/missions/businesses?clazz_id={{d.b_clazz_id}}&staff_id={{d.id}}&business_year=<%= @year %>">{{d.business_b}}</a>
25
25
  </div>
26
26
  </script>
27
27
  <script type="text/html" id="business_c">
28
28
  <div class="layui-text">
29
- <a href="/missions/businesses?clazz_id={{d.c_clazz_id}}&staff_id={{d.id}}">{{d.business_c}}</a>
29
+ <a href="/missions/businesses?clazz_id={{d.c_clazz_id}}&staff_id={{d.id}}&business_year=<%= @year %>">{{d.business_c}}</a>
30
30
  </div>
31
31
  </script>
32
32
  <script type="text/html" id="business_d">
33
33
  <div class="layui-text">
34
- <a href="/missions/businesses?clazz_id={{d.d_clazz_id}}&staff_id={{d.id}}">{{d.business_d}}</a>
34
+ <a href="/missions/businesses?clazz_id={{d.d_clazz_id}}&staff_id={{d.id}}&business_year=<%= @year %>">{{d.business_d}}</a>
35
35
  </div>
36
36
  </script>
37
37
  <script type="text/html" id="business_e">
38
38
  <div class="layui-text">
39
- <a href="/missions/businesses?clazz_id={{d.e_clazz_id}}&staff_id={{d.id}}">{{d.business_e}}</a>
39
+ <a href="/missions/businesses?clazz_id={{d.e_clazz_id}}&staff_id={{d.id}}&business_year=<%= @year %>">{{d.business_e}}</a>
40
40
  </div>
41
41
  </script>
42
42
  <script type="text/html" id="business_o">
43
43
  <div class="layui-text">
44
- <a href="/missions/businesses?clazz_id={{d.o_clazz_id}}&staff_id={{d.id}}">{{d.business_o}}</a>
44
+ <a href="/missions/businesses?clazz_id={{d.o_clazz_id}}&staff_id={{d.id}}&business_year=<%= @year %>">{{d.business_o}}</a>
45
45
  </div>
46
46
  </script>
47
47
  <script type="text/html" id="school_count">
@@ -60,7 +60,7 @@ json.data do
60
60
  json.school_count school_count
61
61
  follow_school_count = (EducodeSales::CustomerFollow.where(staff_id: d.id).where("created_at >= ? AND created_at <= ?", "#{@year}-01-01 00:00:00", "#{@year}-12-31 23:59:59").pluck(:school_id) + EducodeSales::Business.where(id: EducodeSales::FollowUp.where("created_at >= ? AND created_at <= ?", "#{@year}-01-01 00:00:00", "#{@year}-12-31 23:59:59").where(staff_id: d.id).pluck(:business_id).uniq).pluck(:school_id)).uniq.size
62
62
  json.follow_school_count follow_school_count
63
- json.follow_school_counts EducodeSales::CustomerFollow.where(staff_id: d.id).where("created_at >= ? AND created_at <= ?", "#{@year}-01-01", "#{@year}-12-31").size + EducodeSales::FollowUp.where(staff_id: d.id).where("created_at >= ? AND created_at <= ?", "#{@year}-01-01", "#{@year}-12-31").size
63
+ json.follow_school_counts EducodeSales::CustomerFollow.where(staff_id: d.id).where("created_at >= ? AND created_at <= ?", "#{@year}-01-01 00:00:00", "#{@year}-12-31 23:59:59").size + EducodeSales::FollowUp.where(staff_id: d.id).where("created_at >= ? AND created_at <= ?", "#{@year}-01-01 00:00:00", "#{@year}-12-31 23:59:59").size
64
64
  follow_school_rate = (follow_school_count!=0 ? school_count.to_f * 100 / follow_school_count : 0).round(2)
65
65
  json.follow_school_rate follow_school_rate.to_s + '%'
66
66
  follow_department_rate = (follow_school_count!=0 ? school_count.to_f * 110 / follow_school_count : 0).round(2)
@@ -25,11 +25,17 @@
25
25
  </div>
26
26
  </div>
27
27
  <div class="layui-form-item">
28
- <label class="layui-form-label required">负责区域</label>
28
+ <label class="layui-form-label">负责区域</label>
29
29
  <div class="layui-input-block">
30
30
  <div id="area" class="demo-transfer"></div>
31
31
  </div>
32
32
  </div>
33
+ <div class="layui-form-item" >
34
+ <label class="layui-form-label">监管学校</label>
35
+ <div class="layui-input-inline" style="">
36
+ <div id="edit_assign_follow" style="width: 1140px;"></div>
37
+ </div>
38
+ </div>
33
39
  <div class="layui-form-item">
34
40
  <label class="layui-form-label required">生效日期</label>
35
41
  <div class="layui-input-block">
@@ -85,6 +91,40 @@
85
91
  return false
86
92
  }
87
93
  })
94
+ var sales_list = xmSelect.render({
95
+ el: '#edit_assign_follow',
96
+ remoteSearch: true,
97
+ autoRow: true,
98
+ // clickClose: true,
99
+ delay: 1000,
100
+ tips: '支持名称/省份搜索,请至少输入一个字符',
101
+ searchTips: '支持名称/省份搜索,请至少输入一个字符',
102
+ paging: true,
103
+ pageRemote: true,
104
+ filterable: true,
105
+ remoteMethod: function (val, cb, show, pageIndex) {
106
+ if(!val){
107
+ return cb([]);
108
+ }
109
+ $.ajax( '/missions/staff_schools', {
110
+ method: 'get',
111
+ data: {
112
+ q: val,
113
+ page: pageIndex
114
+ },
115
+ dataType: 'json',
116
+ success: function (res) {
117
+ var data = res.data;
118
+ if (res.code == 0) {
119
+ cb(res.data, res.count);
120
+ } else {
121
+ layer.msg(res.msg, {time: 2000, icon: 2, shade: 0.01});
122
+ }
123
+ }
124
+ })
125
+ }
126
+ })
127
+ sales_list.setValue(gon.schools)
88
128
 
89
129
  //监听提交
90
130
  form.on('submit(saveBtn)', function (data) {
@@ -92,10 +132,11 @@
92
132
  layui.each(transfer.getData('area_list'), function (i, v) {
93
133
  area_ids.push(v.value)
94
134
  })
95
- if (area_ids.length == 0) {
96
- layer.alert("请选择负责区域");
97
- return false;
98
- }
135
+ var schools = [];
136
+ sales_list.getValue().forEach(function(d) {
137
+ schools.push(d.value);
138
+ })
139
+ data.field['school_ids'] = schools;
99
140
  data.field['area_ids'] = area_ids;
100
141
  request.authPut("missions/staffs/" + parent.staff_id, data.field, function (res) {
101
142
  console.log(res.success == false)
@@ -87,6 +87,12 @@
87
87
  {
88
88
  field: 'area',
89
89
  title: '负责区域',
90
+ templet:'<div><span title="{{d.area}}">{{d.area}}</span></div>'
91
+ },
92
+ {
93
+ field: 'schools',
94
+ title: '监管学校',
95
+ templet:'<div><span title="{{d.schools}}">{{d.schools}}</span></div>'
90
96
  },
91
97
  {
92
98
  field: 'month',
@@ -4,6 +4,7 @@ json.data do
4
4
  json.id d.id
5
5
  json.name d.user.real_name
6
6
  json.role d.role&.name
7
+ json.schools d.staff_schools.map(&:school).map(&:name).join("、")
7
8
  json.job_type EducodeSales::Common.job_type_name[d.job_type]
8
9
  json.month d.month
9
10
  json.enabled_at d.enabled_at ? d.enabled_at.to_s(:date) : ''
@@ -257,7 +257,7 @@
257
257
 
258
258
 
259
259
 
260
- <!--未完成计划列表-->
260
+ <!--计划回款计划列表-->
261
261
  <script type="text/html" id="unfinish_toolbar">
262
262
  <div class="layui-btn-container">
263
263
  <span class="table-label">跟进计划列表</span>
data/config/routes.rb CHANGED
@@ -12,6 +12,7 @@ EducodeSales::Engine.routes.draw do
12
12
  get :no_permission, to: "home#no_permission"
13
13
  get :sales_staff, to: "home#sales_staff"
14
14
  get :sales_place, to: "home#sales_place"
15
+ get :staff_schools, to: "home#staff_schools"
15
16
 
16
17
  resources :sessions do
17
18
  end
@@ -83,6 +84,7 @@ EducodeSales::Engine.routes.draw do
83
84
  resources :businesses do
84
85
  collection do
85
86
  get :export_records
87
+ post :get_export_data
86
88
  get :add_export_records
87
89
  get :show_keys
88
90
  get :add_keys
@@ -15,6 +15,11 @@ class CreateEducodeSalesRolePermissions < ActiveRecord::Migration[5.2]
15
15
  EducodeSales::Permission.create(name: '上传附件', subject: 'Business', action: 'upload_file', clazz: 'business', position: '11')
16
16
  EducodeSales::Permission.create(name: '下载附件', subject: 'Business', action: 'download_file', clazz: 'business', position: '11')
17
17
  EducodeSales::Permission.create(name: '删除附件', subject: 'Business', action: 'delete_file', clazz: 'business', position: '11')
18
+ #商机个人权限
19
+ EducodeSales::Permission.create(name: '编辑商机(本人商机)', subject: 'Business', action: 'self_edit_business', clazz: 'business', position: '5')
20
+ EducodeSales::Permission.create(name: '添加跟进记录(本人商机)', subject: 'Business', action: 'self_add_follow', clazz: 'business', position: '8')
21
+ EducodeSales::Permission.create(name: '编辑跟进记录(本人创建)', subject: 'Business', action: 'self_edit_follow', clazz: 'business', position: '9')
22
+ EducodeSales::Permission.create(name: '删除跟进记录(本人创建)', subject: 'Business', action: 'self_delete_follow', clazz: 'business', position: '10')
18
23
  #回款管理权限
19
24
  EducodeSales::Permission.create(name: '查看回款列表', subject: 'MoneyPlan', action: 'read', clazz: 'money_plan', position: '15')
20
25
 
@@ -0,0 +1,10 @@
1
+ class CreateEducodeSalesStaffSchools < ActiveRecord::Migration[5.2]
2
+ def change
3
+ create_table :educode_sales_staff_schools do |t|
4
+ t.references :staff
5
+ t.references :school
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ class CreateEducodeSalesCustomerAdds < ActiveRecord::Migration[5.2]
2
+ def change
3
+ create_table :educode_sales_customer_adds do |t|
4
+ t.references :school
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module EducodeSales
2
- VERSION = '0.6.8'
2
+ VERSION = '0.7.2'
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.6.8
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - anke1460
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-24 00:00:00.000000000 Z
11
+ date: 2022-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -165,6 +165,7 @@ files:
165
165
  - app/helpers/educode_sales/activities_helper.rb
166
166
  - app/helpers/educode_sales/application_helper.rb
167
167
  - app/helpers/educode_sales/business_helper.rb
168
+ - app/helpers/educode_sales/follow_up_helper.rb
168
169
  - app/helpers/educode_sales/home_helper.rb
169
170
  - app/helpers/educode_sales/sessions_helper.rb
170
171
  - app/helpers/educode_sales/teachers_helper.rb
@@ -181,6 +182,7 @@ files:
181
182
  - app/models/educode_sales/common.rb
182
183
  - app/models/educode_sales/course_subject.rb
183
184
  - app/models/educode_sales/customer.rb
185
+ - app/models/educode_sales/customer_add.rb
184
186
  - app/models/educode_sales/customer_extension.rb
185
187
  - app/models/educode_sales/customer_follow.rb
186
188
  - app/models/educode_sales/follow_up.rb
@@ -201,6 +203,7 @@ files:
201
203
  - app/models/educode_sales/sale_report.rb
202
204
  - app/models/educode_sales/sale_trend.rb
203
205
  - app/models/educode_sales/staff.rb
206
+ - app/models/educode_sales/staff_school.rb
204
207
  - app/models/educode_sales/teacher.rb
205
208
  - app/models/educode_sales/teacher_assign_follow.rb
206
209
  - app/models/educode_sales/teacher_follow.rb
@@ -216,6 +219,7 @@ files:
216
219
  - app/views/educode_sales/businesses/export_records.html.erb
217
220
  - app/views/educode_sales/businesses/export_records.json.jbuilder
218
221
  - app/views/educode_sales/businesses/file.html.erb
222
+ - app/views/educode_sales/businesses/get_export_data.json.jbuilder
219
223
  - app/views/educode_sales/businesses/index.html.erb
220
224
  - app/views/educode_sales/businesses/index.json.jbuilder
221
225
  - app/views/educode_sales/businesses/new.html.erb
@@ -257,6 +261,7 @@ files:
257
261
  - app/views/educode_sales/home/search_operation_teacher.json.jbuilder
258
262
  - app/views/educode_sales/home/search_teacher.json.jbuilder
259
263
  - app/views/educode_sales/home/search_users.json.jbuilder
264
+ - app/views/educode_sales/home/staff_schools.json.jbuilder
260
265
  - app/views/educode_sales/home/statistics.html.erb
261
266
  - app/views/educode_sales/money_plans/index.html.erb
262
267
  - app/views/educode_sales/money_plans/index.json.jbuilder
@@ -415,6 +420,8 @@ files:
415
420
  - db/migrate/20211220102720_add_position_to_commons.rb
416
421
  - db/migrate/20211221075146_add_school_id_to_educode_sales_businesses.rb
417
422
  - db/migrate/20220121060006_create_educode_sales_business_export_records.rb
423
+ - db/migrate/20220125013811_create_educode_sales_staff_schools.rb
424
+ - db/migrate/20220125033552_create_educode_sales_customer_adds.rb
418
425
  - lib/educode_sales.rb
419
426
  - lib/educode_sales/engine.rb
420
427
  - lib/educode_sales/version.rb