educode_sales 0.2.0 → 0.2.1
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/assets/images/educode_sales/indexlogo.png +0 -0
- data/app/assets/stylesheets/educode_sales/app.css +23 -0
- data/app/assets/stylesheets/educode_sales/public.css +4 -0
- data/app/controllers/educode_sales/businesses_controller.rb +12 -1
- data/app/controllers/educode_sales/follow_ups_controller.rb +13 -0
- data/app/controllers/educode_sales/home_controller.rb +7 -7
- data/app/controllers/educode_sales/operation_reports_controller.rb +3 -3
- data/app/controllers/educode_sales/staffs_controller.rb +3 -2
- data/app/controllers/educode_sales/teacher_follows_controller.rb +1 -0
- data/app/controllers/educode_sales/teachers_controller.rb +1 -0
- data/app/models/educode_sales/activity.rb +1 -1
- data/app/models/educode_sales/staff.rb +3 -3
- data/app/models/educode_sales/teacher.rb +3 -2
- data/app/views/educode_sales/activities/index.html.erb +11 -11
- data/app/views/educode_sales/activities/show_teachers.html.erb +1 -5
- data/app/views/educode_sales/businesses/edit_plan.html.erb +7 -2
- data/app/views/educode_sales/businesses/index.html.erb +18 -10
- data/app/views/educode_sales/businesses/index.json.jbuilder +3 -1
- data/app/views/educode_sales/businesses/new.html.erb +1 -1
- data/app/views/educode_sales/businesses/new_follow_record.html.erb +12 -2
- data/app/views/educode_sales/businesses/show_follow.html.erb +23 -19
- data/app/views/educode_sales/businesses/show_follow.json.jbuilder +1 -0
- data/app/views/educode_sales/businesses/show_keys.html.erb +1 -1
- data/app/views/educode_sales/commons/edit.html.erb +1 -1
- data/app/views/educode_sales/commons/index.html.erb +2 -3
- data/app/views/educode_sales/home/index.html.erb +1 -1
- data/app/views/educode_sales/home/search_teacher.json.jbuilder +2 -2
- data/app/views/educode_sales/home/statistics.html.erb +1 -0
- data/app/views/educode_sales/operation_plans/_monthPlan.html.erb +2 -3
- data/app/views/educode_sales/operation_plans/_monthly.html.erb +2 -2
- data/app/views/educode_sales/operation_plans/_weekPlan.html.erb +2 -3
- data/app/views/educode_sales/operation_plans/_weekly.html.erb +2 -1
- data/app/views/educode_sales/operation_plans/edit_monthly.html.erb +3 -3
- data/app/views/educode_sales/operation_plans/edit_weekly.html.erb +3 -3
- data/app/views/educode_sales/operation_plans/new_month.html.erb +1 -1
- data/app/views/educode_sales/operation_plans/new_monthly.html.erb +3 -3
- data/app/views/educode_sales/operation_plans/new_week.html.erb +1 -1
- data/app/views/educode_sales/operation_plans/new_weekly.html.erb +3 -3
- data/app/views/educode_sales/operation_plans/show_monthly.html.erb +3 -3
- data/app/views/educode_sales/operation_plans/show_weekly.html.erb +3 -3
- data/app/views/educode_sales/operation_reports/audit.html.erb +2 -2
- data/app/views/educode_sales/operation_reports/edit.html.erb +3 -3
- data/app/views/educode_sales/operation_reports/show.html.erb +139 -27
- data/app/views/educode_sales/places/index.html.erb +6 -6
- data/app/views/educode_sales/plans/_monthPlan.html.erb +2 -1
- data/app/views/educode_sales/plans/_monthly.html.erb +2 -1
- data/app/views/educode_sales/plans/_weekPlan.html.erb +2 -1
- data/app/views/educode_sales/plans/_weekly.html.erb +2 -1
- data/app/views/educode_sales/plans/audit_weekly.html.erb +3 -3
- data/app/views/educode_sales/plans/edit_monthly.html.erb +3 -3
- data/app/views/educode_sales/plans/edit_weekly.html.erb +1 -1
- data/app/views/educode_sales/plans/new_monthly.html.erb +1 -1
- data/app/views/educode_sales/plans/new_weekly.html.erb +1 -1
- data/app/views/educode_sales/plans/show_monthly.html.erb +3 -3
- data/app/views/educode_sales/plans/show_weekly.html.erb +1 -1
- data/app/views/educode_sales/roles/index.html.erb +2 -1
- data/app/views/educode_sales/sale_reports/audit.html.erb +1 -1
- data/app/views/educode_sales/sale_reports/edit.html.erb +3 -3
- data/app/views/educode_sales/sale_reports/show.html.erb +1 -1
- data/app/views/educode_sales/sale_trends/operations.html.erb +1 -1
- data/app/views/educode_sales/sales/index.html.erb +12 -7
- data/app/views/educode_sales/sales/index.json.jbuilder +1 -1
- data/app/views/educode_sales/sales/operations.html.erb +7 -5
- data/app/views/educode_sales/sales/operations.json.jbuilder +3 -2
- data/app/views/educode_sales/sales/school.html.erb +1 -2
- data/app/views/educode_sales/sales/xschool.html.erb +1 -2
- data/app/views/educode_sales/staffs/follow_up_departments.json.jbuilder +1 -2
- data/app/views/educode_sales/staffs/follow_up_schools.json.jbuilder +1 -2
- data/app/views/educode_sales/staffs/index.html.erb +6 -8
- data/app/views/educode_sales/staffs/new.html.erb +1 -1
- data/app/views/educode_sales/teachers/add_courses.html.erb +3 -3
- data/app/views/educode_sales/teachers/add_event.html.erb +1 -1
- data/app/views/educode_sales/teachers/add_keys.html.erb +11 -5
- data/app/views/educode_sales/teachers/index.html.erb +8 -6
- data/app/views/educode_sales/teachers/new_follow_record.html.erb +1 -0
- data/app/views/educode_sales/teachers/search_new.html.erb +2 -2
- data/app/views/educode_sales/teachers/show_class.html.erb +1 -1
- data/app/views/educode_sales/teachers/show_follow.html.erb +11 -9
- data/app/views/educode_sales/teachers/show_follow.json.jbuilder +1 -0
- data/app/views/layouts/educode_sales/application.html.erb +6 -9
- data/config/routes.rb +1 -0
- data/lib/educode_sales/version.rb +1 -1
- metadata +3 -2
@@ -47,17 +47,25 @@
|
|
47
47
|
</div>
|
48
48
|
</form>
|
49
49
|
|
50
|
-
|
51
|
-
<
|
52
|
-
<script type="text/html" id="currentShowWeekly">
|
53
|
-
<a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="show">查看</a>
|
54
|
-
<a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>
|
55
|
-
<a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a>
|
50
|
+
<script type="text/html" id="show_follow_show">
|
51
|
+
<a href="javascript:void(0);" lay-event="show_follow_show" class="layui-table-link">{{ d.count }}</a>
|
56
52
|
</script>
|
53
|
+
<!--表格-->
|
54
|
+
<table class="layui-hide" id="showWeeklyTable" lay-filter="showWeeklyTable"></table>
|
55
|
+
<!--<script type="text/html" id="currentShowWeekly">-->
|
56
|
+
<!-- <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="show">查看</a>-->
|
57
|
+
<!-- <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>-->
|
58
|
+
<!-- <a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a>-->
|
59
|
+
<!--</script>-->
|
57
60
|
<script>
|
58
61
|
layui.use(['rate', 'table'], function () {
|
59
|
-
var rate = layui.rate
|
60
|
-
|
62
|
+
var rate = layui.rate,
|
63
|
+
form = layui.form,
|
64
|
+
$ = layui.jquery,
|
65
|
+
miniPage = layui.miniPage,
|
66
|
+
request = layui.request;
|
67
|
+
table = layui.table;
|
68
|
+
|
61
69
|
rate.render({
|
62
70
|
elem: '#weekStar4',
|
63
71
|
half: true,
|
@@ -73,36 +81,36 @@
|
|
73
81
|
half: true,
|
74
82
|
readonly: true
|
75
83
|
})
|
76
|
-
|
84
|
+
|
77
85
|
|
78
86
|
table.render({
|
79
87
|
elem: '#showWeeklyTable',
|
80
|
-
|
88
|
+
url: '/educode_sales/operation_reports/' + "<%= @sale_report.id%>" + '/plans',
|
89
|
+
|
81
90
|
defaultToolbar: [],
|
82
91
|
cols: [
|
83
|
-
[
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
},
|
92
|
+
[{
|
93
|
+
field: 'id',
|
94
|
+
width: 80,
|
95
|
+
title:'序号',type: 'numbers',
|
96
|
+
},
|
89
97
|
{
|
90
|
-
field: '
|
98
|
+
field: 'staff',
|
91
99
|
width: 100,
|
92
100
|
title: '姓名'
|
93
101
|
},
|
94
102
|
{
|
95
|
-
field: '
|
96
|
-
width:
|
97
|
-
title: '
|
103
|
+
field: 'teacher_name',
|
104
|
+
width: 100,
|
105
|
+
title: '教师姓名',
|
98
106
|
},
|
99
107
|
{
|
100
|
-
field: '
|
108
|
+
field: 'school',
|
101
109
|
width: 100,
|
102
110
|
title: '单位'
|
103
111
|
},
|
104
112
|
{
|
105
|
-
field: '
|
113
|
+
field: 'department',
|
106
114
|
width: 100,
|
107
115
|
title: '部门'
|
108
116
|
},
|
@@ -112,14 +120,15 @@
|
|
112
120
|
title: '周次',
|
113
121
|
},
|
114
122
|
{
|
115
|
-
field: '
|
123
|
+
field: 'content',
|
116
124
|
width: 300,
|
117
125
|
title: '计划内容',
|
118
126
|
},
|
119
127
|
{
|
120
|
-
field: '
|
128
|
+
field: 'count',
|
121
129
|
width: 100,
|
122
130
|
title: '跟进',
|
131
|
+
templet: '#show_follow_show'
|
123
132
|
},
|
124
133
|
{
|
125
134
|
field: 'rate',
|
@@ -127,13 +136,116 @@
|
|
127
136
|
title: '完成率',
|
128
137
|
},
|
129
138
|
{
|
130
|
-
field: '
|
131
|
-
width:
|
139
|
+
field: 'updated_at',
|
140
|
+
width: 190,
|
132
141
|
title: '更新时间',
|
133
142
|
sort: true,
|
134
|
-
}
|
143
|
+
},
|
144
|
+
// {
|
145
|
+
// title: '操作',
|
146
|
+
// minWidth: 190,
|
147
|
+
// toolbar: '#currentShowWeekly',
|
148
|
+
// align: "center",
|
149
|
+
// fixed: 'right'
|
150
|
+
// }
|
135
151
|
]
|
136
152
|
],
|
137
153
|
page: true
|
138
154
|
});
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
table.on('toolbar(showWeeklyTable)', function (obj) {
|
159
|
+
if (obj.event === 'add') { // 监听添加操作
|
160
|
+
from_weekly = true;
|
161
|
+
var content = miniPage.getHrefContent('/educode_sales/operation_plans/new_week');
|
162
|
+
var openWH = miniPage.getOpenWidthHeight();
|
163
|
+
sindex = layer.open({
|
164
|
+
title: '添加计划',
|
165
|
+
type: 1,
|
166
|
+
shade: 0.2,
|
167
|
+
maxmin: true,
|
168
|
+
shadeClose: true,
|
169
|
+
area: [openWH[0] + 'px', openWH[1] + 'px'],
|
170
|
+
offset: [openWH[2] + 'px', openWH[3] + 'px'],
|
171
|
+
content: content,
|
172
|
+
success: function (layero, index) {
|
173
|
+
// 重新渲染弹层中的下拉选择框select
|
174
|
+
form.render('select');
|
175
|
+
}
|
176
|
+
});
|
177
|
+
$(window).on("resize", function () {
|
178
|
+
layer.full(sindex);
|
179
|
+
});
|
180
|
+
}
|
181
|
+
});
|
182
|
+
table.on('tool(showWeeklyTable)', function (obj) {
|
183
|
+
var data = obj.data;
|
184
|
+
id = data.id
|
185
|
+
if (obj.event === 'delete') {
|
186
|
+
layer.confirm('确定删除ID为' + id + " 的周计划", function (index) {
|
187
|
+
request.delete('educode_sales/operation_plans/' + id, {}, function (res) {
|
188
|
+
layer.close(index);
|
189
|
+
table.reload("showWeeklyTable")
|
190
|
+
})
|
191
|
+
});
|
192
|
+
} else if (obj.event === 'show') {
|
193
|
+
content = miniPage.getHrefContent('/educode_sales/operation_plans/show_week?id=' + id);
|
194
|
+
openWH = miniPage.getOpenWidthHeight();
|
195
|
+
index = layer.open({
|
196
|
+
title: '查看',
|
197
|
+
type: 1,
|
198
|
+
shade: 0.2,
|
199
|
+
maxmin: true,
|
200
|
+
shadeClose: true,
|
201
|
+
area: [openWH[0] + 'px', openWH[1] + 'px'],
|
202
|
+
offset: [openWH[2] + 'px', openWH[3] + 'px'],
|
203
|
+
content: content
|
204
|
+
});
|
205
|
+
$(window).on("resize", function () {
|
206
|
+
layer.full(index);
|
207
|
+
});
|
208
|
+
return false;
|
209
|
+
} else if (obj.event === 'edit') {
|
210
|
+
plan_id = id;
|
211
|
+
from_sales = true;
|
212
|
+
content = miniPage.getHrefContent('/educode_sales/operation_plans/edit_week?id=' + id);
|
213
|
+
openWH = miniPage.getOpenWidthHeight();
|
214
|
+
sindex = layer.open({
|
215
|
+
title: '编辑',
|
216
|
+
type: 1,
|
217
|
+
shade: 0.2,
|
218
|
+
maxmin: true,
|
219
|
+
shadeClose: true,
|
220
|
+
area: [openWH[0] + 'px', openWH[1] + 'px'],
|
221
|
+
offset: [openWH[2] + 'px', openWH[3] + 'px'],
|
222
|
+
content: content
|
223
|
+
});
|
224
|
+
$(window).on("resize", function () {
|
225
|
+
layer.full(sindex);
|
226
|
+
});
|
227
|
+
return false;
|
228
|
+
} else if (obj.event === 'show_follow_show') {
|
229
|
+
id = data.teacher_id
|
230
|
+
content = miniPage.getHrefContent('/educode_sales/teachers/show_follow?id=' + data.teacher_id);
|
231
|
+
openWH = miniPage.getOpenWidthHeight();
|
232
|
+
index = layer.open({
|
233
|
+
title: '教师列表/' + data.teacher_name + '的跟进记录',
|
234
|
+
type: 1,
|
235
|
+
shade: 0.2,
|
236
|
+
maxmin: true,
|
237
|
+
shadeClose: true,
|
238
|
+
area: [openWH[0] + 'px', openWH[1] + 'px'],
|
239
|
+
offset: [openWH[2] + 'px', openWH[3] + 'px'],
|
240
|
+
content: content
|
241
|
+
});
|
242
|
+
$(window).on("resize", function () {
|
243
|
+
layer.full(index);
|
244
|
+
});
|
245
|
+
}
|
246
|
+
});
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
})
|
139
251
|
</script>
|
@@ -40,7 +40,7 @@
|
|
40
40
|
{
|
41
41
|
field: 'id',
|
42
42
|
width: 80,
|
43
|
-
title:
|
43
|
+
title:'序号',type: 'numbers',
|
44
44
|
},
|
45
45
|
{
|
46
46
|
field: 'name',
|
@@ -49,32 +49,32 @@
|
|
49
49
|
},
|
50
50
|
{
|
51
51
|
field: 'area_id',
|
52
|
-
width: 300,
|
53
52
|
title: '负责区域',
|
54
53
|
},
|
55
54
|
{
|
56
55
|
field: 'businesses_count',
|
57
|
-
width:
|
56
|
+
width: 120,
|
58
57
|
title: '商机'
|
59
58
|
},
|
60
59
|
{
|
61
60
|
field: 'amount',
|
62
|
-
width:
|
61
|
+
width: 120,
|
63
62
|
title: '中标(万)'
|
64
63
|
},
|
65
64
|
{
|
66
65
|
field: 'return_mount',
|
67
|
-
width:
|
66
|
+
width: 120,
|
68
67
|
title: '回款(万)',
|
69
68
|
},
|
70
69
|
{
|
71
70
|
title: '操作',
|
72
|
-
|
71
|
+
width: 120,
|
73
72
|
toolbar: '#currentTableBar',
|
74
73
|
align: "center"
|
75
74
|
}
|
76
75
|
]
|
77
76
|
],
|
77
|
+
limit: 20,
|
78
78
|
page: true
|
79
79
|
});
|
80
80
|
|
@@ -101,7 +101,7 @@
|
|
101
101
|
{
|
102
102
|
field: 'id',
|
103
103
|
width: 80,
|
104
|
-
title:
|
104
|
+
title:'序号',type: 'numbers',
|
105
105
|
},
|
106
106
|
{
|
107
107
|
field: 'username',
|
@@ -169,8 +169,8 @@
|
|
169
169
|
"rate": "100%",
|
170
170
|
"updateTime": "2021-07-27",
|
171
171
|
}],
|
172
|
-
|
173
|
-
|
172
|
+
|
173
|
+
|
174
174
|
page: true,
|
175
175
|
skin: 'line'
|
176
176
|
});
|
@@ -105,7 +105,7 @@
|
|
105
105
|
{
|
106
106
|
field: 'id',
|
107
107
|
width: 80,
|
108
|
-
title:
|
108
|
+
title:'序号',type: 'numbers',
|
109
109
|
},
|
110
110
|
{
|
111
111
|
field: 'username',
|
@@ -173,8 +173,8 @@
|
|
173
173
|
"rate": "100%",
|
174
174
|
"updateTime": "2021-07-27",
|
175
175
|
}],
|
176
|
-
|
177
|
-
|
176
|
+
|
177
|
+
|
178
178
|
page: true,
|
179
179
|
skin: 'line'
|
180
180
|
});
|
@@ -93,7 +93,7 @@
|
|
93
93
|
{
|
94
94
|
field: 'id',
|
95
95
|
width: 80,
|
96
|
-
title:
|
96
|
+
title:'序号',type: 'numbers',
|
97
97
|
},
|
98
98
|
{
|
99
99
|
field: 'username',
|
@@ -161,8 +161,8 @@
|
|
161
161
|
"rate": "100%",
|
162
162
|
"updateTime": "2021-07-27",
|
163
163
|
}],
|
164
|
-
|
165
|
-
|
164
|
+
|
165
|
+
|
166
166
|
page: true,
|
167
167
|
skin: 'line'
|
168
168
|
});
|
@@ -78,14 +78,14 @@
|
|
78
78
|
|
79
79
|
table.render({
|
80
80
|
elem: '#newWeeklyTable',
|
81
|
-
|
82
|
-
|
81
|
+
url: '/educode_sales/sale_reports/' + "<%= @sale_report.id%>" + '/plans',
|
82
|
+
toolbar: '#newWeeklyToolbar',
|
83
83
|
defaultToolbar: [],
|
84
84
|
cols: [
|
85
85
|
[{
|
86
86
|
field: 'id',
|
87
87
|
width: 60,
|
88
|
-
title:
|
88
|
+
title:'序号',type: 'numbers',
|
89
89
|
},
|
90
90
|
{
|
91
91
|
field: 'staff',
|
@@ -29,32 +29,37 @@
|
|
29
29
|
cols: [
|
30
30
|
[{
|
31
31
|
field: 'id',
|
32
|
-
title: '
|
32
|
+
title:'序号',type: 'numbers',
|
33
33
|
width: 80
|
34
34
|
}, {
|
35
35
|
field: 'name',
|
36
|
-
title: '姓名'
|
36
|
+
title: '姓名',
|
37
|
+
width: 100
|
37
38
|
}, {
|
38
39
|
field: 'area',
|
39
40
|
title: '负责区域',
|
40
|
-
width: 400,
|
41
41
|
}, {
|
42
42
|
field: 'business_a',
|
43
43
|
title: 'A类商机',
|
44
|
-
templet: "#business_a"
|
44
|
+
templet: "#business_a",
|
45
|
+
width: 120
|
45
46
|
}, {
|
46
47
|
field: 'business_b',
|
47
48
|
title: 'B类商机',
|
48
|
-
templet: "#business_b"
|
49
|
+
templet: "#business_b",
|
50
|
+
width: 120
|
49
51
|
}, {
|
50
52
|
field: 'goal',
|
51
|
-
title: '中标金额(万)'
|
53
|
+
title: '中标金额(万)',
|
54
|
+
width: 120
|
52
55
|
}, {
|
53
56
|
field: 'return_money',
|
54
|
-
title: '回款'
|
57
|
+
title: '回款(万)',
|
58
|
+
width: 120
|
55
59
|
}
|
56
60
|
]
|
57
61
|
],
|
62
|
+
limit: 20,
|
58
63
|
page: true
|
59
64
|
});
|
60
65
|
});
|
@@ -7,7 +7,7 @@ json.data do
|
|
7
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
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
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.stage_id in (?)", @step_ids).sum(:total_amount)
|
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").sum("
|
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").sum("educode_sales_businesses.return_money")
|
11
11
|
json.a_clazz_id @a_clazz&.id
|
12
12
|
json.b_clazz_id @b_clazz&.id
|
13
13
|
end
|
@@ -35,12 +35,12 @@
|
|
35
35
|
cols: [
|
36
36
|
[{
|
37
37
|
field: 'id',
|
38
|
-
title: '
|
38
|
+
title:'序号',type: 'numbers',
|
39
39
|
width: 80
|
40
40
|
}, {
|
41
41
|
field: 'name',
|
42
42
|
title: '姓名',
|
43
|
-
width:
|
43
|
+
width: 120
|
44
44
|
}, {
|
45
45
|
field: 'job_type',
|
46
46
|
title: '岗位类型',
|
@@ -48,18 +48,20 @@
|
|
48
48
|
}, {
|
49
49
|
field: 'area',
|
50
50
|
title: '负责区域',
|
51
|
-
width: 400,
|
52
51
|
}, {
|
53
52
|
field: 'schools',
|
54
53
|
title: '跟进学校',
|
55
|
-
templet: "#school"
|
54
|
+
templet: "#school",
|
55
|
+
width: 120
|
56
56
|
}, {
|
57
57
|
field: 'departments',
|
58
58
|
title: '跟进二级学院',
|
59
|
-
templet: "#xschool"
|
59
|
+
templet: "#xschool",
|
60
|
+
width: 120
|
60
61
|
},
|
61
62
|
]
|
62
63
|
],
|
64
|
+
limit: 20,
|
63
65
|
page: true
|
64
66
|
});
|
65
67
|
|
@@ -5,8 +5,9 @@ json.data do
|
|
5
5
|
json.role d.role&.name
|
6
6
|
json.job_type EducodeSales::Common.job_type_name[d.job_type]
|
7
7
|
json.area d.areas.present? ? d.areas.pluck(:name).join("、") : ''
|
8
|
-
json.departments EducodeSales::Business.joins(:last_follow_up).where("educode_sales_follow_ups.staff_id = #{d.id}").select("COUNT(educode_sales_follow_ups.staff_id) AS count")[0]&.send('count') || 0
|
9
|
-
json.schools EducodeSales::Business.joins(:last_follow_up, :department).where("educode_sales_follow_ups.staff_id = #{d.id}").select("COUNT(distinct(departments.school_id)) AS count")[0]['count']
|
8
|
+
json.departments EducodeSales::Business.joins(:last_follow_up).where("educode_sales_follow_ups.staff_id = #{d.id}").select("COUNT(educode_sales_follow_ups.staff_id) AS count")[0]&.send('count') + EducodeSales::Teacher.joins(:follow_up).where("educode_sales_teacher_follows.staff_id = #{d.id}").select("COUNT(educode_sales_teacher_follows.staff_id) AS count")[0]&.send('count') || 0
|
9
|
+
json.schools EducodeSales::Business.joins(:last_follow_up, :department).where("educode_sales_follow_ups.staff_id = #{d.id}").select("COUNT(distinct(departments.school_id)) AS count")[0]['count'] + EducodeSales::Teacher.joins(:follow_up, :department).where("educode_sales_teacher_follows.staff_id = #{d.id}").select("COUNT(distinct(departments.school_id)) AS count")[0]['count']
|
10
|
+
|
10
11
|
end
|
11
12
|
end
|
12
13
|
|