educode_sales 0.9.43 → 0.9.45

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.
@@ -45,6 +45,12 @@
45
45
  <script type="text/html" id="toolbarDemo">
46
46
  <div class="layui-btn-container">
47
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 %>
48
54
  <% if can? :create, EducodeSales::Customer %>
49
55
  <button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="add">添加客户</button>
50
56
  <% end %>
@@ -83,10 +89,11 @@
83
89
 
84
90
 
85
91
  <script>
86
- layui.use(['form', 'table', 'miniPage', 'element', 'request', 'laydate'], function () {
92
+ layui.use(['form', 'table', 'miniPage', 'element', 'request', 'laydate', 'upload'], function () {
87
93
  var $ = layui.jquery,
88
94
  form = layui.form,
89
95
  request = layui.request,
96
+ upload = layui.upload,
90
97
  dropdown = layui.dropdown,
91
98
  miniPage = layui.miniPage,
92
99
  laydate = layui.laydate;
@@ -102,18 +109,7 @@
102
109
 
103
110
  var property_list = xmSelect.render({
104
111
  el: '#property',
105
- data: [
106
- // {value: 0, name: '985工程'},
107
- // {value: 1, name: '211工程'},
108
- {value: 2, name: '本科院校'},
109
- {value: 5, name: '军事院校'},
110
- {value: 3, name: '高职院校'},
111
- {value: 4, name: '中职院校'},
112
- {value: 7, name: '中学'},
113
- {value: 8, name: '小学'},
114
- {value: 6, name: '企业'},
115
- {value: 9, name: '其他'},
116
- ]
112
+ data: gon.school_tags
117
113
  })
118
114
 
119
115
  laydate.render({
@@ -125,12 +121,13 @@
125
121
  });
126
122
 
127
123
  table = layui.table;
128
- table.render({
124
+ var customer_table = table.render({
129
125
  elem: '#customers_table',
130
126
  url: '/missions/customers',
131
127
  where: {q: form.val('search_teachers')},
132
128
  toolbar: '#toolbarDemo',
133
129
  // totalRow:true,
130
+ title: '客户列表',
134
131
  defaultToolbar: ['filter'],
135
132
  cols: [
136
133
  [
@@ -197,6 +194,11 @@
197
194
  limit: 20,
198
195
  limits: [10, 15, 20, 30, 40, 50, 60, 70, 80, 90],
199
196
  page: true,
197
+ done: function() {
198
+ if ($('#modify_customer').length > 0) {
199
+ uploadCustomer();
200
+ }
201
+ }
200
202
  });
201
203
 
202
204
  //监听表格复选框选择
@@ -360,6 +362,22 @@
360
362
  $(window).on("resize", function () {
361
363
  layer.full(index);
362
364
  });
365
+ } else if (obj.event == 'export') {
366
+ layer.load(0, {});
367
+ var data = form.val("search_teachers");
368
+ var property = [];
369
+ property_list.getValue().forEach(function (d) {
370
+ property.push(d.value);
371
+ })
372
+ data.property = property.toString();
373
+ request.authGet("/missions/customers?=" + $.param({q:data}), {
374
+ }, function (res) {
375
+ data = res.data
376
+ table.exportFile(customer_table.config.id, data, 'xls');
377
+ layer.closeAll('loading');
378
+ })
379
+ } else if (obj.event == 'modify_customer') {
380
+
363
381
  }
364
382
  });
365
383
 
@@ -514,11 +532,53 @@
514
532
  }
515
533
  });
516
534
 
535
+ function uploadCustomer() {
536
+ upload.render({
537
+ elem: '#modify_customer'
538
+ ,url: '/missions/customers/batch_update_school_tags'
539
+ ,accept: 'file' //普通文件
540
+ ,acceptMime: 'application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,application/vnd.ms-excel'
541
+ ,headers: {
542
+ 'X-CSRF-Token': $('meta[name=csrf-token]').attr('content')
543
+ }
544
+ ,before: function(obj){
545
+ layer.load();
546
+ }
547
+ ,done: function(res){
548
+ layer.msg('导入成功');
549
+ table.reload('customers_table');
550
+ layer.closeAll('loading'); //关闭loading
551
+ }
552
+ ,error: function(index, upload){
553
+ table.reload('file');
554
+ layer.closeAll('loading'); //关闭loading
555
+ layer.alert('导入失败,请检查文件格式')
556
+ layer.close(parent.import_index)
557
+ }
558
+ });
559
+ }
560
+ if ($('#modify_customer').length > 0) {
561
+ var uploadTip;
562
+ $(document).on('mouseenter', '#modify_customer', function() {
563
+ uploadTip = layer.tips("<p style='color:#000;'>" + "导入Excel文件可批量修改客户性质。表格格式:客户名称 区域 性质。格式按导出的客户列表格式导入" + "</p>",
564
+ this,
565
+ {
566
+ tips:[1,'#f2f2f2'],
567
+ time:0,
568
+ area: 'auto',
569
+ maxWidth:500
570
+ });
571
+ })
572
+
573
+ $(document).on('mouseleave', '#modify_customer', function() {
574
+ layer.close(uploadTip);
575
+ })
576
+ }
577
+
517
578
  });
518
579
  </script>
519
580
  <style>
520
581
  .layui-table-tool-temp {
521
- padding-right: 30px;
522
- !important;
582
+ padding-right: 30px; !important;
523
583
  }
524
584
  </style>
@@ -14,21 +14,21 @@ json.data do
14
14
  json.id d.id
15
15
  json.name d.name
16
16
  json.area d.province
17
- school_property = d.school_property
18
- property = []
19
- if school_property.present?
20
- # property << '985工程' if school_property.project_985
21
- # property << '211工程' if school_property.project_211
22
- property << '本科院校' if school_property.regular_college
23
- property << '大专院校' if school_property.junior_college
24
- property << '中专学校' if school_property.secondary_school
25
- property << '军事院校' if school_property.military_school
26
- property << '企业' if school_property.enterprise
27
- property << '小学' if school_property.ele_school
28
- property << '中学' if school_property.mid_school
29
- property << '其他' if school_property.other
30
- end
31
- json.property property.join("、")
17
+ # school_property = d.school_property
18
+ # property = []
19
+ # if school_property.present?
20
+ # # property << '985工程' if school_property.project_985
21
+ # # property << '211工程' if school_property.project_211
22
+ # property << '本科院校' if school_property.regular_college
23
+ # property << '大专院校' if school_property.junior_college
24
+ # property << '中专学校' if school_property.secondary_school
25
+ # property << '军事院校' if school_property.military_school
26
+ # property << '企业' if school_property.enterprise
27
+ # property << '小学' if school_property.ele_school
28
+ # property << '中学' if school_property.mid_school
29
+ # property << '其他' if school_property.other
30
+ # end
31
+ json.property d.school_tags.where(for_missions: true).pluck(:name).join("、")
32
32
  json.department d.departments.size
33
33
  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
34
34
  json.follow follow_ups.size + customer_follows.size
@@ -37,4 +37,6 @@ json.data do
37
37
  end
38
38
 
39
39
  json.code 0
40
- json.count @customers.total_count
40
+ if params[:page].present?
41
+ json.count @customers.total_count
42
+ end
@@ -13,7 +13,7 @@
13
13
  <div class="layui-input-block">
14
14
  <%= select_tag "role_id",
15
15
  options_for_select(EducodeSales::Role.pluck(:name, :id),
16
- @staff.role_id), { 'lay-filter': 'role_id' } %>
16
+ @staff.role_id), { 'lay-filter': 'role_id', include_blank: true } %>
17
17
  </div>
18
18
  </div>
19
19
  <div class="layui-form-item">
@@ -21,7 +21,7 @@
21
21
  <div class="layui-input-block">
22
22
  <%= select_tag "job_type",
23
23
  options_for_select(@staff_types,
24
- @staff.job_type), { 'lay-filter': 'job_type' } %>
24
+ @staff.job_type), { 'lay-filter': 'job_type', include_blank: true } %>
25
25
  </div>
26
26
  </div>
27
27
  <div class="layui-form-item">
data/config/routes.rb CHANGED
@@ -37,6 +37,7 @@ EducodeSales::Engine.routes.draw do
37
37
  get :new_department
38
38
  get :edit_department
39
39
  get :give
40
+ post :batch_update_school_tags
40
41
  end
41
42
 
42
43
  member do
@@ -49,6 +49,9 @@ class CreateEducodeSalesRolePermissions < ActiveRecord::Migration[5.2]
49
49
  EducodeSales::Permission.create(name: '编辑跟进记录', subject: 'Customer', action: 'update_follow', clazz: 'customer')
50
50
  EducodeSales::Permission.create(name: '删除跟进记录', subject: 'Customer', action: 'destroy_follow', clazz: 'customer')
51
51
 
52
+ EducodeSales::Permission.create(name: '导出', subject: 'Customer', action: 'export', clazz: 'customer')
53
+ EducodeSales::Permission.create(name: '批量导入修改客户类型', subject: 'Customer', action: 'modify_school_tag', clazz: 'customer')
54
+
52
55
 
53
56
  EducodeSales::Permission.create(name: '查看数据', subject: 'SaleTrend', action: 'trends', clazz: 'market')
54
57
  EducodeSales::Permission.create(name: '编辑目标', subject: 'SaleTrend', action: 'sale_trends', clazz: 'market')
@@ -1,3 +1,3 @@
1
1
  module EducodeSales
2
- VERSION = '0.9.43'
2
+ VERSION = '0.9.45'
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.9.43
4
+ version: 0.9.45
5
5
  platform: ruby
6
6
  authors:
7
7
  - anke1460
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-10 00:00:00.000000000 Z
11
+ date: 2023-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -105,7 +105,6 @@ files:
105
105
  - app/assets/images/educode_sales/icon-login.png
106
106
  - app/assets/images/educode_sales/icon.png
107
107
  - app/assets/images/educode_sales/indexLogo.png
108
- - app/assets/images/educode_sales/indexlogo.png
109
108
  - app/assets/images/educode_sales/loading-0.gif
110
109
  - app/assets/images/educode_sales/loading-1.gif
111
110
  - app/assets/images/educode_sales/loading-2.gif
@@ -502,7 +501,7 @@ homepage: https://www.educoder.net
502
501
  licenses:
503
502
  - MIT
504
503
  metadata: {}
505
- post_install_message:
504
+ post_install_message:
506
505
  rdoc_options: []
507
506
  require_paths:
508
507
  - lib
@@ -517,8 +516,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
517
516
  - !ruby/object:Gem::Version
518
517
  version: '0'
519
518
  requirements: []
520
- rubygems_version: 3.0.9
521
- signing_key:
519
+ rubygems_version: 3.0.0
520
+ signing_key:
522
521
  specification_version: 4
523
522
  summary: Summary of EducodeSales.
524
523
  test_files: []