educode_sales 0.7.9 → 0.8.3

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 (25) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/educode_sales/application_controller.rb +14 -0
  3. data/app/controllers/educode_sales/assessments_controller.rb +58 -55
  4. data/app/controllers/educode_sales/businesses_controller.rb +16 -1
  5. data/app/controllers/educode_sales/follow_ups_controller.rb +1 -1
  6. data/app/controllers/educode_sales/money_plans_controller.rb +0 -2
  7. data/app/models/educode_sales/filter.rb +12 -0
  8. data/app/models/educode_sales/follow_up.rb +7 -0
  9. data/app/views/educode_sales/assessments/_setup.html.erb +183 -132
  10. data/app/views/educode_sales/assessments/new.html.erb +1 -1
  11. data/app/views/educode_sales/businesses/edit_follow_record.html.erb +9 -0
  12. data/app/views/educode_sales/businesses/index.html.erb +220 -161
  13. data/app/views/educode_sales/businesses/index.json.jbuilder +8 -0
  14. data/app/views/educode_sales/businesses/new_follow_record.html.erb +13 -3
  15. data/app/views/educode_sales/businesses/show_follow.html.erb +6 -3
  16. data/app/views/educode_sales/businesses/show_follow.json.jbuilder +7 -0
  17. data/app/views/educode_sales/businesses/show_follow_record.html.erb +15 -5
  18. data/app/views/educode_sales/money_plans/index.json.jbuilder +1 -1
  19. data/config/routes.rb +1 -0
  20. data/db/migrate/20220507020149_create_filter.rb +10 -0
  21. data/db/migrate/20220507091959_change_educode_sales_filter_column_length.rb +5 -0
  22. data/db/migrate/20220509073936_update_educode_sales_filters_filter_data.rb +9 -0
  23. data/db/migrate/20220512031715_add_column_o_business_deployment_to_follow_ups.rb +5 -0
  24. data/lib/educode_sales/version.rb +1 -1
  25. metadata +7 -2
@@ -257,180 +257,210 @@
257
257
  console.log(data);
258
258
 
259
259
  table = layui.table;
260
- var business_table = table.render({
261
- elem: '#businesses_table',
262
- url: '/missions/businesses',
263
- where: {q: data},
264
- defaultToolbar: ['filter'],
265
- toolbar: '#bussinessBar',
266
- title: '商机数据表',
267
- totalRow: true,//开启合并行
268
- cols: [
269
- [
270
- {
271
- field: 'id',
272
- width: 60,
273
- title: '序号', type: 'numbers',
274
- totalRowText: '合计',
275
- fixed: "left"
276
- },
277
- {
278
- field: 'name',
279
- width: 170,
280
- title: '商机名称',
281
- templet: '<div><span title="{{d.name}}">{{d.name}}</span></div>',
282
- fixed: 'left'
283
- },
284
- {
285
- field: 'school',
286
- width: 150,
287
- title: '单位',
288
- templet: '#school_name'
289
- },
290
- {
291
- field: 'department',
292
- width: 150,
293
- title: '部门',
294
- templet: '<div><span title="{{d.department}}">{{d.department}}</span></div>'
295
- },
296
- {
297
- field: 'follow_ups_count',
298
- title: '跟进',
299
- width: 60,
300
- templet: '#show_follow',
301
- totalRow: true,
302
- },
303
- // {
304
- // field: 'teachers_count',
305
- // width: 100,
306
- // title: '关键人',
307
- // templet: '#show_keys'
308
- // },
309
- {
310
- field: 'clazz',
311
- width: 80,
312
- title: '类型',
313
- templet: '<div><span title="{{d.clazz}}">{{d.clazz}}</span></div>'
314
- },
315
- {
316
- field: 'stage',
317
- width: 90,
318
- title: '阶段'
319
- },
260
+ var cols_table = [
261
+ [
262
+ {
263
+ field: 'id',
264
+ width: 60,
265
+ title: '序号', type: 'numbers',
266
+ totalRowText: '合计',
267
+ fixed: "left"
268
+ },
269
+ {
270
+ field: 'name',
271
+ width: 170,
272
+ title: '商机名称',
273
+ templet: '<div><span title="{{d.name}}">{{d.name}}</span></div>',
274
+ fixed: 'left',
275
+ hide: gon.filter.name
276
+ },
277
+ {
278
+ field: 'school',
279
+ width: 150,
280
+ title: '单位',
281
+ templet: '#school_name',
282
+ hide: gon.filter.school
283
+ },
284
+ {
285
+ field: 'department',
286
+ width: 150,
287
+ title: '部门',
288
+ templet: '<div><span title="{{d.department}}">{{d.department}}</span></div>',
289
+ hide: gon.filter.department
290
+ },
291
+ {
292
+ field: 'follow_ups_count',
293
+ title: '跟进',
294
+ width: 60,
295
+ templet: '#show_follow',
296
+ totalRow: true,
297
+ hide: gon.filter.follow_ups_count
298
+ },
299
+ // {
300
+ // field: 'teachers_count',
301
+ // width: 100,
302
+ // title: '关键人',
303
+ // templet: '#show_keys'
304
+ // },
305
+ {
306
+ field: 'clazz',
307
+ width: 80,
308
+ title: '类型',
309
+ templet: '<div><span title="{{d.clazz}}">{{d.clazz}}</span></div>',
310
+ hide: gon.filter.clazz
311
+ },
312
+ {
313
+ field: 'stage',
314
+ width: 90,
315
+ title: '阶段',
316
+ hide: gon.filter.stage
317
+ },
320
318
  {
321
319
  field: 'source',
322
320
  width: 90,
323
- title: '商机来源'
321
+ title: '商机来源',
322
+ hide: gon.filter.source
324
323
  },
325
324
  {
326
325
  field: 'last_follow_person',
327
326
  width: 100,
328
- title: '最新跟进人'
327
+ title: '最新跟进人',
328
+ hide: gon.filter.last_follow_person
329
329
  },
330
330
  {
331
331
  field: 'latest_time',
332
332
  width: 200,
333
333
  title: '最新跟进时间',
334
- sort: true
334
+ sort: true,
335
+ hide: gon.filter.latest_time
335
336
  },
336
- {
337
- field: 'invitation_at',
338
- width: 105,
339
- title: '招标时间',
340
- sort: true
341
- },
342
- {
343
- field: 'bidded_date',
344
- width: 105,
345
- title: '中标时间',
346
- sort: true
347
- },
348
- {
349
- field: 'signed_date',
350
- width: 105,
351
- title: '签单时间',
352
- sort: true
353
- },
354
- {
355
- field: 'reception_at',
356
- width: 105,
357
- title: '验收时间',
358
- sort: true
359
- },
360
- {
361
- field: 'service_end_time',
362
- width: 200,
363
- title: '服务期',
364
- sort: true
365
- },
366
- {
367
- field: 'total_amount',
368
- width: 100,
369
- title: '总额',
370
- totalRow: true,
371
- sort: true
372
- },
373
- {
374
- field: 'actual_amount',
375
- width: 100,
376
- title: '合同额',
377
- totalRow: true,
378
- sort: true
379
- },
380
- {
381
- field: 'return_money',
382
- width: 100,
383
- title: '回款',
384
- sort: true,
385
- totalRow: true
386
- },
387
- {
388
- field: 'wait_return_money',
389
- width: 100,
390
- title: '待回款',
391
- sort: true,
392
- totalRow: true
393
- },
394
- {
395
- field: 'return_money_days',
396
- width: 150,
397
- title: '首次回款周期(天)',
398
- },
399
- {
400
- field: 'place',
401
- width: 160,
402
- title: '渠道',
403
- },
404
- {
405
- field: 'year',
406
- width: 105,
407
- title: '所属年度',
408
- sort: true
409
- },
410
- {
411
- field: 'followed',
412
- templet:function(d){
413
- if (d.followed==1){
337
+ {
338
+ field: 'invitation_at',
339
+ width: 105,
340
+ title: '招标时间',
341
+ sort: true,
342
+ hide: gon.filter.invitation_at
343
+ },
344
+ {
345
+ field: 'bidded_date',
346
+ width: 105,
347
+ title: '中标时间',
348
+ sort: true,
349
+ hide: gon.filter.bidded_date
350
+ },
351
+ {
352
+ field: 'signed_date',
353
+ width: 105,
354
+ title: '签单时间',
355
+ sort: true,
356
+ hide: gon.filter.signed_date
357
+ },
358
+ {
359
+ field: 'reception_at',
360
+ width: 105,
361
+ title: '验收时间',
362
+ sort: true,
363
+ hide: gon.filter.reception_at
364
+ },
365
+ {
366
+ field: 'service_end_time',
367
+ width: 200,
368
+ title: '服务期',
369
+ sort: true,
370
+ hide: gon.filter.service_end_time
371
+ },
372
+ {
373
+ field: 'o_business_deployment',
374
+ width: 150,
375
+ title: '部署类型',
376
+ sort: true,
377
+ hide: gon.filter.o_business_deployment
378
+ },
379
+ {
380
+ field: 'total_amount',
381
+ width: 100,
382
+ title: '总额',
383
+ totalRow: true,
384
+ sort: true,
385
+ hide: gon.filter.total_amount
386
+ },
387
+ {
388
+ field: 'actual_amount',
389
+ width: 100,
390
+ title: '合同额',
391
+ totalRow: true,
392
+ sort: true,
393
+ hide: gon.filter.actual_amount
394
+ },
395
+ {
396
+ field: 'return_money',
397
+ width: 100,
398
+ title: '回款',
399
+ sort: true,
400
+ totalRow: true,
401
+ hide: gon.filter.return_money
402
+ },
403
+ {
404
+ field: 'wait_return_money',
405
+ width: 100,
406
+ title: '待回款',
407
+ sort: true,
408
+ totalRow: true,
409
+ hide: gon.filter.wait_return_money
410
+ },
411
+ {
412
+ field: 'return_money_days',
413
+ width: 150,
414
+ title: '首次回款周期()',
415
+ hide: gon.filter.return_money_days
416
+ },
417
+ {
418
+ field: 'place',
419
+ width: 160,
420
+ title: '渠道',
421
+ hide: gon.filter.place
422
+ },
423
+ {
424
+ field: 'year',
425
+ width: 105,
426
+ title: '所属年度',
427
+ sort: true,
428
+ hide: gon.filter.year
429
+ },
430
+ {
431
+ field: 'followed',
432
+ templet:function(d){
433
+ if (d.followed==1){
414
434
 
415
- return '<i class="layui-icon" style="color: goldenrod">&#xe658;</i> '
416
- }
435
+ return '<i class="layui-icon" style="color: goldenrod">&#xe658;</i> '
436
+ }
417
437
 
418
- else return ''
419
- },
420
- width: 105,
421
- title: '关注',
422
- align: "center"
438
+ else return ''
439
+ },
440
+ width: 105,
441
+ title: '关注',
442
+ align: "center",
443
+ hide: gon.filter.followed
423
444
 
424
- },
425
- {
426
- title: '操作',
427
- minWidth: 220,
428
- toolbar: '#currentTableBar',
429
- align: "center",
430
- fixed: 'right'
431
- }
445
+ },
446
+ {
447
+ title: '操作',
448
+ minWidth: 220,
449
+ toolbar: '#currentTableBar',
450
+ align: "center",
451
+ fixed: 'right',
452
+ }
432
453
  ]
433
- ],
454
+ ]
455
+ var business_table = table.render({
456
+ elem: '#businesses_table',
457
+ url: '/missions/businesses',
458
+ where: {q: data},
459
+ toolbar: '#bussinessBar',
460
+ defaultToolbar: ['filter'],
461
+ title: '商机数据表',
462
+ totalRow: true,//开启合并行
463
+ cols: cols_table,
434
464
 
435
465
  limit: 20,
436
466
  limits: [10,15,20,30,40,50,60,70,80,90],
@@ -794,7 +824,6 @@
794
824
  data.field.business_type = business_type.toString();
795
825
  data.field.business_step = business_step.toString();
796
826
  search = data.field
797
- console.log(search);
798
827
  table.reload('businesses_table', {
799
828
  url: '/missions/businesses',
800
829
  page: {
@@ -803,7 +832,6 @@
803
832
  where: {q: search, sort: sort}
804
833
  }, 'data');
805
834
  table.reload('teachers_table', {
806
- url: '/missions/businesses',
807
835
  page: {
808
836
  curr: 1
809
837
  },
@@ -832,8 +860,40 @@
832
860
 
833
861
  return false;
834
862
  });
835
-
836
863
  table.on('toolbar(businesses_table)', function (obj) {
864
+ switch (obj.event) {
865
+ case 'LAYTABLE_COLS':
866
+ layui.form.on('checkbox(LAY_TABLE_TOOL_COLS)', function(objs) {
867
+ var value = objs.elem.checked
868
+ var name = objs.elem.attributes[1].value
869
+ $.ajax({
870
+ url: "filter",
871
+ type: "GET",
872
+ data: "type=businesses_list&name=" + name + "&check=" + value,
873
+ success: function (data){
874
+ let hide_type = "[data-field='"+name+"']"
875
+ if (data.hidden === 1){
876
+ $(hide_type).addClass('layui-hide');
877
+ }else if (data.hidden === 0){
878
+ $(hide_type).removeClass('layui-hide');
879
+ }
880
+ //(因为触发筛选器出现的checkbox是根据cols的值得到 这里必须修改 cols的值 然后才会出现下次点击筛选器时 checkbox正常显示)
881
+ for (i=1;i<cols_table[0].length;i++){
882
+ if (name === cols_table[0][i].field ){
883
+ cols_table[0][i].hide = !value
884
+ objs.config.cols = cols_table
885
+ }
886
+ }
887
+ },
888
+ error: function (data){
889
+ layer.msg("操作失败")
890
+ },
891
+ dataType: 'Json'
892
+ })
893
+ });
894
+ }
895
+
896
+
837
897
  if (obj.event === 'add') { // 监听添加操作
838
898
  var content = miniPage.getHrefContent('/missions/businesses/new');
839
899
  var openWH = miniPage.getOpenWidthHeight();
@@ -1045,7 +1105,6 @@
1045
1105
  });
1046
1106
  }
1047
1107
  });
1048
-
1049
1108
  });
1050
1109
  </script>
1051
1110
  <style>
@@ -18,6 +18,14 @@ json.data do
18
18
  json.bidded_date d.last_follow_up&.bidded_date.to_s
19
19
  json.signed_date d.last_follow_up&.signed_date.to_s
20
20
  json.service_end_time d.last_follow_up&.service_start_time.to_s + "-" + d.last_follow_up&.service_end_time.to_s
21
+ EducodeSales::FollowUp::BUSINESS_DEPLOYMENT.each do |m|
22
+ if d.last_follow_up&.o_business_deployment == m[1]
23
+ json.o_business_deployment m[0]
24
+ break
25
+ else
26
+ json.o_business_deployment ''
27
+ end
28
+ end
21
29
  json.year d.last_follow_up&.year.to_s
22
30
  json.total_amount d.last_follow_up&.total_amount
23
31
  json.actual_amount d.last_follow_up&.actual_amount
@@ -74,6 +74,12 @@
74
74
  <input type="text" class="layui-input required" id="service_time" name="service_time" placeholder=" - " autocomplete="off" value="<%= (@last_follow_up&.service_start_time.present? && @last_follow_up&.service_end_time.present?) ? (@last_follow_up.service_start_time.to_s + " - " + @last_follow_up.service_end_time.to_s) : '' %>">
75
75
  </div>
76
76
  </div>
77
+ <div class="layui-inline deployment_type layui-hide">
78
+ <label class="layui-form-label required">部署类型</label>
79
+ <div class="layui-input-inline">
80
+ <%= select_tag "o_business_deployment", options_for_select(@deployment_type, @last_follow_up&.o_business_deployment), class: 'required' %>
81
+ </div>
82
+ </div>
77
83
  <br class="service_show layui-hide">
78
84
  <div class="layui-inline">
79
85
  <label class="layui-form-label">总额(万)</label>
@@ -168,10 +174,11 @@
168
174
  xmSelect = layui.xmSelect,
169
175
  $ = layui.$;
170
176
 
171
- flag =
172
- <%=@last_follow_up&.clazz&.name == @o_name %>
177
+ flag = <%=@last_follow_up&.clazz&.name == @o_name %>
173
178
  if (flag) {
179
+ console.log(flag)
174
180
  $(".service_show").removeClass('layui-hide')
181
+ $(".deployment_type").removeClass('layui-hide')
175
182
  }
176
183
 
177
184
  form.on('select(clazz_id)', function (data) {
@@ -179,8 +186,9 @@
179
186
  const value = data.value;
180
187
  if (value == <%= EducodeSales::Common.where(extras: EducodeSales::Common::OTYPE).first&.id %>) {
181
188
  $(".service_show").removeClass('layui-hide')
189
+ $(".deployment_type").removeClass('layui-hide')
182
190
  } else {
183
- console.log(data.value)
191
+ $(".deployment_type").addClass('layui-hide')
184
192
  $(".service_show").addClass('layui-hide')
185
193
  }
186
194
  })
@@ -292,6 +300,8 @@
292
300
  data.field.assign_follow_up = assign_follow;
293
301
  data.field.business_id = "<%= @business.id %>";
294
302
  data.field.place_id = place_list.getValue('valueStr');
303
+ console.log("start")
304
+ console.log(data.field)
295
305
  request.authPost("missions/follow_ups", data.field, function (res) {
296
306
  if (res.success == false) {
297
307
  layer.alert(res.msg)
@@ -178,6 +178,11 @@
178
178
  width: 200,
179
179
  title: '服务期',
180
180
  },
181
+ {
182
+ field: 'o_business_deployment',
183
+ width: 100,
184
+ title: '部署类型',
185
+ },
181
186
  {
182
187
  field: 'total_amount',
183
188
  width: 100,
@@ -219,7 +224,7 @@
219
224
  }
220
225
  ]
221
226
  ],
222
- limit: 20,
227
+ limit: 90,
223
228
  limits: [10,15,20,30,40,50,60,70,80,90],
224
229
  page: true,
225
230
  skin: 'line',
@@ -435,8 +440,6 @@
435
440
  }
436
441
  ]
437
442
  ],
438
-
439
-
440
443
  page: true,
441
444
  skin: 'line'
442
445
  });
@@ -10,6 +10,13 @@ json.data do
10
10
  json.bidded_date d.bidded_date&.to_s(:date)
11
11
  json.signed_date d.signed_date&.to_s(:date)
12
12
  json.service_end_time (d.service_start_time.present? && d.service_end_time.present?) ? (d.service_start_time&.to_s + "-" + d.service_end_time&.to_s) : ''
13
+ if d.o_business_deployment.present?
14
+ EducodeSales::FollowUp::BUSINESS_DEPLOYMENT.each do |m|
15
+ if d.o_business_deployment == m[1]
16
+ json.o_business_deployment m[0]
17
+ end
18
+ end
19
+ end
13
20
  json.total_amount d.total_amount
14
21
  json.actual_amount d.actual_amount
15
22
  json.divide_amount d.divide_amount ? d.divide_amount : ""
@@ -53,12 +53,22 @@
53
53
  </div>
54
54
  </div>
55
55
  <br>
56
- <div class="layui-inline">
57
- <label class="layui-form-label">服务期:</label>
58
- <div class="layui-input-inline">
59
- <%= @follow_up.service_start_time.to_s + "-" + @follow_up.service_end_time.to_s %>
56
+ <%if @follow_up.clazz_id == EducodeSales::Common.find_by(extras: EducodeSales::Common::OTYPE)&.id %>
57
+ <div class="layui-inline">
58
+ <label class="layui-form-label">服务期:</label>
59
+ <div class="layui-input-inline">
60
+ <%= @follow_up.service_start_time.to_s + "-" + @follow_up.service_end_time.to_s %>
61
+ </div>
60
62
  </div>
61
- </div>
63
+ <%end %>
64
+ <%if @follow_up.clazz_id == EducodeSales::Common.find_by(extras: EducodeSales::Common::OTYPE)&.id %>
65
+ <div class="layui-inline">
66
+ <label class="layui-form-label">部署类型:</label>
67
+ <div class="layui-input-inline">
68
+ <%=@show_follow_recored_deployment%>
69
+ </div>
70
+ </div>
71
+ <% end %>
62
72
  <br>
63
73
  <div class="layui-inline">
64
74
  <label class="layui-form-label">总额:</label>
@@ -2,7 +2,7 @@ total_amount = 0
2
2
  json.data do
3
3
  json.array! @money_plans do |d|
4
4
  json.id d.id
5
- json.date_at d.date_at.to_s(:date)
5
+ json.date_at (d&.date_at&.to_s(:date) || "")
6
6
  json.amount d.amount
7
7
  total_amount += d.amount
8
8
  json.clazz d.clazz
data/config/routes.rb CHANGED
@@ -13,6 +13,7 @@ EducodeSales::Engine.routes.draw do
13
13
  get :sales_staff, to: "home#sales_staff"
14
14
  get :sales_place, to: "home#sales_place"
15
15
  get :staff_schools, to: "home#staff_schools"
16
+ get :filter, to: "application#filter"
16
17
 
17
18
 
18
19
  resources :sessions do
@@ -0,0 +1,10 @@
1
+ class CreateFilter < ActiveRecord::Migration[5.2]
2
+ def change
3
+ create_table :educode_sales_filters do |t|
4
+ t.string :filter_type
5
+ t.references :staff
6
+ t.string :filter_data
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,5 @@
1
+ class ChangeEducodeSalesFilterColumnLength < ActiveRecord::Migration[5.2]
2
+ def change
3
+ change_column :educode_sales_filters, :filter_data, :text
4
+ end
5
+ end
@@ -0,0 +1,9 @@
1
+ class UpdateEducodeSalesFiltersFilterData < ActiveRecord::Migration[5.2]
2
+ def change
3
+ rename_column :educode_sales_filters, :filter_data , :extras
4
+ rename_column :educode_sales_filters, :filter_type, :clazz
5
+ EducodeSales::Filter.find_each do |filter|
6
+ filter.update_attributes!(:extras => nil )
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ class AddColumnOBusinessDeploymentToFollowUps < ActiveRecord::Migration[5.2]
2
+ def change
3
+ add_column :educode_sales_follow_ups, :o_business_deployment, :integer
4
+ end
5
+ end
@@ -1,3 +1,3 @@
1
1
  module EducodeSales
2
- VERSION = '0.7.9'
2
+ VERSION = '0.8.3'
3
3
  end