educode_sales 0.9.68 → 0.9.69

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 (38) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/educode_sales/indexlogo.png +0 -0
  3. data/app/assets/javascripts/educode_sales/extent/treeTable.js +235 -0
  4. data/app/controllers/educode_sales/customers_controller.rb +107 -0
  5. data/app/controllers/educode_sales/follow_ups_controller.rb +6 -0
  6. data/app/controllers/educode_sales/projects_controller.rb +420 -0
  7. data/app/controllers/educode_sales/roles_controller.rb +4 -1
  8. data/app/controllers/educode_sales/teachers_controller.rb +38 -13
  9. data/app/helpers/educode_sales/application_helper.rb +1 -0
  10. data/app/models/educode_sales/business.rb +21 -5
  11. data/app/models/educode_sales/business_history.rb +8 -0
  12. data/app/models/educode_sales/permission.rb +2 -1
  13. data/app/models/educode_sales/project.rb +53 -0
  14. data/app/models/educode_sales/role_area.rb +2 -1
  15. data/app/views/educode_sales/activities/show_teachers.html.erb +1 -1
  16. data/app/views/educode_sales/businesses/index.html.erb +5 -0
  17. data/app/views/educode_sales/businesses/index.json.jbuilder +3 -0
  18. data/app/views/educode_sales/businesses/time_line.html.erb +9 -5
  19. data/app/views/educode_sales/customers/edit_major.html.erb +872 -0
  20. data/app/views/educode_sales/customers/list.html.erb +602 -0
  21. data/app/views/educode_sales/customers/list.json.jbuilder +33 -0
  22. data/app/views/educode_sales/follow_ups/index.json.jbuilder +2 -2
  23. data/app/views/educode_sales/projects/detail.html.erb +269 -0
  24. data/app/views/educode_sales/projects/edit.html.erb +246 -0
  25. data/app/views/educode_sales/projects/history.html.erb +41 -0
  26. data/app/views/educode_sales/projects/index.html.erb +688 -0
  27. data/app/views/educode_sales/projects/index.json.jbuilder +69 -0
  28. data/app/views/educode_sales/teachers/_index.html.erb +17 -1
  29. data/app/views/educode_sales/teachers/index.json.jbuilder +2 -0
  30. data/app/views/layouts/educode_sales/application.html.erb +25 -0
  31. data/config/routes.rb +12 -0
  32. data/db/migrate/20230411134203_add_realname_to_teacher.rb +5 -0
  33. data/db/migrate/20230412083510_add_p_staff_id_to_businesses.rb +20 -0
  34. data/db/migrate/20230412092000_create_business_histories.rb +10 -0
  35. data/db/migrate/20230413015619_add_permissions_to_projects.rb +11 -0
  36. data/db/migrate/20230413031029_add_pre_time_to_businesses.rb +5 -0
  37. data/lib/educode_sales/version.rb +1 -1
  38. metadata +24 -6
@@ -0,0 +1,602 @@
1
+ <div style="margin: 10px 10px 10px 10px">
2
+ <form class="layui-form layui-form-pane" lay-filter="search_teachers">
3
+ <div class="layui-form-item">
4
+ <div class="layui-inline">
5
+ <label class="layui-form-label">客户名称</label>
6
+ <div class="layui-input-inline">
7
+ <input type="text" name="name" class="layui-input">
8
+ </div>
9
+ </div>
10
+ <div class="layui-inline">
11
+ <label class="layui-form-label">区域</label>
12
+ <div class="layui-input-inline">
13
+ <%= select_tag "area", options_for_select(EducodeSales::Common.where(clazz: 'area').pluck(:name)), { include_blank: true } %>
14
+ </div>
15
+ </div>
16
+ <div class="layui-inline">
17
+ <label class="layui-form-label">负责人</label>
18
+ <div class="layui-input-inline">
19
+ <%= select_tag "staff_id", options_for_select(@staffs, params[:staff_id]), { include_blank: true } %>
20
+ </div>
21
+ </div>
22
+ <!-- <div class="layui-inline">-->
23
+ <!-- <label class="layui-form-label">最后跟进</label>-->
24
+ <!-- <div class="layui-input-inline">-->
25
+ <!-- <input type="text" class="layui-input" id="date" name="date" placeholder=" - ">-->
26
+ <!-- </div>-->
27
+ <!-- </div>-->
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>
34
+ <div class="layui-inline">
35
+ <button type="reset" class="layui-btn layui-btn-primary" lay-submit lay-filter="reset_business_search">重置
36
+ </button>
37
+ <button type="submit" class="layui-btn layui-btn-primary" id="search_bt" lay-submit lay-filter="search_teachers">搜
38
+
39
+ </button>
40
+ </div>
41
+ </div>
42
+ </form>
43
+ </div>
44
+
45
+ <script type="text/html" id="toolbarDemo">
46
+ <div class="layui-btn-container">
47
+ <span class="table-label">客户列表</span>
48
+ <% if can? :export, EducodeSales::Customer %>
49
+ <button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="export">导出</button>
50
+ <% end %>
51
+ <% if can? :modify_school_tag, EducodeSales::Customer %>
52
+ <button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" id="modify_customer">批量修改客户类型</button>
53
+ <% end %>
54
+ <% if can? :create, EducodeSales::Customer %>
55
+ <button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="add">添加客户</button>
56
+ <% end %>
57
+ <% if can? :give, EducodeSales::Customer %>
58
+ <button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="give">分配/移交</button>
59
+ <% end %>
60
+ </button>
61
+ </div>
62
+ </script>
63
+ <div class="">
64
+ <table class="layui-hide" id="customers_table" style="min-height: 300px;" lay-filter="customers_table"></table>
65
+ </div>
66
+ <script type="text/html" id="currentTableBar">
67
+ <% if can? :create_follow, EducodeSales::Customer %>
68
+ <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="add_follow">添加跟进记录</a>
69
+ <% end %>
70
+ <% if can? :update, EducodeSales::Customer %>
71
+ <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>
72
+ <% end %>
73
+ </script>
74
+ <script type="text/html" id="business">
75
+ <a href="/missions/businesses?school={{d.name}}" class="layui-table-link">{{ d.business }}</a>
76
+ </script>
77
+ <script type="text/html" id="name">
78
+ <a href="<%= base_url %>/colleges/{{d.id}}/statistics" class="layui-table-link" target="_blank">{{ d.name }}</a>
79
+ </script>
80
+ <script type="text/html" id="department">
81
+ <a href="javascript:void(0);" lay-event="department" class="layui-table-link">{{ d.department }}</a>
82
+ </script>
83
+ <script type="text/html" id="follow">
84
+ <a href="javascript:void(0);" lay-event="follow" class="layui-table-link">{{ d.follow }}</a>
85
+ </script>
86
+
87
+
88
+ <script>
89
+ layui.use(['form', 'table', 'miniPage', 'element', 'request', 'laydate', 'upload'], function () {
90
+ var $ = layui.jquery,
91
+ form = layui.form,
92
+ request = layui.request,
93
+ upload = layui.upload,
94
+ dropdown = layui.dropdown,
95
+ miniPage = layui.miniPage,
96
+ laydate = layui.laydate;
97
+
98
+ var laydate = layui.laydate;
99
+
100
+ // function hn(){
101
+ // $("#search_bt").trigger("click");
102
+ // }
103
+ // $(document).ready(function(){
104
+ // window.onload=hn;
105
+ // });
106
+
107
+ var property_list = xmSelect.render({
108
+ el: '#property',
109
+ data: gon.school_tags
110
+ })
111
+
112
+ laydate.render({
113
+ elem: '#date',
114
+ range: true
115
+ });
116
+ laydate.render({
117
+ elem: '#time',
118
+ });
119
+
120
+ table = layui.table;
121
+ var customer_table = table.render({
122
+ elem: '#customers_table',
123
+ url: '/missions/customers/list',
124
+ where: {q: form.val('search_teachers')},
125
+ toolbar: '#toolbarDemo',
126
+ // totalRow:true,
127
+ title: '客户列表',
128
+ defaultToolbar: ['filter'],
129
+ cols: [
130
+ [
131
+ {type: 'checkbox'},
132
+ {
133
+ field: 'id',
134
+ width: 60,
135
+ title: '序号', type: 'numbers',
136
+
137
+ },
138
+ {
139
+ field: 'name',
140
+ title: '客户名称',
141
+ width: 150,
142
+ templet: "#name"
143
+ },
144
+ {
145
+ field: 'department',
146
+ width: 160,
147
+ title: '部门',
148
+ templet: "#department"
149
+ },
150
+ {
151
+ field: 'major',
152
+ width: 160,
153
+ title: '专业',
154
+ },
155
+ // {
156
+ // field: 'teacher_counts',
157
+ // width: 100,
158
+ // title: '教师数',
159
+ // },
160
+ // {
161
+ // field: 'student_counts',
162
+ // width: 100,
163
+ // title: '学生数',
164
+ // },
165
+
166
+ {
167
+ field: 'area',
168
+ width: 100,
169
+ title: '区域',
170
+ },
171
+ {
172
+ field: 'property',
173
+ width: 160,
174
+ title: '性质',
175
+ },
176
+
177
+ {
178
+ field: 'business',
179
+ width: 60,
180
+ title: '商机',
181
+ templet: "#business"
182
+ },
183
+ {
184
+ field: 'follow',
185
+ width: 100,
186
+ title: '跟进次数',
187
+ templet: "#follow"
188
+ },
189
+ {
190
+ field: 'last_follow_time',
191
+ width: 170,
192
+ title: '最后跟进时间',
193
+ },
194
+ {
195
+ field: 'staff',
196
+ width: 100,
197
+ title: '负责人',
198
+ },
199
+ {
200
+ title: '操作',
201
+ width: 300,
202
+ toolbar: '#currentTableBar',
203
+ align: "center",
204
+ fixed: 'right'
205
+ }
206
+ ]
207
+ ],
208
+
209
+ limit: 20,
210
+ limits: [10, 15, 20, 30, 40, 50, 60, 70, 80, 90],
211
+ page: true,
212
+ done: function() {
213
+ if ($('#modify_customer').length > 0) {
214
+ uploadCustomer();
215
+ }
216
+ }
217
+ });
218
+
219
+ //监听表格复选框选择
220
+ table.on('checkbox(customers_table)', function (obj) {
221
+ });
222
+
223
+
224
+ function edit(id) {
225
+ var content = miniPage.getHrefContent('/missions/teachers/' + id + '/edit');
226
+ var openWH = miniPage.getOpenWidthHeight();
227
+ sindex = layer.open({
228
+ title: '编辑',
229
+ type: 1,
230
+ shade: 0.2,
231
+ maxmin: true,
232
+ shadeClose: true,
233
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
234
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
235
+ content: content
236
+ });
237
+ $(window).on("resize", function () {
238
+ layer.full(sindex);
239
+ });
240
+ }
241
+
242
+ function month(id) {
243
+ var content = miniPage.getHrefContent('/missions/operation_plans/new_month?teacher_id=' + id);
244
+ var openWH = miniPage.getOpenWidthHeight();
245
+ teacherindex2 = layer.open({
246
+ title: '添加月计划',
247
+ type: 1,
248
+ shade: 0.2,
249
+ maxmin: true,
250
+ shadeClose: true,
251
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
252
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
253
+ content: content
254
+ });
255
+ $(window).on("resize", function () {
256
+ layer.full(sindex);
257
+ });
258
+ }
259
+
260
+ function deleteBusiness(id, name) {
261
+ layer.confirm('确定删除' + name, function (index) {
262
+ request.delete('missions/teachers/' + id, {}, function (res) {
263
+ layer.close(index);
264
+ table.reload("customers_table")
265
+ })
266
+ });
267
+ }
268
+
269
+ var sort = {}, search = {};
270
+ table.on('sort(customers_table)', function (obj) {
271
+ sort.field = obj.field;
272
+ sort.order = obj.type;
273
+ table.reload('customers_table', {
274
+ initSort: obj,
275
+ where: {
276
+ sort: sort,
277
+ q: search
278
+ }
279
+ });
280
+ })
281
+
282
+ // 监听搜索操作
283
+ form.on('submit(search_teachers)', function (data) {
284
+ var property = [];
285
+ property_list.getValue().forEach(function (d) {
286
+ property.push(d.value);
287
+ })
288
+ data.field.property = property.toString();
289
+ search = data.field
290
+ table.reload('customers_table', {
291
+ page: {
292
+ curr: 1
293
+ },
294
+ where: {q: search, sort: sort}
295
+ }, 'data');
296
+ return false;
297
+ });
298
+
299
+ form.on('submit(reset_business_search)', function (data) {
300
+ var field = data.field;
301
+ form.val('search_teachers', {
302
+ area: "",
303
+ date: "",
304
+ attitude: "",
305
+ name: "",
306
+ professional_title: "",
307
+ regist_at: "",
308
+ staff_id: "",
309
+ status: "",
310
+ school: "",
311
+ assist: "",
312
+ teacher_source: ""
313
+ });
314
+ property_list.setValue([])
315
+ return false;
316
+ });
317
+ /**
318
+ * toolbar事件监听
319
+ */
320
+ table.on('toolbar(customers_table)', function (obj) {
321
+ if (obj.event === 'add') { // 手动添加
322
+ var content = miniPage.getHrefContent('/missions/customers/new');
323
+ var openWH = miniPage.getOpenWidthHeight();
324
+ index = layer.open({
325
+ title: '添加客户',
326
+ type: 1,
327
+ shade: 0.2,
328
+ maxmin: true,
329
+ shadeClose: true,
330
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
331
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
332
+ content: content,
333
+ });
334
+ $(window).on("resize", function () {
335
+ layer.full(index);
336
+ });
337
+ } else if (obj.event === 'give') { //
338
+ var school_ids = []
339
+ var checkStatus = table.checkStatus('customers_table')
340
+ , data = checkStatus.data;
341
+ for (var i = 0, len = data.length; i < len; i++) {
342
+ school_ids.push(data[i].id)
343
+ }
344
+ ids = school_ids
345
+ if (ids.length == 0) {
346
+ layer.msg('请选择客户')
347
+ return
348
+ }
349
+ content = miniPage.getHrefContent('/missions/customers/give');
350
+ openWH = miniPage.getOpenWidthHeight();
351
+ index = layer.open({
352
+ title: '分配/移交',
353
+ type: 1,
354
+ shade: 0.2,
355
+ maxmin: true,
356
+ shadeClose: true,
357
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
358
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
359
+ content: content,
360
+ });
361
+ $(window).on("resize", function () {
362
+ layer.full(index);
363
+ });
364
+ } else if (obj.event === 'search_new') { // 搜索添加
365
+ content = miniPage.getHrefContent('/missions/teachers/search_new');
366
+ openWH = miniPage.getOpenWidthHeight();
367
+ index = layer.open({
368
+ title: '搜索添加',
369
+ type: 1,
370
+ shade: 0.2,
371
+ maxmin: true,
372
+ shadeClose: true,
373
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
374
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
375
+ content: content,
376
+ });
377
+ $(window).on("resize", function () {
378
+ layer.full(index);
379
+ });
380
+ } else if (obj.event == 'export') {
381
+ layer.load(0, {});
382
+ var data = form.val("search_teachers");
383
+ var property = [];
384
+ property_list.getValue().forEach(function (d) {
385
+ property.push(d.value);
386
+ })
387
+ data.property = property.toString();
388
+ request.authGet("/missions/customers?=" + $.param({q:data}), {
389
+ }, function (res) {
390
+ data = res.data
391
+ table.exportFile(customer_table.config.id, data, 'xls');
392
+ layer.closeAll('loading');
393
+ })
394
+ } else if (obj.event == 'modify_customer') {
395
+
396
+ }
397
+ });
398
+
399
+
400
+ table.on('tool(customers_table)', function (obj) {
401
+ var data = obj.data;
402
+ id = data.id;
403
+ console.log(data)
404
+ department_id = data.department_id;
405
+ major_id = data.major_id;
406
+ if (obj.event === 'edit') { // 监听添加操作
407
+ var content = miniPage.getHrefContent('/missions/customers/' + data.id + '/edit_major?major=' + major_id + "&department_id=" + department_id);
408
+ var openWH = miniPage.getOpenWidthHeight();
409
+ sale_plan_index = layer.open({
410
+ title: '编辑客户',
411
+ type: 1,
412
+ shade: 0.2,
413
+ maxmin: true,
414
+ shadeClose: true,
415
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
416
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
417
+ content: content,
418
+ success: function (layero, index) {
419
+ form.render('select');
420
+ }
421
+ });
422
+ $(window).on("resize", function () {
423
+ layer.full(sale_plan_index);
424
+ });
425
+ } else if (obj.event === 'delete') {
426
+ layer.confirm('确定删除' + data.name, function (index) {
427
+ request.delete('missions/teachers/' + data.id, {}, function (res) {
428
+ layer.close(index);
429
+ table.reload("customers_table")
430
+ })
431
+ });
432
+ } else if (obj.event === 'addWeek') {
433
+ var content = miniPage.getHrefContent('/missions/operation_plans/new_week?teacher_id=' + obj.data.id);
434
+ var openWH = miniPage.getOpenWidthHeight();
435
+
436
+ teacherindex1 = layer.open({
437
+ title: '添加周计划',
438
+ type: 1,
439
+ shade: 0.2,
440
+ maxmin: true,
441
+ shadeClose: true,
442
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
443
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
444
+ content: content
445
+ });
446
+ $(window).on("resize", function () {
447
+ layer.full(sindex);
448
+ });
449
+ } else if (obj.event === 'addMonth') {
450
+ var content = miniPage.getHrefContent('/missions/operation_plans/new_month?teacher_id=' + obj.data.id);
451
+ var openWH = miniPage.getOpenWidthHeight();
452
+ teacherindex2 = layer.open({
453
+ title: '添加月计划',
454
+ type: 1,
455
+ shade: 0.2,
456
+ maxmin: true,
457
+ shadeClose: true,
458
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
459
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
460
+ content: content
461
+ });
462
+ $(window).on("resize", function () {
463
+ layer.full(sindex);
464
+ });
465
+
466
+ } else if (obj.event === 'courses') {
467
+ teacher_id = data.id
468
+ content = miniPage.getHrefContent('/missions/teachers/add_courses?id=' + data.id);
469
+ openWH = miniPage.getOpenWidthHeight();
470
+ index = layer.open({
471
+ title: '课程方向',
472
+ type: 1,
473
+ shade: 0.2,
474
+ maxmin: true,
475
+ shadeClose: true,
476
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
477
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
478
+ content: content,
479
+ success: function (layero, index) {
480
+ // 重新渲染弹层中的下拉选择框select
481
+ // form.render('select');
482
+ }
483
+ });
484
+ $(window).on("resize", function () {
485
+ layer.full(index);
486
+ });
487
+ } else if (obj.event === 'add_department') {
488
+ school_id = data.id
489
+ var content = miniPage.getHrefContent('/missions/customers/new_department?id=' + data.id);
490
+ var openWH = miniPage.getOpenWidthHeight();
491
+ new_department_index = layer.open({
492
+ title: '添加部门',
493
+ type: 1,
494
+ shade: 0.2,
495
+ maxmin: true,
496
+ shadeClose: true,
497
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
498
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
499
+ content: content,
500
+ success: function (layero, index) {
501
+ // 重新渲染弹层中的下拉选择框select
502
+ form.render('select');
503
+ }
504
+ });
505
+ $(window).on("resize", function () {
506
+ layer.full(index);
507
+ });
508
+ } else if (obj.event === 'add_follow') { // 监听添加操作
509
+ var content = miniPage.getHrefContent('/missions/customers/new_follow_record?id=' + data.id)
510
+ var openWH = miniPage.getOpenWidthHeight();
511
+ addFollowIndex = layer.open({
512
+ title: '添加跟进记录',
513
+ type: 1,
514
+ shade: 0.2,
515
+ maxmin: true,
516
+ shadeClose: true,
517
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
518
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
519
+ content: content,
520
+ success: function (layero, index) {
521
+ // 重新渲染弹层中的下拉选择框select
522
+ form.render('select');
523
+ }
524
+ });
525
+ $(window).on("resize", function () {
526
+ layer.full(index);
527
+ });
528
+ } else if (obj.event === 'follow' || obj.event === 'name' || obj.event === 'department') {
529
+ id = data.id
530
+ time = data.last_follow_time || ''
531
+ content = miniPage.getHrefContent('/missions/customers/show_follow?id=' + data.id);
532
+ openWH = miniPage.getOpenWidthHeight();
533
+ index = layer.open({
534
+ title: '客户列表/' + data.name,
535
+ type: 1,
536
+ shade: 0.2,
537
+ maxmin: true,
538
+ shadeClose: true,
539
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
540
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
541
+ content: content,
542
+ success: function (layero, index) {
543
+ // 重新渲染弹层中的下拉选择框select
544
+ // form.render('select');
545
+ }
546
+ });
547
+ $(window).on("resize", function () {
548
+ layer.full(index);
549
+ });
550
+ }
551
+ });
552
+
553
+ function uploadCustomer() {
554
+ upload.render({
555
+ elem: '#modify_customer'
556
+ ,url: '/missions/customers/batch_update_school_tags'
557
+ ,accept: 'file' //普通文件
558
+ ,acceptMime: 'application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,application/vnd.ms-excel'
559
+ ,headers: {
560
+ 'X-CSRF-Token': $('meta[name=csrf-token]').attr('content')
561
+ }
562
+ ,before: function(obj){
563
+ layer.load();
564
+ }
565
+ ,done: function(res){
566
+ layer.msg('导入成功');
567
+ table.reload('customers_table');
568
+ layer.closeAll('loading'); //关闭loading
569
+ }
570
+ ,error: function(index, upload){
571
+ table.reload('file');
572
+ layer.closeAll('loading'); //关闭loading
573
+ layer.alert('导入失败,请检查文件格式')
574
+ layer.close(parent.import_index)
575
+ }
576
+ });
577
+ }
578
+ if ($('#modify_customer').length > 0) {
579
+ var uploadTip;
580
+ $(document).on('mouseenter', '#modify_customer', function() {
581
+ uploadTip = layer.tips("<p style='color:#000;'>" + "导入Excel文件可批量修改客户性质。表格格式:客户名称 区域 性质。格式按导出的客户列表格式导入" + "</p>",
582
+ this,
583
+ {
584
+ tips:[1,'#f2f2f2'],
585
+ time:0,
586
+ area: 'auto',
587
+ maxWidth:500
588
+ });
589
+ })
590
+
591
+ $(document).on('mouseleave', '#modify_customer', function() {
592
+ layer.close(uploadTip);
593
+ })
594
+ }
595
+
596
+ });
597
+ </script>
598
+ <style>
599
+ .layui-table-tool-temp {
600
+ padding-right: 30px; !important;
601
+ }
602
+ </style>
@@ -0,0 +1,33 @@
1
+ x = EducodeSales::Common.find_by(extras: EducodeSales::Common::XTYPE)&.id
2
+ json.data do
3
+ json.array! @customers do |d|
4
+ business_ids = EducodeSales::Business.where(school_id: d.id).ids
5
+ follow_ups = EducodeSales::FollowUp.where(business_id: business_ids)
6
+ customer_follows = EducodeSales::CustomerFollow.where(school_id: d.id)
7
+ a_last_follow_time = follow_ups.last&.created_at&.to_s
8
+ b_last_follow_time = customer_follows.last&.created_at&.to_s
9
+ if a_last_follow_time.present? && b_last_follow_time.present?
10
+ json.last_follow_time a_last_follow_time < b_last_follow_time ? b_last_follow_time : a_last_follow_time
11
+ else
12
+ json.last_follow_time a_last_follow_time || b_last_follow_time
13
+ end
14
+ json.id d.id
15
+ json.name d.name
16
+ json.area d.province
17
+ json.property d.school_tags.where(for_missions: true).pluck(:name).join("、")
18
+ 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
+ json.follow follow_ups.size + customer_follows.size
20
+ json.staff EducodeSales::CustomerExtension.find_by(school_id: d.id)&.customer_staff&.user&.real_name
21
+ json.department d['department_name'] || ''
22
+ json.major d['major'] || ''
23
+ json.major_id d.major_id || ''
24
+ json.department_id d.department_id || ''
25
+ # json.teacher_counts UserExtension.where(department_id: d.department_id, identity: 'teacher').size
26
+ #json.student_counts UserExtension.where(department_id: d.department_id, identity: 'student').size
27
+ end
28
+ end
29
+
30
+ json.code 0
31
+ if params[:page].present?
32
+ json.count @customers.total_count
33
+ end
@@ -6,8 +6,8 @@ json.data do
6
6
  json.staff d.staff.user.real_name
7
7
  json.description d.description
8
8
  json.advise d.advise
9
- json.school d.business.department.school.name
10
- json.school_id d.business.department.school.id
9
+ json.school d.business.department&.school&.name
10
+ json.school_id d.business.department&.school&.id
11
11
  json.created_at d.created_at.to_s
12
12
  json.business d.business.name
13
13
  json.business_id d.business.id