educode_sales 1.0.0 → 1.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 424093f43324c2f4af4d4989f4ff829a9cf10bd9ad1ea4b42bd46c86031c8aed
4
- data.tar.gz: cc722d4ff970b1cfb81d06f46be5b4463da9bb129ca5710dbcfc93c91e893de6
3
+ metadata.gz: 2f22bc4c0ef5a0ae9badb57ed14a6ea2d06f3ebb757746eb2b865cc1d9295c7f
4
+ data.tar.gz: 9a1d107c5a64574e40693890012cba94d9eb3593325db8723320dfbe56a3957b
5
5
  SHA512:
6
- metadata.gz: 3fe4801f732d17d747152c861f101527f3160c71c7d63168bd1beec408b5f4b19f4a3f0355f1283edb5d2e125bf5e836f9b9f6ad68eff30f50095a24cb0371ef
7
- data.tar.gz: a975715e196da44618cad0d5d6cc453f3aefbf236b58f51473b2ec2f4b1b60a6259bcd705a1bef425f844edb5d9140765cbc842f3bda03c5188a952f654e50a1
6
+ metadata.gz: 7b67e1c0d5edc38a48f8e9dcebfac180fe01d4546cdf23cb98aeda429835de1e68221071fb62af3d30622101ddc3f64cec9d88a7c879a90642ba0e5d30faf466
7
+ data.tar.gz: e062d9eee3c4c6ceae7ffcea260dc8b4f2d107b74afbd67f68e440a7adc22031b48c21f24f7e25fa74339c931c55386b2e0bdbfa92a408225e2d1d4021690f02
@@ -352,9 +352,8 @@ module EducodeSales
352
352
  d.select! { |d| d.delete_if{|f| f == ''}.present? }
353
353
  end
354
354
 
355
-
356
-
357
355
  follow_up = last_follow_up.dup
356
+
358
357
  follow_up.assign_attributes(follow_up_params)
359
358
  follow_up.description = params[:content]
360
359
  if params[:service_time].present?
@@ -366,6 +365,8 @@ module EducodeSales
366
365
  follow_up.staff = @current_admin
367
366
 
368
367
  if follow_up.save!
368
+ last_follow_up.assign_follow_ups.update_all(follow_up_id: follow_up.id)
369
+
369
370
  contract_lists = EducodeSales::ContractDateList.clazzs.invert
370
371
  data.each_with_index do |s, i|
371
372
  if s.present?
@@ -9,7 +9,13 @@ module EducodeSales
9
9
  render_success
10
10
  end
11
11
 
12
-
12
+ def restore_follow_up
13
+ @recycle = Recycle.find(params[:id])
14
+ report_id = @recycle.source_id
15
+ EducodeSales::FollowUp.unscoped.find(report_id).update(deleted_at: nil)
16
+ @recycle.destroy
17
+ render_success
18
+ end
13
19
 
14
20
  def restore_reports
15
21
  @recycle = Recycle.find(params[:id])
@@ -52,6 +58,16 @@ module EducodeSales
52
58
  @businesses = @businesses.page(params[:page]).per(params[:limit])
53
59
  end
54
60
 
61
+ def follow_up
62
+ @data = Recycle.where(source_type:"EducodeSales::FollowUp")
63
+ if params[:sort].present? && params[:sort][:field]
64
+ @data = @data.order("created_at #{params[:sort][:order]}")
65
+ else
66
+ @data = @data.order("educode_sales_recycles.created_at desc")
67
+ end
68
+ @data = @data.page(params[:page]).per(params[:limit])
69
+ end
70
+
55
71
  def weekly
56
72
  @weekly = Recycle.where(source_type:"EducodeSales::SaleReport").order(created_at: :desc).page(params[:page]).per(params[:limit])
57
73
  if params[:sort].present? && params[:sort][:field]
@@ -456,7 +456,7 @@ module EducodeSales
456
456
  user_stat = EducodeSales::UserStatService.new
457
457
  gon.table_1 = user_stat.table_1
458
458
  gon.table_2 = user_stat.table_2(1)
459
- gon.table_3 = user_stat.table_2(0)
459
+ gon.table_3 = user_stat.table_3
460
460
  end
461
461
  end
462
462
  end
@@ -138,14 +138,15 @@ module EducodeSales
138
138
  rows.times do |r| #行数
139
139
  next unless ods.row(r+2)[0]
140
140
  business = EducodeSales::Business.find_by(number: ods.row(r+2)[0].to_s.strip)
141
- product_catalog = EducodeSales::ProductCatalog.find_by(item_clazz: ods.row(r+2)[7].to_s.strip,
142
- brand: ods.row(r+2)[8].to_s.strip,
143
- specification: ods.row(r+2)[9].to_s.strip,
144
- unit: ods.row(r+2)[10].to_s.strip,
145
- source_method: ods.row(r+2)[14].to_s.strip,
146
- supplier: ods.row(r+2)[16].to_s.strip)
141
+ product_catalog = EducodeSales::ProductCatalog.find_by(name: ods.row(r+2)[5].to_s.strip,
142
+ item_clazz: ods.row(r+2)[6].to_s.strip,
143
+ brand: ods.row(r+2)[7].to_s.strip,
144
+ specification: ods.row(r+2)[8].to_s.strip,
145
+ unit: ods.row(r+2)[9].to_s.strip,
146
+ source_method: ods.row(r+2)[13].to_s.strip,
147
+ supplier: ods.row(r+2)[15].to_s.strip)
147
148
  if business.present? && product_catalog.present?
148
- SalesDetail.create(staff_id: @current_admin.id, business_id: business.id, product_catalog_id: product_catalog.id, price: ods.row(r+2)[12].to_s.strip, amount: ods.row(r+2)[11].to_s.strip, total_price: ods.row(r+2)[13].to_s.strip, custom_clazz: ods.row(r+2)[15].to_s.strip, delivery_date: ods.row(r+2)[17].to_s.strip, proprietorship: ods.row(r+2)[18].to_s.strip)
149
+ SalesDetail.create(staff_id: @current_admin.id, business_id: business.id, product_catalog_id: product_catalog.id, price: ods.row(r+2)[11].to_s.strip, amount: ods.row(r+2)[10].to_s.strip, total_price: ods.row(r+2)[12].to_s.strip, custom_clazz: ods.row(r+2)[14].to_s.strip, delivery_date: ods.row(r+2)[16].to_s.strip, proprietorship: ods.row(r+2)[17].to_s.strip)
149
150
  end
150
151
  end
151
152
 
@@ -109,6 +109,87 @@ module EducodeSales
109
109
  end
110
110
  end
111
111
 
112
+ def table_3
113
+ users = {'1' => [0, 0, 0], '2-5' => [0, 0, 0], '6-10' => [0, 0, 0], '11-20' => [0, 0, 0], '21-50' => [0, 0, 0], '51-100' => [0, 0, 0] }
114
+ signed_users = {'1' => [0, 0, 0], '2-5' => [0, 0, 0], '6-10' => [0, 0, 0], '11-20' => [0, 0, 0], '21-50' => [0, 0, 0], '51-100' => [0, 0, 0] }
115
+ schools(0).each do |d|
116
+ if d[1] == 1
117
+ users['1'][0] += 1
118
+ elsif d[1] <= 5
119
+ users['2-5'][0] += 1
120
+ elsif d[1] <= 10
121
+ users['6-10'][0] += 1
122
+ elsif d[1] <= 20
123
+ users['11-20'][0] += 1
124
+ elsif d[1] <= 50
125
+ users['21-50'][0] += 1
126
+ elsif d[1] <= 100
127
+ users['51-100'][0] += 1
128
+ end
129
+ end
130
+
131
+ departments(0).each do |d|
132
+ if d[1] == 1
133
+ users['1'][1] += 1
134
+ elsif d[1] <= 5
135
+ users['2-5'][1] += 1
136
+ elsif d[1] <= 10
137
+ users['6-10'][1] += 1
138
+ elsif d[1] <= 20
139
+ users['11-20'][1] += 1
140
+ elsif d[1] <= 50
141
+ users['21-50'][1] += 1
142
+ elsif d[1] <= 100
143
+ users['51-100'][1] += 1
144
+ end
145
+ end
146
+
147
+ signed_schools(0).each do |d|
148
+ if d[1] == 1
149
+ signed_users['1'][0] += 1
150
+ elsif d[1] <= 5
151
+ signed_users['2-5'][0] += 1
152
+ elsif d[1] <= 10
153
+ signed_users['6-10'][0] += 1
154
+ elsif d[1] <= 20
155
+ signed_users['11-20'][0] += 1
156
+ elsif d[1] <= 50
157
+ signed_users['21-50'][0] += 1
158
+ elsif d[1] <= 100
159
+ signed_users['51-100'][0] += 1
160
+ end
161
+ end
162
+
163
+ signed_departments(0).each do |d|
164
+ if d[1] == 1
165
+ signed_users['1'][1] += 1
166
+ elsif d[1] <= 5
167
+ signed_users['2-5'][1] += 1
168
+ elsif d[1] <= 10
169
+ p "----#{d}"
170
+ signed_users['6-10'][1] += 1
171
+ elsif d[1] <= 20
172
+ signed_users['11-20'][1] += 1
173
+ elsif d[1] <= 50
174
+ signed_users['21-50'][1] += 1
175
+ elsif d[1] <= 100
176
+ signed_users['51-100'][1] += 1
177
+ end
178
+ end
179
+
180
+
181
+ ['1', '2-5', '6-10', '11-20', '21-50', '51-100'].map do |d|
182
+ {
183
+ 'num' => d,
184
+ 'schools' => users[d][0],
185
+ 'departments' => users[d][1],
186
+ 'majors' => 0,
187
+ 'signed_schools' => signed_users[d][0],
188
+ 'signed_departments' => signed_users[d][1],
189
+ 'signed_majors' => 0,
190
+ }
191
+ end
192
+ end
112
193
 
113
194
  def public_user
114
195
  UserExtension.where(school_id: @school_ids).
@@ -1,6 +1,7 @@
1
1
  json.data do
2
2
  json.array! @business do |d|
3
3
  json.value d.id
4
- json.name d.name
4
+ staff_manage = d.last_follow_up&.assign_follow_ups.present? ? (d.last_follow_up.assign_follow_ups.map{ |d| d.staff.user.real_name}.join("、")) : d.staff&.user&.real_name
5
+ json.name d.name + " " + staff_manage + " " + d.created_at.to_s
5
6
  end
6
7
  end
@@ -0,0 +1,143 @@
1
+ <script type="text/html" id="toolbarfollowup">
2
+ <div class="layui-btn-container">
3
+ <span class="table-label">商机跟进列表</span>
4
+ </div>
5
+ </script>
6
+
7
+ <table class="layui-hide" id="follow_up" lay-filter="follow_up"></table>
8
+
9
+ <script type="text/html" id="currentTable_followup">
10
+ <%# if can? :update, EducodeSales::business %>
11
+ <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="restore">还原</a>
12
+ <%# end %>
13
+ <%# if can? :destroy, EducodeSales::business %>
14
+ <a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a>
15
+ <%# end %>
16
+ </script>
17
+
18
+ <script type="text/html" id="showchance">
19
+ <a href="/missions/businesses" class="layui-table-link">{{ d.chance }}</a>
20
+ </script>
21
+
22
+ <script>
23
+ layui.use(['form', 'table', 'miniPage', 'element', 'request'], function () {
24
+ var $ = layui.jquery,
25
+ form = layui.form,
26
+ table = layui.table,
27
+ request = layui.request,
28
+ miniPage = layui.miniPage;
29
+
30
+ table.render({
31
+ elem: '#follow_up',
32
+ url: '/missions/recycles/follow_up',
33
+ toolbar: '#toolbarfollowup',
34
+ totalRow:true,
35
+ defaultToolbar: [],
36
+ cols: [
37
+ [
38
+ {
39
+ field: 'id',
40
+ title:'序号',type: 'numbers',
41
+ },
42
+ {
43
+ field: 'name',
44
+ width: 180,
45
+ title: '商机名称'
46
+ },
47
+ {
48
+ field: 'follow_up_content',
49
+ width: 180,
50
+ title: '内容'
51
+ },
52
+ {
53
+ field: 'clazz',
54
+ title: '商机类型'
55
+ },
56
+ {
57
+ field: 'stage',
58
+ title: '阶段'
59
+ },
60
+ {
61
+ field: 'staff_manages',
62
+ width: 150,
63
+ title: '销售经理'
64
+ },
65
+ {
66
+ field: 'school',
67
+ title: '单位'
68
+ },
69
+ {
70
+ field: 'department',
71
+ title: '部门'
72
+ },
73
+ {
74
+ field: 'last_follow_person',
75
+ width: 150,
76
+ title: '最新跟进人'
77
+ },
78
+ {
79
+ field: 'latest_time',
80
+ title: '最新跟进时间',
81
+ width: 150,
82
+ },
83
+ {
84
+ field: 'deleter',
85
+ width: 90,
86
+ title: '删除人',
87
+ },
88
+ {
89
+ field: 'delete_time',
90
+ title: '删除时间',
91
+ width: 150,
92
+ sort: true,
93
+
94
+ },
95
+ {
96
+ title: '操作',
97
+ width: 120,
98
+ toolbar: '#currentTable_followup',
99
+ align: "center"
100
+ }
101
+ ]
102
+ ],
103
+ limit: 20,
104
+ limits: [10,15,20,30,40,50,60,70,80,90],
105
+ page: true
106
+ });
107
+
108
+ var sort = {}, search = {};
109
+ table.on('sort(follow_up)', function (obj) {
110
+ sort.field = obj.field;
111
+ sort.order = obj.type;
112
+ table.reload('follow_up', {
113
+ initSort: obj,
114
+ where: {
115
+ sort: sort,
116
+ q: search
117
+ }
118
+ });
119
+ })
120
+
121
+
122
+ table.on('tool(follow_up)', function (obj) {
123
+ var data = obj.data;
124
+ var id = data.id
125
+ if (obj.event === 'restore') {
126
+ layer.confirm('确定恢复' + data.name, function (index) {
127
+ request.get('missions/recycles/' + data.id + '/restore_follow_up', {}, function (res) {
128
+ layer.close(index);
129
+ table.reload("follow_up")
130
+ })
131
+ });
132
+ } else if (obj.event === 'delete') {
133
+ layer.confirm('确定删除' + data.name, function (index) {
134
+ request.delete('missions/recycles/' + data.id, {}, function (res) {
135
+ layer.close(index);
136
+ table.reload("follow_up")
137
+ })
138
+ });
139
+ }
140
+ });
141
+
142
+ });
143
+ </script>
@@ -0,0 +1,21 @@
1
+ json.data do
2
+ json.array! @data do |d|
3
+ follow_up = EducodeSales::FollowUp.unscoped.find(d.source_id)
4
+ business = EducodeSales::Business.unscoped.find(follow_up.business_id)
5
+ json.id d.id
6
+ json.name business&.name
7
+ json.clazz business.clazz&.name
8
+ json.staff_manages follow_up.assign_follow_ups.present? ? (follow_up.assign_follow_ups.map{ |s| s.staff.user&.real_name}.join("、")) : business.staff&.user&.real_name
9
+ json.follow_up_content follow_up.description
10
+ json.school business.department&.school&.name
11
+ json.department business.department&.name
12
+ json.last_follow_person follow_up.staff.user&.real_name
13
+ json.latest_time follow_up.created_at.to_s
14
+ json.deleter EducodeSales::Staff.find(d.deleter_id).user&.real_name
15
+ json.delete_time d.created_at.to_s
16
+ json.stage follow_up.stage&.name
17
+ end
18
+ end
19
+
20
+ json.code 0
21
+ json.count @data.total_count
@@ -1,6 +1,7 @@
1
1
  <div class="layui-tab" lay-filter="sale_tab">
2
2
  <ul class="layui-tab-title">
3
3
  <li class="layui-this" data="business">商机</li>
4
+ <li data="follow_up">商机跟进</li>
4
5
  <li data="week">周计划</li>
5
6
  <li data="weekly">周报</li>
6
7
  <li data="month">月计划</li>
@@ -11,6 +12,9 @@
11
12
  <div class="layui-tab-item layui-show">
12
13
  <%= render 'business' %>
13
14
  </div>
15
+ <div class="layui-tab-item">
16
+ <%= render 'follow_up' %>
17
+ </div>
14
18
  <div class="layui-tab-item">
15
19
  <%= render 'weekPlan' %>
16
20
  </div>
@@ -25,7 +25,6 @@
25
25
  align: 'center',
26
26
  width: 150,
27
27
  rowspan: 2,
28
- totalRowText:'合计',
29
28
  }
30
29
  , {
31
30
  title: '公有云',
@@ -47,59 +46,49 @@
47
46
  title: '用户数',
48
47
  align: 'center',
49
48
  width: 110,
50
- totalRow: '{{ parseInt(d.TOTAL_NUMS) }}',
51
49
  }, {
52
50
  field: 'school_1',
53
51
  title: '学校数',
54
52
  align: 'center',
55
53
  width: 110,
56
- totalRow: '{{ parseInt(d.TOTAL_NUMS) }}',
57
54
  }, {
58
55
  field: 'department_1',
59
56
  title: '学院数',
60
57
  align: 'center',
61
58
  width: 110,
62
- totalRow: '{{ parseInt(d.TOTAL_NUMS) }}',
63
59
  },{
64
60
  field: 'user_2',
65
61
  title: '用户数',
66
62
  align: 'center',
67
63
  width: 110,
68
- totalRow: '{{ parseInt(d.TOTAL_NUMS) }}',
69
64
  }, {
70
65
  field: 'school_2',
71
66
  title: '学校数',
72
67
  align: 'center',
73
68
  width: 110,
74
- totalRow: '{{ parseInt(d.TOTAL_NUMS) }}',
75
69
  }, {
76
70
  field: 'department_2',
77
71
  align: 'center',
78
72
  title: '学院数',
79
73
  width: 110,
80
- totalRow: '{{ parseInt(d.TOTAL_NUMS) }}',
81
74
  },{
82
75
  field: 'user_2',
83
76
  title: '用户数',
84
77
  align: 'center',
85
78
  width: 110,
86
- totalRow: '{{ parseInt(d.TOTAL_NUMS) }}',
87
79
  }, {
88
80
  field: 'school_2',
89
81
  title: '学校数',
90
82
  align: 'center',
91
83
  width: 110,
92
- totalRow: '{{ parseInt(d.TOTAL_NUMS) }}',
93
84
  }, {
94
85
  field: 'department_2',
95
86
  align: 'center',
96
87
  title: '学院数',
97
88
  width: 110,
98
- totalRow: '{{ parseInt(d.TOTAL_NUMS) }}',
99
89
  }]
100
90
  ],
101
91
  data: gon.table_1,
102
- totalRow: true,
103
92
  page: false
104
93
  });
105
94
 
@@ -151,14 +151,20 @@
151
151
  field: 'majors',
152
152
  width: 150,
153
153
  title: '专业',
154
+ hide: true
154
155
  }, {
155
156
  field: 'signed_department',
156
157
  title: '签约单位',
157
158
  width: 280,
159
+ hide: true
158
160
  }, {
159
161
  field: 'actual_amount',
160
162
  width: 120,
161
163
  title: '合同金额',
164
+ }, {
165
+ field: 'project_name',
166
+ width: 100,
167
+ title: '产品名称',
162
168
  }, {
163
169
  field: 'item_clazz',
164
170
  width: 100,
@@ -27,6 +27,7 @@ json.data do
27
27
  json.supplier d.product_catalog.supplier
28
28
  json.delivery_date d.delivery_date
29
29
  json.proprietorship d.proprietorship
30
+ json.project_name d.product_catalog.name
30
31
  end
31
32
  end
32
33
 
data/config/routes.rb CHANGED
@@ -185,11 +185,13 @@ EducodeSales::Engine.routes.draw do
185
185
  get :weekPlan
186
186
  get :business
187
187
  get :yearPlan
188
+ get :follow_up
188
189
  end
189
190
  member do
190
191
  get :restore_plans
191
192
  get :restore_reports
192
193
  get :restore_businesses
194
+ get :restore_follow_up
193
195
  end
194
196
  end
195
197
 
@@ -1,3 +1,3 @@
1
1
  module EducodeSales
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.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: 1.0.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - anke1460
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-23 00:00:00.000000000 Z
11
+ date: 2023-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -495,12 +495,14 @@ files:
495
495
  - app/views/educode_sales/projects/index.html.erb
496
496
  - app/views/educode_sales/projects/index.json.jbuilder
497
497
  - app/views/educode_sales/recycles/_business.html.erb
498
+ - app/views/educode_sales/recycles/_follow_up.html.erb
498
499
  - app/views/educode_sales/recycles/_monthPlan.html.erb
499
500
  - app/views/educode_sales/recycles/_monthly.html.erb
500
501
  - app/views/educode_sales/recycles/_weekPlan.html.erb
501
502
  - app/views/educode_sales/recycles/_weekly.html.erb
502
503
  - app/views/educode_sales/recycles/_yearPlan.html.erb
503
504
  - app/views/educode_sales/recycles/business.json.jbuilder
505
+ - app/views/educode_sales/recycles/follow_up.json.jbuilder
504
506
  - app/views/educode_sales/recycles/index.html.erb
505
507
  - app/views/educode_sales/recycles/monthPlan.json.jbuilder
506
508
  - app/views/educode_sales/recycles/monthly.json.jbuilder
@@ -706,7 +708,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
706
708
  - !ruby/object:Gem::Version
707
709
  version: '0'
708
710
  requirements: []
709
- rubygems_version: 3.0.9
711
+ rubygems_version: 3.0.0
710
712
  signing_key:
711
713
  specification_version: 4
712
714
  summary: Summary of EducodeSales.