educode_sales 0.5.5 → 0.5.6
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 +2 -0
- data/app/controllers/educode_sales/follow_ups_controller.rb +57 -0
- data/app/controllers/educode_sales/home_controller.rb +11 -0
- data/app/controllers/educode_sales/sale_trends_controller.rb +1 -2
- data/app/controllers/educode_sales/teachers_controller.rb +35 -14
- data/app/models/educode_sales/teacher.rb +2 -1
- data/app/models/educode_sales/teacher_assign_follow.rb +6 -0
- data/app/views/educode_sales/activities/index.html.erb +4 -5
- data/app/views/educode_sales/activities/show_teachers.html.erb +1 -1
- data/app/views/educode_sales/businesses/_follows.html.erb +233 -0
- data/app/views/educode_sales/businesses/edit_follow_record.html.erb +48 -4
- data/app/views/educode_sales/businesses/index.html.erb +130 -62
- data/app/views/educode_sales/businesses/new_follow_record.html.erb +49 -4
- data/app/views/educode_sales/businesses/show_follow.html.erb +4 -4
- data/app/views/educode_sales/businesses/time_line.html.erb +1 -1
- data/app/views/educode_sales/follow_ups/index.json.jbuilder +19 -0
- data/app/views/educode_sales/home/sales_place.json.jbuilder +9 -0
- data/app/views/educode_sales/recycles/index.html.erb +1 -1
- data/app/views/educode_sales/sale_trends/trends.html.erb +2 -2
- data/app/views/educode_sales/sales/operations.html.erb +2 -0
- data/app/views/educode_sales/teachers/course_list.json.jbuilder +1 -1
- data/app/views/educode_sales/teachers/edit.html.erb +53 -7
- data/app/views/educode_sales/teachers/index.html.erb +35 -1
- data/app/views/educode_sales/teachers/index.json.jbuilder +4 -1
- data/app/views/educode_sales/teachers/new.html.erb +55 -17
- data/config/routes.rb +1 -0
- data/db/migrate/20211201023750_create_educode_sales_teacher_assign_follows.rb +11 -0
- data/lib/educode_sales/version.rb +1 -1
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3990eb5d7556c5bab5819c03981769a0385a28d52a8357ca8116cc1083ab6d0
|
4
|
+
data.tar.gz: 073e8a50229f8a39a2966fdfad84bd177efceb1101e82c6553dbc3fc905542b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7fefe63cc01a8977e73b6f4f758aee060afe88f6c9706effda0e61ec0ab4cf38a21fa5a825e2ccf7420940a17d3712c91ac2e9a9a5268040d897dae24df55197
|
7
|
+
data.tar.gz: 03a089117cb9d969c68e38fb91904983dd978c459a33e8d0a03264355852e3716044fd85e280f5f9d62d54445332e516f4a0d0f324178305d8d988dd8ca3365a
|
@@ -270,6 +270,7 @@ module EducodeSales
|
|
270
270
|
gon.sales = @last_follow_up.assign_follow_ups.map do |d|
|
271
271
|
{value: d.staff_id, name: d.staff.user.full_name}
|
272
272
|
end
|
273
|
+
gon.place = [{ value: @last_follow_up.place&.id, name: @last_follow_up.place&.name }]
|
273
274
|
end
|
274
275
|
render layout: false
|
275
276
|
end
|
@@ -303,6 +304,7 @@ module EducodeSales
|
|
303
304
|
gon.sales = @follow_up.assign_follow_ups.map do |d|
|
304
305
|
{value: d.staff_id, name: d.staff.user.full_name}
|
305
306
|
end
|
307
|
+
gon.place = [{ value: @follow_up.place&.id, name: @follow_up.place&.name }]
|
306
308
|
render layout: false
|
307
309
|
end
|
308
310
|
|
@@ -3,6 +3,63 @@ require_dependency "educode_sales/application_controller"
|
|
3
3
|
module EducodeSales
|
4
4
|
class FollowUpsController < ApplicationController
|
5
5
|
|
6
|
+
def index
|
7
|
+
authorize! :read, Business
|
8
|
+
respond_to do |format|
|
9
|
+
format.html do
|
10
|
+
end
|
11
|
+
format.json do
|
12
|
+
if @current_admin.is_admin?
|
13
|
+
@follow_ups = FollowUp.all
|
14
|
+
else
|
15
|
+
level = @current_admin.role.role_areas.find_by(clazz: '商机管理').level
|
16
|
+
case level
|
17
|
+
when '自己'
|
18
|
+
business_ids = Business.joins(last_follow_up: :assign_follow_ups).where("educode_sales_assign_follow_ups.staff_id = ?", @current_admin.id).pluck(:id)
|
19
|
+
@businesses = Business.where("educode_sales_businesses.staff_id = ? OR educode_sales_businesses.id in (?)", @current_admin.id, business_ids)
|
20
|
+
business_ids = @businesses.pluck(:id)
|
21
|
+
@follow_ups = @follow_ups.where(business_id: business_ids)
|
22
|
+
when '区域'
|
23
|
+
school_ids = School.where(province: @current_admin.areas.pluck(:name)).pluck(:id)
|
24
|
+
business_ids = Business.joins(last_follow_up: :assign_follow_ups).where("educode_sales_assign_follow_ups.staff_id = ?", @current_admin.id).pluck(:id)
|
25
|
+
@businesses = Business.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)
|
26
|
+
business_ids = @businesses.pluck(:id)
|
27
|
+
@follow_ups = @follow_ups.where(business_id: business_ids)
|
28
|
+
else
|
29
|
+
@follow_ups = FollowUp.all
|
30
|
+
end
|
31
|
+
end
|
32
|
+
if params[:q].present? && params[:q][:follows_business].present?
|
33
|
+
@follow_ups = @follow_ups.joins(:business).where("educode_sales_businesses.name LIKE ?", "%#{params[:q][:follows_business]}%")
|
34
|
+
end
|
35
|
+
if params[:q].present? && params[:q][:follows_date].present?
|
36
|
+
date = params[:q][:follows_date].split(" - ")
|
37
|
+
@follow_ups = @follow_ups.where("educode_sales_follow_ups.created_at > ? AND educode_sales_follow_ups.created_at < ?", date[0], date[1])
|
38
|
+
end
|
39
|
+
if params[:q].present? && params[:q][:follows_staff_id].present?
|
40
|
+
@follow_ups = @follow_ups.where(staff_id: params[:q][:follows_staff_id])
|
41
|
+
end
|
42
|
+
if params[:q].present? && params[:q][:follows_department].present?
|
43
|
+
departments_ids = Department.joins(:school).where("schools.name like ?", "%#{params[:q][:follows_department]}%").pluck(:id)
|
44
|
+
@follow_ups = @follow_ups.joins(business: :department).where("departments.id in (?)", departments_ids)
|
45
|
+
end
|
46
|
+
if params[:q].present? && params[:q][:follows_area].present?
|
47
|
+
p = EducodeSales::Common.find(params[:q][:follows_area]).name
|
48
|
+
@follow_ups = @follow_ups.joins(:business).joins("
|
49
|
+
JOIN departments ON educode_sales_businesses.department_id = departments.id
|
50
|
+
JOIN schools ON departments.school_id = schools.id
|
51
|
+
").where("province = ?", p)
|
52
|
+
end
|
53
|
+
if params[:sort].present? && params[:sort][:field]
|
54
|
+
@follow_ups = @follow_ups.order("#{params[:sort][:field]} #{params[:sort][:order]}")
|
55
|
+
else
|
56
|
+
@follow_ups = @follow_ups.order("educode_sales_follow_ups.created_at desc")
|
57
|
+
end
|
58
|
+
@follow_ups = @follow_ups.page(params[:page]).per(params[:limit])
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
6
63
|
def create
|
7
64
|
load_business
|
8
65
|
follow_up = @business.follow_ups.build(follow_up_params)
|
@@ -43,6 +43,9 @@ module EducodeSales
|
|
43
43
|
|
44
44
|
def sales_staff
|
45
45
|
common = Common.find_by(clazz: 'staff_type', name: '销售')
|
46
|
+
if params[:teacher_assist].present?
|
47
|
+
common = Common.find_by(clazz: 'staff_type', name: '运营')
|
48
|
+
end
|
46
49
|
@staffs = Staff
|
47
50
|
if params[:q].present?
|
48
51
|
@staffs = @staffs.joins(user: :user_extension).where("concat(lastname, firstname) like :q", q: "%#{params[:q]}%")
|
@@ -50,5 +53,13 @@ module EducodeSales
|
|
50
53
|
@staffs = @staffs.where(is_admin: false).where.not(id: @current_admin.id).where(job_type: common.id).page(params[:page]).per(10)
|
51
54
|
end
|
52
55
|
|
56
|
+
def sales_place
|
57
|
+
@places = EducodeSales::Place
|
58
|
+
if params[:q].present?
|
59
|
+
@places = @places.where("name like :q", q: "%#{params[:q]}%")
|
60
|
+
end
|
61
|
+
@places = @places.page(params[:page]).per(10)
|
62
|
+
end
|
63
|
+
|
53
64
|
end
|
54
65
|
end
|
@@ -43,7 +43,7 @@ module EducodeSales
|
|
43
43
|
@follow_count_data = week_follow_count_chart(default_dates,names,x_business_ids,colors)
|
44
44
|
if params[:follow_count_range].present?
|
45
45
|
case params[:follow_count_range]
|
46
|
-
when "week"
|
46
|
+
when "week" #按周
|
47
47
|
if params[:date_week].present?
|
48
48
|
date = params[:date_week].split(" - ")
|
49
49
|
dates = (date[0].to_date..date[1].to_date).map { |d|
|
@@ -76,7 +76,6 @@ module EducodeSales
|
|
76
76
|
# 已中标图表
|
77
77
|
goal_default_dates = ("#{Time.now.year}-01".."#{Time.now.year}-#{Time.now.month}").to_a
|
78
78
|
sale_names = ['已中标','已签单','已回款']
|
79
|
-
10.times{p count_type}
|
80
79
|
@goal_count_data = month_sale_chart(goal_default_dates,sale_names,colors,x,stage_ids,s_stage_ids,count_type)
|
81
80
|
if params[:goal_count_range].present?
|
82
81
|
case params[:goal_count_range]
|
@@ -21,6 +21,8 @@ module EducodeSales
|
|
21
21
|
def index
|
22
22
|
respond_to do |format|
|
23
23
|
format.html do
|
24
|
+
common = Common.find_by(clazz: 'staff_type', name: '运营')
|
25
|
+
@staffs = Staff.joins(:user).where(job_type: common.id).map { |d| [d.user.real_name, d.id]}
|
24
26
|
@more = can?(:create, EducodeSales::OperationPlan) || can?(:update, EducodeSales::Teacher) || can?(:destroy, EducodeSales::Teacher)
|
25
27
|
gon.menus = []
|
26
28
|
if can?(:create, EducodeSales::OperationPlan)
|
@@ -50,7 +52,17 @@ module EducodeSales
|
|
50
52
|
@teachers = Teacher.where(is_key: false)
|
51
53
|
end
|
52
54
|
end
|
53
|
-
|
55
|
+
|
56
|
+
public_teacher_ids = EducodeSales::Teacher.where(staff_id: 0).pluck(:id) - EducodeSales::TeacherAssignFollow.all.pluck(:Teacher_id)
|
57
|
+
teacher_ids = @teachers.ids
|
58
|
+
teacher_ids = teacher_ids + public_teacher_ids + EducodeSales::TeacherAssignFollow.where(staff_id: @current_admin.id).pluck(:teacher_id)
|
59
|
+
@teachers = @teachers.where(id: teacher_ids)
|
60
|
+
|
61
|
+
if params[:q].present? && params[:q][:assist].present?
|
62
|
+
staff_id = params[:q][:assist].to_i
|
63
|
+
teacher_ids = EducodeSales::TeacherAssignFollow.where(staff_id: staff_id).pluck(:teacher_id)
|
64
|
+
@teachers = @teachers.where(id: teacher_ids)
|
65
|
+
end
|
54
66
|
if params[:q].present? && params[:q][:name].present?
|
55
67
|
@teachers = @teachers.where("educode_sales_teachers.name like ?", "%#{params[:q][:name]}%")
|
56
68
|
end
|
@@ -60,6 +72,13 @@ module EducodeSales
|
|
60
72
|
if params[:q].present? && params[:q][:regist_at].present?
|
61
73
|
@teachers = @teachers.where("educode_sales_teachers.regist_at like ?", "%#{params[:q][:regist_at]}%")
|
62
74
|
end
|
75
|
+
if params[:q].present? && params[:q][:status].present?
|
76
|
+
if params[:q][:status] == "1"
|
77
|
+
@teachers = @teachers.where("educode_sales_teachers.regist_at is not null AND educode_sales_teachers.user_id is not null")
|
78
|
+
else
|
79
|
+
@teachers = @teachers.where("educode_sales_teachers.regist_at is null OR educode_sales_teachers.user_id is null")
|
80
|
+
end
|
81
|
+
end
|
63
82
|
if params[:q].present? && params[:q][:attitude].present?
|
64
83
|
# @teachers = @teachers.where("educode_sales_teachers.attitude_id = ?", "#{params[:q][:attitude]}")
|
65
84
|
@teachers = @teachers.joins("
|
@@ -105,6 +124,9 @@ module EducodeSales
|
|
105
124
|
def create
|
106
125
|
department = Department.find(params[:department_id])
|
107
126
|
teacher = @current_admin.teachers.build(teacher_params)
|
127
|
+
params[:teacher_assist].each do |d|
|
128
|
+
teacher.teacher_assign_follows.build(staff_id: d)
|
129
|
+
end
|
108
130
|
teacher.department_id = department.id
|
109
131
|
if params[:user_id].present?
|
110
132
|
user = User.find(params[:user_id])
|
@@ -147,6 +169,13 @@ module EducodeSales
|
|
147
169
|
teacher = Teacher.find(params[:id])
|
148
170
|
teacher.department_id = department.id
|
149
171
|
teacher.assign_attributes(teacher_params)
|
172
|
+
|
173
|
+
teacher_assists = []
|
174
|
+
params[:teacher_assist].each do |d|
|
175
|
+
teacher_assists << teacher.teacher_assign_follows.find_or_initialize_by(staff_id: d)
|
176
|
+
end
|
177
|
+
teacher.teacher_assign_follows = teacher_assists
|
178
|
+
|
150
179
|
if params[:user_id].present?
|
151
180
|
user = User.find(params[:user_id])
|
152
181
|
teacher.user_id = user.id
|
@@ -171,7 +200,10 @@ module EducodeSales
|
|
171
200
|
end
|
172
201
|
|
173
202
|
def edit
|
174
|
-
|
203
|
+
load_teacher
|
204
|
+
gon.teacher_assist = @teacher.teacher_assign_follows.map do |d|
|
205
|
+
{value: d.staff_id, name: d.staff.user.full_name}
|
206
|
+
end
|
175
207
|
gon.department = { value: @teacher.department_id, name: "#{@teacher.department&.school&.name}-#{@teacher.department&.name}" }
|
176
208
|
gon.value = @teacher.department_id
|
177
209
|
render layout: false
|
@@ -256,17 +288,6 @@ module EducodeSales
|
|
256
288
|
render layout: false
|
257
289
|
end
|
258
290
|
|
259
|
-
# def create_follow_record
|
260
|
-
#
|
261
|
-
# end
|
262
|
-
#
|
263
|
-
# def update_follow_record
|
264
|
-
#
|
265
|
-
# end
|
266
|
-
# def delete_follow_record
|
267
|
-
#
|
268
|
-
# end
|
269
|
-
|
270
291
|
def show_follow_record
|
271
292
|
@follow_up = TeacherFollow.find(params[:id])
|
272
293
|
render layout: false
|
@@ -294,7 +315,7 @@ module EducodeSales
|
|
294
315
|
|
295
316
|
private
|
296
317
|
def teacher_params
|
297
|
-
params.permit(:name, :professional_title, :job, :source_id)
|
318
|
+
params.permit(:name, :professional_title, :job, :source_id, :wechat)
|
298
319
|
end
|
299
320
|
|
300
321
|
def load_teacher
|
@@ -6,8 +6,9 @@ module EducodeSales
|
|
6
6
|
has_many :operation_plans, dependent: :destroy
|
7
7
|
has_many :course_subjects, dependent: :destroy
|
8
8
|
has_many :key_person, dependent: :destroy
|
9
|
+
has_many :teacher_assign_follows
|
9
10
|
belongs_to :department, optional: true
|
10
|
-
belongs_to :staff
|
11
|
+
belongs_to :staff, optional: true
|
11
12
|
belongs_to :user, optional: true
|
12
13
|
# belongs_to :follow_up, counter_cache: true, optional: true
|
13
14
|
belongs_to :follow_up, class_name: 'TeacherFollow', optional: true
|
@@ -52,24 +52,23 @@
|
|
52
52
|
{
|
53
53
|
field: 'name',
|
54
54
|
title: '活动名称',
|
55
|
-
width: 400,
|
56
55
|
templet: '#teachers'
|
57
56
|
},
|
58
57
|
{
|
59
58
|
field: 'start_at',
|
60
|
-
width:
|
59
|
+
width: 200,
|
61
60
|
title: '时间',
|
62
61
|
sort: true,
|
63
62
|
},
|
64
63
|
{
|
65
64
|
field: 'days',
|
66
65
|
title: '天数',
|
67
|
-
width:
|
66
|
+
width: 200
|
68
67
|
},
|
69
68
|
{
|
70
69
|
field: 'teachers_count',
|
71
70
|
title: '教师数',
|
72
|
-
width:
|
71
|
+
width: 200,
|
73
72
|
totalRow:true,
|
74
73
|
templet: '#teachers_count'
|
75
74
|
},
|
@@ -77,7 +76,7 @@
|
|
77
76
|
field: 'students_count',
|
78
77
|
title: '学生数',
|
79
78
|
totalRow:'{{ parseInt(d.TOTAL_NUMS) }}',
|
80
|
-
width:
|
79
|
+
width: 200
|
81
80
|
},
|
82
81
|
{
|
83
82
|
title: '操作',
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<script type="text/html" id="teacher_toolbar">
|
3
3
|
<div class="layui-btn-container">
|
4
4
|
<span class="table-label">教师列表</span>
|
5
|
-
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="search_new">
|
5
|
+
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="search_new"> 添加教师
|
6
6
|
</button>
|
7
7
|
</div>
|
8
8
|
</script>
|
@@ -0,0 +1,233 @@
|
|
1
|
+
<div style="margin: 10px 10px 10px 10px">
|
2
|
+
<form class="layui-form layui-form-pane" lay-filter="search_follows">
|
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="follows_business" autocomplete="off" class="layui-input">
|
8
|
+
</div>
|
9
|
+
</div>
|
10
|
+
<div class="layui-inline">
|
11
|
+
<label class="layui-form-label">单位</label>
|
12
|
+
<div class="layui-input-inline">
|
13
|
+
<input type="text" name="follows_department" autocomplete="off" class="layui-input">
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
<div class="layui-inline">
|
17
|
+
<label class="layui-form-label">销售人员</label>
|
18
|
+
<div class="layui-input-inline">
|
19
|
+
<%= select_tag "follows_staff_id", options_for_select(@staffs, params[:follows_staff_id]), { 'lay-filter': 'follows_staff_id', include_blank: true } %>
|
20
|
+
</div>
|
21
|
+
</div>
|
22
|
+
<div class="layui-inline">
|
23
|
+
<label class="layui-form-label">区域</label>
|
24
|
+
<div class="layui-input-inline">
|
25
|
+
<%= select_tag "follows_area", options_for_select(EducodeSales::Common.where(clazz: 'area').pluck(:name, :id)), { include_blank: true } %>
|
26
|
+
</div>
|
27
|
+
</div>
|
28
|
+
<div class="layui-inline">
|
29
|
+
<label class="layui-form-label">跟进时间</label>
|
30
|
+
<div class="layui-input-inline">
|
31
|
+
<input type="text" class="layui-input" id="follows_date" name="follows_date" autocomplete="off" placeholder=" - ">
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div class="layui-inline">
|
36
|
+
<button type="reset" class="layui-btn layui-btn-primary" lay-submit lay-filter="reset_follows_search">重置
|
37
|
+
</button>
|
38
|
+
<button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="search_follows">搜 索
|
39
|
+
</button>
|
40
|
+
</div>
|
41
|
+
</div>
|
42
|
+
</form>
|
43
|
+
</div>
|
44
|
+
<div class="">
|
45
|
+
<table class="layui-hide" id="teachers_table" style="min-height: 300px;" lay-filter="teachers_table"></table>
|
46
|
+
</div>
|
47
|
+
<script type="text/html" id="toolbarDemo_follows">
|
48
|
+
<div class="layui-btn-container">
|
49
|
+
<span class="table-label">跟进动态</span>
|
50
|
+
</div>
|
51
|
+
</script>
|
52
|
+
<script type="text/html" id="currentTableBar_follows">
|
53
|
+
<a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="add_event">详情</a>
|
54
|
+
</script>
|
55
|
+
<script type="text/html" id="business">
|
56
|
+
<a href="javascript:void(0);" lay-event="business" class="layui-table-link">{{ d.business }}</a>
|
57
|
+
</script>
|
58
|
+
|
59
|
+
|
60
|
+
<script>
|
61
|
+
layui.use(['form', 'table', 'miniPage', 'element', 'request', 'laydate'], function () {
|
62
|
+
var $ = layui.jquery,
|
63
|
+
form = layui.form,
|
64
|
+
request = layui.request,
|
65
|
+
dropdown = layui.dropdown,
|
66
|
+
miniPage = layui.miniPage,
|
67
|
+
laydate = layui.laydate;
|
68
|
+
|
69
|
+
var laydate = layui.laydate;
|
70
|
+
|
71
|
+
laydate.render({
|
72
|
+
elem: '#follows_date',
|
73
|
+
range: true
|
74
|
+
});
|
75
|
+
|
76
|
+
table = layui.table;
|
77
|
+
table.render({
|
78
|
+
elem: '#teachers_table',
|
79
|
+
url: '/missions/follow_ups',
|
80
|
+
// where: {q: form.val('search_form')},
|
81
|
+
toolbar: '#toolbarDemo_follows',
|
82
|
+
defaultToolbar: ['filter'],
|
83
|
+
cols: [
|
84
|
+
[
|
85
|
+
{
|
86
|
+
field: 'id',
|
87
|
+
width: 60,
|
88
|
+
title:'序号',type: 'numbers',
|
89
|
+
},
|
90
|
+
{
|
91
|
+
field: 'description',
|
92
|
+
title: '最新进展',
|
93
|
+
},
|
94
|
+
{
|
95
|
+
field: 'advise',
|
96
|
+
width: 170,
|
97
|
+
title: '团队建议',
|
98
|
+
},
|
99
|
+
{
|
100
|
+
field: 'clazz',
|
101
|
+
width: 80,
|
102
|
+
title: '类型'
|
103
|
+
},
|
104
|
+
{
|
105
|
+
field: 'stage',
|
106
|
+
title: '阶段',
|
107
|
+
width: 90,
|
108
|
+
},
|
109
|
+
{
|
110
|
+
field: 'key_people',
|
111
|
+
width: 90,
|
112
|
+
title: '关键人',
|
113
|
+
|
114
|
+
},
|
115
|
+
{
|
116
|
+
field: 'staff',
|
117
|
+
width: 90,
|
118
|
+
title: '跟进人',
|
119
|
+
},
|
120
|
+
{
|
121
|
+
field: 'created_at',
|
122
|
+
width: 170,
|
123
|
+
title: '跟进时间',
|
124
|
+
sort: true,
|
125
|
+
},
|
126
|
+
{
|
127
|
+
field: 'business',
|
128
|
+
width: 150,
|
129
|
+
title: '所属商机',
|
130
|
+
templet:'#business'
|
131
|
+
},
|
132
|
+
{
|
133
|
+
title: '操作',
|
134
|
+
width: 80,
|
135
|
+
toolbar: '#currentTableBar_follows',
|
136
|
+
align: "center",
|
137
|
+
fixed: 'right'
|
138
|
+
}
|
139
|
+
]
|
140
|
+
],
|
141
|
+
limit: 20,
|
142
|
+
limits: [10,15,20,30,40,50,60,70,80,90],
|
143
|
+
page: true,
|
144
|
+
});
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
var sort = {}, search = {};
|
151
|
+
table.on('sort(teachers_table)', function (obj) {
|
152
|
+
sort.field = obj.field;
|
153
|
+
sort.order = obj.type;
|
154
|
+
table.reload('teachers_table', {
|
155
|
+
initSort: obj,
|
156
|
+
where: {
|
157
|
+
sort: sort,
|
158
|
+
q: search
|
159
|
+
}
|
160
|
+
});
|
161
|
+
})
|
162
|
+
|
163
|
+
// 监听搜索操作
|
164
|
+
form.on('submit(search_follows)', function (data) {
|
165
|
+
search = data.field
|
166
|
+
table.reload('teachers_table', {
|
167
|
+
page: {
|
168
|
+
curr: 1
|
169
|
+
},
|
170
|
+
where: {q: search, sort: sort}
|
171
|
+
}, 'data');
|
172
|
+
return false;
|
173
|
+
});
|
174
|
+
|
175
|
+
form.on('submit(reset_follows_search)', function (data) {
|
176
|
+
var field = data.field;
|
177
|
+
form.val('search_follows', {
|
178
|
+
follows_area: "",
|
179
|
+
follows_date: "",
|
180
|
+
follows_business: "",
|
181
|
+
follows_department: "",
|
182
|
+
follows_staff_id: ""
|
183
|
+
})
|
184
|
+
return false;
|
185
|
+
});
|
186
|
+
table.on('tool(teachers_table)', function (obj) {
|
187
|
+
var data = obj.data;
|
188
|
+
id = data.id
|
189
|
+
if (obj.event === 'add_event') { // 监听添加操作
|
190
|
+
var content = miniPage.getHrefContent('/missions/businesses/show_follow_record?follow_up_id=' + data.id);
|
191
|
+
var openWH = miniPage.getOpenWidthHeight();
|
192
|
+
show_index = layer.open({
|
193
|
+
title: '查看商机跟进记录',
|
194
|
+
type: 1,
|
195
|
+
shade: 0.2,
|
196
|
+
maxmin: true,
|
197
|
+
shadeClose: true,
|
198
|
+
area: [openWH[0] + 'px', openWH[1] + 'px'],
|
199
|
+
offset: [openWH[2] + 'px', openWH[3] + 'px'],
|
200
|
+
content: content
|
201
|
+
});
|
202
|
+
$(window).on("resize", function () {
|
203
|
+
layer.full(index);
|
204
|
+
});
|
205
|
+
} else if (obj.event === 'business') {
|
206
|
+
console.log(data);
|
207
|
+
business_id = data.business_id
|
208
|
+
business_name = data.business
|
209
|
+
content = miniPage.getHrefContent('/missions/businesses/show_follow?id=' + data.business_id);
|
210
|
+
openWH = miniPage.getOpenWidthHeight();
|
211
|
+
index = layer.open({
|
212
|
+
title: '商机列表/' + data.business + '的跟进记录',
|
213
|
+
type: 1,
|
214
|
+
shade: 0.2,
|
215
|
+
maxmin: true,
|
216
|
+
shadeClose: true,
|
217
|
+
area: [openWH[0] + 'px', openWH[1] + 'px'],
|
218
|
+
offset: [openWH[2] + 'px', openWH[3] + 'px'],
|
219
|
+
content: content
|
220
|
+
});
|
221
|
+
$(window).on("resize", function () {
|
222
|
+
layer.full(index);
|
223
|
+
});
|
224
|
+
}
|
225
|
+
});
|
226
|
+
|
227
|
+
});
|
228
|
+
</script>
|
229
|
+
<style>
|
230
|
+
.layui-table-tool-temp{
|
231
|
+
padding-right: 30px; !important;
|
232
|
+
}
|
233
|
+
</style>
|
@@ -79,8 +79,8 @@
|
|
79
79
|
<br>
|
80
80
|
<div class="layui-inline">
|
81
81
|
<label class="layui-form-label">渠道</label>
|
82
|
-
<div class="layui-input-inline">
|
83
|
-
|
82
|
+
<div class="layui-input-inline" style="z-index: 101">
|
83
|
+
<div id="edit_place" style="width: 190px;"></div>
|
84
84
|
</div>
|
85
85
|
</div>
|
86
86
|
<div class="layui-inline">
|
@@ -174,6 +174,49 @@
|
|
174
174
|
}
|
175
175
|
})
|
176
176
|
sales_list.setValue(gon.sales)
|
177
|
+
var places_list = xmSelect.render({
|
178
|
+
el: '#edit_place',
|
179
|
+
remoteSearch: true,
|
180
|
+
clickClose: true,
|
181
|
+
model: {
|
182
|
+
icon: 'hidden',
|
183
|
+
label: {
|
184
|
+
type: 'text',
|
185
|
+
text: {
|
186
|
+
//左边拼接的字符
|
187
|
+
left: '',
|
188
|
+
//右边拼接的字符
|
189
|
+
right: '',
|
190
|
+
//中间的分隔符
|
191
|
+
separator: ', ',
|
192
|
+
},
|
193
|
+
}
|
194
|
+
},
|
195
|
+
delay: 1000,
|
196
|
+
radio: true,
|
197
|
+
paging: true,
|
198
|
+
pageRemote: true,
|
199
|
+
filterable: true,
|
200
|
+
remoteMethod: function (val, cb, show, pageIndex) {
|
201
|
+
$.ajax( '/missions/sales_place', {
|
202
|
+
method: 'get',
|
203
|
+
data: {
|
204
|
+
q: val,
|
205
|
+
page: pageIndex
|
206
|
+
},
|
207
|
+
dataType: 'json',
|
208
|
+
success: function (res) {
|
209
|
+
var data = res.data;
|
210
|
+
if (res.code == 0) {
|
211
|
+
cb(res.data, res.count);
|
212
|
+
} else {
|
213
|
+
layer.msg(res.msg, {time: 2000, icon: 2, shade: 0.01});
|
214
|
+
}
|
215
|
+
}
|
216
|
+
})
|
217
|
+
}
|
218
|
+
})
|
219
|
+
places_list.setValue(gon.place)
|
177
220
|
|
178
221
|
form.render();
|
179
222
|
form.on('submit(update_follow_up)', function (data) {
|
@@ -181,8 +224,9 @@
|
|
181
224
|
sales_list.getValue().forEach(function(d) {
|
182
225
|
assign_follow.push(d.value);
|
183
226
|
})
|
184
|
-
|
185
|
-
|
227
|
+
data.field.assign_follow_up = assign_follow;
|
228
|
+
data.field.place_id = places_list.getValue()[0].value;
|
229
|
+
request.authPut("missions/follow_ups/<%= @follow_up.id%>", data.field, function (res) {
|
186
230
|
if (res.success == false) {
|
187
231
|
layer.alert(res.msg)
|
188
232
|
} else {
|