educode_sales 0.6.1 → 0.6.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 +4 -4
- data/app/controllers/educode_sales/businesses_controller.rb +3 -2
- data/app/controllers/educode_sales/customers_controller.rb +44 -34
- data/app/controllers/educode_sales/places_controller.rb +5 -1
- data/app/controllers/educode_sales/sale_trends_controller.rb +16 -1
- data/app/controllers/educode_sales/teachers_controller.rb +13 -2
- data/app/models/educode_sales/permission.rb +1 -1
- data/app/views/educode_sales/businesses/_follows.html.erb +4 -1
- data/app/views/educode_sales/businesses/index.html.erb +22 -16
- data/app/views/educode_sales/businesses/index.json.jbuilder +1 -0
- data/app/views/educode_sales/businesses/show_follow.html.erb +1 -1
- data/app/views/educode_sales/businesses/time_line.html.erb +1 -1
- data/app/views/educode_sales/customers/edit.html.erb +54 -20
- data/app/views/educode_sales/customers/index.html.erb +11 -11
- data/app/views/educode_sales/customers/index.json.jbuilder +1 -2
- data/app/views/educode_sales/customers/new.html.erb +28 -21
- data/app/views/educode_sales/customers/show_follow_record.html.erb +3 -3
- data/app/views/educode_sales/follow_ups/index.json.jbuilder +1 -0
- data/app/views/educode_sales/places/index.html.erb +64 -0
- data/app/views/educode_sales/roles/edit.html.erb +1 -1
- data/app/views/educode_sales/sale_trends/trends.html.erb +20 -0
- data/app/views/educode_sales/sales/index.html.erb +9 -3
- data/app/views/educode_sales/sales/index.json.jbuilder +16 -6
- data/app/views/educode_sales/teachers/index.html.erb +4 -11
- data/app/views/educode_sales/teachers/index.json.jbuilder +1 -1
- data/db/migrate/20211220102720_add_position_to_commons.rb +12 -0
- data/db/migrate/20211221075146_add_school_id_to_educode_sales_businesses.rb +8 -0
- data/lib/educode_sales/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97a73ea8470e60cc322017425b3af50411105d237ae981f490aef1df1cd2816f
|
4
|
+
data.tar.gz: 3711b02d39d60076344835b00d1ff44fc152d30a0671eee314096cb817f720f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30dda9e9c18079954c459b90f623735b7c286d8a8c0fb6c42ab32464289bdd8133f87d39d938d8d20979b5eb944b65362910d1edf675f32e82c62cefc3ebfdf5
|
7
|
+
data.tar.gz: 73f820c375a6035995ddcbae380fd39fd07d7db4b2d53e27637c3e6c955371b1a7fe4d4e4ed7649544090501ad2c2aefba4ce02dd6adb9a0778d7313429ba354
|
@@ -191,6 +191,7 @@ module EducodeSales
|
|
191
191
|
last_follow.reception_at,
|
192
192
|
last_follow.bidded_date,
|
193
193
|
last_follow.signed_date,
|
194
|
+
last_follow.created_at as latest_time,
|
194
195
|
last_follow.actual_amount,
|
195
196
|
last_follow.total_amount").joins("
|
196
197
|
LEFT JOIN educode_sales_follow_ups AS last_follow ON educode_sales_businesses.last_follow_up_id = last_follow.id
|
@@ -201,7 +202,7 @@ module EducodeSales
|
|
201
202
|
|
202
203
|
def create
|
203
204
|
department = Department.find(params[:department_id])
|
204
|
-
business = @current_admin.businesses.build(name: params[:name], department_id: department.id, source: params[:source])
|
205
|
+
business = @current_admin.businesses.build(name: params[:name], department_id: department.id, source: params[:source], school_id: department.school_id)
|
205
206
|
if business.save
|
206
207
|
render_success
|
207
208
|
else
|
@@ -223,7 +224,7 @@ module EducodeSales
|
|
223
224
|
def update
|
224
225
|
business = Business.find(params[:id])
|
225
226
|
department = Department.find(params[:department_id])
|
226
|
-
if business.update(name: params[:name], department_id: department.id, source: params[:source])
|
227
|
+
if business.update(name: params[:name], department_id: department.id, source: params[:source], school_id: department.school_id)
|
227
228
|
render_success
|
228
229
|
else
|
229
230
|
render_failure business
|
@@ -2,8 +2,6 @@ require_dependency "educode_sales/application_controller"
|
|
2
2
|
|
3
3
|
module EducodeSales
|
4
4
|
class CustomersController < ApplicationController
|
5
|
-
# before_action :find_school, only: [:edit, :update]
|
6
|
-
# before_action :must_admin!, only: [:destroy]
|
7
5
|
|
8
6
|
def new_department
|
9
7
|
render layout: false
|
@@ -43,7 +41,7 @@ module EducodeSales
|
|
43
41
|
end
|
44
42
|
format.json do
|
45
43
|
if @current_admin.is_admin?
|
46
|
-
@customers = School
|
44
|
+
@customers = School.all
|
47
45
|
else
|
48
46
|
level = @current_admin.role.role_areas.find_by(clazz: '客户管理').level
|
49
47
|
case level
|
@@ -56,7 +54,7 @@ module EducodeSales
|
|
56
54
|
school_ids = a_school_ids + b_school_ids
|
57
55
|
@customers = School.where(id: school_ids)
|
58
56
|
else
|
59
|
-
@customers = School
|
57
|
+
@customers = School.all
|
60
58
|
end
|
61
59
|
end
|
62
60
|
|
@@ -71,21 +69,29 @@ module EducodeSales
|
|
71
69
|
@customers = @customers.where(id: school_ids)
|
72
70
|
end
|
73
71
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
72
|
+
if params[:q].present? && params[:q][:date].present?
|
73
|
+
ids = EducodeSales::CustomerFollow.all.pluck(:school_id)
|
74
|
+
@customers = @customers.where(id: ids)
|
75
|
+
school_ids =[]
|
76
|
+
date = params[:q][:date].split(" - ")
|
77
|
+
@customers.each do |d|
|
78
|
+
business_ids = EducodeSales::Business.where(school_id: d.id).ids
|
79
|
+
follow_ups = EducodeSales::FollowUp.where(business_id: business_ids)
|
80
|
+
customer_follows = EducodeSales::CustomerFollow.where(school_id: d.id)
|
81
|
+
next if follow_ups.blank? && customer_follows.blank?
|
82
|
+
a_last_follow_time = follow_ups.last&.created_at&.to_s
|
83
|
+
b_last_follow_time = customer_follows.last&.created_at&.to_s
|
84
|
+
if a_last_follow_time.present? && b_last_follow_time.present?
|
85
|
+
last_follow_time = ((a_last_follow_time < b_last_follow_time) ? b_last_follow_time : a_last_follow_time)
|
86
|
+
else
|
87
|
+
last_follow_time = (a_last_follow_time || b_last_follow_time)
|
88
|
+
end
|
89
|
+
if last_follow_time.present? && last_follow_time > date[0] && last_follow_time < date[1]
|
90
|
+
school_ids << d.id
|
91
|
+
end
|
92
|
+
end
|
93
|
+
@customers = @customers.where(id: school_ids)
|
94
|
+
end
|
89
95
|
|
90
96
|
@customers = @customers.order(id: :desc).page(params[:page]).per(params[:limit])
|
91
97
|
end
|
@@ -109,11 +115,6 @@ module EducodeSales
|
|
109
115
|
format.json do
|
110
116
|
@follow_ups = EducodeSales::CustomerFollow.where(school_id: params[:id])
|
111
117
|
@latest = @follow_ups.order(created_at: :desc).first
|
112
|
-
# if params[:field]
|
113
|
-
# @follow_ups = @follow_ups.order("#{params[:field]} #{params[:order]}")
|
114
|
-
# else
|
115
|
-
# @follow_ups = @follow_ups.order("created_at desc")
|
116
|
-
# end
|
117
118
|
@follow_ups = @follow_ups.order("created_at desc")
|
118
119
|
@follow_ups = @follow_ups.page(params[:page]).per(params[:limit])
|
119
120
|
end
|
@@ -122,11 +123,6 @@ module EducodeSales
|
|
122
123
|
|
123
124
|
def show_department
|
124
125
|
@departments = School.find(params[:id]).departments
|
125
|
-
# if params[:field]
|
126
|
-
# @follow_ups = @follow_ups.order("#{params[:field]} #{params[:order]}")
|
127
|
-
# else
|
128
|
-
# @follow_ups = @follow_ups.order("created_at desc")
|
129
|
-
# end
|
130
126
|
@departments = @departments.order("created_at desc")
|
131
127
|
@departments = @departments.page(params[:page]).per(params[:limit])
|
132
128
|
end
|
@@ -154,40 +150,54 @@ module EducodeSales
|
|
154
150
|
end
|
155
151
|
|
156
152
|
def create
|
157
|
-
@school = School.find(params[:id])
|
158
153
|
ActiveRecord::Base.transaction do
|
159
|
-
property = SchoolProperty.find_or_create_by!(
|
154
|
+
property = SchoolProperty.find_or_create_by!(project_985: params[:project_985].present? ? 1 : 0,
|
155
|
+
project_211: params[:project_211].present? ? 1 : 0,
|
156
|
+
regular_college: params[:regular_college].present? ? 1 : 0,
|
157
|
+
junior_college: params[:junior_college].present? ? 1 : 0,
|
158
|
+
secondary_school: params[:secondary_school].present? ? 1 : 0,
|
159
|
+
military_school: params[:military_school].present? ? 1 : 0,
|
160
|
+
enterprise: params[:enterprise].present? ? 1 : 0)
|
160
161
|
@school = School.new
|
161
162
|
@school.attributes = school_params
|
162
163
|
@school.school_property = property
|
163
164
|
@school.save!
|
164
165
|
end
|
166
|
+
render_success
|
165
167
|
end
|
166
168
|
|
167
169
|
def edit
|
168
170
|
@school = School.find(params[:id])
|
171
|
+
@school_property = @school.school_property
|
169
172
|
render layout: false
|
170
173
|
end
|
171
174
|
|
172
175
|
def update
|
173
176
|
@school = School.find(params[:id])
|
174
177
|
ActiveRecord::Base.transaction do
|
175
|
-
property = SchoolProperty.find_or_create_by!(
|
178
|
+
property = SchoolProperty.find_or_create_by!(project_985: params[:project_985].present? ? 1 : 0,
|
179
|
+
project_211: params[:project_211].present? ? 1 : 0,
|
180
|
+
regular_college: params[:regular_college].present? ? 1 : 0,
|
181
|
+
junior_college: params[:junior_college].present? ? 1 : 0,
|
182
|
+
secondary_school: params[:secondary_school].present? ? 1 : 0,
|
183
|
+
military_school: params[:military_school].present? ? 1 : 0,
|
184
|
+
enterprise: params[:enterprise].present? ? 1 : 0)
|
176
185
|
@school.attributes = school_params
|
177
186
|
@school.school_property = property
|
178
187
|
@school.save!
|
179
188
|
end
|
189
|
+
render_success
|
180
190
|
end
|
181
191
|
|
182
192
|
private
|
183
193
|
|
184
194
|
|
185
195
|
def school_property_params
|
186
|
-
params.
|
196
|
+
params.permit(:project_985, :project_211, :regular_college, :junior_college, :secondary_school, :military_school, :enterprise)
|
187
197
|
end
|
188
198
|
|
189
199
|
def school_params
|
190
|
-
params.
|
200
|
+
params.permit(:name, :province, :city, :address)
|
191
201
|
end
|
192
202
|
|
193
203
|
end
|
@@ -8,7 +8,11 @@ module EducodeSales
|
|
8
8
|
format.html do
|
9
9
|
end
|
10
10
|
format.json do
|
11
|
-
@places = Place.
|
11
|
+
@places = EducodeSales::Place.all
|
12
|
+
if params[:q].present? && params[:q][:name].present?
|
13
|
+
@places = @places.where("name like ?", "%#{params[:q][:name]}%")
|
14
|
+
end
|
15
|
+
@places = @places.page(params[:page]).per(params[:limit])
|
12
16
|
@x = Common.find_by(extras: EducodeSales::Common::XTYPE)&.id
|
13
17
|
@stage_ids = Common.where(clazz: '商机阶段', name: ['已中标','已签单','已验收','回款中', '服务中','已结束']).pluck(:id)
|
14
18
|
end
|
@@ -13,7 +13,7 @@ module EducodeSales
|
|
13
13
|
x = Common.find_by(extras: EducodeSales::Common::XTYPE)&.id
|
14
14
|
o = Common.find_by(extras: EducodeSales::Common::OTYPE)&.id
|
15
15
|
@sale_trend = SaleTrend.find_or_create_by(year: @year)
|
16
|
-
@business_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?
|
16
|
+
@business_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).sum(:total_amount).round(2)
|
17
17
|
stage_ids = Common.where(clazz: '商机阶段', name: ['已中标','已签单','已验收','回款中', '服务中','已结束']).pluck(:id)
|
18
18
|
@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.bidded_date <= ? AND educode_sales_follow_ups.stage_id IN (?)", "#{@year}-01-01", "#{@year}-12-31", stage_ids).sum(:total_amount).round(2)
|
19
19
|
@actual_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.bidded_date <= ? AND educode_sales_follow_ups.stage_id IN (?)", "#{@year}-01-01", "#{@year}-12-31", stage_ids).sum(:actual_amount).round(2)
|
@@ -72,6 +72,21 @@ module EducodeSales
|
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
+
#商机区域分布图表
|
76
|
+
provinces = EducodeSales::Common.where(clazz: 'area').pluck(:name)
|
77
|
+
@business_data = {
|
78
|
+
labels: provinces,
|
79
|
+
datasets:[
|
80
|
+
{
|
81
|
+
label: "商机总额",
|
82
|
+
data: provinces.map{|province| Business.joins(:last_follow_up).where("educode_sales_businesses.department_id in (?)", School.joins(:departments).where(province: province).pluck("departments.id")).where("educode_sales_follow_ups.clazz_id != ?", x).sum(:total_amount).round(2)},
|
83
|
+
backgroundColor: colors[0],
|
84
|
+
borderColor: colors[0],
|
85
|
+
borderWidth: 1
|
86
|
+
}
|
87
|
+
]
|
88
|
+
}
|
89
|
+
|
75
90
|
|
76
91
|
# 已中标图表
|
77
92
|
goal_default_dates = ("#{Time.now.year}-01".."#{Time.now.year}-#{Time.now.month}").to_a
|
@@ -113,10 +113,21 @@ module EducodeSales
|
|
113
113
|
@teachers = @teachers.where("educode_sales_teachers.created_at > ? AND educode_sales_teachers.created_at < ?", date[0], date[1])
|
114
114
|
end
|
115
115
|
|
116
|
-
@teachers = @teachers.
|
116
|
+
@teachers = @teachers.select("
|
117
|
+
educode_sales_teachers.*,
|
118
|
+
users.created_on,
|
119
|
+
users.last_login_on").joins("
|
120
|
+
LEFT JOIN users ON educode_sales_teachers.user_id = users.id
|
121
|
+
")
|
122
|
+
if params[:sort].present? && params[:sort][:field]
|
123
|
+
@teachers = @teachers.order("#{params[:sort][:field]} #{params[:sort][:order]}")
|
124
|
+
else
|
125
|
+
@teachers = @teachers.order("educode_sales_teachers.created_at desc")
|
126
|
+
end
|
127
|
+
@teachers = @teachers.page(params[:page]).per(params[:limit])
|
128
|
+
end
|
117
129
|
|
118
130
|
end
|
119
|
-
end
|
120
131
|
end
|
121
132
|
|
122
133
|
def import
|
@@ -55,6 +55,9 @@
|
|
55
55
|
<script type="text/html" id="business">
|
56
56
|
<a href="javascript:void(0);" lay-event="business" class="layui-table-link">{{ d.business }}</a>
|
57
57
|
</script>
|
58
|
+
<script type="text/html" id="school">
|
59
|
+
<a href="<%= base_url%>/colleges/{{d.school_id}}/statistics" class="layui-table-link" target="_blank">{{ d.school }}</a>
|
60
|
+
</script>
|
58
61
|
|
59
62
|
|
60
63
|
<script>
|
@@ -130,7 +133,7 @@
|
|
130
133
|
field: 'school',
|
131
134
|
width: 120,
|
132
135
|
title: '单位',
|
133
|
-
templet:'
|
136
|
+
templet:'#school'
|
134
137
|
},
|
135
138
|
{
|
136
139
|
field: 'staff',
|
@@ -18,6 +18,7 @@
|
|
18
18
|
<label class="layui-form-label">商机名称</label>
|
19
19
|
<div class="layui-input-inline">
|
20
20
|
<input type="text" name="name" autocomplete="off" class="layui-input" value="<%=params[:name] %>">
|
21
|
+
<input type="text" style="display: none" name="place_id" autocomplete="off" class="layui-input" value="<%=params[:place_id] %>">
|
21
22
|
</div>
|
22
23
|
</div>
|
23
24
|
<div class="layui-inline">
|
@@ -107,6 +108,9 @@
|
|
107
108
|
<script type="text/html" id="show_follow">
|
108
109
|
<a href="javascript:void(0);" lay-event="show_follow" class="layui-table-link">{{ d.follow_ups_count }}</a>
|
109
110
|
</script>
|
111
|
+
<script type="text/html" id="school_name">
|
112
|
+
<a href="<%= base_url%>/colleges/{{d.school_id}}/statistics" class="layui-table-link" target="_blank">{{ d.school }}</a>
|
113
|
+
</script>
|
110
114
|
|
111
115
|
|
112
116
|
<script>
|
@@ -203,7 +207,7 @@
|
|
203
207
|
field: 'school',
|
204
208
|
width: 150,
|
205
209
|
title: '单位',
|
206
|
-
templet:'
|
210
|
+
templet:'#school_name'
|
207
211
|
},
|
208
212
|
{
|
209
213
|
field: 'department',
|
@@ -235,6 +239,22 @@
|
|
235
239
|
width: 90,
|
236
240
|
title: '阶段'
|
237
241
|
},
|
242
|
+
{
|
243
|
+
field: 'source',
|
244
|
+
width: 90,
|
245
|
+
title: '商机来源'
|
246
|
+
},
|
247
|
+
{
|
248
|
+
field: 'last_follow_person',
|
249
|
+
width: 100,
|
250
|
+
title: '最新跟进人'
|
251
|
+
},
|
252
|
+
{
|
253
|
+
field: 'latest_time',
|
254
|
+
width: 200,
|
255
|
+
title: '最新跟进时间',
|
256
|
+
sort: true
|
257
|
+
},
|
238
258
|
{
|
239
259
|
field: 'invitation_at',
|
240
260
|
width: 105,
|
@@ -285,21 +305,6 @@
|
|
285
305
|
width: 160,
|
286
306
|
title: '渠道',
|
287
307
|
},
|
288
|
-
{
|
289
|
-
field: 'source',
|
290
|
-
width: 90,
|
291
|
-
title: '商机来源'
|
292
|
-
},
|
293
|
-
{
|
294
|
-
field: 'last_follow_person',
|
295
|
-
width: 100,
|
296
|
-
title: '最新跟进人'
|
297
|
-
},
|
298
|
-
{
|
299
|
-
field: 'latest_time',
|
300
|
-
width: 200,
|
301
|
-
title: '最新跟进时间'
|
302
|
-
},
|
303
308
|
{
|
304
309
|
title: '操作',
|
305
310
|
minWidth: 170,
|
@@ -390,6 +395,7 @@
|
|
390
395
|
});
|
391
396
|
}
|
392
397
|
function time_line(id,name) {
|
398
|
+
business_id = id
|
393
399
|
var content = miniPage.getHrefContent('/missions/businesses/time_line?business_id=' + id);
|
394
400
|
var openWH = miniPage.getOpenWidthHeight();
|
395
401
|
sindex = layer.open({
|
@@ -5,6 +5,7 @@ json.data do
|
|
5
5
|
json.name d.name
|
6
6
|
json.department d.department.name
|
7
7
|
json.school d.department.school.name
|
8
|
+
json.school_id d.department.school.id
|
8
9
|
json.follow_ups_count d.follow_ups_count
|
9
10
|
follow_ups_count += d.follow_ups_count
|
10
11
|
json.follow_up_id d.last_follow_up_id
|
@@ -12,7 +12,7 @@
|
|
12
12
|
<span class="table-label pull-right" style="padding-right: 20px">温馨提示:仅可以在24小时之内,编辑/删除最新的跟进记录</span>
|
13
13
|
</div>
|
14
14
|
</script>
|
15
|
-
<div class="
|
15
|
+
<div class=" tool">
|
16
16
|
<div class="z-index">
|
17
17
|
<table class="layui-hide" id="sale_plan_follow_table" lay-filter="sale_plan_follow_table"></table>
|
18
18
|
</div>
|
@@ -43,7 +43,7 @@
|
|
43
43
|
function demo(){
|
44
44
|
layer.closeAll()
|
45
45
|
business_id = parent.business_id
|
46
|
-
var content = miniPage.getHrefContent('/missions/businesses/show_follow?id=' +
|
46
|
+
var content = miniPage.getHrefContent('/missions/businesses/show_follow?id=' + business_id);
|
47
47
|
var openWH = miniPage.getOpenWidthHeight();
|
48
48
|
sindex = layer.open({
|
49
49
|
title: '商机列表/'+ parent.business_name +'的跟进记录',
|
@@ -1,14 +1,58 @@
|
|
1
|
-
|
2
|
-
<form class="layui-form " action="">
|
1
|
+
<form class="layui-form layuimini-form " action="">
|
3
2
|
<div class="layui-form-item" style="padding: 25px">
|
3
|
+
<div class="layui-inline">
|
4
|
+
<label class="layui-form-label required">学校:</label>
|
5
|
+
<div class="layui-input-block">
|
6
|
+
<input type="text" name="name" required lay-verify="required" value="<%=@school.name %>" placeholder="请输入学校" autocomplete="off"
|
7
|
+
class="layui-input" id="inputFocus">
|
8
|
+
</div>
|
9
|
+
</div>
|
10
|
+
<br>
|
11
|
+
<div class="layui-inline">
|
12
|
+
<label class="layui-form-label required">省:</label>
|
13
|
+
<div class="layui-input-block">
|
14
|
+
<input type="text" name="province" lay-verify="required" value="<%=@school.province %>" autocomplete="off"
|
15
|
+
class="layui-input" placeholder="请输入地址" >
|
16
|
+
</div>
|
17
|
+
</div>
|
18
|
+
<br>
|
19
|
+
<div class="layui-inline">
|
20
|
+
<label class="layui-form-label ">市:</label>
|
21
|
+
<div class="layui-input-block">
|
22
|
+
<input type="text" name="city" value="<%=@school.city %>" autocomplete="off"
|
23
|
+
class="layui-input" placeholder="请输入地址" >
|
24
|
+
</div>
|
25
|
+
</div>
|
26
|
+
<br>
|
27
|
+
<div class="layui-inline">
|
28
|
+
<label class="layui-form-label ">地址:</label>
|
29
|
+
<div class="layui-input-block">
|
30
|
+
<input type="text" name="address" value="<%=@school.address %>" autocomplete="off"
|
31
|
+
class="layui-input" placeholder="请输入地址" >
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
<div class="layui-form-item">
|
35
|
+
<label class="layui-form-label">学校性质:</label>
|
36
|
+
<div class="layui-input-block">
|
37
|
+
<input type="checkbox" name="project_985" lay-skin="primary" value="1" <%= 'checked' if @school_property&.project_985 %> title="985工程">
|
38
|
+
<input type="checkbox" name="project_211" lay-skin="primary" value="1" <%= 'checked' if @school_property&.project_211 %> title="211工程" >
|
39
|
+
<input type="checkbox" name="regular_college" lay-skin="primary" value="1" <%= 'checked' if @school_property&.regular_college %> title="本科院校">
|
40
|
+
</div>
|
41
|
+
</div>
|
4
42
|
<div class="layui-form-item">
|
5
|
-
<label class="layui-form-label required">负责区域</label>
|
6
43
|
<div class="layui-input-block">
|
7
|
-
<
|
44
|
+
<input type="checkbox" name="junior_college" lay-skin="primary" value="1" <%= 'checked' if @school_property&.junior_college %> title="大专院校">
|
45
|
+
<input type="checkbox" name="secondary_school" lay-skin="primary" value="1" <%= 'checked' if @school_property&.secondary_school %> title="中专院校" >
|
46
|
+
<input type="checkbox" name="military_school" lay-skin="primary" value="1" <%= 'checked' if @school_property&.military_school %> title="军事院校">
|
47
|
+
</div>
|
48
|
+
</div>
|
49
|
+
<div class="layui-form-item">
|
50
|
+
<div class="layui-input-block">
|
51
|
+
<input type="checkbox" name="enterprise" lay-skin="primary" value="1" <%= 'checked' if @school_property&.enterprise %> title="企业">
|
8
52
|
</div>
|
9
53
|
</div>
|
10
54
|
<div class="layui-inline" style="padding-left: 30px">
|
11
|
-
<button type="submit" class="layui-btn layui-btn-normal" lay-submit lay-filter="
|
55
|
+
<button type="submit" class="layui-btn layui-btn-normal" lay-submit lay-filter="data-reset-btn">提交
|
12
56
|
</button>
|
13
57
|
</div>
|
14
58
|
</div>
|
@@ -35,23 +79,13 @@
|
|
35
79
|
|
36
80
|
|
37
81
|
//监听提交
|
38
|
-
form.on('submit(
|
39
|
-
|
40
|
-
|
41
|
-
layui.each(transfer.getData('area_list'), function (i, v) {
|
42
|
-
area_ids.push(v.value)
|
43
|
-
})
|
44
|
-
if (area_ids.length == 0) {
|
45
|
-
layer.alert("请选择负责区域");
|
46
|
-
return false;
|
47
|
-
}
|
48
|
-
data.field['area_ids'] = area_ids;
|
49
|
-
request.authPut("missions/places/" + data.field.id, data.field, function (res) {
|
50
|
-
if (res.success == false) {
|
82
|
+
form.on('submit(data-reset-btn)', function (data) {
|
83
|
+
request.authPut("missions/customers/" + <%= @school.id %>, data.field, function (res) {
|
84
|
+
if (res.success === false) {
|
51
85
|
layer.alert(res.msg)
|
52
86
|
} else {
|
53
|
-
layer.closeAll();
|
54
|
-
table.reload('
|
87
|
+
layer.closeAll(); //关闭所有层
|
88
|
+
table.reload('customers_table')
|
55
89
|
}
|
56
90
|
})
|
57
91
|
return false;
|
@@ -40,7 +40,7 @@
|
|
40
40
|
<div class="layui-btn-container">
|
41
41
|
<span class="table-label">客户列表</span>
|
42
42
|
<% if can? :create, EducodeSales::Customer %>
|
43
|
-
|
43
|
+
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="add">添加客户</button>
|
44
44
|
<% end %>
|
45
45
|
<% if can? :give, EducodeSales::Customer %>
|
46
46
|
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="give">分配/移交</button>
|
@@ -59,14 +59,14 @@
|
|
59
59
|
<a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="add_follow">添加跟进记录</a>
|
60
60
|
<% end %>
|
61
61
|
<% if can? :update, EducodeSales::Customer %>
|
62
|
-
|
62
|
+
<a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>
|
63
63
|
<% end %>
|
64
64
|
</script>
|
65
65
|
<script type="text/html" id="business">
|
66
66
|
<a href="/missions/businesses?school={{d.name}}" class="layui-table-link">{{ d.business }}</a>
|
67
67
|
</script>
|
68
68
|
<script type="text/html" id="name">
|
69
|
-
<a href="
|
69
|
+
<a href="<%= base_url%>/colleges/{{d.id}}/statistics" class="layui-table-link" target="_blank">{{ d.name }}</a>
|
70
70
|
</script>
|
71
71
|
<script type="text/html" id="department">
|
72
72
|
<a href="javascript:void(0);" lay-event="department" class="layui-table-link">{{ d.department }}</a>
|
@@ -87,12 +87,12 @@
|
|
87
87
|
|
88
88
|
var laydate = layui.laydate;
|
89
89
|
|
90
|
-
function hn(){
|
91
|
-
|
92
|
-
}
|
93
|
-
$(document).ready(function(){
|
94
|
-
|
95
|
-
});
|
90
|
+
// function hn(){
|
91
|
+
// $("#search_bt").trigger("click");
|
92
|
+
// }
|
93
|
+
// $(document).ready(function(){
|
94
|
+
// window.onload=hn;
|
95
|
+
// });
|
96
96
|
|
97
97
|
laydate.render({
|
98
98
|
elem: '#date',
|
@@ -106,7 +106,7 @@
|
|
106
106
|
table.render({
|
107
107
|
elem: '#customers_table',
|
108
108
|
url: '/missions/customers',
|
109
|
-
|
109
|
+
where: {q: form.val('search_teachers')},
|
110
110
|
toolbar: '#toolbarDemo',
|
111
111
|
// totalRow:true,
|
112
112
|
defaultToolbar: ['filter'],
|
@@ -338,7 +338,7 @@
|
|
338
338
|
var data = obj.data;
|
339
339
|
id = data.id
|
340
340
|
if (obj.event === 'edit') { // 监听添加操作
|
341
|
-
var content = miniPage.getHrefContent('/missions/customers' + data.id + '/edit');
|
341
|
+
var content = miniPage.getHrefContent('/missions/customers/' + data.id + '/edit');
|
342
342
|
var openWH = miniPage.getOpenWidthHeight();
|
343
343
|
sale_plan_index = layer.open({
|
344
344
|
title: '编辑客户',
|
@@ -1,7 +1,6 @@
|
|
1
1
|
json.data do
|
2
2
|
json.array! @customers do |d|
|
3
|
-
|
4
|
-
business_ids = EducodeSales::Business.where(department_id: department_ids).ids
|
3
|
+
business_ids = EducodeSales::Business.where(school_id: d.id).ids
|
5
4
|
follow_ups = EducodeSales::FollowUp.where(business_id: business_ids)
|
6
5
|
customer_follows = EducodeSales::CustomerFollow.where(school_id: d.id)
|
7
6
|
a_last_follow_time = follow_ups.last&.created_at&.to_s
|
@@ -1,17 +1,33 @@
|
|
1
|
-
<form class="layui-form
|
1
|
+
<form class="layui-form layuimini-form" action="">
|
2
2
|
<div class="layui-form-item" style="padding: 25px">
|
3
3
|
<div class="layui-inline">
|
4
4
|
<label class="layui-form-label required">学校:</label>
|
5
5
|
<div class="layui-input-block">
|
6
|
-
<input type="text" name="name"
|
6
|
+
<input type="text" name="name" lay-verify="required" placeholder="请输入学校" autocomplete="off"
|
7
7
|
class="layui-input" id="inputFocus">
|
8
8
|
</div>
|
9
9
|
</div>
|
10
10
|
<br>
|
11
11
|
<div class="layui-inline">
|
12
|
-
<label class="layui-form-label required"
|
12
|
+
<label class="layui-form-label required">省:</label>
|
13
13
|
<div class="layui-input-block">
|
14
|
-
<input type="text" name="
|
14
|
+
<input type="text" name="province" lay-verify="required" autocomplete="off"
|
15
|
+
class="layui-input" placeholder="请输入省" >
|
16
|
+
</div>
|
17
|
+
</div>
|
18
|
+
<br>
|
19
|
+
<div class="layui-inline">
|
20
|
+
<label class="layui-form-label ">市:</label>
|
21
|
+
<div class="layui-input-block">
|
22
|
+
<input type="text" name="city" autocomplete="off"
|
23
|
+
class="layui-input" placeholder="请输入市" >
|
24
|
+
</div>
|
25
|
+
</div>
|
26
|
+
<br>
|
27
|
+
<div class="layui-inline">
|
28
|
+
<label class="layui-form-label ">地址:</label>
|
29
|
+
<div class="layui-input-block">
|
30
|
+
<input type="text" name="address" autocomplete="off"
|
15
31
|
class="layui-input" placeholder="请输入地址" >
|
16
32
|
</div>
|
17
33
|
</div>
|
@@ -66,23 +82,14 @@
|
|
66
82
|
//监听提交
|
67
83
|
form.on('submit(data-reset-btn)', function (data) {
|
68
84
|
console.log(data.field);
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
// data.field['area_ids'] = area_ids;
|
78
|
-
// request.authPost("missions/places", data.field, function (res) {
|
79
|
-
// if (res.success === false) {
|
80
|
-
// layer.alert(res.msg)
|
81
|
-
// } else {
|
82
|
-
// layer.closeAll(); //关闭所有层
|
83
|
-
// table.reload('place')
|
84
|
-
// }
|
85
|
-
// })
|
85
|
+
request.authPost("missions/customers", data.field, function (res) {
|
86
|
+
if (res.success === false) {
|
87
|
+
layer.alert(res.msg)
|
88
|
+
} else {
|
89
|
+
layer.closeAll(); //关闭所有层
|
90
|
+
parent.table.reload('customers_table')
|
91
|
+
}
|
92
|
+
})
|
86
93
|
return false;
|
87
94
|
});
|
88
95
|
});
|
@@ -1,10 +1,10 @@
|
|
1
1
|
<h1 class="text-center" style="padding: 25px"><%=@school.name %></h1>
|
2
2
|
<form class="layui-form form-value" action="">
|
3
3
|
<div class="layui-form-item" style="padding: 25px">
|
4
|
-
<div class="layui-
|
4
|
+
<div class="layui-form-item layui-form-text">
|
5
5
|
<label class="layui-form-label">跟进内容:</label>
|
6
|
-
<div class="layui-input-
|
7
|
-
<
|
6
|
+
<div class="layui-input-block" style="padding-right: 20px;">
|
7
|
+
<pre><%= @follow_up.content %></pre>
|
8
8
|
</div>
|
9
9
|
</div>
|
10
10
|
<br>
|
@@ -7,6 +7,7 @@ json.data do
|
|
7
7
|
json.description d.description
|
8
8
|
json.advise d.advise
|
9
9
|
json.school d.business.department.school.name
|
10
|
+
json.school_id d.business.department.school.id
|
10
11
|
json.created_at d.created_at.to_s
|
11
12
|
json.business d.business.name
|
12
13
|
json.business_id d.business.id
|
@@ -1,3 +1,22 @@
|
|
1
|
+
<div style="margin: 10px 10px 10px 10px">
|
2
|
+
<form class="layui-form layui-form-pane" lay-filter="search_teachers">
|
3
|
+
<div class="layui-form-item">
|
4
|
+
<div class="layui-inline">
|
5
|
+
<label class="layui-form-label">渠道名称</label>
|
6
|
+
<div class="layui-input-inline">
|
7
|
+
<input type="text" name="name" autocomplete="off" class="layui-input">
|
8
|
+
</div>
|
9
|
+
</div>
|
10
|
+
<div class="layui-inline">
|
11
|
+
<button type="reset" class="layui-btn layui-btn-primary" lay-submit lay-filter="reset_business_search">重置
|
12
|
+
</button>
|
13
|
+
<button type="submit" class="layui-btn layui-btn-primary" id="search_bt" lay-submit lay-filter="search_teachers">搜 索
|
14
|
+
</button>
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
</form>
|
18
|
+
</div>
|
19
|
+
|
1
20
|
<script type="text/html" id="toolbarDemo">
|
2
21
|
<div class="layui-btn-container">
|
3
22
|
<span class="table-label">渠道列表</span>
|
@@ -35,6 +54,51 @@
|
|
35
54
|
request = layui.request,
|
36
55
|
miniPage = layui.miniPage;
|
37
56
|
|
57
|
+
|
58
|
+
|
59
|
+
var sort = {}, search = {};
|
60
|
+
table.on('sort(place)', function (obj) {
|
61
|
+
sort.field = obj.field;
|
62
|
+
sort.order = obj.type;
|
63
|
+
table.reload('place', {
|
64
|
+
initSort: obj,
|
65
|
+
where: {
|
66
|
+
sort: sort,
|
67
|
+
q: search
|
68
|
+
}
|
69
|
+
});
|
70
|
+
})
|
71
|
+
|
72
|
+
// 监听搜索操作
|
73
|
+
form.on('submit(search_teachers)', function (data) {
|
74
|
+
search = data.field
|
75
|
+
table.reload('place', {
|
76
|
+
page: {
|
77
|
+
curr: 1
|
78
|
+
},
|
79
|
+
where: {q: search, sort: sort}
|
80
|
+
}, 'data');
|
81
|
+
return false;
|
82
|
+
});
|
83
|
+
|
84
|
+
form.on('submit(reset_business_search)', function (data) {
|
85
|
+
var field = data.field;
|
86
|
+
form.val('search_teachers', {
|
87
|
+
area: "",
|
88
|
+
date: "",
|
89
|
+
attitude: "",
|
90
|
+
name: "",
|
91
|
+
professional_title: "",
|
92
|
+
regist_at: "",
|
93
|
+
staff_id: "",
|
94
|
+
status: "",
|
95
|
+
school: "",
|
96
|
+
assist: "",
|
97
|
+
teacher_source: ""
|
98
|
+
});
|
99
|
+
return false;
|
100
|
+
});
|
101
|
+
|
38
102
|
table.render({
|
39
103
|
elem: '#place',
|
40
104
|
url: '/missions/places',
|
@@ -7,7 +7,7 @@
|
|
7
7
|
<div class="layui-tab-item layui-show">
|
8
8
|
<form class="layui-form line" action="">
|
9
9
|
<% id = 0 %>
|
10
|
-
<% EducodeSales::Permission.all.group_by{ |d| d.clazz}.each do |k, d| %>
|
10
|
+
<% EducodeSales::Permission.all.order(position: :asc).group_by{ |d| d.clazz}.each do |k, d| %>
|
11
11
|
<div class="layui-form-item">
|
12
12
|
<label class="layui-form-label"><%= k %></label>
|
13
13
|
<div class="layui-input-block">
|
@@ -272,6 +272,19 @@
|
|
272
272
|
|
273
273
|
</div>
|
274
274
|
</div>
|
275
|
+
<br>
|
276
|
+
<br>
|
277
|
+
<div class="layui-tab layui-tab-card " id="销售额分析" lay-filter="test1">
|
278
|
+
<ul class="layui-tab-title">
|
279
|
+
<li class="layui-this">商机区域分布</li>
|
280
|
+
</ul>
|
281
|
+
<div class="layui-tab-content" style="padding-right: 50px">
|
282
|
+
<div class="layui-tab-item layui-show" style="padding-left: 20px">
|
283
|
+
<canvas id="myChart3" width="960" height="200"></canvas>
|
284
|
+
</div>
|
285
|
+
|
286
|
+
</div>
|
287
|
+
</div>
|
275
288
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/chart.js@2.9.1/dist/Chart.min.css">
|
276
289
|
<script src="https://cdn.jsdelivr.net/npm/chart.js@2.9.1/dist/Chart.min.js"></script>
|
277
290
|
<script>
|
@@ -498,5 +511,12 @@
|
|
498
511
|
data: <%=raw @goal_count_data.to_json %>,
|
499
512
|
options: opt
|
500
513
|
});
|
514
|
+
|
515
|
+
var ctx = document.getElementById('myChart3');
|
516
|
+
var myChart3 = new Chart(ctx, {
|
517
|
+
type: 'bar',
|
518
|
+
data: <%=raw @business_data.to_json %>,
|
519
|
+
options: opt
|
520
|
+
});
|
501
521
|
})
|
502
522
|
</script>
|
@@ -49,6 +49,10 @@
|
|
49
49
|
<a href="/missions/customers?staff_id={{d.id}}">{{d.school_count}}</a>
|
50
50
|
</div>
|
51
51
|
</script>
|
52
|
+
<script type="text/html" id="bussinessBar">
|
53
|
+
<div class="layui-btn-container">
|
54
|
+
</div>
|
55
|
+
</script>
|
52
56
|
<script>
|
53
57
|
layui.use('table', function () {
|
54
58
|
var form = layui.form,
|
@@ -63,7 +67,9 @@
|
|
63
67
|
table.render({
|
64
68
|
elem: '#table',
|
65
69
|
url: '/missions/sales?year=<%= @year %>',
|
66
|
-
|
70
|
+
defaultToolbar: ['filter'],
|
71
|
+
cellMinWidth: 80,
|
72
|
+
toolbar: '#bussinessBar',
|
67
73
|
totalRow:true,
|
68
74
|
cols: [
|
69
75
|
[{
|
@@ -161,14 +167,14 @@
|
|
161
167
|
field: 'follow_school_rate',
|
162
168
|
title: '学校覆盖率',
|
163
169
|
sort:true,
|
164
|
-
totalRow:
|
170
|
+
totalRow:true,
|
165
171
|
width: 120
|
166
172
|
},
|
167
173
|
{
|
168
174
|
field: 'follow_department_rate',
|
169
175
|
title: '学院覆盖率',
|
170
176
|
sort:true,
|
171
|
-
totalRow:
|
177
|
+
totalRow:true,
|
172
178
|
width: 120
|
173
179
|
},
|
174
180
|
]
|
@@ -5,6 +5,8 @@ businesses_d_count = 0
|
|
5
5
|
businesses_e_count = 0
|
6
6
|
businesses_o_count = 0
|
7
7
|
school_counts = 0
|
8
|
+
follow_school_rates = 0
|
9
|
+
follow_department_rates = 0
|
8
10
|
area_ids = EducodeSales::Common.where(clazz: 'area').ids.sort.to_s
|
9
11
|
json.data do
|
10
12
|
json.array! @staffs do |d|
|
@@ -38,11 +40,13 @@ json.data do
|
|
38
40
|
json.goal @businesses.joins("JOIN educode_sales_follow_ups on educode_sales_follow_ups.id = educode_sales_businesses.last_follow_up_id").where("educode_sales_follow_ups.clazz_id != ? AND educode_sales_follow_ups.stage_id in (?)", @x, @step_ids).sum(:total_amount).round(2)
|
39
41
|
json.return_money @businesses.joins(last_follow_up: :money_plans).where("educode_sales_follow_ups.clazz_id != ?", @x).where.not("educode_sales_money_plans.clazz!= ?", 1).sum(:amount).round(2)
|
40
42
|
json.school_count school_count
|
41
|
-
follow_school_count = EducodeSales::CustomerFollow.where(staff_id: d.id).pluck(:school_id).uniq.size
|
43
|
+
follow_school_count = (EducodeSales::CustomerFollow.where(staff_id: d.id).pluck(:school_id) + EducodeSales::Business.where(id: EducodeSales::FollowUp.where(staff_id: d.id).pluck(:business_id).uniq).pluck(:school_id)).uniq.size
|
42
44
|
json.follow_school_count follow_school_count
|
43
45
|
json.follow_school_counts EducodeSales::CustomerFollow.where(staff_id: d.id).size + EducodeSales::FollowUp.where(staff_id: d.id).size
|
44
|
-
|
45
|
-
json.
|
46
|
+
follow_school_rate = (follow_school_count!=0 ? school_count.to_f * 100 / follow_school_count : 0).round(2)
|
47
|
+
json.follow_school_rate follow_school_rate.to_s + '%'
|
48
|
+
follow_department_rate = (follow_school_count!=0 ? school_count.to_f * 110 / follow_school_count : 0).round(2)
|
49
|
+
json.follow_department_rate follow_department_rate.to_s + '%'
|
46
50
|
else
|
47
51
|
business_a = @businesses.joins("JOIN educode_sales_follow_ups on educode_sales_follow_ups.id = educode_sales_businesses.last_follow_up_id").where("educode_sales_follow_ups.clazz_id = ?", @a_clazz&.id).where("educode_sales_follow_ups.year = ?", @year).count
|
48
52
|
business_b = @businesses.joins("JOIN educode_sales_follow_ups on educode_sales_follow_ups.id = educode_sales_businesses.last_follow_up_id").where("educode_sales_follow_ups.clazz_id = ?", @b_clazz&.id).where("educode_sales_follow_ups.year = ?", @year).count
|
@@ -54,11 +58,13 @@ json.data do
|
|
54
58
|
json.goal @businesses.joins("JOIN educode_sales_follow_ups on educode_sales_follow_ups.id = educode_sales_businesses.last_follow_up_id").where("educode_sales_follow_ups.clazz_id != ? AND educode_sales_follow_ups.stage_id in (?)", @x, @step_ids).where("educode_sales_follow_ups.bidded_date >= ? AND educode_sales_follow_ups.bidded_date <= ?", "#{@year}-01-01", "#{@year}-12-31").sum(:total_amount).round(2)
|
55
59
|
json.return_money @businesses.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}-01-01 00:00:00", "#{@year}-12-31 23:59:59").sum(:amount).round(2)
|
56
60
|
json.school_count school_count
|
57
|
-
follow_school_count = EducodeSales::CustomerFollow.where(staff_id: d.id).where("created_at >= ? AND created_at <= ?", "#{@year}-01-01", "#{@year}-12-31").pluck(:school_id).uniq.size
|
61
|
+
follow_school_count = (EducodeSales::CustomerFollow.where(staff_id: d.id).where("created_at >= ? AND created_at <= ?", "#{@year}-01-01", "#{@year}-12-31").pluck(:school_id) + EducodeSales::Business.where(id: EducodeSales::FollowUp.where("created_at >= ? AND created_at <= ?", "#{@year}-01-01", "#{@year}-12-31").where(staff_id: d.id).pluck(:business_id).uniq).pluck(:school_id)).uniq.size
|
58
62
|
json.follow_school_count follow_school_count
|
59
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
|
60
|
-
|
61
|
-
json.
|
64
|
+
follow_school_rate = (follow_school_count!=0 ? school_count.to_f * 100 / follow_school_count : 0).round(2)
|
65
|
+
json.follow_school_rate follow_school_rate.to_s + '%'
|
66
|
+
follow_department_rate = (follow_school_count!=0 ? school_count.to_f * 110 / follow_school_count : 0).round(2)
|
67
|
+
json.follow_department_rate follow_department_rate.to_s + '%'
|
62
68
|
end
|
63
69
|
|
64
70
|
json.business_a business_a
|
@@ -81,6 +87,8 @@ json.data do
|
|
81
87
|
businesses_e_count += business_e
|
82
88
|
businesses_o_count += business_o
|
83
89
|
school_counts += school_count
|
90
|
+
follow_school_rates += follow_school_rate
|
91
|
+
follow_department_rates += follow_department_rate
|
84
92
|
end
|
85
93
|
end
|
86
94
|
|
@@ -92,6 +100,8 @@ json.totalRow do
|
|
92
100
|
json.business_e businesses_e_count.to_s
|
93
101
|
json.business_o businesses_o_count.to_s
|
94
102
|
json.school_count school_counts.to_s
|
103
|
+
json.follow_school_rate (follow_school_rates.to_f / @staffs.size).to_s + '%'
|
104
|
+
json.follow_department_rate (follow_department_rates.to_f / @staffs.size).to_s + '%'
|
95
105
|
end
|
96
106
|
json.code 0
|
97
107
|
json.count @staffs.total_count
|
@@ -88,16 +88,6 @@
|
|
88
88
|
<table class="layui-hide" id="teachers_table" style="min-height: 300px;" lay-filter="teachers_table"></table>
|
89
89
|
</div>
|
90
90
|
<script type="text/html" id="currentTableBar">
|
91
|
-
<%# if can? :create, EducodeSales::OperationPlan %>
|
92
|
-
<!-- <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="addWeek">添加周计划</a>-->
|
93
|
-
<!-- <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="addMonth">添加月计划</a>-->
|
94
|
-
<%# end %>
|
95
|
-
<%# if can? :update, EducodeSales::Teacher %>
|
96
|
-
<!-- <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>-->
|
97
|
-
<%# end %>
|
98
|
-
<%# if can? :destroy, EducodeSales::Teacher %>
|
99
|
-
<!-- <a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a>-->
|
100
|
-
<%# end %>
|
101
91
|
<% if can? :create, EducodeSales::TeacherFollow %>
|
102
92
|
<a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="add_event">添加跟进记录</a>
|
103
93
|
<% end %>
|
@@ -243,19 +233,22 @@
|
|
243
233
|
templet: "#event"
|
244
234
|
},
|
245
235
|
{
|
246
|
-
field: '
|
236
|
+
field: 'created_on',
|
247
237
|
width: 120,
|
248
238
|
title: '注册时间',
|
239
|
+
sort: true,
|
249
240
|
},
|
250
241
|
{
|
251
242
|
field: 'last_login_on',
|
252
243
|
width: 120,
|
253
244
|
title: '最近登录',
|
245
|
+
sort: true,
|
254
246
|
},
|
255
247
|
{
|
256
248
|
field: 'created_at',
|
257
249
|
width: 120,
|
258
250
|
title: '添加时间',
|
251
|
+
sort: true,
|
259
252
|
},
|
260
253
|
{
|
261
254
|
field: 'wechat',
|
@@ -18,7 +18,7 @@ json.data do
|
|
18
18
|
json.courses_count d.courses_count
|
19
19
|
json.actives d.actives
|
20
20
|
json.students d.students_count
|
21
|
-
json.
|
21
|
+
json.created_on d.user.present? ? d.user.created_on.to_s(:date) : ''
|
22
22
|
json.last_login_on (d.user.present? && d.user.last_login_on.present?) ? d.user.last_login_on.to_s(:date) : ''
|
23
23
|
json.teacher_used d.teacher_used
|
24
24
|
json.wechat d.wechat
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class AddPositionToCommons < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
add_column :educode_sales_permissions, :position, :integer
|
4
|
+
EducodeSales::Permission.all.each_with_index do |d,index|
|
5
|
+
if d.clazz == '销售态势' || d.clazz == '销售分工' || d.clazz == '商机管理' || d.clazz == '客户管理'
|
6
|
+
d.update(position: index)
|
7
|
+
else
|
8
|
+
d.update(position: index * 10)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
class AddSchoolIdToEducodeSalesBusinesses < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
add_column :educode_sales_businesses, :school_id, :integer
|
4
|
+
EducodeSales::Business.all.each do |business|
|
5
|
+
business.update(school_id: business.department.school.id)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
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.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- anke1460
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-12-
|
11
|
+
date: 2021-12-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -405,6 +405,8 @@ files:
|
|
405
405
|
- db/migrate/20211206054756_add_year_to_follow_ups.rb
|
406
406
|
- db/migrate/20211214100803_create_customer_extensions.rb
|
407
407
|
- db/migrate/20211215025029_create_educode_sales_customer_follows.rb
|
408
|
+
- db/migrate/20211220102720_add_position_to_commons.rb
|
409
|
+
- db/migrate/20211221075146_add_school_id_to_educode_sales_businesses.rb
|
408
410
|
- lib/educode_sales.rb
|
409
411
|
- lib/educode_sales/engine.rb
|
410
412
|
- lib/educode_sales/version.rb
|