educode_sales 0.9.24 → 0.9.26

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8c2b7f37f4b1fda07383d7cca772b7ee22fab18ca21a73ea6865f3d09e208dbc
4
- data.tar.gz: 92ab5c8bd9aa56c678d3f54e7720ba6d851d4745f16c55c6b841dd9810128471
3
+ metadata.gz: 23546de4bbb1afb063c383c9284ac5df3851a0b5b80ff1156b4a395d3bacdbdb
4
+ data.tar.gz: a4e1a21cab776582c8e5659778b81073ee5cd397e7544e8508e7d373a37fa99f
5
5
  SHA512:
6
- metadata.gz: 0f823e988d77eb4aff8ad1999a4ef058beb639bba844948144e444cd70065d0835e6865801537aabe4d03c3835f7db686edec6844de218afd925a14a2134801d
7
- data.tar.gz: 6009835052d5b11ce9d9609d16e2cb5e26d0cda5afb6f9bbeb3c2d8b7acd61e4a1ea1be955e9d6873143e25d5ec48e79903d3485ed42d7c4e7a8a348546f79f4
6
+ metadata.gz: 952ec86ff8bd23312b8b5e439c1adfebaa3547c59f5bc8f35553699f59ebc2163b64401a971a29207ceb29e3fb586f698a94d07c028fcf3ee7ed2d2fcf8d8aba
7
+ data.tar.gz: 16b22885432f18349e35abb396db51aad96b55ff882fbda645410e6fb7d1fc2bb59688aadebc5aab1e2ebf02a6b02417f3d55b99ebc2258850d005fb7d7e2046
@@ -34,7 +34,7 @@ module EducodeSales
34
34
  end
35
35
 
36
36
  if params[:bidded_date_year].present? && params[:bidded_date_year] != '全部'
37
- gon.bidded_date = Time.new(params[:bidded_date_year]).strftime("%Y-%m-%d") + " - " + Time.new(params[:bidded_date_year]).end_of_year.strftime("%Y-%m-%d")
37
+ gon.bidded_date = "2015-01-01" + " - " + Time.new(params[:bidded_date_year]).end_of_year.strftime("%Y-%m-%d")
38
38
  end
39
39
 
40
40
  if params[:signed_date_year].present? && params[:signed_date_year] != '全部'
@@ -173,6 +173,12 @@ module EducodeSales
173
173
  ").where("educode_sales_follow_ups.year = ?", params[:q][:business_year])
174
174
  end
175
175
 
176
+ if params[:q].present? && params[:q][:o_business_deployment].present?
177
+ @businesses = @businesses.joins("
178
+ JOIN educode_sales_follow_ups ON educode_sales_businesses.last_follow_up_id = educode_sales_follow_ups.id
179
+ ").where("educode_sales_follow_ups.o_business_deployment = ?", params[:q][:o_business_deployment])
180
+ end
181
+
176
182
  if params[:q].present? && params[:q][:area].present?
177
183
  p = EducodeSales::Common.find(params[:q][:area]).name
178
184
  if @current_admin.is_admin?
@@ -239,6 +245,7 @@ module EducodeSales
239
245
  educode_sales_businesses.*,
240
246
  last_follow.invitation_at,
241
247
  last_follow.budget_amount,
248
+ last_follow.o_business_deployment,
242
249
  last_follow.service_time_long,
243
250
  last_follow.service_end_time,
244
251
  last_follow.service_start_time,
@@ -45,8 +45,7 @@ module EducodeSales
45
45
  end
46
46
  if params[:q].present? && params[:q][:area].present?
47
47
  p = EducodeSales::Common.find(params[:q][:area]).name
48
- @follow_ups = @follow_ups.joins(:business).joins("
49
- JOIN departments ON educode_sales_businesses.department_id = departments.id
48
+ @follow_ups = @follow_ups.joins(business: :department).joins("
50
49
  JOIN schools ON departments.school_id = schools.id
51
50
  ").where("province = ?", p)
52
51
  end
@@ -57,6 +56,8 @@ module EducodeSales
57
56
 
58
57
  end
59
58
 
59
+ @follow_ups = @follow_ups.includes(:staff, :clazz, :stage, key_person: :teacher, business: [department: :school])
60
+
60
61
  if params[:sort].present? && params[:sort][:field]
61
62
  @follow_ups = @follow_ups.order("#{params[:sort][:field]} #{params[:sort][:order]}")
62
63
  else
@@ -22,7 +22,7 @@ module EducodeSales
22
22
  @service_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.stage_id IN (?)", s_stage_ids).sum(:total_amount).round(2)
23
23
  @actual_service_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.stage_id IN (?)", s_stage_ids).sum(:actual_amount).round(2)
24
24
 
25
- # @return_amount = Business.joins(last_follow_up: :money_plans).where("educode_sales_follow_ups.clazz_id != ?", x).where.not("educode_sales_money_plans.clazz!= ?", 1).sum(:amount).round(2)
25
+ @return_amount = Business.joins(last_follow_up: :money_plans).where("educode_sales_follow_ups.clazz_id != ?", x).where.not("educode_sales_money_plans.clazz!= ?", 1).sum(:amount).round(2)
26
26
  # # @return_amount = total_return[0]['return_money']&.round(2) || 0
27
27
  # @receivable_amount = @goal_amount - @return_amount
28
28
 
@@ -57,7 +57,7 @@ module EducodeSales
57
57
  # @former_return_amount = Business.joins(last_follow_up: :money_plans).where("educode_sales_follow_ups.clazz_id != ?", x).where.not("educode_sales_money_plans.clazz!= ?", 1).where("educode_sales_money_plans.date_at <= ? ", year_over_time).sum(:amount).round(2)
58
58
  # @receivable_amount = @former_goal_amount - @former_return_amount
59
59
 
60
- @receivable_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.bidded_date >= ? AND educode_sales_follow_ups.bidded_date <= ? AND educode_sales_follow_ups.stage_id IN (?)", "#{@year}-01-01", "#{@year}-12-31", stage_ids).select("(SUM(educode_sales_follow_ups.actual_amount) - SUM(educode_sales_businesses.return_money)) AS num")
60
+ @receivable_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.bidded_date <= ? AND educode_sales_follow_ups.stage_id IN (?)", "#{@year}-12-31", stage_ids).select("(SUM(educode_sales_follow_ups.actual_amount) - SUM(educode_sales_businesses.return_money)) AS num")
61
61
  @receivable_amount = @receivable_amount.present? && @receivable_amount[0]['num'] ? @receivable_amount[0]['num'].round(2) : 0
62
62
 
63
63
  a = Common.where(clazz: '商机类型', name: Common.find_by(extras: EducodeSales::Common::ATYPE)&.name).pluck(:id)
@@ -142,6 +142,12 @@
142
142
  title: '关键人',
143
143
  templet:'<div><span title="{{d.key_people}}">{{d.key_people}}</span></div>'
144
144
  },
145
+ {
146
+ field: 'tel',
147
+ width: 90,
148
+ title: '联系方式',
149
+ templet:'<div><span title="{{d.tel}}">{{d.tel}}</span></div>'
150
+ },
145
151
  {
146
152
  field: 'staff',
147
153
  width: 90,
@@ -195,15 +201,15 @@
195
201
  },
196
202
  where: {q: search, sort: sort}
197
203
  }, 'data');
198
- table.reload('businesses_table', {
199
- page: {
200
- curr: 1
201
- },
202
- where: {q: search, sort: sort}
203
- }, 'data');
204
- form.val('search_form', {
205
- name: data.field.name, department: data.field.department, staff_id: data.field.staff_id, area: data.field.area , description: data.field.description
206
- })
204
+ // table.reload('businesses_table', {
205
+ // page: {
206
+ // curr: 1
207
+ // },
208
+ // where: {q: search, sort: sort}
209
+ // }, 'data');
210
+ // form.val('search_form', {
211
+ // name: data.field.name, department: data.field.department, staff_id: data.field.staff_id, area: data.field.area , description: data.field.description
212
+ // })
207
213
  return false;
208
214
  });
209
215
 
@@ -19,8 +19,8 @@
19
19
  <% text += "二、本月已组织会议 \n\n"%>
20
20
  <% text += "三、客户跟进情况 \n"%>
21
21
  <% @followups.each_with_index do |d, i| %>
22
- <% text += "#{i+1}、**学校--**商机:#{d .description}\n" %>
23
- <p><%= i+1 %>、**学校--**商机:<%= d .description%></p>
22
+ <% text += "#{i+1}、#{d.business&.department&.school&.name}--**商机:#{d.description}\n" %>
23
+ <p><%= i+1 %>、<%= d.business&.department&.school&.name %>--**商机:<%= d.description%></p>
24
24
  <% end %>
25
25
 
26
26
  <% text += "\n四、需要协助支持事宜 \n\n"%>
@@ -94,9 +94,14 @@
94
94
  </div>
95
95
  </div>
96
96
  <div class="layui-inline show_item" style="<%= params[:name] || params[:type] ? '' : 'display:none;' %>">
97
- <label class="layui-form-label">编号</label>
97
+ <label class="layui-form-label">部署类型</label>
98
98
  <div class="layui-input-inline">
99
- <input type="text" class="layui-input" id="number" name="number" placeholder=" - " autocomplete="off">
99
+ <select name="o_business_deployment">
100
+ <option value=""></option>
101
+ <option value="1">公有云</option>
102
+ <option value="2">私有云</option>
103
+ <option value="3">混合云</option>
104
+ </select>
100
105
  </div>
101
106
  </div>
102
107
  <div class="layui-inline">
@@ -225,8 +230,8 @@
225
230
  value: gon.date_at
226
231
  });
227
232
 
228
-
229
-
233
+
234
+
230
235
  // $('#businesses_table_wraper .layui-table-body').on('scroll', function(e) {
231
236
  // var leftPx = $(e.target).scrollLeft(); //获取表格body,滚动条距离左边的长度
232
237
  // var left = 'translateX(-' + leftPx + 'px)';
@@ -246,7 +251,7 @@
246
251
  el: '#business_type',
247
252
  data: gon.business_type
248
253
  })
249
-
254
+
250
255
  var business_step_list = xmSelect.render({
251
256
  el: '#business_step',
252
257
  data: gon.business_step
@@ -299,7 +304,6 @@
299
304
 
300
305
  var data = form.val("search_form");
301
306
  data.business_year = gon.business_year;
302
-
303
307
  data.business_type = business_type_list.getValue('valueStr')
304
308
  data.business_step = business_step_list.getValue('valueStr');
305
309
 
@@ -547,6 +551,7 @@
547
551
  var business_table = table.render({
548
552
  elem: '#businesses_table',
549
553
  url: '/missions/businesses',
554
+ autoSort: false,
550
555
  where: {q: data},
551
556
  toolbar: '#bussinessBar',
552
557
  defaultToolbar: ['filter'],
@@ -864,11 +869,10 @@
864
869
 
865
870
 
866
871
 
867
- var sort = {}, search = {};
868
- <% if params[:name].present? %>
869
- search.name = "<%= params[:name] %>";
870
- <% end %>
872
+ var sort = {}, search = data;
873
+
871
874
  table.on('sort(businesses_table)', function (obj) {
875
+ var data = form.val("search_form");
872
876
  sort.field = obj.field;
873
877
  sort.order = obj.type;
874
878
  table.reload('businesses_table', {
@@ -905,15 +909,15 @@
905
909
  },
906
910
  where: {q: search, sort: sort}
907
911
  }, 'data');
908
- table.reload('teachers_table', {
909
- page: {
910
- curr: 1
911
- },
912
- where: {q: search, sort: sort}
913
- }, 'data');
914
- form.val('search_follows', {
915
- name: data.field.name, department: data.field.department, staff_id: data.field.staff_id, area: data.field.area
916
- })
912
+ // table.reload('teachers_table', {
913
+ // page: {
914
+ // curr: 1
915
+ // },
916
+ // where: {q: search, sort: sort}
917
+ // }, 'data');
918
+ // form.val('search_follows', {
919
+ // name: data.field.name, department: data.field.department, staff_id: data.field.staff_id, area: data.field.area
920
+ // })
917
921
  if (search['clazz'] == 'me') {
918
922
  $(".my-btn").addClass("selected-btn");
919
923
  } else if (search['clazz'] == 'followes') {
@@ -19,13 +19,9 @@ json.data do
19
19
  json.reception_at d.last_follow_up&.reception_at.to_s
20
20
  json.bidded_date d.last_follow_up&.bidded_date.to_s
21
21
  json.signed_date d.last_follow_up&.signed_date.to_s
22
+ json.o_business_deployment EducodeSales::FollowUp::BUSINESS_DEPLOYMENT[1..-1].to_h.invert[d.last_follow_up&.o_business_deployment]
22
23
  json.service_end_time d.last_follow_up&.service_start_time.to_s + "-" + d.last_follow_up&.service_end_time.to_s
23
- EducodeSales::FollowUp::BUSINESS_DEPLOYMENT[1..-1].each do |m|
24
- if d.last_follow_up&.o_business_deployment == m[1]
25
- json.o_business_deployment m[0]
26
- break
27
- end
28
- end
24
+
29
25
  json.divide_rate d.divide_rate
30
26
  json.divide_money d.divide_amount
31
27
  json.budget_amount d.budget_amount #d.follow_ups.where(stage_id: @budget_stage_ids).order("created_at desc").first&.total_amount&.round(2) || 0
@@ -1,4 +1,4 @@
1
- <form class="layui-form layuimini-form " id="custom_data" data-required="true" action="">
1
+ <div class="layui-form layuimini-form " id="custom_data" data-required="true">
2
2
  <div class="layui-form-item" style="padding: 25px">
3
3
  <div class="layui-inline">
4
4
  <label class="layui-form-label required">客户:</label>
@@ -30,7 +30,7 @@
30
30
  </div>
31
31
  </div>
32
32
  <div class="layui-form-item">
33
- <label class="layui-form-label">学校性质:</label>
33
+ <label class="layui-form-label required">学校性质:</label>
34
34
  <div class="layui-input-block">
35
35
  <input type="checkbox" name="project_985" lay-skin="primary" value="1" <%= 'checked' if @school_property&.project_985 %> title="985工程">
36
36
  <input type="checkbox" name="project_211" lay-skin="primary" value="1" <%= 'checked' if @school_property&.project_211 %> title="211工程" >
@@ -54,7 +54,7 @@
54
54
  </button>
55
55
  </div>
56
56
  </div>
57
- </form>
57
+ </div>
58
58
 
59
59
 
60
60
  <script>
@@ -339,6 +339,13 @@
339
339
  form.on('submit(data-reset-btn)', function (data) {
340
340
  data.field.province = $("#province option:selected").text(); //获取选中的项
341
341
  data.field.city = $("#city option:selected").text(); //获取选中的项
342
+ if (data.field.enterprise == undefined && data.field.junior_college == undefined &&
343
+ data.field.military_school == undefined && data.field.project_211 == undefined && data.field.project_985 == undefined
344
+ && data.field.regular_college == undefined && data.field.secondary_school == undefined) {
345
+ layer.alert("请选择学校性质");
346
+ return false;
347
+ }
348
+
342
349
  request.authPut("missions/customers/" + <%= @school.id %>, data.field, function (res) {
343
350
  if (res.success === false) {
344
351
  layer.alert(res.msg)
@@ -11,8 +11,9 @@ json.data do
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
14
- teacher_ids = d.key_person.pluck(:teacher_id)
15
- json.key_people key_people(teacher_ids)
14
+ # teacher_ids = d.key_person.pluck(:teacher_id)
15
+ json.tel d.key_person.pluck(:tel).select { |d| d.present? }.join("、")
16
+ json.key_people d.key_person.map { |d| d.teacher.name }.join("、")# key_people(teacher_ids)
16
17
 
17
18
  end
18
19
  end
@@ -25,15 +25,20 @@
25
25
  </form>
26
26
  </div>
27
27
  <canvas id="myChart" width="960" height="400"></canvas>
28
+ <div class="two-header" style="margin-top: 30px;">
29
+ <table id="followup_table" lay-filter="followup_table"></table>
30
+ </div>
28
31
  </div>
29
32
  </div>
30
33
  <script>
31
- layui.use(['form', 'jquery', 'request', 'element'], function () {
32
- form = layui.form;
34
+ layui.use(['form', 'jquery', 'request', 'element', 'table'], function () {
35
+ var table = layui.table,
36
+ form = layui.form;
37
+ chart_data = <%=raw @follow_count_data.to_json %>;
33
38
  var ctx = document.getElementById('myChart');
34
39
  myChart = new Chart(ctx, {
35
40
  type: 'line',
36
- data: <%=raw @follow_count_data.to_json %>,
41
+ data: chart_data,
37
42
  options: {
38
43
  elements: {
39
44
  line: {
@@ -42,12 +47,46 @@
42
47
  }
43
48
  }
44
49
  });
50
+
51
+
45
52
  form.render();
53
+
54
+ function renderTable(chart_data) {
55
+ var labels = [];
56
+ fields = [
57
+ {field: 'col0', title: '姓名', width:100}
58
+ ];
59
+ chart_data.labels.forEach(function(d, i) {
60
+ labels.push(d);
61
+ fields.push({title: d.split("(").join("<br/>").replace(")", ""), field: 'col' + (i + 1), width:160, align: 'center'})
62
+ })
63
+ var table_data = [];
64
+ chart_data.datasets.forEach(function(d, i) {
65
+ var value = {}
66
+ value['col0'] = d.label;
67
+ d.data.forEach(function(v, i1) {
68
+ value['col' + (i1 + 1)] = v;
69
+ })
70
+ table_data.push(value);
71
+ })
72
+ table.render({
73
+ elem: '#followup_table',
74
+ height: 312,
75
+ url: '',
76
+ limit: 30,
77
+ page: true,
78
+ data: table_data,
79
+ cols: [fields]
80
+ });
81
+ }
82
+
83
+ renderTable(chart_data);
46
84
  laydate.render({
47
85
  elem: '#date',
48
86
  range: true
49
87
  });
50
88
 
89
+
51
90
  laydate.render({
52
91
  elem: '#date_week',
53
92
  range: true
@@ -101,7 +140,8 @@
101
140
  } else {
102
141
  myChart.data.datasets = res.data.datasets;
103
142
  myChart.data.labels = res.data.labels;
104
- myChart.update()
143
+ myChart.update();
144
+ renderTable(res.data);
105
145
  }
106
146
  }
107
147
  });
@@ -54,9 +54,9 @@
54
54
  </div>
55
55
  </div>
56
56
  <div class="layui-input-inline" style="width: 300px;">
57
- <label class="layui-form-label ">联系方式</label>
57
+ <label class="layui-form-label required">联系方式</label>
58
58
  <div class="layui-input-block">
59
- <input type="text" class="layui-input" name="tel" autocomplete="off" value=""
59
+ <input type="text" class="layui-input" name="tel" autocomplete="off" value="" lay-verify="required"
60
60
  id="tel" placeholder="请输入联系方式">
61
61
  </div>
62
62
  </div>
@@ -297,4 +297,7 @@
297
297
  .ul-down .layui-icon-down{
298
298
  display: none;!important;
299
299
  }
300
+ .two-header thead .layui-table-cell {
301
+ height: auto;
302
+ }
300
303
  </style>
@@ -1,3 +1,3 @@
1
1
  module EducodeSales
2
- VERSION = '0.9.24'
2
+ VERSION = '0.9.26'
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.24
4
+ version: 0.9.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - anke1460
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-06 00:00:00.000000000 Z
11
+ date: 2022-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails