educode_sales 1.10.33 → 1.10.35

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 22b7976d2189b10d3280296023ca6d52fbb050307cf59d6b83c81547d5fee47e
4
- data.tar.gz: 4c81b96887d55e9bc415d2a0f0359884cb196a1dc900d9fc56b837585f6f882b
3
+ metadata.gz: 733d10f3f04531daa5d9aed3a9a9d8d34e41c74ca57ce61b817360147b914d61
4
+ data.tar.gz: 80527d327ad6f4cee282df6608140f1df12edac667b9882559d52e405ad0f14c
5
5
  SHA512:
6
- metadata.gz: 3697ec424b22d9ed64d8aa5d8e10665c719826651441a597376170287e0b9e54b565ec6ec0d5c545755a6899f5ea9ce5d530ab92daf36a92f843ffbd9d035f47
7
- data.tar.gz: c8a57001d38e3ca5f824167565b668228de6e089be99b44bd07b92732a6971fb3aa296b2abd0f945311b01dfa019887faf7a0a1e60b1924a0560d84b7979c329
6
+ metadata.gz: 82c1b9e3da991893900a0b5b28ff034ee6b818128f491fe3c9eb8b3b26025cdd283ce365c5ec5f495340d4fef314e78167941c6f89ced2533b0e6f08e7dd6f75
7
+ data.tar.gz: e710d633ca97617cb7c946d56c071f16d8339d208e851ef24b2a905c3d027aabf7dfbd38d1158793eadca1286af25fee759bc128e0e8de2b542de9649cd5bfa6
@@ -133,7 +133,19 @@ module EducodeSales
133
133
  elsif params[:q][:clazz] == 'delete_list'
134
134
  @businesses = Business.unscoped.where(state_id: [1, 3])
135
135
  elsif params[:q][:clazz] == 'plan_year'
136
- @businesses = Business.joins(:last_follow_up).where("educode_sales_follow_ups.plan_a_date > :year OR educode_sales_follow_ups.plan_return_date > :year OR educode_sales_follow_ups.invitation_at > :year", year: Time.now.beginning_of_year)
136
+ if @current_admin.is_admin?
137
+ @businesses = Business
138
+ else
139
+ # 年度计划,按负责区域和专项客户类型查看对应的年度商机
140
+ school_ids = School.where(province: @current_admin.areas.pluck(:name)).pluck(:id) + StaffSchool.where(staff_id: @current_admin.id).pluck(:school_id)
141
+ if @current_admin.staff_school_tags.present?
142
+ # 如果设置专项客户类型,则视为专项经理,根据专项客户查看对应商机
143
+ school_ids += School.joins(:school_tags).where("school_tags.id in (?)", @current_admin.staff_school_tags.pluck(:school_tag_id)).pluck(:id)
144
+ end
145
+ @businesses = Business.joins("JOIN departments ON educode_sales_businesses.department_id = departments.id").where("departments.school_id in (?) ", school_ids.uniq)
146
+ end
147
+
148
+ @businesses = @businesses.joins(:last_follow_up).where("educode_sales_follow_ups.plan_a_date > :year OR educode_sales_follow_ups.plan_return_date > :year OR educode_sales_follow_ups.invitation_at > :year", year: Time.now.beginning_of_year)
137
149
  end
138
150
  else
139
151
  if @current_admin.is_admin?
@@ -139,9 +139,13 @@ module EducodeSales
139
139
  assist_staff_ids = Array(params[:assist_staff_ids].to_s.split(","))
140
140
  attachment_ids = Array(params[:attachment_ids].to_s.split(","))
141
141
  other_staff_ids = Array(params[:other_staff_ids].to_s.split(","))
142
- if idea.business_id.present?
143
- idea.school_id = idea.business&.department&.school_id
144
- idea.department_id = idea.business&.department_id
142
+ if params[:business_id].present?
143
+ idea.business_id = params[:business_id]
144
+ elsif params[:school_id].present?
145
+ idea.name = params[:project_name]
146
+ end
147
+ if params[:school_id].present?
148
+ idea.school_id = params[:school_id]
145
149
  end
146
150
  idea.attachment_ids = attachment_ids
147
151
 
@@ -174,9 +178,13 @@ module EducodeSales
174
178
  @idea.attachment_ids = attachment_ids
175
179
  other_staff_ids = Array(params[:other_staff_ids].to_s.split(","))
176
180
  # @idea.other_staff_ids = other_staff_ids
177
- if @idea.business_id.present?
178
- @idea.school_id = @idea.business&.department&.school_id
179
- @idea.department_id = @idea.business&.department_id
181
+ if params[:business_id].present?
182
+ @idea.business_id = params[:business_id]
183
+ elsif params[:school_id].present?
184
+ @idea.name = params[:project_name]
185
+ end
186
+ if params[:school_id].present?
187
+ @idea.school_id = params[:school_id]
180
188
  end
181
189
  check_changes
182
190
  @idea.save
@@ -348,8 +356,8 @@ module EducodeSales
348
356
  def idea_params
349
357
  params.permit(:name, :level, :staff_id,
350
358
  :status, :types, :model, :hardware, :project,
351
- :money, :end_time, :content, :department_id, :school_id,
352
- :manager_name, :manager_phone, :school_name, :department_name, :attachment_id, :idea_type, :business_id)
359
+ :money, :end_time, :content, :department_id,
360
+ :manager_name, :manager_phone, :school_name, :department_name, :attachment_id, :idea_type)
353
361
  end
354
362
 
355
363
  def find_idea
@@ -24,7 +24,13 @@ module EducodeSales
24
24
  @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)
25
25
 
26
26
 
27
- @return_amount = EducodeSales::MoneyPlanRecord.joins(:money_plan_claims).sum(:amount).round(2)
27
+ @return_amount = EducodeSales::MoneyPlanRecord.from("(
28
+ SELECT distinct(educode_sales_money_plan_records.id), educode_sales_money_plan_records.amount
29
+ FROM educode_sales_money_plan_records
30
+ JOIN educode_sales_money_plan_claims ON educode_sales_money_plan_claims.money_plan_record_id = educode_sales_money_plan_records.id
31
+ GROUP BY educode_sales_money_plan_records.id
32
+ ) AS educode_sales_money_plan_records
33
+ ").sum("amount").round(2)
28
34
  # @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)
29
35
  # # @return_amount = total_return[0]['return_money']&.round(2) || 0
30
36
  # @receivable_amount = @goal_amount - @return_amount
@@ -54,7 +60,13 @@ module EducodeSales
54
60
  @actual_service_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.signed_date >= ? AND educode_sales_follow_ups.signed_date <= ? AND educode_sales_follow_ups.stage_id IN (?)", "#{@year}-01-01", "#{@year}-12-31", s_stage_ids).sum(:actual_amount).round(2)
55
61
  # @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 >= ? AND educode_sales_money_plans.date_at <= ? ", year_time, year_over_time).sum(:amount).round(2)
56
62
 
57
- @return_amount = EducodeSales::MoneyPlanRecord.joins(:money_plan_claims).where("educode_sales_money_plan_records.date_at >= ? AND educode_sales_money_plan_records.date_at <= ? ", year_time, year_over_time).sum(:amount).round(2)
63
+ @return_amount = EducodeSales::MoneyPlanRecord.from("(
64
+ SELECT distinct(educode_sales_money_plan_records.id), educode_sales_money_plan_records.amount, date_at
65
+ FROM educode_sales_money_plan_records
66
+ JOIN educode_sales_money_plan_claims ON educode_sales_money_plan_claims.money_plan_record_id = educode_sales_money_plan_records.id
67
+ GROUP BY educode_sales_money_plan_records.id
68
+ ) AS educode_sales_money_plan_records
69
+ ").where("educode_sales_money_plan_records.date_at >= ? AND educode_sales_money_plan_records.date_at <= ? ", year_time, year_over_time).sum(:amount).round(2)
58
70
  # 往年累计已中标合同
59
71
  # @former_goal_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).sum(:actual_amount).round(2)
60
72
  # # 往年累计已回款
@@ -56,7 +56,7 @@
56
56
  </div>
57
57
  </div>
58
58
  <div class="layui-inline">
59
- <label class="layui-form-label">项目名称</label>
59
+ <label class="layui-form-label">商机名称</label>
60
60
  <div class="layui-input-inline">
61
61
  <input type="text" class="layui-input" id="name" name="name" placeholder=" - " autocomplete="off">
62
62
  </div>
@@ -167,7 +167,7 @@
167
167
  {
168
168
  field: 'name',
169
169
  width: 160,
170
- title: '项目名称',
170
+ title: '商机名称',
171
171
  hide: gon.filter.name
172
172
  },
173
173
  {
@@ -9,7 +9,7 @@
9
9
  <div class="layui-col-md6">
10
10
  <labeL class="layui-form-label required">单位:</labeL>
11
11
  <div class="layui-input-block">
12
- <div id="school_id" style="width: 600px;"></div>
12
+ <div id="" style="width: 600px;"></div>
13
13
  </div>
14
14
  </div>
15
15
  <div class="layui-col-md6">
@@ -41,7 +41,7 @@
41
41
  </div>
42
42
  </div>
43
43
  <div class="layui-col-md6">
44
- <labeL class="layui-form-label">项目名称:</labeL>
44
+ <labeL class="layui-form-label">商机名称:</labeL>
45
45
  <div class="layui-input-block">
46
46
  <div id="business_id" style="width: 600px;"></div>
47
47
  </div>
@@ -53,6 +53,20 @@
53
53
  </div>
54
54
  </div>
55
55
  </div>
56
+ <div class="layui-row" style="padding-top: 15px;">
57
+ <div class="layui-col-md6">
58
+ <labeL class="layui-form-label">单位:</labeL>
59
+ <div class="layui-input-block">
60
+ <div id="school_id"></div>
61
+ </div>
62
+ </div>
63
+ <div class="layui-col-md6">
64
+ <labeL class="layui-form-label">项目名称:</labeL>
65
+ <div class="layui-input-block">
66
+ <input type="text" name="project_name" value="<%= @idea&.name %>" autocomplete="off" placeholder="请输入项目名称" class="layui-input">
67
+ </div>
68
+ </div>
69
+ </div>
56
70
  <div class="layui-row" style="padding-top: 15px;display: none">
57
71
  <div class="layui-col-md6" style="display: none">
58
72
  <labeL class="layui-form-label">方案经理:</labeL>
@@ -5,20 +5,6 @@
5
5
  <div class="layui-row">
6
6
  <h2 style="padding-left: 25px">方案信息</h2>
7
7
  </div>
8
- <div class="layui-row" style="padding-top: 15px;display: none">
9
- <div class="layui-col-md6">
10
- <labeL class="layui-form-label required">单位:</labeL>
11
- <div class="layui-input-block">
12
- <div id="school_id" style="width: 600px;"></div>
13
- </div>
14
- </div>
15
- <div class="layui-col-md6">
16
- <labeL class="layui-form-label">部门:</labeL>
17
- <div class="layui-input-block">
18
- <div id="department_id" style="width: 600px;"></div>
19
- </div>
20
- </div>
21
- </div>
22
8
  <div class="layui-row" style="padding-top: 15px">
23
9
  <div class="layui-col-md6">
24
10
  <labeL class="layui-form-label">单位联系人:</labeL>
@@ -41,9 +27,9 @@
41
27
  </div>
42
28
  </div>
43
29
  <div class="layui-col-md6">
44
- <labeL class="layui-form-label">项目名称:</labeL>
30
+ <labeL class="layui-form-label">商机名称:</labeL>
45
31
  <div class="layui-input-block">
46
- <div id="business_id" style="width: 600px;"></div>
32
+ <div id="business_id"></div>
47
33
  </div>
48
34
  </div>
49
35
  <div class="layui-col-md6" style="display: none">
@@ -53,6 +39,20 @@
53
39
  </div>
54
40
  </div>
55
41
  </div>
42
+ <div class="layui-row" style="padding-top: 15px;">
43
+ <div class="layui-col-md6">
44
+ <labeL class="layui-form-label">单位:</labeL>
45
+ <div class="layui-input-block">
46
+ <div id="school_id"></div>
47
+ </div>
48
+ </div>
49
+ <div class="layui-col-md6">
50
+ <labeL class="layui-form-label">项目名称:</labeL>
51
+ <div class="layui-input-block">
52
+ <input type="text" name="project_name" autocomplete="off" placeholder="请输入项目名称" class="layui-input">
53
+ </div>
54
+ </div>
55
+ </div>
56
56
  <div class="layui-row" style="padding-top: 15px;display: none">
57
57
  <div class="layui-col-md6" style="display: none">
58
58
  <labeL class="layui-form-label">方案经理:</labeL>
@@ -412,10 +412,6 @@
412
412
 
413
413
  //监听提交
414
414
  form.on('submit(saveBtn)', function (data) {
415
- // if (department.getValue() == "" && department_id == "") {
416
- // layer.alert("请选择单位部门")
417
- // return false;
418
- // } else {
419
415
 
420
416
  var schools = [];
421
417
  school_list.getValue().forEach(function (d) {
@@ -438,6 +434,7 @@
438
434
  data.field.assist_staff_ids = assist_staff_list.getValue('valueStr');
439
435
  data.field.other_staff_ids = other_staff_list.getValue('valueStr');
440
436
  data.field.attachment_ids = attachment_list.getValue('valueStr');
437
+ data.field.school_id = school_list.getValue('valueStr');
441
438
  request.authPost("missions/ideas/", data.field, function (res) {
442
439
  if (res.success == false) {
443
440
  layer.alert(res.msg)
@@ -1,3 +1,3 @@
1
1
  module EducodeSales
2
- VERSION = '1.10.33'
2
+ VERSION = '1.10.35'
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: 1.10.33
4
+ version: 1.10.35
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-07-13 00:00:00.000000000 Z
11
+ date: 2023-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -105,6 +105,7 @@ 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
108
109
  - app/assets/images/educode_sales/loading-0.gif
109
110
  - app/assets/images/educode_sales/loading-1.gif
110
111
  - app/assets/images/educode_sales/loading-2.gif
@@ -757,7 +758,7 @@ homepage: https://www.educoder.net
757
758
  licenses:
758
759
  - MIT
759
760
  metadata: {}
760
- post_install_message:
761
+ post_install_message:
761
762
  rdoc_options: []
762
763
  require_paths:
763
764
  - lib
@@ -772,8 +773,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
772
773
  - !ruby/object:Gem::Version
773
774
  version: '0'
774
775
  requirements: []
775
- rubygems_version: 3.0.0
776
- signing_key:
776
+ rubygems_version: 3.0.9
777
+ signing_key:
777
778
  specification_version: 4
778
779
  summary: Summary of EducodeSales.
779
780
  test_files: []