educode_sales 0.9.39 → 0.9.41

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: '0488628c96716313e1eea256035cfdb1d8cf279a5260b24637ce11f9d4bad0da'
4
- data.tar.gz: b5706f45f7360c978624378e74ede31f1a429868a8b5574b413dc9932f679784
3
+ metadata.gz: bbfbd499c3b8b9a0b17b3178a95cb9bf9599376ef9d372e04c4fc42c54d9e93d
4
+ data.tar.gz: 1d8c044c648874c7cc36035a0c0271bc1017d3bae1fa051e546d094cfb8a6803
5
5
  SHA512:
6
- metadata.gz: 584eed74e015e9c2f9d9e90deb17d2ff45b8b255fb4886ffa7244834b2fe661d49731606a3c2daa5b7d9f1f2e12097a4590cdfd1fe9df3c2534650c6d122a56a
7
- data.tar.gz: 36c75432a6286b056b4f4eee4a34ba68a12ab23265a92d41fb7d6a437385fb544fb33efa31d8d9fbac5db42d9df4ec979c477d53325857510eb5fa439e2c259f
6
+ metadata.gz: b8507c1f295984000ec4cd5d650c46d42efd0bba14479039da5f3cf7b2c3e63b272d38219ed175f305743029721d6e11bd293be9a7f62683924480717ef93464
7
+ data.tar.gz: 4c7dbc8bff6bdc3c6ffa8152a5efde7463e60ed60bfd560cef86f2d3fead6843c1ae561c62bd640e0ebacf9b43590ebf1b07d74981d7688cd5f4f87c77ee3a98
@@ -10,7 +10,8 @@ module EducodeSales
10
10
  respond_to do |format|
11
11
  format.html do
12
12
  common = Common.find_by(clazz: 'staff_type', name: '销售')
13
- @staffs = Staff.joins(:user).where(job_type: common.id).where.not(role_id: 11).map { |d| [d.user.real_name, d.id]} # [[], [], ............]
13
+ @staffs = Staff.joins(:user).where(job_type: common.id).where.not(role_id: 11).map { |d| [d.user.real_name, d.id]}
14
+ gon.staffs = Staff.joins(:user).where(job_type: common.id).where.not(role_id: 11).map { |d| {name: d.user.real_name, value: d.id } }
14
15
  # @more = can?(:create, EducodeSales::SalePlan) || can?(:update, EducodeSales::Business) || can?(:destroy, EducodeSales::Business) || can?(:show_file, EducodeSales::Business)
15
16
  @more = true
16
17
  gon.menus = []
@@ -40,7 +41,7 @@ module EducodeSales
40
41
  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")
41
42
  end
42
43
  end
43
-
44
+
44
45
  if params[:signed_date_year].present? && params[:signed_date_year] != '全部'
45
46
  gon.signed_date = Time.new(params[:signed_date_year]).strftime("%Y-%m-%d") + " - " + Time.new(params[:signed_date_year]).end_of_year.strftime("%Y-%m-%d")
46
47
  end
@@ -94,20 +95,42 @@ module EducodeSales
94
95
  end
95
96
  end
96
97
  format.json do
97
- if @current_admin.is_admin?
98
- @businesses = Business
98
+ if params[:q] && (params[:q][:clazz] == 'area' || params[:q][:clazz] == 'special')
99
+ if params[:q][:clazz] == 'special'
100
+ school_ids = []
101
+ # 专项商机
102
+ school_tag_ids = @current_admin.staff_school_tags.pluck(:school_tag_id)
103
+ school_ids = SchoolTagMiddle.where(school_tag_id: school_tag_ids).pluck(:school_id)
104
+ @businesses = Business.joins("JOIN departments AS dp ON educode_sales_businesses.department_id = dp.id").where("dp.school_id in (?)", school_ids)
105
+ elsif params[:q][:clazz] == 'area'
106
+ school_ids = []
107
+ # 区域管理商机
108
+ school_ids = School.where(province: @current_admin.areas.pluck(:name)).pluck(:id) + StaffSchool.where(staff_id: @current_admin.id).pluck(:school_id)
109
+ @businesses = Business.joins("JOIN departments AS dp ON educode_sales_businesses.department_id = dp.id").where("dp.school_id in (?)", school_ids)
110
+ end
99
111
  else
100
- level = @current_admin.role.role_areas.find_by(clazz: '商机管理').level
101
- case level
102
- when '自己'
103
- business_ids = Business.joins(last_follow_up: :assign_follow_ups).where("educode_sales_assign_follow_ups.staff_id = ?", @current_admin.id).pluck(:id)
104
- @businesses = Business.where("educode_sales_businesses.staff_id = ? OR educode_sales_businesses.id in (?)", @current_admin.id, business_ids)
105
- when '区域'
106
- school_ids = School.where(province: @current_admin.areas.pluck(:name)).pluck(:id) + StaffSchool.where(staff_id: @current_admin.id).pluck(:school_id)
107
- business_ids = Business.joins(last_follow_up: :assign_follow_ups).where("educode_sales_assign_follow_ups.staff_id = ?", @current_admin.id).pluck(:id)
108
- @businesses = Business.joins("JOIN departments ON educode_sales_businesses.department_id = departments.id").where("departments.school_id in (?) OR educode_sales_businesses.staff_id = #{@current_admin.id} OR educode_sales_businesses.id in (?)", school_ids, business_ids)
109
- else
112
+ if @current_admin.is_admin?
110
113
  @businesses = Business
114
+ else
115
+ level = @current_admin.role.role_areas.find_by(clazz: '商机管理').level
116
+ case level
117
+ when '自己'
118
+ business_ids = Business.joins(last_follow_up: :assign_follow_ups).where("educode_sales_assign_follow_ups.staff_id = ?", @current_admin.id).pluck(:id)
119
+ @businesses = Business.where("educode_sales_businesses.staff_id = ? OR educode_sales_businesses.id in (?)", @current_admin.id, business_ids)
120
+ when '区域'
121
+
122
+ school_ids = School.where(province: @current_admin.areas.pluck(:name)).pluck(:id) + StaffSchool.where(staff_id: @current_admin.id).pluck(:school_id)
123
+ if can?(:special, EducodeSales::Business)
124
+ # 专项商机
125
+ school_tag_ids = @current_admin.staff_school_tags.pluck(:school_tag_id)
126
+ tag_school_ids = SchoolTagMiddle.where(school_tag_id: school_tag_ids).pluck(:school_id)
127
+ school_ids += tag_school_ids
128
+ end
129
+ business_ids = Business.joins(last_follow_up: :assign_follow_ups).where("educode_sales_assign_follow_ups.staff_id = ?", @current_admin.id).pluck(:id)
130
+ @businesses = Business.joins("JOIN departments ON educode_sales_businesses.department_id = departments.id").where("departments.school_id in (?) OR educode_sales_businesses.staff_id = #{@current_admin.id} OR educode_sales_businesses.id in (?)", school_ids, business_ids)
131
+ else
132
+ @businesses = Business
133
+ end
111
134
  end
112
135
  end
113
136
  if params[:q].present? && params[:q][:name].present?
@@ -115,8 +138,6 @@ module EducodeSales
115
138
  end
116
139
 
117
140
  # @budget_stage_ids = Common.where(clazz: '商机阶段', name: ['初步接洽', '准备方案','已交方案', '已立项']).pluck(:id)
118
-
119
-
120
141
  if params[:q] && params[:q][:signed_date].present?
121
142
  date = params[:q][:signed_date].split(" - ")
122
143
  @businesses = @businesses.joins("
@@ -177,6 +198,12 @@ module EducodeSales
177
198
  ").where("educode_sales_follow_ups.year = ?", params[:q][:business_year])
178
199
  end
179
200
 
201
+ if params[:q].present? && params[:q][:year].present?
202
+ @businesses = @businesses.joins("
203
+ JOIN educode_sales_follow_ups ON educode_sales_businesses.last_follow_up_id = educode_sales_follow_ups.id
204
+ ").where("educode_sales_follow_ups.year <= ?", params[:q][:year])
205
+ end
206
+
180
207
  if params[:q].present? && params[:q][:o_business_deployment].present?
181
208
  @businesses = @businesses.joins("
182
209
  JOIN educode_sales_follow_ups ON educode_sales_businesses.last_follow_up_id = educode_sales_follow_ups.id
@@ -537,6 +564,12 @@ module EducodeSales
537
564
  ").where("educode_sales_follow_ups.year = ?", params[:business_year])
538
565
  end
539
566
 
567
+ if params[:year].present?
568
+ @businesses = @businesses.joins("
569
+ JOIN educode_sales_follow_ups ON educode_sales_businesses.last_follow_up_id = educode_sales_follow_ups.id
570
+ ").where("educode_sales_follow_ups.year <= ?", params[:year])
571
+ end
572
+
540
573
  if params[:all].present?
541
574
  @businesses = @businesses
542
575
  end
@@ -88,7 +88,7 @@ module EducodeSales
88
88
  follow_up.clazz_changed = last_follow_up.clazz_id != follow_up.clazz_id
89
89
  if follow_up.clazz_changed
90
90
  clazz_changes = "#{last_follow_up.clazz.extras.split('_')[0]}-#{follow_up.clazz.extras.split('_')[0]}"
91
- business_clazz_change = @business.business_clazz_changes.find_or_initialize_by clazz_changed: clazz_changes
91
+ business_clazz_change = EducodeSales::BusinessClazzChange.find_or_initialize_by(business_id: @business.id, clazz_changed: clazz_changes)
92
92
  business_clazz_change.save unless business_clazz_change.persisted?
93
93
  end
94
94
  end
@@ -38,7 +38,7 @@ module EducodeSales
38
38
  year_over_time = "#{@year}-12-31 23:59:59"
39
39
 
40
40
  @sale_trend = SaleTrend.find_or_create_by(year: @year)
41
- @business_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ? AND educode_sales_follow_ups.clazz_id != ?", x, o).where("educode_sales_follow_ups.year = ?", @year).sum(:total_amount).round(2)
41
+ @business_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ? AND educode_sales_follow_ups.clazz_id != ?", x, o).where("educode_sales_follow_ups.year <= ?", @year).sum(:total_amount).round(2)
42
42
  stage_ids = Common.where(clazz: '商机阶段', name: ['已中标', '已签单', '已验收', '回款中', '服务中', '已结束']).pluck(:id)
43
43
 
44
44
  # 中标总金额, 已回款总金额
@@ -61,9 +61,9 @@ module EducodeSales
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)
64
- @a_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id IN (?)", a).where("educode_sales_follow_ups.year = ?", @year).sum(:total_amount).round(2)
64
+ @a_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id IN (?)", a).where("educode_sales_follow_ups.year <= ?", @year).sum(:total_amount).round(2)
65
65
  b = Common.where(clazz: '商机类型', name: Common.find_by(extras: EducodeSales::Common::BTYPE)&.name).pluck(:id)
66
- @b_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id IN (?)", b).where("educode_sales_follow_ups.year = ?", @year).sum(:total_amount).round(2)
66
+ @b_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id IN (?)", b).where("educode_sales_follow_ups.year <= ?", @year).sum(:total_amount).round(2)
67
67
  end
68
68
 
69
69
  end
@@ -52,6 +52,8 @@ module EducodeSales
52
52
  # gon.school_ids = School.all.ids
53
53
  # gon.schools = School.all.first(100).map { |d| { value: d.id, title: d.name } } #.unshift({value: -1, title: '全国'})
54
54
  @staff_types = Common.where(clazz: 'staff_type').pluck(:name, :id)
55
+ tag_ids = @staff.staff_school_tags.pluck(:school_tag_id)
56
+ gon.school_properties = SchoolTag.where(weight: 1).map { |d| {value: d.id, name: d.name, selected: tag_ids.include?(d.id) } }
55
57
  render layout: false
56
58
  end
57
59
 
@@ -87,13 +89,20 @@ module EducodeSales
87
89
  end
88
90
  staff.areas = commons
89
91
  if params[:school_ids].present?
90
- staff.staff_schools.destroy_all
92
+ schools = []
91
93
  params[:school_ids].each do |d|
92
- staff.staff_schools.create(school_id: d)
94
+ schools << EducodeSales::StaffSchool.find_or_initialize_by(staff_id: staff.id, school_id: d)
93
95
  end
96
+ staff.staff_schools = schools
94
97
  else
95
98
  staff.staff_schools.destroy_all
96
99
  end
100
+ tags = []
101
+ params[:school_tag_ids].each do |tag_id|
102
+ tags << EducodeSales::StaffSchoolTag.find_or_initialize_by(staff_id: staff.id, school_tag_id: tag_id)
103
+ end
104
+
105
+ staff.staff_school_tags = tags
97
106
  params[:current_admin] = @current_admin.id
98
107
  impressionist(staff, params)
99
108
  if staff.save
@@ -1,7 +1,7 @@
1
1
  module EducodeSales
2
2
  class BusinessClazzChange < ApplicationRecord
3
3
  belongs_to :business
4
- validates :clazz_changed, uniqueness: { message: '已存在' }
4
+ validates :clazz_changed, uniqueness: {scope: :business_id, message: '已存在' }
5
5
 
6
6
 
7
7
 
@@ -19,6 +19,8 @@ module EducodeSales
19
19
 
20
20
  has_many :login_histories, dependent: :destroy
21
21
 
22
+ has_many :staff_school_tags, dependent: :destroy
23
+
22
24
  has_many :market_areas, dependent: :destroy
23
25
  has_many :areas, through: :market_areas
24
26
  validates :user_id, uniqueness: { message: '已存在' }
@@ -0,0 +1,6 @@
1
+ module EducodeSales
2
+ class StaffSchoolTag < ApplicationRecord
3
+ belongs_to :staff
4
+ belongs_to :school_tag
5
+ end
6
+ end
@@ -30,7 +30,7 @@
30
30
  <div class="layui-inline">
31
31
  <label class="layui-form-label">最新跟进人</label>
32
32
  <div class="layui-input-inline">
33
- <%= select_tag "staff_id", options_for_select(@staffs, params[:staff_id]), { 'lay-filter': 'staff_id', include_blank: true } %>
33
+ <div id="staffs_id" style="width: 190px;"></div>
34
34
  </div>
35
35
  </div>
36
36
  <div class="layui-inline">
@@ -151,6 +151,12 @@
151
151
  <% end %>
152
152
  <button class="layui-btn layui-btn-primary layui-border-green layui-btn-sm pull-right at-btn" lay-event="followes"> 我的关注</button>
153
153
  <button class="layui-btn layui-btn-primary layui-border-green layui-btn-sm pull-right my-btn" lay-event="mine"> 我的商机</button>
154
+ <% if can?(:special, EducodeSales::Business) %>
155
+ <button class="layui-btn layui-btn-primary layui-border-green layui-btn-sm pull-right s-btn" lay-event="special">专项管理商机</button>
156
+ <% end %>
157
+ <% if can?(:area_manage, EducodeSales::Business) %>
158
+ <button class="layui-btn layui-btn-primary layui-border-green layui-btn-sm pull-right area-btn" lay-event="area">区域管理商机</button>
159
+ <% end %>
154
160
  <button class="layui-btn layui-btn-primary layui-border-green layui-btn-sm pull-right all-btn" lay-event="all"> 全部商机</button>
155
161
  </div>
156
162
  </script>
@@ -268,6 +274,13 @@
268
274
  data: gon.business_type
269
275
  })
270
276
 
277
+ var staff_list = xmSelect.render({
278
+ el: '#staffs_id',
279
+ data: gon.staffs,
280
+ filterable: true,
281
+ radio: true,
282
+ })
283
+
271
284
  var business_step_list = xmSelect.render({
272
285
  el: '#business_step',
273
286
  data: gon.business_step
@@ -322,6 +335,10 @@
322
335
  data.business_year = gon.business_year;
323
336
  data.business_type = business_type_list.getValue('valueStr')
324
337
  data.business_step = business_step_list.getValue('valueStr');
338
+ data.staff_id = staff_list.getValue('valueStr');
339
+ <% if params[:year].present? %>
340
+ data.year = "<%= params[:year] %>";
341
+ <% end %>
325
342
 
326
343
  table = layui.table;
327
344
  var cols_table = [
@@ -413,6 +430,19 @@
413
430
  title: '最新跟进人',
414
431
  hide: gon.filter.last_follow_person
415
432
  },
433
+ {
434
+ field: 'no_followup_days',
435
+ width: 100,
436
+ title: '无跟进天数',
437
+ hide: gon.filter.no_followup_days
438
+ },
439
+ {
440
+ field: 'created_at',
441
+ width: 200,
442
+ title: '商机创建时间',
443
+ sort: true,
444
+ hide: gon.filter.created_at
445
+ },
416
446
  {
417
447
  field: 'latest_time',
418
448
  width: 200,
@@ -701,6 +731,10 @@
701
731
  data.place_id = index_place_list.getValue('valueStr');
702
732
  data.business_type = business_type.toString();
703
733
  data.business_step = business_step.toString();
734
+ data.staff_id = staff_list.getValue('valueStr');
735
+ <% if params[:year].present? %>
736
+ data.year = "<%= params[:year] %>";
737
+ <% end %>
704
738
  layer.load(0, {});
705
739
  request.authPost("/missions/businesses/get_export_data", {
706
740
  name: data.name,
@@ -717,10 +751,10 @@
717
751
  date_at: data.date_at,
718
752
  bidded_date: data.bidded_date,
719
753
  business_year: data.business_year,
754
+ year: data.year,
720
755
  mine: search['clazz'] == 'me' ? true : '',
721
756
  is_follow: search['clazz'] == 'followes' ? true : '',
722
757
  }, function (res) {
723
- console.log(res.data);
724
758
  data = res.data
725
759
  table.exportFile(business_table.config.id,data, type);
726
760
  layer.closeAll('loading');
@@ -912,8 +946,12 @@
912
946
  business_step.push(d.value);
913
947
  })
914
948
  data.field.place_id = index_place_list.getValue('valueStr');
949
+ data.field.staff_id = staff_list.getValue('valueStr');
915
950
  data.field.business_type = business_type.toString();
916
951
  data.field.business_step = business_step.toString();
952
+ <% if params[:year].present? %>
953
+ data.field.year = "<%= params[:year] %>";
954
+ <% end %>
917
955
  if (search['clazz']) {
918
956
  data.field['clazz'] = search['clazz']
919
957
  }
@@ -938,6 +976,10 @@
938
976
  $(".my-btn").addClass("selected-btn");
939
977
  } else if (search['clazz'] == 'followes') {
940
978
  $(".at-btn").addClass("selected-btn");
979
+ } else if (search['clazz'] == 'special') {
980
+ $(".s-btn").addClass("selected-btn");
981
+ } else if (search['clazz'] == 'area') {
982
+ $(".area-btn").addClass("selected-btn");
941
983
  } else {
942
984
  $(".all-btn").addClass("selected-btn");
943
985
  }
@@ -958,6 +1000,7 @@
958
1000
  business_type_list.setValue([])
959
1001
  business_step_list.setValue([])
960
1002
  index_place_list.setValue([])
1003
+ staff_list.setValue([])
961
1004
 
962
1005
  return false;
963
1006
  });
@@ -1059,6 +1102,40 @@
1059
1102
  $(".my-btn").addClass("selected-btn");
1060
1103
  return false;
1061
1104
  }
1105
+ else if (obj.event === 'special') {
1106
+ search = {"clazz": "special"}
1107
+ business_type_list.setValue([])
1108
+ table.reload('businesses_table', {
1109
+ url: '/missions/businesses',
1110
+ page: {
1111
+ curr: 1
1112
+ },
1113
+ where: {q: search, sort: sort}
1114
+ }, 'data');
1115
+ form.val('search_form', {
1116
+ name: '', department: '', staff_id: '', business_type: '', business_step: '',
1117
+ place_id: '', date: '', area: ''
1118
+ })
1119
+ $(".s-btn").addClass("selected-btn");
1120
+ return false;
1121
+ }
1122
+ else if (obj.event === 'area') {
1123
+ search = {"clazz": "area"}
1124
+ business_type_list.setValue([])
1125
+ table.reload('businesses_table', {
1126
+ url: '/missions/businesses',
1127
+ page: {
1128
+ curr: 1
1129
+ },
1130
+ where: {q: search, sort: sort}
1131
+ }, 'data');
1132
+ form.val('search_form', {
1133
+ name: '', department: '', staff_id: '', business_type: '', business_step: '',
1134
+ place_id: '', date: '', area: ''
1135
+ })
1136
+ $(".area-btn").addClass("selected-btn");
1137
+ return false;
1138
+ }
1062
1139
  else if (obj.event === 'delete') {
1063
1140
  var checkStatus = table.checkStatus('currentTableId'),
1064
1141
  data = checkStatus.data;
@@ -21,7 +21,9 @@ json.data do
21
21
  json.signed_date d.last_follow_up&.signed_date.to_s
22
22
  json.o_business_deployment EducodeSales::FollowUp::BUSINESS_DEPLOYMENT[1..-1].to_h.invert[d.last_follow_up&.o_business_deployment]
23
23
  json.service_end_time d.last_follow_up&.service_start_time.to_s + "-" + d.last_follow_up&.service_end_time.to_s
24
-
24
+ json.created_at d.created_at.to_s
25
+ json.no_followup_days (d['latest_time'] ? DateTime.parse(Time.now.strftime("%Y-%m-%d")) - DateTime.parse(d['latest_time'].strftime("%Y-%m-%d")) : DateTime.parse(Time.now.strftime("%Y-%m-%d")) - DateTime.parse(d.created_at.strftime("%Y-%m-%d"))).to_i
26
+
25
27
  json.divide_rate d.divide_rate
26
28
  json.divide_money d.divide_amount.to_f.round(2)
27
29
  json.budget_amount d.budget_amount.to_f.round(2) #d.follow_ups.where(stage_id: @budget_stage_ids).order("created_at desc").first&.total_amount&.round(2) || 0
@@ -98,7 +98,7 @@
98
98
  <div class="panel layui-bg-number">
99
99
  <div class="panel-body">
100
100
  <div class="panel-title">
101
- <h5>现有商机<a href="/missions/businesses?name=(销售态势-<%=@year %>-现有商机)&type=1&business_year=<%= @year %>" style="color: #0000FF;float: right">查看商机</a></h5>
101
+ <h5>现有商机<a href="/missions/businesses?name=(销售态势-<%=@year %>-现有商机)&type=1&year=<%= @year %>" style="color: #0000FF;float: right">查看商机</a></h5>
102
102
  </div>
103
103
  <div class="panel-content y-t-10">
104
104
  <h1 class="no-margins"><%= @business_amount.round(2) %>万</h1>
@@ -150,7 +150,7 @@
150
150
  <div class="panel layui-bg-number">
151
151
  <div class="panel-body">
152
152
  <div class="panel-title">
153
- <h5>A类商机<a href="/missions/businesses?type=a&business_year=<%= @year %>" style="color: #0000FF;float: right">查看商机</a></h5>
153
+ <h5>A类商机<a href="/missions/businesses?type=a&year=<%= @year %>" style="color: #0000FF;float: right">查看商机</a></h5>
154
154
  </div>
155
155
  <div class="panel-content y-t-10">
156
156
  <h1 class="no-margins"><%= @a_amount %>万</h1>
@@ -201,7 +201,7 @@
201
201
  <div class="panel layui-bg-number">
202
202
  <div class="panel-body">
203
203
  <div class="panel-title">
204
- <h5>B类商机<a href="/missions/businesses?type=b&business_year=<%= @year %>" style="color: #0000FF;float: right">查看商机</a></h5>
204
+ <h5>B类商机<a href="/missions/businesses?type=b&year=<%= @year %>" style="color: #0000FF;float: right">查看商机</a></h5>
205
205
  </div>
206
206
  <div class="panel-content y-t-10">
207
207
  <h1 class="no-margins"><%= @b_amount %>万</h1>
@@ -35,7 +35,15 @@
35
35
  <div class="layui-input-inline" style="">
36
36
  <div id="edit_assign_follow" style="width: 1140px;"></div>
37
37
  </div>
38
+ </div>
39
+ <% if can?(:special, EducodeSales::Business) %>
40
+ <div class="layui-form-item">
41
+ <label class="layui-form-label">专项客户类型</label>
42
+ <div class="layui-input-inline">
43
+ <div id="school_properties" style="width: 600px;"></div>
38
44
  </div>
45
+ </div>
46
+ <% end %>
39
47
  <div class="layui-form-item">
40
48
  <label class="layui-form-label required">生效日期</label>
41
49
  <div class="layui-input-block">
@@ -78,7 +86,13 @@
78
86
  laydate.render({
79
87
  elem: '#day'
80
88
  });
81
-
89
+ if (document.getElementById("school_properties")) {
90
+ var school_properties_list = xmSelect.render({
91
+ el: '#school_properties',
92
+ data: gon.school_properties,
93
+ filterable: true,
94
+ })
95
+ }
82
96
 
83
97
  var parentIndex = layer.index;
84
98
  transfer.render({
@@ -136,8 +150,15 @@
136
150
  sales_list.getValue().forEach(function(d) {
137
151
  schools.push(d.value);
138
152
  })
153
+ var tag_ids = [];
154
+ if (document.getElementById("school_properties")) {
155
+ school_properties_list.getValue().forEach(function(d) {
156
+ tag_ids.push(d.value);
157
+ })
158
+ }
139
159
  data.field['school_ids'] = schools;
140
160
  data.field['area_ids'] = area_ids;
161
+ data.field['school_tag_ids'] = tag_ids;
141
162
  request.authPut("missions/staffs/" + parent.staff_id, data.field, function (res) {
142
163
  console.log(res.success == false)
143
164
  if (res.success == false) {
@@ -30,6 +30,9 @@ class CreateEducodeSalesRolePermissions < ActiveRecord::Migration[5.2]
30
30
  EducodeSales::Permission.create(name: '删除跟进记录(本人创建)', subject: 'Business', action: 'self_delete_follow', clazz: 'business', position: '10')
31
31
 
32
32
  EducodeSales::Permission.create(name: '合并商机', subject: 'Business', action: 'merge_business', clazz: 'business', position: '12')
33
+ EducodeSales::Permission.create(name: '专项管理商机', subject: 'Business', action: 'special', clazz: 'business', position: '13')
34
+ EducodeSales::Permission.create(name: '区域管理商机', subject: 'Business', action: 'area_manage', clazz: 'business', position: '14')
35
+
33
36
  #回款管理权限
34
37
  EducodeSales::Permission.create(name: '查看回款列表', subject: 'MoneyPlan', action: 'read', clazz: 'money_plan', position: '15')
35
38
 
@@ -0,0 +1,10 @@
1
+ class CreateEducodeSalesStaffSchoolTags < ActiveRecord::Migration[5.2]
2
+ def change
3
+ create_table :educode_sales_staff_school_tags do |t|
4
+ t.references :staff
5
+ t.references :school_tag
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -1,3 +1,3 @@
1
1
  module EducodeSales
2
- VERSION = '0.9.39'
2
+ VERSION = '0.9.41'
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.39
4
+ version: 0.9.41
5
5
  platform: ruby
6
6
  authors:
7
7
  - anke1460
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-29 00:00:00.000000000 Z
11
+ date: 2023-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -221,6 +221,7 @@ files:
221
221
  - app/models/educode_sales/sale_trend.rb
222
222
  - app/models/educode_sales/staff.rb
223
223
  - app/models/educode_sales/staff_school.rb
224
+ - app/models/educode_sales/staff_school_tag.rb
224
225
  - app/models/educode_sales/teacher.rb
225
226
  - app/models/educode_sales/teacher_assign_follow.rb
226
227
  - app/models/educode_sales/teacher_follow.rb
@@ -489,6 +490,7 @@ files:
489
490
  - db/migrate/20221107122147_change_divide_rate_follow_ups.rb
490
491
  - db/migrate/20230115080730_add_origin_business_id_to_follow_ups.rb
491
492
  - db/migrate/20230117144025_create_educode_sales_business_clazz_changes.rb
493
+ - db/migrate/20230206080303_create_educode_sales_staff_school_tags.rb
492
494
  - lib/educode_sales.rb
493
495
  - lib/educode_sales/engine.rb
494
496
  - lib/educode_sales/version.rb