educode_sales 1.10.7 → 1.10.9
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/assessments_controller.rb +31 -1
- data/app/controllers/educode_sales/businesses_controller.rb +46 -1
- data/app/controllers/educode_sales/follow_ups_controller.rb +57 -3
- data/app/controllers/educode_sales/money_plan_records_controller.rb +30 -1
- data/app/controllers/educode_sales/money_plans_controller.rb +8 -0
- data/app/models/educode_sales/follow_up.rb +3 -0
- data/app/models/educode_sales/follow_up_tag.rb +7 -0
- data/app/models/educode_sales/money_plan.rb +5 -5
- data/app/models/educode_sales/money_plan_claim.rb +9 -0
- data/app/models/educode_sales/money_plan_record.rb +1 -1
- data/app/models/educode_sales/tag.rb +7 -0
- data/app/models/educode_sales/watch_follow_up.rb +6 -0
- data/app/views/educode_sales/assessments/_attendances.html.erb +45 -3
- data/app/views/educode_sales/assessments/index.html.erb +3 -1
- data/app/views/educode_sales/businesses/edit.html.erb +44 -38
- data/app/views/educode_sales/businesses/get_export_data.json.jbuilder +9 -0
- data/app/views/educode_sales/businesses/index.html.erb +48 -36
- data/app/views/educode_sales/businesses/index.json.jbuilder +6 -1
- data/app/views/educode_sales/businesses/new.html.erb +92 -3
- data/app/views/educode_sales/businesses/time_line.html.erb +62 -2
- data/app/views/educode_sales/follow_ups/add_assign.html.erb +42 -0
- data/app/views/educode_sales/follow_ups/add_tag.html.erb +48 -0
- data/app/views/educode_sales/home/search_money_plans.json.jbuilder +1 -1
- data/app/views/educode_sales/money_plan_records/_index.html.erb +33 -3
- data/app/views/educode_sales/money_plan_records/edit.html.erb +58 -0
- data/app/views/educode_sales/money_plan_records/index.json.jbuilder +1 -0
- data/app/views/educode_sales/money_plans/_index.html.erb +8 -1
- data/app/views/educode_sales/money_plans/index.json.jbuilder +1 -0
- data/app/views/educode_sales/money_plans/list.html.erb +19 -8
- data/config/routes.rb +5 -0
- data/db/migrate/20230614141225_create_educode_sales_tags.rb +11 -0
- data/db/migrate/20230614141628_create_educode_sales_follow_up_tags.rb +11 -0
- data/db/migrate/20230614142145_create_educode_sales_watch_follow_ups.rb +10 -0
- data/lib/educode_sales/version.rb +1 -1
- metadata +15 -7
- data/app/assets/images/educode_sales/indexlogo.png +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 73d98a4d83213078f656abfeb070db43d2a6a594e8a273a8ace4bad8165dc541
|
|
4
|
+
data.tar.gz: 52b10fb147e17a25bd4f3d5b155676cbbb76d61cf6f799b2249edc6428b1ca1e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9808f3c65fd410beaf59ef94d4be34b7ba5f25c6377975eead142d6943f5c20007c70b6cd297150473c3e569a29142e17edf89671788e77173389711b2124684
|
|
7
|
+
data.tar.gz: 5b2c468c9b57723d26804fd589637a5f4f877da54be8a88d180b5aec8adca7b69d08bbd28a901b9c6c0cde03e78755e3cc4750a4c700f62f9c02041456d58b73
|
|
@@ -434,6 +434,22 @@ module EducodeSales
|
|
|
434
434
|
render layout: false
|
|
435
435
|
end
|
|
436
436
|
|
|
437
|
+
#批量删除签到记录
|
|
438
|
+
def batch_delete
|
|
439
|
+
begin
|
|
440
|
+
ActiveRecord::Base.transaction do
|
|
441
|
+
if params[:ids].present?
|
|
442
|
+
ids = params[:ids]
|
|
443
|
+
attendances = EducodeSales::Attendance.where(id: ids)
|
|
444
|
+
attendances.destroy_all
|
|
445
|
+
end
|
|
446
|
+
end
|
|
447
|
+
render_success
|
|
448
|
+
rescue Exception => e
|
|
449
|
+
render_failure(e.message)
|
|
450
|
+
end
|
|
451
|
+
end
|
|
452
|
+
|
|
437
453
|
#导入签到记录接口
|
|
438
454
|
def import_attendances
|
|
439
455
|
render_failure("文件不存在或格式错误") if params[:file].blank? || !params[:file].is_a?(ActionDispatch::Http::UploadedFile)
|
|
@@ -453,7 +469,21 @@ module EducodeSales
|
|
|
453
469
|
address = d[6]
|
|
454
470
|
mobile_id = d[7]
|
|
455
471
|
ip_address = d[8]
|
|
456
|
-
|
|
472
|
+
if d[9].blank?
|
|
473
|
+
school_college_name = d[5].split("学院")[0]
|
|
474
|
+
school_university_name = d[5].split("大学")[0] + "大学"
|
|
475
|
+
school = School.where("name like ?", "%#{school_college_name}%").first
|
|
476
|
+
school01 = School.where("name like ?", "%#{school_university_name}%").first
|
|
477
|
+
if school.present?
|
|
478
|
+
customer = school.name
|
|
479
|
+
elsif school01.present?
|
|
480
|
+
customer = school01.name
|
|
481
|
+
else
|
|
482
|
+
customer = ""
|
|
483
|
+
end
|
|
484
|
+
else
|
|
485
|
+
customer = d[9]
|
|
486
|
+
end
|
|
457
487
|
target = d[10]
|
|
458
488
|
attendance_vales << {name: name, attendance_date: attendance_date, longitude: longitude, latitude: latitude, location: location,
|
|
459
489
|
address: address, mobile_id: mobile_id, ip_address: ip_address, customer: customer, target: target}
|
|
@@ -295,6 +295,32 @@ module EducodeSales
|
|
|
295
295
|
end
|
|
296
296
|
end
|
|
297
297
|
|
|
298
|
+
#商机来源
|
|
299
|
+
if params[:q].present? && params[:q][:source_way].present?
|
|
300
|
+
if params[:q].present? && params[:q][:source_name].present?
|
|
301
|
+
if ["会议活动", "渠道代理", "客户"].include?(params[:q][:source_way])
|
|
302
|
+
if params[:q][:source_way] == '会议活动'
|
|
303
|
+
sourcable_id = EducodeSales::Activity.where("name like ?", "%#{params[:q][:source_name]}%").limit(20).pluck(:id)
|
|
304
|
+
elsif params[:q][:source_way] == '渠道代理'
|
|
305
|
+
sourcable_id = EducodeSales::Place.where("name like ?", "%#{params[:q][:source_name]}%").limit(20).pluck(:id)
|
|
306
|
+
elsif params[:q][:source_way] == '客户'
|
|
307
|
+
sourcable_id = EducodeSales::Department.where("name like ?", "%#{params[:q][:source_name]}%").limit(20).pluck(:id)
|
|
308
|
+
end
|
|
309
|
+
|
|
310
|
+
if sourcable_id.present?
|
|
311
|
+
@businesses = @businesses.where(source_way: params[:q][:source_way], sourcable_id: sourcable_id)
|
|
312
|
+
else
|
|
313
|
+
@businesses = @businesses.none
|
|
314
|
+
end
|
|
315
|
+
else
|
|
316
|
+
@businesses = @businesses.where(source_way: params[:q][:source_way]).where("sourcable_type like ?", "%#{params[:q][:source_name]}%")
|
|
317
|
+
end
|
|
318
|
+
else
|
|
319
|
+
@businesses = @businesses.where(source_way: params[:q][:source_way])
|
|
320
|
+
end
|
|
321
|
+
end
|
|
322
|
+
|
|
323
|
+
|
|
298
324
|
# 商机变化
|
|
299
325
|
if params[:q][:clazz_changes].present?
|
|
300
326
|
clazz_changes = EducodeSales::BusinessClazzChange.clazz_changes_value[params[:q][:clazz_changes].to_s]
|
|
@@ -406,7 +432,26 @@ module EducodeSales
|
|
|
406
432
|
|
|
407
433
|
def create
|
|
408
434
|
department = Department.find(params[:department_id])
|
|
409
|
-
|
|
435
|
+
if params[:sourcable_type].present?
|
|
436
|
+
if params[:source_way] == '会议活动'
|
|
437
|
+
params[:sourcable_type] = 'EducodeSales::Activity'
|
|
438
|
+
elsif params[:source_way] == '渠道代理'
|
|
439
|
+
params[:sourcable_type] = 'EducodeSales::Place'
|
|
440
|
+
elsif params[:source_way] == '客户'
|
|
441
|
+
params[:sourcable_type] = 'EducodeSales::Department'
|
|
442
|
+
else
|
|
443
|
+
params[:sourcable_id] = ""
|
|
444
|
+
end
|
|
445
|
+
end
|
|
446
|
+
if ['会议活动', '渠道代理', '客户'].include?(params[:source_way] ) && params[:sourcable_id].blank?
|
|
447
|
+
params[:sourcable_type] = ""
|
|
448
|
+
end
|
|
449
|
+
if params[:sourcable_type].blank?
|
|
450
|
+
params[:sourcable_id] = ""
|
|
451
|
+
end
|
|
452
|
+
business = @current_admin.businesses.build(name: params[:name], department_id: department.id, source: params[:source], school_id: department.school_id, clazz_id: params[:clazz_id],
|
|
453
|
+
sourcable_type: params[:sourcable_type], sourcable_id: params[:sourcable_id], source_way: params[:source_way])
|
|
454
|
+
|
|
410
455
|
if business.save
|
|
411
456
|
render_success
|
|
412
457
|
else
|
|
@@ -33,13 +33,17 @@ module EducodeSales
|
|
|
33
33
|
business_ids = Business.joins(last_follow_up: :assign_follow_ups).where("educode_sales_assign_follow_ups.staff_id = ?", @current_admin.id).pluck(:id)
|
|
34
34
|
@businesses = Business.where("educode_sales_businesses.staff_id = ? OR educode_sales_businesses.id in (?)", @current_admin.id, business_ids)
|
|
35
35
|
business_ids = @businesses.pluck(:id)
|
|
36
|
-
|
|
36
|
+
|
|
37
|
+
# 指定查看人
|
|
38
|
+
follow_up_ids = EducodeSales::WatchFollowUp.where(staff_id: @current_admin.id).pluck(:follow_up_id)
|
|
39
|
+
@follow_ups = FollowUp.where(business_id: business_ids + area_business_ids).or(FollowUp.where(id: follow_up_ids))
|
|
37
40
|
when '区域'
|
|
38
41
|
school_ids = School.where(province: @current_admin.areas.pluck(:name)).pluck(:id) + StaffSchool.where(staff_id: @current_admin.id).pluck(:school_id)
|
|
39
42
|
business_ids = Business.joins(last_follow_up: :assign_follow_ups).where("educode_sales_assign_follow_ups.staff_id = ?", @current_admin.id).pluck(:id)
|
|
40
43
|
@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)
|
|
41
44
|
business_ids = @businesses.pluck(:id)
|
|
42
|
-
|
|
45
|
+
follow_up_ids = EducodeSales::WatchFollowUp.where(staff_id: @current_admin.id).pluck(:follow_up_id)
|
|
46
|
+
@follow_ups = FollowUp.where(business_id: business_ids + area_business_ids).or(FollowUp.where(id: follow_up_ids))
|
|
43
47
|
else
|
|
44
48
|
@follow_ups = FollowUp.all
|
|
45
49
|
end
|
|
@@ -296,12 +300,62 @@ module EducodeSales
|
|
|
296
300
|
render layout: false
|
|
297
301
|
end
|
|
298
302
|
|
|
303
|
+
def add_tag
|
|
304
|
+
followup = FollowUp.find(params[:id])
|
|
305
|
+
gon.tags = []
|
|
306
|
+
tags = Tag.all.pluck(:name)
|
|
307
|
+
selecte_tags = followup.follow_up_tags.includes(:tag).map { |d| d.tag.name }
|
|
308
|
+
tags.each do |d|
|
|
309
|
+
gon.tags << {name: d, value: d, selected: selecte_tags.include?(d)}
|
|
310
|
+
end
|
|
311
|
+
render layout: false
|
|
312
|
+
end
|
|
313
|
+
|
|
314
|
+
def update_tags
|
|
315
|
+
follow_up = FollowUp.find(params[:id])
|
|
316
|
+
tags = []
|
|
317
|
+
tags_name = []
|
|
318
|
+
params[:tags].split(",").uniq.each do |d|
|
|
319
|
+
tag = Tag.find_or_initialize_by(name: d) do |d|
|
|
320
|
+
d.staff = @current_admin
|
|
321
|
+
end
|
|
322
|
+
tags_name << tag.name
|
|
323
|
+
tag.save unless tag.persisted?
|
|
324
|
+
t = FollowUpTag.find_or_initialize_by(tag_id: tag.id, follow_up_id: follow_up.id)
|
|
325
|
+
t.staff = @current_admin
|
|
326
|
+
tags << t
|
|
327
|
+
end
|
|
328
|
+
follow_up.follow_up_tags = tags
|
|
329
|
+
follow_up.save
|
|
330
|
+
render json: {success: true, tags: tags_name}
|
|
331
|
+
end
|
|
332
|
+
|
|
333
|
+
def add_assign
|
|
334
|
+
follow_up = FollowUp.find(params[:id])
|
|
335
|
+
staff_ids = follow_up.watch_follow_ups.pluck(:staff_id)
|
|
336
|
+
|
|
337
|
+
common = Common.find_by(clazz: 'staff_type', name: '销售')
|
|
338
|
+
gon.assign_watch= Staff.joins(:user).where.not(job_type: common.id).where.not(role_id: 11).map { |d| {name: d.user.real_name, value: d.id, selected: staff_ids.include?(d.id)} }
|
|
339
|
+
render layout: false
|
|
340
|
+
end
|
|
341
|
+
|
|
342
|
+
def update_assign
|
|
343
|
+
follow_up = FollowUp.find(params[:id])
|
|
344
|
+
staffs = []
|
|
345
|
+
params[:staff_ids].split(",").each do |staff_id|
|
|
346
|
+
staffs << WatchFollowUp.find_or_initialize_by(staff_id: staff_id, follow_up_id: follow_up.id)
|
|
347
|
+
end
|
|
348
|
+
follow_up.watch_follow_ups = staffs
|
|
349
|
+
follow_up.save
|
|
350
|
+
render json: {success: true, tags: staffs.map { |d| d.staff.user.real_name }}
|
|
351
|
+
end
|
|
352
|
+
|
|
299
353
|
private
|
|
300
354
|
|
|
301
355
|
def edu_setting name
|
|
302
356
|
EduSetting.get(name)
|
|
303
357
|
end
|
|
304
|
-
|
|
358
|
+
|
|
305
359
|
def load_business
|
|
306
360
|
@business = Business.find(params[:business_id])
|
|
307
361
|
end
|
|
@@ -6,8 +6,12 @@ module EducodeSales
|
|
|
6
6
|
def index
|
|
7
7
|
respond_to do |format|
|
|
8
8
|
format.html do
|
|
9
|
+
|
|
9
10
|
end
|
|
10
11
|
format.js do
|
|
12
|
+
gon.edit_record = can?(:update_record, EducodeSales::MoneyPlan)
|
|
13
|
+
gon.edit_record_self = can?(:update_record_self, EducodeSales::MoneyPlan)
|
|
14
|
+
gon.staff_id = @current_admin.id
|
|
11
15
|
end
|
|
12
16
|
format.json do
|
|
13
17
|
@money_plan_records = MoneyPlanRecord.left_joins(:money_plan_claims).group("educode_sales_money_plan_records.id").select("educode_sales_money_plan_records.*, COUNT(educode_sales_money_plan_claims.id) AS claim_num")
|
|
@@ -100,6 +104,26 @@ module EducodeSales
|
|
|
100
104
|
render json: { succcess: true}
|
|
101
105
|
end
|
|
102
106
|
|
|
107
|
+
def edit
|
|
108
|
+
@money_plan_record = MoneyPlanRecord.find(params[:id])
|
|
109
|
+
render layout: false
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def update
|
|
113
|
+
money_plan_record = MoneyPlanRecord.find(params[:id])
|
|
114
|
+
if money_plan_record.update(money_plan_record_params)
|
|
115
|
+
render json: { succcess: true}
|
|
116
|
+
else
|
|
117
|
+
render_failure money_plan_record
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
def destroy
|
|
122
|
+
money_plan_record = MoneyPlanRecord.find(params[:id])
|
|
123
|
+
money_plan_record.destroy
|
|
124
|
+
render json: { succcess: true}
|
|
125
|
+
end
|
|
126
|
+
|
|
103
127
|
def confirm
|
|
104
128
|
money_plan_record = MoneyPlanRecord.find(params[:id])
|
|
105
129
|
money_plan_record.money_plan_claims.where.not(money_plan_id: params[:money_plan_ids]).delete_all
|
|
@@ -114,8 +138,13 @@ module EducodeSales
|
|
|
114
138
|
business.update(return_money: claim.money_plan.money_plan_claims.sum(:amount))
|
|
115
139
|
end
|
|
116
140
|
end
|
|
117
|
-
|
|
118
141
|
render_success
|
|
119
142
|
end
|
|
143
|
+
|
|
144
|
+
private
|
|
145
|
+
|
|
146
|
+
def money_plan_record_params
|
|
147
|
+
params.permit(:amount, :payer_name, :date_at)
|
|
148
|
+
end
|
|
120
149
|
end
|
|
121
150
|
end
|
|
@@ -7,6 +7,7 @@ module EducodeSales
|
|
|
7
7
|
authorize! :read, MoneyPlan
|
|
8
8
|
respond_to do |format|
|
|
9
9
|
format.html do
|
|
10
|
+
|
|
10
11
|
end
|
|
11
12
|
format.json do
|
|
12
13
|
last_follow_up_ids = Business.all.pluck(:last_follow_up_id)
|
|
@@ -48,6 +49,9 @@ module EducodeSales
|
|
|
48
49
|
format.html do
|
|
49
50
|
common = Common.find_by(clazz: 'staff_type', name: '销售')
|
|
50
51
|
@staffs = Staff.joins(:user).where(job_type: common.id).map { |d| [d.user.real_name, d.id]}
|
|
52
|
+
gon.edit_money_plan = can?(:update, EducodeSales::MoneyPlan)
|
|
53
|
+
gon.edit_money_plan_self = can?(:update_self, EducodeSales::MoneyPlan)
|
|
54
|
+
gon.staff_id = @current_admin.id
|
|
51
55
|
end
|
|
52
56
|
|
|
53
57
|
end
|
|
@@ -67,6 +71,10 @@ module EducodeSales
|
|
|
67
71
|
@money_plan = MoneyPlan.find(params[:id])
|
|
68
72
|
gon.business_id = @money_plan.business_id
|
|
69
73
|
gon.business = [{value: @money_plan.business_id.to_s, name: @money_plan.business&.name}]
|
|
74
|
+
|
|
75
|
+
gon.edit_money_plan = can?(:update, EducodeSales::MoneyPlan)
|
|
76
|
+
gon.edit_money_plan_self = can?(:update_self, EducodeSales::MoneyPlan)
|
|
77
|
+
gon.staff_id = @current_admin.id
|
|
70
78
|
render layout: false
|
|
71
79
|
end
|
|
72
80
|
|
|
@@ -22,6 +22,9 @@ module EducodeSales
|
|
|
22
22
|
has_many :key_person
|
|
23
23
|
has_many :teachers, through: :key_person
|
|
24
24
|
has_many :assign_follow_ups
|
|
25
|
+
has_many :follow_up_tags, dependent: :destroy
|
|
26
|
+
|
|
27
|
+
has_many :watch_follow_ups, dependent: :destroy
|
|
25
28
|
belongs_to :staff
|
|
26
29
|
belongs_to :stage, class_name: 'Common'
|
|
27
30
|
belongs_to :clazz, class_name: 'Common'
|
|
@@ -42,11 +42,11 @@ module EducodeSales
|
|
|
42
42
|
private
|
|
43
43
|
|
|
44
44
|
def update_return_money
|
|
45
|
-
if follow_up.business.last_follow_up_id == self.follow_up_id
|
|
46
|
-
|
|
47
|
-
else
|
|
48
|
-
|
|
49
|
-
end
|
|
45
|
+
# if follow_up.business.last_follow_up_id == self.follow_up_id
|
|
46
|
+
# follow_up.business.update(return_money: MoneyPlan.where(clazz: '实际回款', follow_up_id: self.follow_up_id).sum(:amount))
|
|
47
|
+
# else
|
|
48
|
+
# follow_up.update(return_money: follow_up.money_plans.where(clazz: '实际回款').sum(:amount))
|
|
49
|
+
# end
|
|
50
50
|
end
|
|
51
51
|
end
|
|
52
52
|
end
|
|
@@ -3,5 +3,14 @@ module EducodeSales
|
|
|
3
3
|
belongs_to :money_plan
|
|
4
4
|
belongs_to :money_plan_record
|
|
5
5
|
belongs_to :staff
|
|
6
|
+
|
|
7
|
+
after_destroy :update_return_money
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
private
|
|
11
|
+
|
|
12
|
+
def update_return_money
|
|
13
|
+
self.money_plan.business.update(return_money: self.money_plan.money_plan_claims.sum(:amount))
|
|
14
|
+
end
|
|
6
15
|
end
|
|
7
16
|
end
|
|
@@ -34,7 +34,12 @@
|
|
|
34
34
|
<script type="text/html" id="toolbarDemo">
|
|
35
35
|
<div class="layui-btn-container">
|
|
36
36
|
<span class="table-label">签到列表</span>
|
|
37
|
-
|
|
37
|
+
<% if can?(:import_attendances, EducodeSales::AssessmentsSetting) %>
|
|
38
|
+
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="import_attendances"><i class="layui-icon layui-icon-add-circle-fine"></i> 批量导入签到数据</button>
|
|
39
|
+
<% end %>
|
|
40
|
+
<% if can?(:batch_delete, EducodeSales::AssessmentsSetting) %>
|
|
41
|
+
<button class="layui-btn layui-btn-normal layui-btn-sm layui-btn-danger data-delete-btn pull-right" lay-event="batch_delete"><i class="layui-icon layui-icon-delete"></i> 批量删除签到数据</button>
|
|
42
|
+
<% end %>
|
|
38
43
|
</div>
|
|
39
44
|
</script>
|
|
40
45
|
|
|
@@ -43,8 +48,12 @@
|
|
|
43
48
|
</div>
|
|
44
49
|
|
|
45
50
|
<script type="text/html" id="currentTableBar">
|
|
46
|
-
|
|
47
|
-
|
|
51
|
+
<% if can?(:edit_attendance, EducodeSales::AssessmentsSetting) %>
|
|
52
|
+
<a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>
|
|
53
|
+
<% end %>
|
|
54
|
+
<% if can?(:delete_attendance, EducodeSales::AssessmentsSetting) %>
|
|
55
|
+
<a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a>
|
|
56
|
+
<% end %>
|
|
48
57
|
</script>
|
|
49
58
|
|
|
50
59
|
<script>
|
|
@@ -71,6 +80,10 @@
|
|
|
71
80
|
defaultToolbar: ['filter'],
|
|
72
81
|
cols: [
|
|
73
82
|
[
|
|
83
|
+
{
|
|
84
|
+
type: 'checkbox',
|
|
85
|
+
fixed: 'left'
|
|
86
|
+
},
|
|
74
87
|
{
|
|
75
88
|
field: 'id',
|
|
76
89
|
width: 100,
|
|
@@ -184,8 +197,13 @@
|
|
|
184
197
|
return false;
|
|
185
198
|
});
|
|
186
199
|
|
|
200
|
+
//监听表格复选框选择
|
|
201
|
+
table.on('checkbox(attendance_table)',function (obj) {});
|
|
202
|
+
|
|
187
203
|
//toorbar事件监听
|
|
188
204
|
table.on('toolbar(attendance_table)', function (obj) {
|
|
205
|
+
var data = obj.data;
|
|
206
|
+
var checkStatus = table.checkStatus(obj.config.id);
|
|
189
207
|
if (obj.event === 'import_attendances') { //批量导入签到记录
|
|
190
208
|
var content = miniPage.getHrefContent('/missions/assessments/import');
|
|
191
209
|
var openWH = miniPage.getOpenWidthHeight();
|
|
@@ -202,6 +220,30 @@
|
|
|
202
220
|
$(window).on("resize", function () {
|
|
203
221
|
layer.full(index);
|
|
204
222
|
});
|
|
223
|
+
}if (obj.event === 'batch_delete') { //批量删除签到记录
|
|
224
|
+
//定义数组存放批量删除的数据id
|
|
225
|
+
var ids = [];
|
|
226
|
+
//获取所有选中行的数据
|
|
227
|
+
var dataList = checkStatus.data;
|
|
228
|
+
//遍历选中的数据,将每一行的id存储到数据中
|
|
229
|
+
$.each(dataList,function (index, data) {
|
|
230
|
+
ids.push(data.id)
|
|
231
|
+
});
|
|
232
|
+
if (ids.length <= 0){
|
|
233
|
+
layer.msg('请选择要删除的签到记录', {icon: 5})
|
|
234
|
+
}else{
|
|
235
|
+
layer.confirm('确定要删除这些签到记录吗?', function (index) {
|
|
236
|
+
request.authPost("missions/assessments/batch_delete", {'ids': ids}, function (res) {
|
|
237
|
+
if (res.success === false){
|
|
238
|
+
layer.alert(res.msg)
|
|
239
|
+
}else{
|
|
240
|
+
layer.msg('删除成功');
|
|
241
|
+
layer.close(index);
|
|
242
|
+
table.reload("attendance_table")
|
|
243
|
+
}
|
|
244
|
+
})
|
|
245
|
+
})
|
|
246
|
+
}
|
|
205
247
|
}
|
|
206
248
|
});
|
|
207
249
|
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
<% if can?(:show, EducodeSales::AssessmentsSetting) %>
|
|
7
7
|
<li data="assessments" > 考核指标设置</li>
|
|
8
8
|
<%end %>
|
|
9
|
-
|
|
9
|
+
<% if can?(:show_attendances, EducodeSales::AssessmentsSetting) %>
|
|
10
|
+
<li class="">签到记录</li>
|
|
11
|
+
<% end %>
|
|
10
12
|
</ul>
|
|
11
13
|
<!--<div class="layuimini-main min-height-table"></div>-->
|
|
12
14
|
<div class="layui-tab-content">
|
|
@@ -68,34 +68,38 @@
|
|
|
68
68
|
$ = layui.$;
|
|
69
69
|
selectInput = layui.selectInput;
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
71
|
+
if ($("#levels").length > 0) {
|
|
72
|
+
var levels_select = xmSelect.render({
|
|
73
|
+
el: '#levels',
|
|
74
|
+
name: 'level_ids',
|
|
75
|
+
data: gon.levels,
|
|
76
|
+
on: function(data) {
|
|
77
|
+
var is_secret = false;
|
|
78
|
+
data.arr.forEach(function(i) {
|
|
79
|
+
if (i.name == '战略型' || i.name == '保密型') {
|
|
80
|
+
is_secret = true;
|
|
81
|
+
}
|
|
82
|
+
})
|
|
83
|
+
if (is_secret) {
|
|
84
|
+
$("#watch_ids_wraper").removeClass('layui-hide')
|
|
85
|
+
} else {
|
|
86
|
+
$("#watch_ids_wraper").addClass('layui-hide')
|
|
80
87
|
}
|
|
81
|
-
})
|
|
82
|
-
if (is_secret) {
|
|
83
|
-
$("#watch_ids_wraper").removeClass('layui-hide')
|
|
84
|
-
} else {
|
|
85
|
-
$("#watch_ids_wraper").addClass('layui-hide')
|
|
86
88
|
}
|
|
89
|
+
})
|
|
90
|
+
}
|
|
91
|
+
if ($("#watch_ids").length > 0) {
|
|
92
|
+
var watch_id_select = xmSelect.render({
|
|
93
|
+
el: '#watch_ids',
|
|
94
|
+
name: 'watch_ids',
|
|
95
|
+
data: gon.watche_ids,
|
|
96
|
+
filterable: true,
|
|
97
|
+
})
|
|
98
|
+
if (gon.is_secret) {
|
|
99
|
+
$("#watch_ids_wraper").removeClass("layui-hide")
|
|
87
100
|
}
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
var watch_id_select = xmSelect.render({
|
|
91
|
-
el: '#watch_ids',
|
|
92
|
-
name: 'watch_ids',
|
|
93
|
-
data: gon.watche_ids,
|
|
94
|
-
filterable: true,
|
|
95
|
-
})
|
|
96
|
-
if (gon.is_secret) {
|
|
97
|
-
$("#watch_ids_wraper").removeClass("layui-hide")
|
|
98
101
|
}
|
|
102
|
+
|
|
99
103
|
var source_way = gon.source_way;
|
|
100
104
|
form.on('select(source_id)', function(data){
|
|
101
105
|
source_way = data.value;
|
|
@@ -162,20 +166,22 @@
|
|
|
162
166
|
|
|
163
167
|
}
|
|
164
168
|
});
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
169
|
+
if ($("#merge_business").length > 0) {
|
|
170
|
+
var merge_business_select = xmSelect.render({
|
|
171
|
+
el: '#merge_business',
|
|
172
|
+
filterable: true,
|
|
173
|
+
name: 'merge_business_ids',
|
|
174
|
+
remoteSearch: true,
|
|
175
|
+
remoteMethod: function(val, cb, show){
|
|
176
|
+
request.get('missions/businesses/search?id=' + parent.id + "&q=" + val, {},
|
|
177
|
+
function(res) {
|
|
178
|
+
cb(res.data)
|
|
179
|
+
})
|
|
180
|
+
},
|
|
181
|
+
data: []
|
|
182
|
+
})
|
|
183
|
+
}
|
|
184
|
+
|
|
179
185
|
|
|
180
186
|
|
|
181
187
|
var sourcable_id = gon.sourcable_id;
|
|
@@ -32,6 +32,15 @@ json.data do
|
|
|
32
32
|
json.divide_money d.divide_amount
|
|
33
33
|
json.budget_amount d.budget_amount
|
|
34
34
|
json.area d.department&.school&.province
|
|
35
|
+
|
|
36
|
+
json.keys_person_count d.last_follow_up.present? ? EducodeSales::KeyPerson.where("follow_up_id = #{d.last_follow_up.id}").count : 0
|
|
37
|
+
json.rival d.last_follow_up&.rival || ''
|
|
38
|
+
|
|
39
|
+
if ["会议活动", "渠道代理", "客户"].include?(d.source_way)
|
|
40
|
+
json.source "#{d.source_way} #{d.sourcable&.name}"
|
|
41
|
+
else
|
|
42
|
+
json.source "#{d.source_way} #{d.sourcable_type}"
|
|
43
|
+
end
|
|
35
44
|
# school_property = d.department&.school&.school_property
|
|
36
45
|
# property = []
|
|
37
46
|
|