educode_sales 0.8.1 → 0.8.4

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.
@@ -257,202 +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
- toolbar: '#bussinessBar',
265
- defaultToolbar: ['filter'],
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
- hide: gon.business_filter.name
284
- },
285
- {
286
- field: 'school',
287
- width: 150,
288
- title: '单位',
289
- templet: '#school_name',
290
- hide: gon.business_filter.school
291
- },
292
- {
293
- field: 'department',
294
- width: 150,
295
- title: '部门',
296
- templet: '<div><span title="{{d.department}}">{{d.department}}</span></div>',
297
- hide: gon.business_filter.department
298
- },
299
- {
300
- field: 'follow_ups_count',
301
- title: '跟进',
302
- width: 60,
303
- templet: '#show_follow',
304
- totalRow: true,
305
- hide: gon.business_filter.name
306
- },
307
- // {
308
- // field: 'teachers_count',
309
- // width: 100,
310
- // title: '关键人',
311
- // templet: '#show_keys'
312
- // },
313
- {
314
- field: 'clazz',
315
- width: 80,
316
- title: '类型',
317
- templet: '<div><span title="{{d.clazz}}">{{d.clazz}}</span></div>',
318
- hide: gon.business_filter.name
319
- },
320
- {
321
- field: 'stage',
322
- width: 90,
323
- title: '阶段',
324
- hide: gon.business_filter.name
325
- },
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
+ },
326
318
  {
327
319
  field: 'source',
328
320
  width: 90,
329
321
  title: '商机来源',
330
- hide: gon.business_filter.source
322
+ hide: gon.filter.source
331
323
  },
332
324
  {
333
325
  field: 'last_follow_person',
334
326
  width: 100,
335
327
  title: '最新跟进人',
336
- hide: gon.business_filter.last_follow_person
328
+ hide: gon.filter.last_follow_person
337
329
  },
338
330
  {
339
331
  field: 'latest_time',
340
332
  width: 200,
341
333
  title: '最新跟进时间',
342
334
  sort: true,
343
- hide: gon.business_filter.latest_time
335
+ hide: gon.filter.latest_time
344
336
  },
345
- {
346
- field: 'invitation_at',
347
- width: 105,
348
- title: '招标时间',
349
- sort: true,
350
- hide: gon.business_filter.invitation_at
351
- },
352
- {
353
- field: 'bidded_date',
354
- width: 105,
355
- title: '中标时间',
356
- sort: true,
357
- hide: gon.business_filter.bidded_date
358
- },
359
- {
360
- field: 'signed_date',
361
- width: 105,
362
- title: '签单时间',
363
- sort: true,
364
- hide: gon.business_filter.signed_date
365
- },
366
- {
367
- field: 'reception_at',
368
- width: 105,
369
- title: '验收时间',
370
- sort: true,
371
- hide: gon.business_filter.reception_at
372
- },
373
- {
374
- field: 'service_end_time',
375
- width: 200,
376
- title: '服务期',
377
- sort: true,
378
- hide: gon.business_filter.service_end_time
379
- },
380
- {
381
- field: 'total_amount',
382
- width: 100,
383
- title: '总额',
384
- totalRow: true,
385
- sort: true,
386
- hide: gon.business_filter.total_amount
387
- },
388
- {
389
- field: 'actual_amount',
390
- width: 100,
391
- title: '合同额',
392
- totalRow: true,
393
- sort: true,
394
- hide: gon.business_filter.actual_amount
395
- },
396
- {
397
- field: 'return_money',
398
- width: 100,
399
- title: '回款',
400
- sort: true,
401
- totalRow: true,
402
- hide: gon.business_filter.return_money
403
- },
404
- {
405
- field: 'wait_return_money',
406
- width: 100,
407
- title: '待回款',
408
- sort: true,
409
- totalRow: true,
410
- hide: gon.business_filter.wait_return_money
411
- },
412
- {
413
- field: 'return_money_days',
414
- width: 150,
415
- title: '首次回款周期(天)',
416
- hide: gon.business_filter.return_money_days
417
- },
418
- {
419
- field: 'place',
420
- width: 160,
421
- title: '渠道',
422
- hide: gon.business_filter.place
423
- },
424
- {
425
- field: 'year',
426
- width: 105,
427
- title: '所属年度',
428
- sort: true,
429
- hide: gon.business_filter.year
430
- },
431
- {
432
- field: 'followed',
433
- templet:function(d){
434
- 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){
435
434
 
436
- return '<i class="layui-icon" style="color: goldenrod">&#xe658;</i> '
437
- }
435
+ return '<i class="layui-icon" style="color: goldenrod">&#xe658;</i> '
436
+ }
438
437
 
439
- else return ''
440
- },
441
- width: 105,
442
- title: '关注',
443
- align: "center",
444
- hide: gon.business_filter.followed
438
+ else return ''
439
+ },
440
+ width: 105,
441
+ title: '关注',
442
+ align: "center",
443
+ hide: gon.filter.followed
445
444
 
446
- },
447
- {
448
- title: '操作',
449
- minWidth: 220,
450
- toolbar: '#currentTableBar',
451
- align: "center",
452
- fixed: 'right',
453
- }
445
+ },
446
+ {
447
+ title: '操作',
448
+ minWidth: 220,
449
+ toolbar: '#currentTableBar',
450
+ align: "center",
451
+ fixed: 'right',
452
+ }
454
453
  ]
455
- ],
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,
456
464
 
457
465
  limit: 20,
458
466
  limits: [10,15,20,30,40,50,60,70,80,90],
@@ -816,7 +824,6 @@
816
824
  data.field.business_type = business_type.toString();
817
825
  data.field.business_step = business_step.toString();
818
826
  search = data.field
819
- console.log(search);
820
827
  table.reload('businesses_table', {
821
828
  url: '/missions/businesses',
822
829
  page: {
@@ -825,7 +832,6 @@
825
832
  where: {q: search, sort: sort}
826
833
  }, 'data');
827
834
  table.reload('teachers_table', {
828
- url: '/missions/businesses',
829
835
  page: {
830
836
  curr: 1
831
837
  },
@@ -854,15 +860,36 @@
854
860
 
855
861
  return false;
856
862
  });
857
-
858
863
  table.on('toolbar(businesses_table)', function (obj) {
859
864
  switch (obj.event) {
860
865
  case 'LAYTABLE_COLS':
861
- layui.form.on('checkbox(LAY_TABLE_TOOL_COLS)', function(obj) {
862
- var value = obj.elem.checked
863
- var name = obj.elem.attributes[1].value
864
- console.log(obj.elem.attributes.name);
865
- request.get('missions/filter?type=businesses_list&name='+name+'&hidden='+value,{},function (res){})
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
+ })
866
893
  });
867
894
  }
868
895
 
@@ -18,6 +18,12 @@ 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[1..-1].each do |m|
22
+ if d.last_follow_up&.o_business_deployment == m[1]
23
+ json.o_business_deployment m[0]
24
+ break
25
+ end
26
+ end
21
27
  json.year d.last_follow_up&.year.to_s
22
28
  json.total_amount d.last_follow_up&.total_amount
23
29
  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, nil ), 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
  })
@@ -283,6 +291,10 @@
283
291
  layer.msg('请选择服务期', {time: 2000, icon: 2, shade: 0.01});
284
292
  return false;
285
293
  }
294
+ if (data.field.o_business_deployment === ''){
295
+ layer.msg('请选择部署类型');
296
+ return false // 退出添加该条记录
297
+ }
286
298
  }
287
299
  $(".submit-btn").addClass("layui-hide");
288
300
  var assign_follow = [];
@@ -292,6 +304,8 @@
292
304
  data.field.assign_follow_up = assign_follow;
293
305
  data.field.business_id = "<%= @business.id %>";
294
306
  data.field.place_id = place_list.getValue('valueStr');
307
+ console.log("start")
308
+ console.log(data.field)
295
309
  request.authPost("missions/follow_ups", data.field, function (res) {
296
310
  if (res.success == false) {
297
311
  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
@@ -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.8.1'
2
+ VERSION = '0.8.4'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: educode_sales
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - anke1460
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-07 00:00:00.000000000 Z
11
+ date: 2022-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -456,6 +456,8 @@ files:
456
456
  - db/migrate/20220420071909_create_educode_sales_business_relation_ships.rb
457
457
  - db/migrate/20220507020149_create_filter.rb
458
458
  - db/migrate/20220507091959_change_educode_sales_filter_column_length.rb
459
+ - db/migrate/20220509073936_update_educode_sales_filters_filter_data.rb
460
+ - db/migrate/20220512031715_add_column_o_business_deployment_to_follow_ups.rb
459
461
  - lib/educode_sales.rb
460
462
  - lib/educode_sales/engine.rb
461
463
  - lib/educode_sales/version.rb