educode_sales 0.6.6 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/educode_sales/activities_controller.rb +0 -2
  3. data/app/controllers/educode_sales/businesses_controller.rb +259 -43
  4. data/app/controllers/educode_sales/customers_controller.rb +48 -15
  5. data/app/controllers/educode_sales/home_controller.rb +6 -0
  6. data/app/controllers/educode_sales/money_plans_controller.rb +3 -3
  7. data/app/controllers/educode_sales/operation_plans_controller.rb +1 -1
  8. data/app/controllers/educode_sales/plans_controller.rb +1 -1
  9. data/app/controllers/educode_sales/sale_trends_controller.rb +107 -18
  10. data/app/controllers/educode_sales/staffs_controller.rb +29 -0
  11. data/app/controllers/educode_sales/teacher_follows_controller.rb +1 -93
  12. data/app/controllers/educode_sales/teachers_controller.rb +1 -1
  13. data/app/models/educode_sales/business_export_record.rb +5 -0
  14. data/app/models/educode_sales/customer_add.rb +4 -0
  15. data/app/models/educode_sales/staff.rb +1 -0
  16. data/app/models/educode_sales/staff_school.rb +6 -0
  17. data/app/views/educode_sales/activities/index.html.erb +7 -1
  18. data/app/views/educode_sales/activities/new.html.erb +1 -1
  19. data/app/views/educode_sales/businesses/edit_follow_record.html.erb +4 -4
  20. data/app/views/educode_sales/businesses/edit_plan.html.erb +5 -2
  21. data/app/views/educode_sales/businesses/export_records.html.erb +53 -0
  22. data/app/views/educode_sales/businesses/export_records.json.jbuilder +11 -0
  23. data/app/views/educode_sales/businesses/get_export_data.json.jbuilder +30 -0
  24. data/app/views/educode_sales/businesses/index.html.erb +161 -8
  25. data/app/views/educode_sales/businesses/index.json.jbuilder +10 -7
  26. data/app/views/educode_sales/businesses/new_follow_record.html.erb +6 -5
  27. data/app/views/educode_sales/businesses/show_follow.html.erb +37 -3
  28. data/app/views/educode_sales/businesses/show_follow.json.jbuilder +1 -0
  29. data/app/views/educode_sales/commons/index.html.erb +7 -1
  30. data/app/views/educode_sales/customers/index.html.erb +31 -1
  31. data/app/views/educode_sales/customers/index.json.jbuilder +12 -0
  32. data/app/views/educode_sales/customers/new.html.erb +106 -53
  33. data/app/views/educode_sales/home/staff_schools.json.jbuilder +9 -0
  34. data/app/views/educode_sales/money_plans/index.html.erb +2 -2
  35. data/app/views/educode_sales/roles/edit.html.erb +16 -10
  36. data/app/views/educode_sales/roles/index.html.erb +7 -1
  37. data/app/views/educode_sales/sale_trends/trends.html.erb +96 -44
  38. data/app/views/educode_sales/sale_trends/trends.json.jbuilder +2 -1
  39. data/app/views/educode_sales/sales/index.json.jbuilder +1 -1
  40. data/app/views/educode_sales/staffs/edit.html.erb +46 -5
  41. data/app/views/educode_sales/staffs/index.html.erb +74 -2
  42. data/app/views/educode_sales/staffs/index.json.jbuilder +1 -0
  43. data/app/views/educode_sales/teachers/index.html.erb +1 -1
  44. data/app/views/layouts/educode_sales/application.html.erb +1 -1
  45. data/config/routes.rb +4 -0
  46. data/db/migrate/20210902064109_create_educode_sales_role_permissions.rb +7 -0
  47. data/db/migrate/20220121060006_create_educode_sales_business_export_records.rb +10 -0
  48. data/db/migrate/20220125013811_create_educode_sales_staff_schools.rb +10 -0
  49. data/db/migrate/20220125033552_create_educode_sales_customer_adds.rb +9 -0
  50. data/lib/educode_sales/version.rb +1 -1
  51. metadata +12 -2
@@ -60,13 +60,13 @@
60
60
  <div class="layui-inline show_item" style="display:none;">
61
61
  <label class="layui-form-label">创建时间</label>
62
62
  <div class="layui-input-inline">
63
- <input type="text" class="layui-input" id="date" name="date" placeholder=" - ">
63
+ <input type="text" class="layui-input" id="date" name="date" placeholder=" - " autocomplete="off">
64
64
  </div>
65
65
  </div>
66
66
  <div class="layui-inline show_item" style="display:none;">
67
67
  <label class="layui-form-label">招标时间</label>
68
68
  <div class="layui-input-inline">
69
- <input type="text" class="layui-input" id="invitation_at" name="invitation_at" placeholder=" - ">
69
+ <input type="text" class="layui-input" id="invitation_at" name="invitation_at" placeholder=" - " autocomplete="off">
70
70
  </div>
71
71
  </div>
72
72
  <div class="layui-inline">
@@ -74,7 +74,7 @@
74
74
  </button>
75
75
  <button type="submit" id="search_bt" class="layui-btn layui-btn-primary" lay-submit lay-filter="search_bussiness">搜索
76
76
  </button>
77
- <a style="padding-left: 20px;color: #0000FF" href="javascript:;" type="submit" class="" lay-submit lay-filter="show_hide">展开/收起
77
+ <a style="padding-left: 20px;color: #0000FF" href="javascript:;" type="submit" class="" lay-submit lay-filter="show_hide">高级搜索
78
78
  </a>
79
79
  </div>
80
80
  </div>
@@ -88,6 +88,9 @@
88
88
  <script type="text/html" id="bussinessBar">
89
89
  <div class="layui-btn-container">
90
90
  <span class="table-label">商机列表</span>
91
+ <% if can?(:export_business, EducodeSales::Business) %>
92
+ <button class="layui-btn layui-btn-primary layui-border-green layui-btn-sm data-count-edit export_more-btn pull-right" style="color: #0000FF;" data-name="export" data-id="export">导出<i class="layui-icon layui-icon-down layui-nav-more"></i></button>
93
+ <% end %>
91
94
  <% if can? :create, EducodeSales::Business %>
92
95
  <button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="add"> 添加商机</button>
93
96
  <% end %>
@@ -96,15 +99,37 @@
96
99
  </div>
97
100
  </script>
98
101
  <script type="text/html" id="currentTableBar">
99
- <% if can? :add_follow, EducodeSales::Business %>
102
+ <%unless !can?(:add_follow, EducodeSales::Business) && can?(:self_add_follow, EducodeSales::Business)%>
103
+ <% if can? :add_follow, EducodeSales::Business %>
104
+ <% if @current_admin.is_admin %>
105
+ <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="add_event">添加跟进记录</a>
106
+ <% else %>
107
+ {{# if ( d.assign_follow_ups.length > 0 && d.assign_follow_ups.indexOf(d.current_staff_id) >=0 || (d.assign_follow_ups.length == 0) || (d.current_staff_id == d.staff_id) ) {}}
108
+ <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="add_event">添加跟进记录</a>
109
+ {{# }}}
110
+ <% end %>
111
+ <% end %>
112
+ <% end %>
113
+ <%if !can?(:add_follow, EducodeSales::Business) && can?(:self_add_follow, EducodeSales::Business)%>
114
+ {{# if (d.self_flag) {}}
100
115
  <% if @current_admin.is_admin %>
101
116
  <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="add_event">添加跟进记录</a>
102
117
  <% else %>
103
118
  {{# if ( d.assign_follow_ups.length > 0 && d.assign_follow_ups.indexOf(d.current_staff_id) >=0 || (d.assign_follow_ups.length == 0) || (d.current_staff_id == d.staff_id) ) {}}
104
119
  <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="add_event">添加跟进记录</a>
105
120
  {{# }}}
121
+ <% end %>
122
+ {{# }}}
123
+ <% end %>
124
+ <%if can?(:update, EducodeSales::Business)%>
125
+ <%unless !can?(:update, EducodeSales::Business) && can?(:self_edit_business, EducodeSales::Business)%>
126
+ <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>
106
127
  <% end %>
107
-
128
+ <% end %>
129
+ <%if !can?(:update, EducodeSales::Business) && can?(:self_edit_business, EducodeSales::Business)%>
130
+ {{# if (d.self_flag) {}}
131
+ <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>
132
+ {{# }}}
108
133
  <% end %>
109
134
  <% if @more %>
110
135
  <a class="layui-btn-xs data-count-edit more-btn" data-name={{d.name}} data-id={{d.id}}>更多<i class="layui-icon layui-icon-down layui-nav-more"></i></a>
@@ -203,12 +228,13 @@
203
228
 
204
229
 
205
230
  table = layui.table;
206
- table.render({
231
+ var business_table = table.render({
207
232
  elem: '#businesses_table',
208
233
  url: '/missions/businesses',
209
234
  where: {q: form.val('search_form')},
210
235
  defaultToolbar: ['filter'],
211
236
  toolbar: '#bussinessBar',
237
+ title: '商机数据表',
212
238
  totalRow: true,//开启合并行
213
239
  cols: [
214
240
  [
@@ -328,14 +354,24 @@
328
354
  sort: true,
329
355
  totalRow: true
330
356
  },
357
+ {
358
+ field: 'return_money_days',
359
+ width: 150,
360
+ title: '首次回款周期(天)',
361
+ },
331
362
  {
332
363
  field: 'place',
333
364
  width: 160,
334
365
  title: '渠道',
335
366
  },
367
+ {
368
+ field: 'year',
369
+ width: 105,
370
+ title: '所属年度',
371
+ },
336
372
  {
337
373
  title: '操作',
338
- minWidth: 170,
374
+ minWidth: 220,
339
375
  toolbar: '#currentTableBar',
340
376
  align: "center",
341
377
  fixed: 'right'
@@ -348,12 +384,16 @@
348
384
  page: true,
349
385
  skin: 'line',
350
386
  done: function (res) {
351
- drowpdwonRender()
387
+ exportData=res.data;
388
+ console.log(exportData);
389
+ drowpdwonRender()
390
+ export_drowpdwonRender()
352
391
  }
353
392
 
354
393
  });
355
394
 
356
395
  var dropmenu = gon.menus;
396
+ var export_dropmenu = gon.export_menus;
357
397
 
358
398
  drowpdwonRender = function() {
359
399
  dropdown.render({
@@ -386,6 +426,118 @@
386
426
  });
387
427
  }
388
428
 
429
+ export_drowpdwonRender = function() {
430
+ dropdown.render({
431
+ elem: '.export_more-btn',
432
+ data: export_dropmenu,
433
+ click: function(data, othis){
434
+ var elem = $(this.elem);
435
+ id = elem.data('id');
436
+ switch (data.event) {
437
+ case 'export_csv':
438
+ export_csv();
439
+ break;
440
+ case 'export_excel':
441
+ export_excel();
442
+ break;
443
+ case 'export_records':
444
+ export_records();
445
+ break;
446
+ }
447
+ }
448
+ });
449
+ }
450
+
451
+ function export_csv() {
452
+ var data = form.val("search_form");
453
+ var business_type = [];
454
+ business_type_list.getValue().forEach(function(d) {
455
+ business_type.push(d.value);
456
+ })
457
+ var business_step = [];
458
+ business_step_list.getValue().forEach(function(d) {
459
+ business_step.push(d.value);
460
+ })
461
+ data.place_id = index_place_list.getValue('valueStr');
462
+ data.business_type = business_type.toString();
463
+ data.business_step = business_step.toString();
464
+ layer.load(0, {});
465
+ console.log(data);
466
+ request.authPost("/missions/businesses/get_export_data", {
467
+ name: data.name,
468
+ area: data.area,
469
+ business_step: data.business_step,
470
+ business_type: data.business_type,
471
+ date: data.date,
472
+ department: data.department,
473
+ invitation_at: data.invitation_at,
474
+ place_id: data.place_id,
475
+ select: data.select,
476
+ staff_id: data.staff_id
477
+ }, function (res) {
478
+ console.log(res.data);
479
+ data = res.data
480
+ table.exportFile(business_table.config.id,data, 'csv');
481
+ layer.closeAll('loading');
482
+ request.get('/missions/businesses/add_export_records?type=csv', {}, function (res) {
483
+ })
484
+ })
485
+
486
+ }
487
+ function export_excel() {
488
+ var data = form.val("search_form");
489
+ var business_type = [];
490
+ business_type_list.getValue().forEach(function(d) {
491
+ business_type.push(d.value);
492
+ })
493
+ var business_step = [];
494
+ business_step_list.getValue().forEach(function(d) {
495
+ business_step.push(d.value);
496
+ })
497
+ data.place_id = index_place_list.getValue('valueStr');
498
+ data.business_type = business_type.toString();
499
+ data.business_step = business_step.toString();
500
+ layer.load(0, {});
501
+ console.log(data);
502
+ request.authPost("/missions/businesses/get_export_data", {
503
+ name: data.name,
504
+ area: data.area,
505
+ business_step: data.business_step,
506
+ business_type: data.business_type,
507
+ date: data.date,
508
+ department: data.department,
509
+ invitation_at: data.invitation_at,
510
+ place_id: data.place_id,
511
+ select: data.select,
512
+ staff_id: data.staff_id
513
+ }, function (res) {
514
+ console.log(res.data);
515
+ data = res.data
516
+ table.exportFile(business_table.config.id,data, 'xls');
517
+ layer.closeAll('loading');
518
+ request.get('/missions/businesses/add_export_records?type=xls', {}, function (res) {
519
+ })
520
+ })
521
+
522
+ }
523
+ function export_records() {
524
+ var content = miniPage.getHrefContent('/missions/businesses/export_records')
525
+ var openWH = miniPage.getOpenWidthHeight();
526
+ sindex = layer.open({
527
+ title: '·',
528
+ type: 1,
529
+ shade: 0.2,
530
+ maxmin: true,
531
+ shadeClose: true,
532
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
533
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
534
+ content: content
535
+ });
536
+ $(window).on("resize", function () {
537
+ layer.full(sindex);
538
+ });
539
+ }
540
+
389
541
  function week(id) {
390
542
  var content = miniPage.getHrefContent('/missions/plans/new_week?business_id=' + id);
391
543
  var openWH = miniPage.getOpenWidthHeight();
@@ -734,6 +886,7 @@
734
886
  layer.full(index);
735
887
  });
736
888
  } else if (obj.event === 'show_follow') {
889
+ self_flag = data.self_flag
737
890
  business_id = obj.data.id
738
891
  business_name = data.name
739
892
  content = miniPage.getHrefContent('/missions/businesses/show_follow?id=' + id);
@@ -1,4 +1,5 @@
1
- follow_ups_count = 0
1
+ follow_up_ids = EducodeSales::AssignFollowUp.where(staff_id: @current_admin.id).pluck(:follow_up_id)
2
+ follow_count = 0
2
3
  json.data do
3
4
  json.array! @businesses do |d|
4
5
  json.id d.id
@@ -6,21 +7,22 @@ json.data do
6
7
  json.department d.department.name
7
8
  json.school d.department.school.name
8
9
  json.school_id d.department.school.id
9
- json.follow_ups_count d.follow_ups.where(deleted_at: nil).size
10
- follow_ups_count += d.follow_ups_count
10
+ follow_ups_count = d.follow_ups.where(deleted_at: nil).size
11
+ json.follow_ups_count follow_ups_count
12
+ follow_count += follow_ups_count
11
13
  json.follow_up_id d.last_follow_up_id
12
- # json.teachers_count d.follow_ups.sum(:key_people_count)
13
- # json.teachers_count EducodeSales::FollowUp.order(created_at: :desc).find_by(business_id: d.id).present? ? EducodeSales::FollowUp.order(created_at: :desc).find_by(business_id: d.id).key_people_count : 0
14
14
  json.clazz d.last_follow_up&.clazz&.name || ""
15
15
  json.stage d.last_follow_up&.stage&.name
16
16
  json.invitation_at d.last_follow_up&.invitation_at.to_s
17
17
  json.reception_at d.last_follow_up&.reception_at.to_s
18
18
  json.bidded_date d.last_follow_up&.bidded_date.to_s
19
19
  json.signed_date d.last_follow_up&.signed_date.to_s
20
+ json.year d.last_follow_up&.year.to_s
20
21
  json.total_amount d.last_follow_up&.total_amount
21
22
  json.actual_amount d.last_follow_up&.actual_amount
22
23
  json.return_money d.return_money
23
24
  json.wait_return_money d.wait_return_money.to_i.round(2)
25
+ json.return_money_days d.last_follow_up&.reception_at.present? && d.last_follow_up.money_plans.where(clazz: '已完成').present? ? (d.last_follow_up.money_plans.where(clazz: '已完成').order(created_at: :asc).first.date_at.to_s(:date).to_date - d.last_follow_up&.reception_at).to_i : ''
24
26
  json.place d.last_follow_up&.place&.name
25
27
  json.last_follow_person d.last_follow_up.present? ? d.last_follow_up.staff.user.real_name : EducodeSales::Staff.find(d.staff_id).user.real_name
26
28
  json.source d.source
@@ -28,11 +30,12 @@ json.data do
28
30
  json.current_staff_id @current_admin.id
29
31
  json.staff_id d.staff_id
30
32
  json.latest_time d.last_follow_up.present? ? d.last_follow_up.created_at.to_s : ''
31
- end
33
+ json.self_flag (d.staff_id == @current_admin.id) || (d.last_follow_up_id.in? follow_up_ids)
34
+ end
32
35
  end
33
36
 
34
37
  json.totalRow do
35
- json.follow_ups_count follow_ups_count.to_s
38
+ json.follow_ups_count follow_count.to_i.to_s
36
39
  end
37
40
  json.code 0
38
41
  json.count @businesses.total_count
@@ -87,10 +87,9 @@
87
87
  <br>
88
88
  <div class="layui-inline new_place_select">
89
89
  <label class="layui-form-label">渠道</label>
90
- <div class="layui-input-inline" style="z-index: 101">
90
+ <div class="layui-input-inline" style="">
91
91
  <div id="place" style="width: 190px;"></div>
92
92
  </div>
93
- 总额里,渠道拿到的部分。
94
93
  </div>
95
94
  <br>
96
95
  <div class="layui-inline">
@@ -98,6 +97,7 @@
98
97
  <div class="layui-input-inline">
99
98
  <input name="divide_amount" class="layui-input" value="<%= @last_follow_up&.divide_amount%>">
100
99
  </div>
100
+ 总额里,渠道拿到的部分。
101
101
  </div>
102
102
  <div class="layui-form-item">
103
103
  <div class="layui-inline">
@@ -110,10 +110,10 @@
110
110
  </div>
111
111
  <div class="layui-form-item">
112
112
  <label class="layui-form-label">指定跟进人</label>
113
- <div class="layui-input-inline" style="z-index: 102">
113
+ <div class="layui-input-inline" style="">
114
114
  <div id="assign_follow" style="width: 512px;"></div>
115
115
  </div>
116
- <div class="layui-inline" style="padding: 9px 15px">
116
+ <div class="layui-inline" style="padding: 9px 15px;z-index: -1;">
117
117
  <label class="layui-form-label" style="padding-left: 220px"></label>
118
118
  指定跟进人和商机创建者,同时拥有对该商机的管理权限
119
119
  </div>
@@ -143,7 +143,7 @@
143
143
  </div>
144
144
  <div class="layui-form-item m-t-20">
145
145
  <div class="layui-input-block">
146
- <button class="layui-btn layui-btn-normal" lay-submit lay-filter="add_follow_up">提交</button>
146
+ <button class="layui-btn layui-btn-normal submit-btn" lay-submit lay-filter="add_follow_up">提交</button>
147
147
  </div>
148
148
  </div>
149
149
  </div>
@@ -248,6 +248,7 @@
248
248
  form.render();
249
249
 
250
250
  form.on('submit(add_follow_up)', function (data) {
251
+ $(".submit-btn").addClass("layui-hide");
251
252
  var assign_follow = [];
252
253
  sales_list.getValue().forEach(function(d) {
253
254
  assign_follow.push(d.value);
@@ -2,13 +2,22 @@
2
2
  <div class="layui-btn-container">
3
3
  <span class="table-label">跟进记录</span>
4
4
  <button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="time_line"> 时间线视图>></button>
5
- <% if can? :add_follow, EducodeSales::Business %>
5
+ <%unless !can?(:add_follow, EducodeSales::Business) && can?(:self_add_follow, EducodeSales::Business)%>
6
+ <% if can? :add_follow, EducodeSales::Business %>
6
7
  <% if @current_admin.is_admin %>
7
8
  <button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="add"> 添加跟进记录</button>
8
9
  <% elsif @business.staff_id == @current_admin.id || @business.last_follow_up.nil? || @business.last_follow_up.assign_follow_ups.blank? || (@business.last_follow_up.assign_follow_ups.pluck(:staff_id).include?(@current_admin.id)) %>
9
10
  <button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="add"> 添加跟进记录</button>
10
11
  <% end %>
11
12
  <% end %>
13
+ <% end %>
14
+ <%if !can?(:add_follow, EducodeSales::Business) && can?(:self_add_follow, EducodeSales::Business)%>
15
+ <% if @current_admin.is_admin %>
16
+ <button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right add_follow" lay-event="add"> 添加跟进记录</button>
17
+ <% elsif @business.staff_id == @current_admin.id || @business.last_follow_up.nil? || @business.last_follow_up.assign_follow_ups.blank? || (@business.last_follow_up.assign_follow_ups.pluck(:staff_id).include?(@current_admin.id)) %>
18
+ <button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right add_follow" lay-event="add"> 添加跟进记录</button>
19
+ <% end %>
20
+ <% end %>
12
21
  <span class="table-label pull-right" style="padding-right: 20px">温馨提示:仅可以在24小时之内,编辑/删除最新的跟进记录</span>
13
22
  </div>
14
23
  </script>
@@ -23,16 +32,37 @@
23
32
  <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="show">查看</a>
24
33
  <% end %>
25
34
  {{# if(d.is_latest && d.flag){ }}
26
- <% if can? :update_follow, EducodeSales::Business %>
35
+
36
+ <%unless !can?(:update_follow, EducodeSales::Business) && can?(:self_edit_follow, EducodeSales::Business)%>
37
+ <% if can? :update_follow, EducodeSales::Business %>
27
38
  <% if @current_admin.is_admin %>
28
39
  <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>
29
40
  <% elsif @business.staff_id == @current_admin.id || @business.last_follow_up.nil? || @business.last_follow_up.assign_follow_ups.blank? || (@business.last_follow_up.assign_follow_ups.pluck(:staff_id).include?(@current_admin.id)) %>
30
41
  <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>
31
42
  <% end %>
32
43
  <% end %>
33
- <% if can? :destroy_follow, EducodeSales::Business %>
44
+ <% end %>
45
+
46
+ <%if !can?(:update_follow, EducodeSales::Business) && can?(:self_edit_follow, EducodeSales::Business)%>
47
+ {{# if(d.self_flag){ }}
48
+ <% if @current_admin.is_admin %>
49
+ <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>
50
+ <% elsif @business.staff_id == @current_admin.id || @business.last_follow_up.nil? || @business.last_follow_up.assign_follow_ups.blank? || (@business.last_follow_up.assign_follow_ups.pluck(:staff_id).include?(@current_admin.id)) %>
51
+ <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>
52
+ <% end %>
53
+ {{# } }}
54
+ <% end %>
55
+
56
+ <%unless !can?(:destroy_follow, EducodeSales::Business) && can?(:self_delete_follow, EducodeSales::Business)%>
57
+ <% if can? :destroy_follow, EducodeSales::Business %>
34
58
  <a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a>
35
59
  <% end %>
60
+ <% end %>
61
+ <%if !can?(:destroy_follow, EducodeSales::Business) && can?(:self_delete_follow, EducodeSales::Business)%>
62
+ {{# if(d.self_flag){ }}
63
+ <a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a>
64
+ {{# } }}
65
+ <% end %>
36
66
  {{# } }}
37
67
  </script>
38
68
 
@@ -201,6 +231,10 @@
201
231
  });
202
232
  })
203
233
 
234
+ if(!parent.self_flag){
235
+ $('.add_follow').addClass("layui-hide");
236
+ }
237
+
204
238
  table.on('toolbar(sale_plan_follow_table)', function (obj) {
205
239
  if (obj.event === 'add') { // 监听添加操作
206
240
  business_id = parent.business_id
@@ -19,6 +19,7 @@ json.data do
19
19
  json.is_latest d.id == @latest&.id
20
20
  json.flag d.created_at.present? ? (Time.now - d.created_at).to_f/3600 < 24 : false
21
21
  json.description d.description
22
+ json.self_flag d.staff_id == @current_admin.id
22
23
  end
23
24
  end
24
25
 
@@ -129,4 +129,10 @@
129
129
  });
130
130
 
131
131
  });
132
- </script>
132
+ </script>
133
+ <style>
134
+ .layui-table-tool-temp{
135
+ padding-right: 0px; !important;
136
+ }
137
+
138
+ </style>
@@ -25,7 +25,12 @@
25
25
  <!-- <input type="text" class="layui-input" id="date" name="date" placeholder=" - ">-->
26
26
  <!-- </div>-->
27
27
  <!-- </div>-->
28
-
28
+ <div class="layui-inline">
29
+ <label class="layui-form-label">性质</label>
30
+ <div class="layui-input-inline">
31
+ <div id="property" style="width: 190px;"></div>
32
+ </div>
33
+ </div>
29
34
  <div class="layui-inline">
30
35
  <button type="reset" class="layui-btn layui-btn-primary" lay-submit lay-filter="reset_business_search">重置
31
36
  </button>
@@ -94,6 +99,19 @@
94
99
  // window.onload=hn;
95
100
  // });
96
101
 
102
+ var property_list = xmSelect.render({
103
+ el: '#property',
104
+ data: [
105
+ {value: 0, name: '985工程'},
106
+ {value: 1, name: '211工程'},
107
+ {value: 2, name: '本科院校'},
108
+ {value: 3, name: '大专院校'},
109
+ {value: 4, name: '中专学校'},
110
+ {value: 5, name: '军事院校'},
111
+ {value: 6, name: '企业'}
112
+ ]
113
+ })
114
+
97
115
  laydate.render({
98
116
  elem: '#date',
99
117
  range: true
@@ -122,6 +140,7 @@
122
140
  {
123
141
  field: 'name',
124
142
  title: '客户名称',
143
+ width: 100,
125
144
  templet: "#name"
126
145
  },
127
146
  {
@@ -129,6 +148,11 @@
129
148
  width: 100,
130
149
  title: '区域',
131
150
  },
151
+ {
152
+ field: 'property',
153
+ width: 200,
154
+ title: '性质',
155
+ },
132
156
  {
133
157
  field: 'department',
134
158
  width: 100,
@@ -238,6 +262,11 @@
238
262
 
239
263
  // 监听搜索操作
240
264
  form.on('submit(search_teachers)', function (data) {
265
+ var property = [];
266
+ property_list.getValue().forEach(function(d) {
267
+ property.push(d.value);
268
+ })
269
+ data.field.property = property.toString();
241
270
  search = data.field
242
271
  table.reload('customers_table', {
243
272
  page: {
@@ -263,6 +292,7 @@
263
292
  assist: "",
264
293
  teacher_source: ""
265
294
  });
295
+ property_list.setValue([])
266
296
  return false;
267
297
  });
268
298
  /**
@@ -14,6 +14,18 @@ json.data do
14
14
  json.id d.id
15
15
  json.name d.name
16
16
  json.area d.province
17
+ school_property = d.school_property
18
+ property = []
19
+ if school_property.present?
20
+ property << '985工程' if school_property.project_985
21
+ property << '211工程' if school_property.project_211
22
+ property << '本科院校' if school_property.regular_college
23
+ property << '大专院校' if school_property.junior_college
24
+ property << '中专学校' if school_property.secondary_school
25
+ property << '军事院校' if school_property.military_school
26
+ property << '企业' if school_property.enterprise
27
+ end
28
+ json.property property.join("、")
17
29
  json.department d.departments.size
18
30
  json.business EducodeSales::Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_businesses.school_id = ?", d.id).size
19
31
  json.follow follow_ups.size + customer_follows.size