educode_sales 0.5.8 → 0.6.2

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 (57) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/educode_sales//345/256/242/346/210/267/347/256/241/347/220/206.png +0 -0
  3. data/app/controllers/educode_sales/businesses_controller.rb +4 -2
  4. data/app/controllers/educode_sales/customer_extensions_controller.rb +17 -0
  5. data/app/controllers/educode_sales/customer_follows_controller.rb +41 -0
  6. data/app/controllers/educode_sales/customers_controller.rb +204 -0
  7. data/app/controllers/educode_sales/places_controller.rb +5 -1
  8. data/app/controllers/educode_sales/roles_controller.rb +4 -1
  9. data/app/controllers/educode_sales/sale_trends_controller.rb +16 -1
  10. data/app/controllers/educode_sales/teachers_controller.rb +13 -2
  11. data/app/models/educode_sales/customer.rb +4 -0
  12. data/app/models/educode_sales/customer_extension.rb +7 -0
  13. data/app/models/educode_sales/customer_follow.rb +5 -0
  14. data/app/models/educode_sales/permission.rb +3 -2
  15. data/app/models/educode_sales/role_area.rb +1 -0
  16. data/app/views/educode_sales/businesses/_follows.html.erb +10 -4
  17. data/app/views/educode_sales/businesses/edit_follow_record.html.erb +2 -2
  18. data/app/views/educode_sales/businesses/index.html.erb +25 -18
  19. data/app/views/educode_sales/businesses/index.json.jbuilder +1 -0
  20. data/app/views/educode_sales/businesses/new.html.erb +3 -0
  21. data/app/views/educode_sales/businesses/new_follow_record.html.erb +2 -2
  22. data/app/views/educode_sales/businesses/show_follow.html.erb +7 -2
  23. data/app/views/educode_sales/businesses/show_follow.json.jbuilder +1 -0
  24. data/app/views/educode_sales/businesses/time_line.html.erb +1 -1
  25. data/app/views/educode_sales/customers/edit.html.erb +94 -0
  26. data/app/views/educode_sales/customers/edit_department.html.erb +54 -0
  27. data/app/views/educode_sales/customers/edit_follow_record.html.erb +50 -0
  28. data/app/views/educode_sales/customers/give.html.erb +51 -0
  29. data/app/views/educode_sales/customers/index.html.erb +493 -0
  30. data/app/views/educode_sales/customers/index.json.jbuilder +24 -0
  31. data/app/views/educode_sales/customers/new.html.erb +96 -0
  32. data/app/views/educode_sales/customers/new_department.html.erb +56 -0
  33. data/app/views/educode_sales/customers/new_follow_record.html.erb +54 -0
  34. data/app/views/educode_sales/customers/show_department.json.jbuilder +13 -0
  35. data/app/views/educode_sales/customers/show_follow.html.erb +442 -0
  36. data/app/views/educode_sales/customers/show_follow.json.jbuilder +13 -0
  37. data/app/views/educode_sales/customers/show_follow_record.html.erb +18 -0
  38. data/app/views/educode_sales/follow_ups/index.json.jbuilder +1 -0
  39. data/app/views/educode_sales/places/index.html.erb +64 -0
  40. data/app/views/educode_sales/places/index.json.jbuilder +1 -1
  41. data/app/views/educode_sales/roles/edit.html.erb +9 -1
  42. data/app/views/educode_sales/sale_trends/trends.html.erb +20 -0
  43. data/app/views/educode_sales/sales/index.html.erb +63 -21
  44. data/app/views/educode_sales/sales/index.json.jbuilder +32 -5
  45. data/app/views/educode_sales/teachers/index.html.erb +4 -11
  46. data/app/views/educode_sales/teachers/index.json.jbuilder +3 -3
  47. data/app/views/educode_sales/teachers/show_follow.html.erb +10 -5
  48. data/app/views/educode_sales/teachers/show_follow.json.jbuilder +1 -0
  49. data/app/views/layouts/educode_sales/application.html.erb +8 -1
  50. data/config/routes.rb +25 -0
  51. data/db/migrate/20210902064109_create_educode_sales_role_permissions.rb +15 -0
  52. data/db/migrate/20211214100803_create_customer_extensions.rb +9 -0
  53. data/db/migrate/20211215025029_create_educode_sales_customer_follows.rb +12 -0
  54. data/db/migrate/20211220102720_add_position_to_commons.rb +12 -0
  55. data/db/migrate/20211221075146_add_school_id_to_educode_sales_businesses.rb +8 -0
  56. data/lib/educode_sales/version.rb +1 -1
  57. metadata +26 -2
@@ -0,0 +1,54 @@
1
+ <h1 class="text-center" style="padding: 25px"><%=@school.name %></h1>
2
+ <form class="layui-form layuimini-form " action="">
3
+ <div class="layui-form-item layui-form-text" style="padding-right: 30px">
4
+ <label class="layui-form-label required" >跟进内容</label>
5
+ <div class="layui-input-block">
6
+ <textarea name="content" placeholder="请输入跟进内容" lay-verify="required" style="height: 200px" class="layui-textarea"></textarea>
7
+ </div>
8
+ </div>
9
+ <div class="layui-form-item ">
10
+ <label class="layui-form-label ">跟进部门</label>
11
+ <div class="layui-input-inline" style="width: 300px">
12
+ <%= select_tag "department_id",options_for_select(@school.departments.pluck(:name, :id)), { include_blank: true}%>
13
+ </div>
14
+ </div>
15
+ <div class="layui-form-item " style="padding-left: 110px">
16
+ <button type="submit" class="layui-btn layui-btn-normal" lay-submit lay-filter="add_follow_up">提交
17
+ </button>
18
+ </div>
19
+ </form>
20
+
21
+
22
+
23
+
24
+ <script>
25
+ layui.use(['form', 'table', 'upload', 'layer', 'laytpl', 'request', 'laydate'], function () {
26
+ var form = layui.form,
27
+ layer = layui.layer,
28
+ table = layui.table,
29
+ laytpl = layui.laytpl,
30
+ request = layui.request,
31
+ laydate = layui.laydate,
32
+ $ = layui.$;
33
+
34
+
35
+ form.render();
36
+
37
+ form.on('submit(add_follow_up)', function (data) {
38
+ data.field.school_id = <%=@school.id %>
39
+ request.authPost("missions/customer_follows", data.field, function (res) {
40
+ if (res.success == false) {
41
+ layer.alert(res.msg)
42
+ } else {
43
+ layer.close(parent.addFollowIndex);
44
+ parent.layer.close(parent.layer.getFrameIndex(window.name))
45
+ parent.table.reload('customers_table')
46
+ parent.table.reload('unfinish_table')
47
+ }
48
+ })
49
+
50
+ return false;
51
+ });
52
+
53
+ });
54
+ </script>
@@ -0,0 +1,13 @@
1
+ json.data do
2
+ json.array! @departments do |d|
3
+ json.id d.id
4
+ # json.created_at d.created_at.to_s
5
+ # json.staff d.staff.user.real_name
6
+ json.department d.name
7
+ # json.content d.content
8
+ # json.is_latest d.id == @latest.id
9
+ end
10
+ end
11
+
12
+ json.code 0
13
+ json.count @departments.total_count
@@ -0,0 +1,442 @@
1
+ <script type="text/html" id="toolbarDemo_follow">
2
+ <div class="layui-btn-container">
3
+ <span class="table-label">二级部门</span>
4
+ <% if can? :create_department, EducodeSales::Customer %>
5
+ <button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="add"> 添加部门</button>
6
+ <% end %>
7
+ </div>
8
+ </script>
9
+
10
+ <h1 style="padding: 20px">客户:<%=@school_name %></h1>
11
+ <div style="padding-left: 20px">
12
+ <span>区域:<%=@area %></span>
13
+ <span style="padding-left: 100px" id="demo"></span>
14
+ <span style="padding-left: 100px">负责人:<%=@staff %></span>
15
+ </div>
16
+
17
+
18
+ <div class="z-index">
19
+ <table class="layui-hide" id="sale_plan_follow_table" lay-filter="sale_plan_follow_table"></table>
20
+ </div>
21
+
22
+ <script type="text/html" id="currentTableBar_follow">
23
+ <% if can? :update_department, EducodeSales::Customer %>
24
+ <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>
25
+ <% end %>
26
+ </script>
27
+
28
+
29
+ <script>
30
+ document.getElementById("demo").innerHTML = "最后跟进时间:" + parent.time;
31
+
32
+ layui.use(['form', 'table', 'miniPage', 'element'], function () {
33
+ var $ = layui.jquery,
34
+ form = layui.form,
35
+ request =layui.request,
36
+ miniPage = layui.miniPage;
37
+
38
+ table = layui.table;
39
+ table.render({
40
+ elem: '#sale_plan_follow_table',
41
+ url: '/missions/customers/show_department?id=' + parent.id ,
42
+ toolbar: '#toolbarDemo_follow',
43
+ defaultToolbar: [],
44
+ cols: [
45
+ [
46
+ {
47
+ field: 'id',
48
+ width: 100,
49
+ title:'序号',type: 'numbers',
50
+ },
51
+ {
52
+ field: 'department',
53
+ title: '学院/部门',
54
+ },
55
+ {
56
+ title: '操作',
57
+ width: 190,
58
+ toolbar: '#currentTableBar_follow',
59
+ align: "center",
60
+ fixed: 'right'
61
+ }
62
+ ]
63
+ ],
64
+
65
+
66
+ page: true,
67
+ skin: 'line'
68
+ });
69
+
70
+
71
+ /**
72
+ * toolbar事件监听
73
+ */
74
+ table.on('toolbar(sale_plan_follow_table)', function (obj) {
75
+ if (obj.event === 'add') { // 监听添加操作
76
+ school_id = parent.id
77
+ var content = miniPage.getHrefContent('/missions/customers/new_department?id=' + parent.id);
78
+ var openWH = miniPage.getOpenWidthHeight();
79
+ new_department_index = layer.open({
80
+ title: '添加部门',
81
+ type: 1,
82
+ shade: 0.2,
83
+ maxmin: true,
84
+ shadeClose: true,
85
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
86
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
87
+ content: content,
88
+ success: function (layero, index) {
89
+ // 重新渲染弹层中的下拉选择框select
90
+ form.render('select');
91
+ }
92
+ });
93
+ $(window).on("resize", function () {
94
+ layer.full(index);
95
+ });
96
+ }
97
+ });
98
+
99
+ table.on('tool(sale_plan_follow_table)', function (obj) {
100
+ var data = obj.data;
101
+ var id = data.id
102
+ if (obj.event === 'delete') {
103
+ layer.confirm('确定删除ID为' + data.id + "的跟进记录", function (index) {
104
+ request.authDelete("missions/teacher_follows/" + data.id, {}, function() {
105
+ obj.del();
106
+ layer.close(index);
107
+ parent.table.reload('sale_plan_follow_table')
108
+ parent.table.reload('teachers_table')
109
+ parent.table.reload('weekPlanTable1')
110
+ parent.table.reload('monthPlanTable')
111
+ })
112
+ });
113
+ } else if (obj.event === 'show') { // 监听添加操作
114
+ var content = miniPage.getHrefContent('/missions/teachers/show_follow_record?id=' + id);
115
+ var openWH = miniPage.getOpenWidthHeight();
116
+ sale_plan_index1 = layer.open({
117
+ title: '查看教师跟进记录',
118
+ type: 1,
119
+ shade: 0.2,
120
+ maxmin: true,
121
+ shadeClose: true,
122
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
123
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
124
+ content: content,
125
+ success: function (layero, index) {
126
+ // 重新渲染弹层中的下拉选择框select
127
+ form.render('select');
128
+ }
129
+ });
130
+ $(window).on("resize", function () {
131
+ layer.full(index);
132
+ });
133
+ } else if (obj.event === 'edit') {
134
+ department_id = obj.data.id
135
+ content = miniPage.getHrefContent('/missions/customers/edit_department?id='+ obj.data.id);
136
+ openWH = miniPage.getOpenWidthHeight();
137
+ edit_index1 = layer.open({
138
+ title: '编辑部门',
139
+ type: 1,
140
+ shade: 0.2,
141
+ maxmin: true,
142
+ shadeClose: true,
143
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
144
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
145
+ content: content,
146
+ success: function (layero, index) {
147
+ // 重新渲染弹层中的下拉选择框select
148
+ form.render('select');
149
+ }
150
+ });
151
+ $(window).on("resize", function () {
152
+ layer.full(index);
153
+ });
154
+ } else if (obj.event === 'add_keys') { // 监听添加操作
155
+ content = miniPage.getHrefContent('/missions/businesses/add_keys');
156
+ openWH = miniPage.getOpenWidthHeight();
157
+ index = layer.open({
158
+ title: '关键人',
159
+ type: 1,
160
+ shade: 0.2,
161
+ maxmin: true,
162
+ shadeClose: true,
163
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
164
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
165
+ content: content,
166
+ success: function (layero, index) {
167
+ // 重新渲染弹层中的下拉选择框select
168
+ form.render('select');
169
+ }
170
+ });
171
+ $(window).on("resize", function () {
172
+ layer.full(index);
173
+ });
174
+ } else if (obj.event === 'edit_plan') {
175
+ content = miniPage.getHrefContent('/missions/businesses/edit_plan');
176
+ openWH = miniPage.getOpenWidthHeight();
177
+ index = layer.open({
178
+ title: '回款计划',
179
+ type: 1,
180
+ shade: 0.2,
181
+ maxmin: true,
182
+ shadeClose: true,
183
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
184
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
185
+ content: content,
186
+ success: function (layero, index) {
187
+ // 重新渲染弹层中的下拉选择框select
188
+ // form.render('select');
189
+ }
190
+ });
191
+ $(window).on("resize", function () {
192
+ layer.full(index);
193
+ });
194
+ }
195
+ });
196
+
197
+ });
198
+ </script>
199
+
200
+
201
+
202
+
203
+
204
+
205
+
206
+ <!--未完成计划列表-->
207
+ <script type="text/html" id="unfinish_toolbar">
208
+ <div class="layui-btn-container">
209
+ <span class="table-label">跟进记录</span>
210
+ <% if can? :create_follow, EducodeSales::Customer %>
211
+ <button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="addFollow"> 添加跟进记录
212
+ <%end %>
213
+ </button>
214
+ </div>
215
+ </script>
216
+
217
+ <table class="layui-hide" id="unfinish_table" lay-filter="unfinish_table"></table>
218
+
219
+ <script type="text/html" id="currentTableBar1234">
220
+ <% if can? :read_follow, EducodeSales::Customer %>
221
+ <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="show">查看</a>
222
+ <% end %>
223
+ <% if can? :update_follow, EducodeSales::Customer %>
224
+ <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>
225
+ <% end %>
226
+ <% if can? :destroy_follow, EducodeSales::Customer %>
227
+ <a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a>
228
+ <% end %>
229
+ </script>
230
+
231
+
232
+ <script>
233
+ layui.use(['form', 'table', 'miniPage', 'element'], function () {
234
+ var $ = layui.jquery,
235
+ form = layui.form,
236
+ table = layui.table,
237
+ request = layui.request,
238
+ miniPage = layui.miniPage;
239
+
240
+ table.render({
241
+ elem: '#unfinish_table',
242
+ url: '/missions/customers/show_follow?id=' + parent.id ,
243
+ toolbar: '#unfinish_toolbar',
244
+ defaultToolbar: [],
245
+ cols: [
246
+ [
247
+ {
248
+ field: 'id',
249
+ width: 100,
250
+ title:'序号',type: 'numbers',
251
+ },
252
+ {
253
+ field: 'created_at',
254
+ width: 180,
255
+ title: '时间',
256
+ sort: true
257
+ },
258
+ {
259
+ field: 'staff',
260
+ width: 100,
261
+ title: '跟进人'
262
+ },
263
+ {
264
+ field: 'department',
265
+ width: 100,
266
+ title: '跟进部门'
267
+ },
268
+ {
269
+ field: 'content',
270
+ title: '跟进内容',
271
+ templet:'<div><span title="{{d.content}}">{{d.content}}</span></div>'
272
+ },
273
+ {
274
+ title: '操作',
275
+ width: 300,
276
+ toolbar: '#currentTableBar1234',
277
+ align: "center"
278
+ }
279
+ ]
280
+ ],
281
+
282
+
283
+ page: true,
284
+ skin: 'line'
285
+ });
286
+ // 监听搜索操作
287
+ form.on('submit(data-search-btn)', function (data) {
288
+ var result = JSON.stringify(data.field);
289
+ layer.alert(result, {
290
+ title: '最终的搜索信息'
291
+ });
292
+
293
+ //执行搜索重载
294
+ table.reload('currentTableId', {
295
+ page: {
296
+ curr: 1
297
+ },
298
+ where: {
299
+ searchParams: result
300
+ }
301
+ }, 'data');
302
+
303
+ return false;
304
+ });
305
+
306
+ /**
307
+ * toolbar事件监听
308
+ */
309
+ table.on('toolbar(unfinish_table)', function (obj) {
310
+ if (obj.event === 'addWeekPlan') { // 监听添加操作
311
+
312
+ var content = miniPage.getHrefContent('/missions/operation_plans/new_week');
313
+ var openWH = miniPage.getOpenWidthHeight();
314
+ var index = layer.open({
315
+ title: '添加周计划',
316
+ type: 1,
317
+ shade: 0.2,
318
+ maxmin: true,
319
+ shadeClose: true,
320
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
321
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
322
+ content: content,
323
+ success: function (layero, index) {
324
+ // 重新渲染弹层中的下拉选择框select
325
+ form.render('select');
326
+ }
327
+ });
328
+ $(window).on("resize", function () {
329
+ layer.full(index);
330
+ });
331
+ } else if (obj.event === 'addFollow') { // 监听添加操作
332
+ var content = miniPage.getHrefContent('/missions/customers/new_follow_record?id=' + parent.id)
333
+ var openWH = miniPage.getOpenWidthHeight();
334
+ addFollowIndex = layer.open({
335
+ title: '添加跟进记录',
336
+ type: 1,
337
+ shade: 0.2,
338
+ maxmin: true,
339
+ shadeClose: true,
340
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
341
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
342
+ content: content,
343
+ success: function (layero, index) {
344
+ // 重新渲染弹层中的下拉选择框select
345
+ form.render('select');
346
+ }
347
+ });
348
+ $(window).on("resize", function () {
349
+ layer.full(index);
350
+ });
351
+ } else if (obj.event === 'delete') { // 监听删除操作
352
+ var checkStatus = table.checkStatus('currentTableId'),
353
+ data = checkStatus.data;
354
+ layer.alert(JSON.stringify(data));
355
+ }
356
+ });
357
+
358
+ //监听表格复选框选择
359
+ table.on('checkbox(unfinish_table)', function (obj) {
360
+ console.log(obj)
361
+ });
362
+
363
+ table.on('tool(unfinish_table)', function (obj) {
364
+ var data = obj.data;
365
+ var id = data.id
366
+ if (obj.event === 'delete') {
367
+ layer.confirm('确定删除ID为' + data.id + "的记录", function (index) {
368
+ request.authDelete("missions/customer_follows/" + data.id, {}, function() {
369
+ obj.del();
370
+ parent.table.reload('customers_table')
371
+ layer.close(index);
372
+ })
373
+
374
+ });
375
+ } else if (obj.event === 'show') {
376
+ content = miniPage.getHrefContent('/missions/customers/show_follow_record?id=' + data.id);
377
+ openWH = miniPage.getOpenWidthHeight();
378
+ index = layer.open({
379
+ title: '查看跟进记录',
380
+ type: 1,
381
+ shade: 0.2,
382
+ maxmin: true,
383
+ shadeClose: true,
384
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
385
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
386
+ content: content
387
+ });
388
+ $(window).on("resize", function () {
389
+ layer.full(index);
390
+ });
391
+ return false;
392
+ } else if (obj.event === 'edit') {
393
+ content = miniPage.getHrefContent('/missions/customers/edit_follow_record?id=' + data.id);
394
+ openWH = miniPage.getOpenWidthHeight();
395
+ editFollowIndex = layer.open({
396
+ title: '编辑',
397
+ type: 1,
398
+ shade: 0.2,
399
+ maxmin: true,
400
+ shadeClose: true,
401
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
402
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
403
+ content: content,
404
+ success: function (layero, index) {
405
+ // 重新渲染弹层中的下拉选择框select
406
+ form.render('select');
407
+ },
408
+ });
409
+ $(window).on("resize", function () {
410
+ layer.full(sindex);
411
+ });
412
+ return false;
413
+ } else if (obj.event === 'show_follow') {
414
+ content = miniPage.getHrefContent('/missions/teachers/show_follow');
415
+ openWH = miniPage.getOpenWidthHeight();
416
+ index = layer.open({
417
+ title: 'xxxx/跟进记录',
418
+ type: 1,
419
+ shade: 0.2,
420
+ maxmin: true,
421
+ shadeClose: true,
422
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
423
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
424
+ content: content,
425
+ success: function (layero, index) {
426
+ // 重新渲染弹层中的下拉选择框select
427
+ // form.render('select');
428
+ }
429
+ });
430
+ $(window).on("resize", function () {
431
+ layer.full(index);
432
+ });
433
+ }
434
+ });
435
+
436
+ });
437
+ </script>
438
+ <style>
439
+ .z-index .layui-table-tool{
440
+ z-index: 10000; !important;
441
+ }
442
+ </style>
@@ -0,0 +1,13 @@
1
+ json.data do
2
+ json.array! @follow_ups do |d|
3
+ json.id d.id
4
+ json.created_at d.created_at.to_s
5
+ json.staff d.staff.user.real_name
6
+ json.department d.department_id.present? ? Department.find(d.department_id)&.name : ''
7
+ json.content d.content
8
+ json.is_latest d.id == @latest.id
9
+ end
10
+ end
11
+
12
+ json.code 0
13
+ json.count @follow_ups.total_count
@@ -0,0 +1,18 @@
1
+ <h1 class="text-center" style="padding: 25px"><%=@school.name %></h1>
2
+ <form class="layui-form form-value" action="">
3
+ <div class="layui-form-item" style="padding: 25px">
4
+ <div class="layui-form-item layui-form-text">
5
+ <label class="layui-form-label">跟进内容:</label>
6
+ <div class="layui-input-block" style="padding-right: 20px;">
7
+ <pre><%= @follow_up.content %></pre>
8
+ </div>
9
+ </div>
10
+ <br>
11
+ <div class="layui-inline">
12
+ <label class="layui-form-label">跟进部门:</label>
13
+ <div class="layui-input-inline">
14
+ <span><%= Department.find(@follow_up.department_id)&.name if @follow_up.department_id.present? %></span>
15
+ </div>
16
+ </div>
17
+ </div>
18
+ </form>
@@ -7,6 +7,7 @@ json.data do
7
7
  json.description d.description
8
8
  json.advise d.advise
9
9
  json.school d.business.department.school.name
10
+ json.school_id d.business.department.school.id
10
11
  json.created_at d.created_at.to_s
11
12
  json.business d.business.name
12
13
  json.business_id d.business.id
@@ -1,3 +1,22 @@
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" autocomplete="off" class="layui-input">
8
+ </div>
9
+ </div>
10
+ <div class="layui-inline">
11
+ <button type="reset" class="layui-btn layui-btn-primary" lay-submit lay-filter="reset_business_search">重置
12
+ </button>
13
+ <button type="submit" class="layui-btn layui-btn-primary" id="search_bt" lay-submit lay-filter="search_teachers">搜 索
14
+ </button>
15
+ </div>
16
+ </div>
17
+ </form>
18
+ </div>
19
+
1
20
  <script type="text/html" id="toolbarDemo">
2
21
  <div class="layui-btn-container">
3
22
  <span class="table-label">渠道列表</span>
@@ -35,6 +54,51 @@
35
54
  request = layui.request,
36
55
  miniPage = layui.miniPage;
37
56
 
57
+
58
+
59
+ var sort = {}, search = {};
60
+ table.on('sort(place)', function (obj) {
61
+ sort.field = obj.field;
62
+ sort.order = obj.type;
63
+ table.reload('place', {
64
+ initSort: obj,
65
+ where: {
66
+ sort: sort,
67
+ q: search
68
+ }
69
+ });
70
+ })
71
+
72
+ // 监听搜索操作
73
+ form.on('submit(search_teachers)', function (data) {
74
+ search = data.field
75
+ table.reload('place', {
76
+ page: {
77
+ curr: 1
78
+ },
79
+ where: {q: search, sort: sort}
80
+ }, 'data');
81
+ return false;
82
+ });
83
+
84
+ form.on('submit(reset_business_search)', function (data) {
85
+ var field = data.field;
86
+ form.val('search_teachers', {
87
+ area: "",
88
+ date: "",
89
+ attitude: "",
90
+ name: "",
91
+ professional_title: "",
92
+ regist_at: "",
93
+ staff_id: "",
94
+ status: "",
95
+ school: "",
96
+ assist: "",
97
+ teacher_source: ""
98
+ });
99
+ return false;
100
+ });
101
+
38
102
  table.render({
39
103
  elem: '#place',
40
104
  url: '/missions/places',
@@ -17,7 +17,7 @@ json.data do
17
17
  business_count = EducodeSales::Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", @x).where("educode_sales_follow_ups.place_id = #{d.id}").count
18
18
  json.businesses_count business_count
19
19
  all_businesses_count += business_count
20
- json.amount EducodeSales::Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", @x).where("educode_sales_follow_ups.place_id = #{d.id} AND educode_sales_follow_ups.stage_id IN (?)", @stage_ids).sum(:profit_amount).round(2)
20
+ json.amount EducodeSales::Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", @x).where("educode_sales_follow_ups.place_id = #{d.id} AND educode_sales_follow_ups.stage_id IN (?)", @stage_ids).sum("actual_amount - divide_amount").round(2)
21
21
  json.return_mount EducodeSales::Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", @x).where("educode_sales_follow_ups.place_id = #{d.id}").sum(:return_money).round(2)
22
22
  end
23
23
  end
@@ -7,7 +7,7 @@
7
7
  <div class="layui-tab-item layui-show">
8
8
  <form class="layui-form line" action="">
9
9
  <% id = 0 %>
10
- <% EducodeSales::Permission.all.group_by{ |d| d.clazz}.each do |k, d| %>
10
+ <% EducodeSales::Permission.all.order(position: :asc).group_by{ |d| d.clazz}.each do |k, d| %>
11
11
  <div class="layui-form-item">
12
12
  <label class="layui-form-label"><%= k %></label>
13
13
  <div class="layui-input-block">
@@ -36,6 +36,14 @@
36
36
  <%= radio_button_tag("business", "全部", @areas.include?("商机管理-全部"), {title: '全部列表', id: 3}) %>
37
37
  </div>
38
38
  </div>
39
+ <div class="layui-form-item">
40
+ <label class="layui-form-label">客户管理</label>
41
+ <div class="layui-input-block">
42
+ <%= radio_button_tag("customer", "自己", @areas.include?("客户管理-自己"), {title: '本人负责列表', id: 13}) %>
43
+ <%= radio_button_tag("customer", "区域", @areas.include?("客户管理-区域"), {title: '本人负责区域列表', id:14}) %>
44
+ <%= radio_button_tag("customer", "全部", @areas.include?("客户管理-全部"), {title: '全部列表', id: 15}) %>
45
+ </div>
46
+ </div>
39
47
  <div class="layui-form-item">
40
48
  <label class="layui-form-label">销售计划</label>
41
49
  <div class="layui-input-block">