educode_sales 0.4.2 → 0.4.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.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/educode_sales/1./351/224/200/345/224/256/346/264/273/345/212/250.png +0 -0
  3. data/app/assets/images/educode_sales/10./346/225/231/345/270/210/350/277/220/350/220/245.png +0 -0
  4. data/app/assets/images/educode_sales/11./346/264/273/345/212/250/350/277/220/350/220/245.png +0 -0
  5. data/app/assets/images/educode_sales/12./350/277/220/350/220/245/350/256/241/345/210/222.png +0 -0
  6. data/app/assets/images/educode_sales/13./347/263/273/347/273/237/350/256/276/347/275/256.png +0 -0
  7. data/app/assets/images/educode_sales/14./350/247/222/350/211/262/347/256/241/347/220/206.png +0 -0
  8. data/app/assets/images/educode_sales/15./344/272/272/345/221/230/347/256/241/347/220/206.png +0 -0
  9. data/app/assets/images/educode_sales/16./345/255/227/345/205/270/345/210/227/350/241/250.png +0 -0
  10. data/app/assets/images/educode_sales/2./345/270/202/345/234/272/346/200/201/345/212/277.png +0 -0
  11. data/app/assets/images/educode_sales/3./351/224/200/345/224/256/345/210/206/345/267/245.png +0 -0
  12. data/app/assets/images/educode_sales/4./345/225/206/346/234/272/347/256/241/347/220/206.png +0 -0
  13. data/app/assets/images/educode_sales/5./346/270/240/351/201/223/347/256/241/347/220/206.png +0 -0
  14. data/app/assets/images/educode_sales/6./351/224/200/345/224/256/350/256/241/345/210/222.png +0 -0
  15. data/app/assets/images/educode_sales/7./350/277/220/350/220/245/346/264/273/345/212/250.png +0 -0
  16. data/app/assets/images/educode_sales/8./350/277/220/350/220/245/346/200/201/345/212/277.png +0 -0
  17. data/app/assets/images/educode_sales/9./350/277/220/350/220/245/345/210/206/345/267/245.png +0 -0
  18. data/app/assets/images/educode_sales/a.png +0 -0
  19. data/app/assets/images/educode_sales/indexLogo.png +0 -0
  20. data/app/assets/images/educode_sales/logo.png +0 -0
  21. data/app/controllers/educode_sales/businesses_controller.rb +21 -3
  22. data/app/controllers/educode_sales/follow_ups_controller.rb +3 -3
  23. data/app/controllers/educode_sales/operation_plans_controller.rb +2 -2
  24. data/app/controllers/educode_sales/operation_reports_controller.rb +3 -3
  25. data/app/controllers/educode_sales/places_controller.rb +1 -1
  26. data/app/controllers/educode_sales/plans_controller.rb +8 -4
  27. data/app/controllers/educode_sales/sale_reports_controller.rb +3 -3
  28. data/app/controllers/educode_sales/sale_trends_controller.rb +3 -3
  29. data/app/controllers/educode_sales/sales_controller.rb +1 -1
  30. data/app/controllers/educode_sales/teacher_follows_controller.rb +1 -1
  31. data/app/models/educode_sales/common.rb +2 -0
  32. data/app/models/educode_sales/teacher.rb +12 -19
  33. data/app/views/educode_sales/activities/index.html.erb +4 -0
  34. data/app/views/educode_sales/activities/index.json.jbuilder +6 -0
  35. data/app/views/educode_sales/businesses/edit_follow_record.html.erb +7 -8
  36. data/app/views/educode_sales/businesses/index.html.erb +46 -6
  37. data/app/views/educode_sales/businesses/index.json.jbuilder +8 -1
  38. data/app/views/educode_sales/businesses/new_follow_record.html.erb +7 -8
  39. data/app/views/educode_sales/businesses/show_follow.html.erb +10 -10
  40. data/app/views/educode_sales/businesses/show_follow.json.jbuilder +2 -2
  41. data/app/views/educode_sales/businesses/show_follow_record.html.erb +16 -4
  42. data/app/views/educode_sales/home/index.html.erb +1 -1
  43. data/app/views/educode_sales/operation_plans/_monthPlan.html.erb +5 -1
  44. data/app/views/educode_sales/operation_plans/_monthly.html.erb +14 -0
  45. data/app/views/educode_sales/operation_plans/_weekPlan.html.erb +5 -1
  46. data/app/views/educode_sales/operation_plans/_weekly.html.erb +14 -0
  47. data/app/views/educode_sales/operation_plans/index.json.jbuilder +10 -2
  48. data/app/views/educode_sales/operation_plans/new_monthly.html.erb +4 -2
  49. data/app/views/educode_sales/operation_plans/new_weekly.html.erb +4 -2
  50. data/app/views/educode_sales/operation_reports/audit.html.erb +40 -13
  51. data/app/views/educode_sales/operation_reports/edit.html.erb +4 -2
  52. data/app/views/educode_sales/operation_reports/index.json.jbuilder +7 -0
  53. data/app/views/educode_sales/operation_reports/show.html.erb +46 -15
  54. data/app/views/educode_sales/places/index.html.erb +5 -0
  55. data/app/views/educode_sales/plans/_monthPlan.html.erb +3 -0
  56. data/app/views/educode_sales/plans/_monthly.html.erb +15 -0
  57. data/app/views/educode_sales/plans/_weekPlan.html.erb +4 -1
  58. data/app/views/educode_sales/plans/_weekly.html.erb +16 -0
  59. data/app/views/educode_sales/plans/index.json.jbuilder +4 -0
  60. data/app/views/educode_sales/plans/new_monthly.html.erb +4 -2
  61. data/app/views/educode_sales/plans/new_weekly.html.erb +4 -2
  62. data/app/views/educode_sales/sale_reports/audit.html.erb +40 -13
  63. data/app/views/educode_sales/sale_reports/edit.html.erb +4 -2
  64. data/app/views/educode_sales/sale_reports/index.json.jbuilder +7 -0
  65. data/app/views/educode_sales/sale_reports/show.html.erb +46 -21
  66. data/app/views/educode_sales/sales/index.html.erb +6 -0
  67. data/app/views/educode_sales/sales/index.json.jbuilder +20 -4
  68. data/app/views/educode_sales/sales/operations.html.erb +4 -4
  69. data/app/views/educode_sales/sales/operations.json.jbuilder +12 -3
  70. data/app/views/educode_sales/teachers/index.html.erb +19 -14
  71. data/app/views/educode_sales/teachers/index.json.jbuilder +12 -2
  72. data/app/views/layouts/educode_sales/application.html.erb +179 -41
  73. data/db/migrate/20211018054256_add_extras_to_commons.rb +6 -0
  74. data/db/migrate/20211022085324_add_teacher_used_to_teachers.rb +7 -0
  75. data/lib/educode_sales/version.rb +1 -1
  76. metadata +22 -3
  77. data/app/assets/images/educode_sales/indexlogo.png +0 -0
@@ -34,6 +34,7 @@
34
34
  elem: '#place',
35
35
  url: '/missions/places',
36
36
  toolbar: '#toolbarDemo',
37
+ totalRow:true,
37
38
  defaultToolbar: [],
38
39
  cols: [
39
40
  [
@@ -41,6 +42,7 @@
41
42
  field: 'id',
42
43
  width: 80,
43
44
  title:'序号',type: 'numbers',
45
+ totalRowText:'合计',
44
46
  },
45
47
  {
46
48
  field: 'name',
@@ -54,16 +56,19 @@
54
56
  {
55
57
  field: 'businesses_count',
56
58
  width: 120,
59
+ totalRow:'{{ parseInt(d.TOTAL_NUMS) }}',
57
60
  title: '商机'
58
61
  },
59
62
  {
60
63
  field: 'amount',
61
64
  width: 120,
65
+ totalRow:true,
62
66
  title: '中标'
63
67
  },
64
68
  {
65
69
  field: 'return_mount',
66
70
  width: 120,
71
+ totalRow:true,
67
72
  title: '回款',
68
73
  },
69
74
  {
@@ -77,12 +77,14 @@
77
77
  url: '/missions/plans?clazz=month',
78
78
  toolbar: '#monthPlanToolbar',
79
79
  defaultToolbar: [],
80
+ totalRow:true,
80
81
  cols: [
81
82
  [
82
83
  {
83
84
  field: 'id',
84
85
  width: 80,
85
86
  title:'序号',type: 'numbers',
87
+ totalRowText:"合计",
86
88
  },
87
89
  {
88
90
  field: 'staff',
@@ -123,6 +125,7 @@
123
125
  {
124
126
  field: 'finish_rate',
125
127
  width: 100,
128
+ totalRow:true,
126
129
  title: '完成率',
127
130
  },
128
131
  {
@@ -79,30 +79,40 @@
79
79
  url: '/missions/sale_reports?clazz=month',
80
80
  toolbar: '#monthly_Toolbar',
81
81
  defaultToolbar: [],
82
+ totalRow:true,
82
83
  cols: [
83
84
  [{
84
85
  field: 'id',
85
86
  width: 60,
86
87
  title:'序号',type: 'numbers',
88
+ totalRowText:"合计",
87
89
  },
88
90
  {
89
91
  field: 'staff',
90
92
  width: 100,
91
93
  title: '姓名'
92
94
  },
95
+ {
96
+ field: 'month',
97
+ width: 100,
98
+ title: '月份'
99
+ },
93
100
  {
94
101
  field: 'finish_rate',
95
102
  width: 100,
103
+ totalRow:true,
96
104
  title: '完成率',
97
105
  },
98
106
  {
99
107
  field: 'client',
100
108
  width: 100,
109
+ totalRow:'{{ parseInt(d.TOTAL_NUMS) }}',
101
110
  title: '覆盖客户'
102
111
  },
103
112
  {
104
113
  field: 'amount',
105
114
  width: 100,
115
+ totalRow:true,
106
116
  title: '项目金额'
107
117
  },
108
118
  {
@@ -134,6 +144,11 @@
134
144
  return '<div class="star3"></div>'
135
145
  }
136
146
  },
147
+ {
148
+ field: 'created_at',
149
+ width: 300,
150
+ title: '提交时间',
151
+ },
137
152
  {
138
153
  title: '操作',
139
154
  minWidth: 220,
@@ -76,6 +76,7 @@
76
76
  elem: '#weekPlanTable',
77
77
  url: '/missions/plans?clazz=week',
78
78
  toolbar: '#weekPlanToolbar',
79
+ totalRow:true,
79
80
  defaultToolbar: [],
80
81
  cols: [
81
82
  [
@@ -83,6 +84,7 @@
83
84
  field: 'id',
84
85
  width: 80,
85
86
  title:'序号',type: 'numbers',
87
+ totalRowText: '合计'
86
88
  },
87
89
  {
88
90
  field: 'staff',
@@ -91,7 +93,7 @@
91
93
  },
92
94
  {
93
95
  field: 'business_name',
94
- width: 280,
96
+ width: 180,
95
97
  title: '商机名称',
96
98
  },
97
99
  {
@@ -129,6 +131,7 @@
129
131
  field: 'finish_rate',
130
132
  width: 100,
131
133
  title: '完成率',
134
+ totalRow:true,
132
135
  },
133
136
  {
134
137
  field: 'updated_at',
@@ -80,31 +80,41 @@
80
80
  url: '/missions/sale_reports?clazz=week',
81
81
  toolbar: '#weeklyToolbar',
82
82
  defaultToolbar: [],
83
+ totalRow:true,
83
84
  cols: [
84
85
  [
85
86
  {
86
87
  field: 'id',
87
88
  width: 60,
88
89
  title:'序号',type: 'numbers',
90
+ totalRowText:"合计",
89
91
  },
90
92
  {
91
93
  field: 'staff',
92
94
  width: 100,
93
95
  title: '姓名'
94
96
  },
97
+ {
98
+ field: 'weekly',
99
+ width: 100,
100
+ title: '周次'
101
+ },
95
102
  {
96
103
  field: 'finish_rate',
97
104
  width: 100,
98
105
  title: '完成率',
106
+ totalRow:true,
99
107
  },
100
108
  {
101
109
  field: 'client',
102
110
  width: 100,
111
+ totalRow:'{{ parseInt(d.TOTAL_NUMS) }}',
103
112
  title: '覆盖客户'
104
113
  },
105
114
  {
106
115
  field: 'amount',
107
116
  width: 100,
117
+ totalRow:true,
108
118
  title: '项目金额'
109
119
  },
110
120
  {
@@ -135,7 +145,13 @@
135
145
  templet: function (d) {
136
146
  return '<div class="star3"></div>'
137
147
  }
148
+
138
149
  },
150
+ {
151
+ field: 'created_at',
152
+ width: 300,
153
+ title: '提交时间',
154
+ },
139
155
  {
140
156
  title: '操作',
141
157
  minWidth: 220,
@@ -15,5 +15,9 @@ json.data do
15
15
  end
16
16
  end
17
17
 
18
+ json.totalRow do
19
+ sum = @sale_plans.inject(0) { |score, i| score + i.finish_rate}
20
+ json.finish_rate ( @sale_plans.size > 0 ? (sum.to_f / @sale_plans.size).round(2).to_s : '0' ) + '%'
21
+ end
18
22
  json.code 0
19
23
  json.count @sale_plans.total_count
@@ -6,7 +6,7 @@
6
6
  <% end %>
7
7
  </div>
8
8
  </script>
9
- <form class="layui-form layui-form-pane">
9
+ <form class="layui-form layui-form-pane" style="padding-right: 20px">
10
10
  <div class="layui-form-item">
11
11
  <div class="layui-inline" style="margin:18px; font-weight: bold">
12
12
  <label>完成率:</label>
@@ -42,7 +42,9 @@
42
42
  </form>
43
43
 
44
44
  <!--表格-->
45
- <table class="layui-hide" id="newmonthlyTable" lay-filter="newmonthlyTable"></table>
45
+ <div style="padding: 20px">
46
+ <table class="layui-hide" id="newmonthlyTable" lay-filter="newmonthlyTable"></table>
47
+ </div>
46
48
  <script type="text/html" id="show_follow">
47
49
  <a href="javascript:void(0);" lay-event="show_follow" class="layui-table-link">{{ d.follow_ups_count }}</a>
48
50
  </script>
@@ -4,7 +4,7 @@
4
4
  <button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="add"> 添加计划</button>
5
5
  </div>
6
6
  </script>
7
- <form class="layui-form layui-form-pane">
7
+ <form class="layui-form layui-form-pane" style="padding-right: 20px">
8
8
  <div class="layui-form-item">
9
9
  <div class="layui-inline" style="margin:18px; font-weight: bold">
10
10
  <label>完成率:</label>
@@ -40,7 +40,9 @@
40
40
  </form>
41
41
 
42
42
  <!--表格-->
43
- <table class="layui-hide" id="newWeeklyTable" lay-filter="newWeeklyTable"></table>
43
+ <div style="padding: 20px">
44
+ <table class="layui-hide" id="newWeeklyTable" lay-filter="newWeeklyTable"></table>
45
+ </div>
44
46
  <script type="text/html" id="show_follow">
45
47
  <a href="javascript:void(0);" lay-event="show_follow" class="layui-table-link">{{ d.follow_ups_count }}</a>
46
48
  </script>
@@ -1,4 +1,4 @@
1
- <form class="layui-form layui-form-pane" action="">
1
+ <form class="layui-form layui-form-pane" action="" style="padding-right: 20px">
2
2
  <div class="layui-form-item">
3
3
  <div class="layui-inline" style="margin:18px; font-weight: bold">
4
4
  <label>完成率:</label>
@@ -18,36 +18,37 @@
18
18
  <div class="layui-form-item layui-form-text">
19
19
  <label class="layui-form-label">个人总结</label>
20
20
  <div class="layui-input-block">
21
- <textarea name="content" placeholder="此处填写要点:
21
+ <textarea name="content" placeholder="此处填写要点:
22
22
  1、一句话概括本周工作的主要成效和主要挫折;
23
23
  2、补充说明收获、经验;
24
- 3、补充说明需要上级解决的问题和挑战。" disabled class="layui-textarea"><%= @sale_report.content %></textarea>
24
+ 3、补充说明需要上级解决的问题和挑战。" disabled class="layui-textarea autosize"><%= @sale_report.content %></textarea>
25
25
  </div>
26
26
  </div>
27
- <div class="layui-form-item layui-form-text">
27
+ <div class="layui-form-item layui-form-text" style="margin-bottom: 0px">
28
28
  <label class="layui-form-label">大区意见</label>
29
29
  <div class="layui-input-block">
30
30
  <textarea name="level1_opinion" placeholder="给出评价、提醒、建议、办法等。"
31
- class="layui-textarea"><%= @sale_report.level1_opinion %></textarea>
31
+ class="layui-textarea autosize"><%= @sale_report.level1_opinion %></textarea>
32
32
  </div>
33
33
  </div>
34
- <div id="weekStar4"></div>
35
- <div class="layui-form-item layui-form-text">
34
+ <div id="weekStar4" style="margin-bottom: 40px"></div>
35
+ <div class="layui-form-item layui-form-text" style="margin-bottom: 0px">
36
36
  <label class="layui-form-label">总监意见</label>
37
37
  <div class="layui-input-block">
38
38
  <textarea name="level2_opinion" placeholder="给出评价、提醒、建议、办法等。"
39
- class="layui-textarea"><%= @sale_report.level2_opinion %></textarea>
39
+ class="layui-textarea autosize"><%= @sale_report.level2_opinion %></textarea>
40
40
  </div>
41
41
  </div>
42
- <div id="weekStar5"></div>
43
- <div class="layui-form-item layui-form-text">
42
+ <div id="weekStar5" style="margin-bottom: 40px"></div>
43
+ <div class="layui-form-item layui-form-text" style="margin-bottom: 0px">
44
44
  <label class="layui-form-label">副总意见</label>
45
45
  <div class="layui-input-block">
46
46
  <textarea name="level3_opinion" placeholder="给出评价、提醒、建议、办法等。"
47
- class="layui-textarea"><%= @sale_report.level3_opinion %></textarea>
47
+ class="layui-textarea autosize"><%= @sale_report.level3_opinion %></textarea>
48
48
  </div>
49
49
  </div>
50
- <div id="weekStar6"></div>
50
+ <div id="weekStar6" style="margin-bottom: 40px"></div>
51
+ <br>
51
52
  <div class="layui-inline m-t-10">
52
53
  <button type="submit" class="layui-btn layui-btn-normal" lay-submit lay-filter="audit_weekly_report"
53
54
  style="margin-left: 18px">提交
@@ -57,7 +58,9 @@
57
58
  </form>
58
59
 
59
60
  <!--表格-->
60
- <table class="layui-hide" id="showWeeklyTable" lay-filter="showWeeklyTable"></table>
61
+ <div style="padding: 20px">
62
+ <table class="layui-hide" id="showWeeklyTable" lay-filter="showWeeklyTable"></table>
63
+ </div>
61
64
  <script type="text/html" id="show_follow">
62
65
  <a href="javascript:void(0);" lay-event="show_follow" class="layui-table-link">{{ d.follow_ups_count }}</a>
63
66
  </script>
@@ -205,5 +208,29 @@
205
208
  ],
206
209
  page: true
207
210
  });
211
+ autosize();
212
+ function autosize(){
213
+ var text = $('.autosize');
214
+
215
+ text.each(function(){
216
+ $(this).attr('rows',1);
217
+ resize($(this));
218
+ });
219
+
220
+ text.on('input', function(){
221
+ resize($(this));
222
+ });
223
+
224
+ function resize ($text) {
225
+ $text.css('height', 'auto');
226
+ $text.css('height', $text[0].scrollHeight+'px');
227
+ }
228
+ }
208
229
  })
209
230
  </script>
231
+ <style>
232
+ .autosize {
233
+ resize: none;
234
+ overflow: hidden;
235
+ }
236
+ </style>
@@ -9,7 +9,7 @@
9
9
  {{# } }}
10
10
  </div>
11
11
  </script>
12
- <form class="layui-form layui-form-pane">
12
+ <form class="layui-form layui-form-pane" style="padding-right: 20px">
13
13
  <div class="layui-form-item">
14
14
  <div class="layui-inline" style="margin:18px; font-weight: bold">
15
15
  <label>完成率:</label>
@@ -43,7 +43,9 @@
43
43
  </form>
44
44
 
45
45
  <!--表格-->
46
- <table class="layui-hide" id="newWeeklyTable" lay-filter="newWeeklyTable"></table>
46
+ <div style="padding: 20px">
47
+ <table class="layui-hide" id="newWeeklyTable" lay-filter="newWeeklyTable"></table>
48
+ </div>
47
49
  <script type="text/html" id="show_follow">
48
50
  <a href="javascript:void(0);" lay-event="show_follow" class="layui-table-link">{{ d.follow_ups_count }}</a>
49
51
  </script>
@@ -10,8 +10,15 @@ json.data do
10
10
  json.level2_score d.level2_score || 0
11
11
  json.level3_score d.level3_score || 0
12
12
  json.updated_at d.updated_at.to_s
13
+ json.weekly d.weekly
14
+ json.created_at d.created_at.to_s
15
+ json.month d.month.strftime("%Y-%m")
13
16
  end
14
17
  end
15
18
 
19
+ json.totalRow do
20
+ sum = @sale_reports.inject(0) { |score, i| score + i.finish_rate}
21
+ json.finish_rate ( @sale_reports.size > 0 ? (sum.to_f / @sale_reports.size).round(2).to_s : '0' ) + '%'
22
+ end
16
23
  json.code 0
17
24
  json.count @sale_reports.total_count
@@ -1,4 +1,4 @@
1
- <form class="layui-form layui-form-pane" action="">
1
+ <form class="layui-form layui-form-pane" action="" style="padding-right: 20px">
2
2
  <div class="layui-form-item">
3
3
  <div class="layui-inline" style="margin:18px; font-weight: bold">
4
4
  <label>完成率:</label>
@@ -20,39 +20,41 @@
20
20
  <textarea name="desc" placeholder="此处填写要点:
21
21
  1、一句话概括本周工作的主要成效和主要挫折;
22
22
  2、补充说明收获、经验;
23
- 3、补充说明需要上级解决的问题和挑战。" disabled class="layui-textarea"><%= @sale_report.content %></textarea>
23
+ 3、补充说明需要上级解决的问题和挑战。" disabled class="layui-textarea autosize"><%= @sale_report.content %></textarea>
24
24
  </div>
25
25
  </div>
26
- <div class="layui-form-item layui-form-text">
26
+ <div class="layui-form-item layui-form-text" style="margin-bottom: 0px">
27
27
  <label class="layui-form-label">大区意见</label>
28
28
  <div class="layui-input-block">
29
29
  <textarea name="desc" placeholder="给出评价、提醒、建议、办法等。" disabled
30
- class="layui-textarea"><%= @sale_report.level1_opinion %></textarea>
30
+ class="layui-textarea autosize"><%= @sale_report.level1_opinion %></textarea>
31
31
  </div>
32
32
  </div>
33
- <div id="weekStar4"></div>
34
- <div class="layui-form-item layui-form-text">
33
+ <div id="weekStar4" style="margin-bottom: 40px"></div>
34
+ <div class="layui-form-item layui-form-text" style="margin-bottom: 0px">
35
35
  <label class="layui-form-label">总监意见</label>
36
36
  <div class="layui-input-block">
37
37
  <textarea name="desc" placeholder="给出评价、提醒、建议、办法等。" disabled
38
- class="layui-textarea"><%= @sale_report.level2_opinion %></textarea>
38
+ class="layui-textarea autosize"><%= @sale_report.level2_opinion %></textarea>
39
39
  </div>
40
40
  </div>
41
- <div id="weekStar5"></div>
42
- <div class="layui-form-item layui-form-text">
41
+ <div id="weekStar5" style="margin-bottom: 40px"></div>
42
+ <div class="layui-form-item layui-form-text" style="margin-bottom: 0px">
43
43
  <label class="layui-form-label">副总意见</label>
44
44
  <div class="layui-input-block">
45
45
  <textarea name="desc" placeholder="给出评价、提醒、建议、办法等。" disabled
46
- class="layui-textarea"><%= @sale_report.level3_opinion %></textarea>
46
+ class="layui-textarea autosize"><%= @sale_report.level3_opinion %></textarea>
47
47
  </div>
48
48
  </div>
49
- <div id="weekStar6"></div>
49
+ <div id="weekStar6" style="margin-bottom: 40px"></div>
50
50
  <br>
51
51
  </div>
52
52
  </form>
53
53
 
54
54
  <!--表格-->
55
- <table class="layui-hide" id="showWeeklyTable" lay-filter="showWeeklyTable"></table>
55
+ <div style="padding: 20px">
56
+ <table class="layui-hide" id="showWeeklyTable" lay-filter="showWeeklyTable"></table>
57
+ </div>
56
58
  <script type="text/html" id="show_follow">
57
59
  <a href="javascript:void(0);" lay-event="show_follow" class="layui-table-link">{{ d.follow_ups_count }}</a>
58
60
  </script>
@@ -117,43 +119,42 @@
117
119
  },
118
120
  {
119
121
  field: 'staff',
120
- width: 120,
122
+ width: 80,
121
123
  title: '姓名'
122
124
  },
123
125
  {
124
126
  field: 'business_name',
125
- width: 270,
127
+ width: 150,
126
128
  title: '商机名称',
127
129
  },
128
130
  {
129
131
  field: 'school',
130
- width: 200,
132
+ width: 120,
131
133
  title: '单位'
132
134
  },
133
135
  {
134
136
  field: 'department',
135
- width: 190,
137
+ width: 170,
136
138
  title: '部门'
137
139
  },
138
140
  {
139
141
  field: 'weekly',
140
- width: 100,
142
+ width: 80,
141
143
  title: '周次',
142
144
  },
143
145
  {
144
146
  field: 'follow_ups_count',
145
- width: 100,
147
+ width: 80,
146
148
  title: '跟进',
147
149
  templet: '#show_follow'
148
150
  },
149
151
  {
150
152
  field: 'finish_rate',
151
- width: 100,
153
+ width: 80,
152
154
  title: '完成率',
153
155
  },
154
156
  {
155
157
  field: 'content',
156
- width: 300,
157
158
  title: '计划内容',
158
159
  },
159
160
  {
@@ -166,7 +167,31 @@
166
167
  ],
167
168
  page: true
168
169
  });
169
- })
170
170
 
171
171
 
172
+ autosize();
173
+ function autosize(){
174
+ var text = $('.autosize');
175
+
176
+ text.each(function(){
177
+ $(this).attr('rows',1);
178
+ resize($(this));
179
+ });
180
+
181
+ text.on('input', function(){
182
+ resize($(this));
183
+ });
184
+
185
+ function resize ($text) {
186
+ $text.css('height', 'auto');
187
+ $text.css('height', $text[0].scrollHeight+'px');
188
+ }
189
+ }
190
+ })
172
191
  </script>
192
+ <style>
193
+ .autosize {
194
+ resize: none;
195
+ overflow: hidden;
196
+ }
197
+ </style>
@@ -26,10 +26,12 @@
26
26
  elem: '#table',
27
27
  url: '/missions/sales',
28
28
  cellMinWidth: 80,
29
+ totalRow:true,
29
30
  cols: [
30
31
  [{
31
32
  field: 'id',
32
33
  title:'序号',type: 'numbers',
34
+ totalRowText:'合计',
33
35
  width: 80
34
36
  }, {
35
37
  field: 'name',
@@ -42,19 +44,23 @@
42
44
  field: 'business_a',
43
45
  title: 'A类商机',
44
46
  templet: "#business_a",
47
+ totalRow:true,
45
48
  width: 120
46
49
  }, {
47
50
  field: 'business_b',
48
51
  title: 'B类商机',
49
52
  templet: "#business_b",
53
+ totalRow:true,
50
54
  width: 120
51
55
  }, {
52
56
  field: 'goal',
53
57
  title: '中标金额',
58
+ totalRow:true,
54
59
  width: 120
55
60
  }, {
56
61
  field: 'return_money',
57
62
  title: '回款',
63
+ totalRow:true,
58
64
  width: 120
59
65
  }
60
66
  ]
@@ -1,17 +1,33 @@
1
+ businesses_a_count = 0
2
+ businesses_b_count = 0
1
3
  json.data do
2
4
  json.array! @staffs do |d|
5
+ part_a_ids = EducodeSales::Business.where("educode_sales_businesses.last_follow_up_id is null AND staff_id = ?",d.id).ids
6
+ part_b_ids = EducodeSales::Business.where("educode_sales_businesses.last_follow_up_id is not null").joins("
7
+ JOIN educode_sales_follow_ups ON educode_sales_businesses.last_follow_up_id = educode_sales_follow_ups.id
8
+ ").where("educode_sales_follow_ups.staff_id = ?", d.id).pluck(:business_id)
9
+ business_ids = part_a_ids + part_b_ids
10
+ @businesses = EducodeSales::Business.where(id:business_ids)
3
11
  json.id d.id
4
12
  json.name d.user.real_name
5
13
  json.role d.role&.name
6
14
  json.area d.areas.present? ? d.areas.pluck(:name).join("、") : ''
7
- json.business_a d.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).count
8
- json.business_b d.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).count
9
- json.goal d.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)
10
- json.return_money d.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 != ?", @x).sum("educode_sales_businesses.return_money").round(2)
15
+ 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).count
16
+ businesses_a_count += business_a
17
+ json.business_a business_a
18
+ 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).count
19
+ businesses_b_count += business_b
20
+ json.business_b business_b
21
+ 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)
22
+ json.return_money @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 != ?", @x).sum("educode_sales_businesses.return_money").round(2)
11
23
  json.a_clazz_id @a_clazz&.id
12
24
  json.b_clazz_id @b_clazz&.id
13
25
  end
14
26
  end
15
27
 
28
+ json.totalRow do
29
+ json.business_a businesses_a_count.to_s
30
+ json.business_b businesses_b_count.to_s
31
+ end
16
32
  json.code 0
17
33
  json.count @staffs.total_count
@@ -11,14 +11,10 @@
11
11
  <script type="text/html" id="currentTableBar">
12
12
  </script>
13
13
  <script type="text/html" id="school">
14
- <div class="layui-text">
15
14
  <a href="javascript:void(0);" lay-event="school" class="layui-table-link">{{d.schools}}</a>
16
- </div>
17
15
  </script>
18
16
  <script type="text/html" id="xschool">
19
- <div class="layui-text">
20
17
  <a href="javascript:void(0);" lay-event="xschool" class="layui-table-link">{{d.departments}}</a>
21
- </div>
22
18
  </script>
23
19
  <script>
24
20
  layui.use(['form', 'table', 'miniPage', 'element'], function () {
@@ -32,10 +28,12 @@
32
28
  elem: '#oper_table',
33
29
  url: '/missions/sales/operations',
34
30
  defaultToolbar: [],
31
+ totalRow:true,
35
32
  cols: [
36
33
  [{
37
34
  field: 'id',
38
35
  title:'序号',type: 'numbers',
36
+ totalRowText:'合计',
39
37
  width: 80
40
38
  }, {
41
39
  field: 'name',
@@ -52,11 +50,13 @@
52
50
  field: 'schools',
53
51
  title: '跟进学校',
54
52
  templet: "#school",
53
+ totalRow:true,
55
54
  width: 120
56
55
  }, {
57
56
  field: 'departments',
58
57
  title: '跟进二级学院',
59
58
  templet: "#xschool",
59
+ totalRow:true,
60
60
  width: 120
61
61
  },
62
62
  ]