educode_sales 0.5.9 → 0.6.3

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.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/educode_sales/businesses_controller.rb +7 -4
  3. data/app/controllers/educode_sales/customers_controller.rb +45 -34
  4. data/app/controllers/educode_sales/follow_ups_controller.rb +1 -1
  5. data/app/controllers/educode_sales/places_controller.rb +5 -1
  6. data/app/controllers/educode_sales/sale_trends_controller.rb +16 -1
  7. data/app/controllers/educode_sales/staffs_controller.rb +2 -2
  8. data/app/controllers/educode_sales/teachers_controller.rb +13 -2
  9. data/app/models/educode_sales/permission.rb +1 -1
  10. data/app/views/educode_sales/businesses/_follows.html.erb +4 -1
  11. data/app/views/educode_sales/businesses/edit.html.erb +3 -0
  12. data/app/views/educode_sales/businesses/index.html.erb +22 -16
  13. data/app/views/educode_sales/businesses/index.json.jbuilder +1 -0
  14. data/app/views/educode_sales/businesses/show_follow.html.erb +1 -1
  15. data/app/views/educode_sales/businesses/time_line.html.erb +1 -1
  16. data/app/views/educode_sales/customers/edit.html.erb +54 -21
  17. data/app/views/educode_sales/customers/edit_department.html.erb +4 -2
  18. data/app/views/educode_sales/customers/edit_follow_record.html.erb +7 -7
  19. data/app/views/educode_sales/customers/index.html.erb +26 -19
  20. data/app/views/educode_sales/customers/index.json.jbuilder +3 -4
  21. data/app/views/educode_sales/customers/new.html.erb +30 -24
  22. data/app/views/educode_sales/customers/new_department.html.erb +5 -2
  23. data/app/views/educode_sales/customers/new_follow_record.html.erb +9 -9
  24. data/app/views/educode_sales/customers/show_follow.html.erb +8 -5
  25. data/app/views/educode_sales/customers/show_follow.json.jbuilder +1 -1
  26. data/app/views/educode_sales/customers/show_follow_record.html.erb +5 -4
  27. data/app/views/educode_sales/follow_ups/index.json.jbuilder +1 -0
  28. data/app/views/educode_sales/places/index.html.erb +64 -0
  29. data/app/views/educode_sales/roles/edit.html.erb +1 -1
  30. data/app/views/educode_sales/sale_trends/trends.html.erb +20 -0
  31. data/app/views/educode_sales/sales/index.html.erb +34 -16
  32. data/app/views/educode_sales/sales/index.json.jbuilder +27 -2
  33. data/app/views/educode_sales/teachers/index.html.erb +4 -11
  34. data/app/views/educode_sales/teachers/index.json.jbuilder +1 -1
  35. data/db/migrate/20211220102720_add_position_to_commons.rb +12 -0
  36. data/db/migrate/20211221075146_add_school_id_to_educode_sales_businesses.rb +8 -0
  37. data/lib/educode_sales/version.rb +1 -1
  38. metadata +4 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 82398cf1df1cb40215b1632031edfd6b6ffa4dfed2ff1c8f86c624fa938c917c
4
- data.tar.gz: b11d133013cc1dfe416f77b26255709fb24b33061568380abf625012b13b4ee0
3
+ metadata.gz: 49cd6d76f9cd164f4672b75479bacf2d6c6c2837a8bd100074d43a5ad687d08d
4
+ data.tar.gz: 503d5d4c354452464da72ef216f9ad9c9ddb7da20e450ada871bb813913f3fc7
5
5
  SHA512:
6
- metadata.gz: ee3920c928e0d06ba4785d0a5ab091b9833d94c42eb881e879c378d36d71f6c75985299b225c198b9abf0f2d5d9a6e133a5afeb7147c87e6523bcde609f07f30
7
- data.tar.gz: 14a4f1e5e7f23f94279b9023656d170fed8cf6b3d1a6a034b71cca658bc4d0ab13c27f8d82b589a747f02fca5f53fda1a224c7fb76d1a7f25db4552b2a9ac53d
6
+ metadata.gz: 8eead6ddaeb216468798a82db5f674a1582a5f641f4be378c8635e500c98d06e5297c9850a62477ddf644c895d9c10d5de5f287fd3dad7c22ae789768631d42c
7
+ data.tar.gz: 3d258a4889bc94043a6af1d20dc54520b01ac0593f357e38d590b70c77e0e6bfafb387a15530fed83fa1f3b4aa7040038f4f2de218e41bd43dcb0d282c9d50fb
@@ -76,7 +76,9 @@ module EducodeSales
76
76
  b_id = Common.find_by(extras: EducodeSales::Common::BTYPE)&.id
77
77
  c_id = Common.find_by(extras: EducodeSales::Common::CTYPE)&.id
78
78
  d_id = Common.find_by(extras: EducodeSales::Common::DTYPE)&.id
79
- ids = [a_id ,b_id ,c_id ,d_id]
79
+ e_id = Common.find_by(extras: EducodeSales::Common::ETYPE)&.id
80
+ o_id = Common.find_by(extras: EducodeSales::Common::OTYPE)&.id
81
+ ids = [a_id ,b_id ,c_id ,d_id ,e_id ,o_id]
80
82
  @businesses = @businesses.joins("
81
83
  JOIN educode_sales_follow_ups ON educode_sales_businesses.last_follow_up_id = educode_sales_follow_ups.id
82
84
  ").where("educode_sales_follow_ups.clazz_id in (?)",ids)
@@ -172,7 +174,7 @@ module EducodeSales
172
174
 
173
175
  if params[:q].present? && params[:q][:date].present?
174
176
  date = params[:q][:date].split(" - ")
175
- @businesses = @businesses.where("educode_sales_businesses.created_at > ? AND educode_sales_businesses.created_at < ?", date[0], date[1])
177
+ @businesses = @businesses.where("educode_sales_businesses.created_at > ? AND educode_sales_businesses.created_at < ?", date[0], date[1] + '23:59:59')
176
178
  end
177
179
 
178
180
  if params[:sort].present? && params[:sort][:field]
@@ -191,6 +193,7 @@ module EducodeSales
191
193
  last_follow.reception_at,
192
194
  last_follow.bidded_date,
193
195
  last_follow.signed_date,
196
+ last_follow.created_at as latest_time,
194
197
  last_follow.actual_amount,
195
198
  last_follow.total_amount").joins("
196
199
  LEFT JOIN educode_sales_follow_ups AS last_follow ON educode_sales_businesses.last_follow_up_id = last_follow.id
@@ -201,7 +204,7 @@ module EducodeSales
201
204
 
202
205
  def create
203
206
  department = Department.find(params[:department_id])
204
- business = @current_admin.businesses.build(name: params[:name], department_id: department.id, source: params[:source])
207
+ business = @current_admin.businesses.build(name: params[:name], department_id: department.id, source: params[:source], school_id: department.school_id)
205
208
  if business.save
206
209
  render_success
207
210
  else
@@ -223,7 +226,7 @@ module EducodeSales
223
226
  def update
224
227
  business = Business.find(params[:id])
225
228
  department = Department.find(params[:department_id])
226
- if business.update(name: params[:name], department_id: department.id, source: params[:source])
229
+ if business.update(name: params[:name], department_id: department.id, source: params[:source], school_id: department.school_id)
227
230
  render_success
228
231
  else
229
232
  render_failure business
@@ -2,8 +2,6 @@ require_dependency "educode_sales/application_controller"
2
2
 
3
3
  module EducodeSales
4
4
  class CustomersController < ApplicationController
5
- # before_action :find_school, only: [:edit, :update]
6
- # before_action :must_admin!, only: [:destroy]
7
5
 
8
6
  def new_department
9
7
  render layout: false
@@ -43,7 +41,7 @@ module EducodeSales
43
41
  end
44
42
  format.json do
45
43
  if @current_admin.is_admin?
46
- @customers = School
44
+ @customers = School.all
47
45
  else
48
46
  level = @current_admin.role.role_areas.find_by(clazz: '客户管理').level
49
47
  case level
@@ -56,7 +54,7 @@ module EducodeSales
56
54
  school_ids = a_school_ids + b_school_ids
57
55
  @customers = School.where(id: school_ids)
58
56
  else
59
- @customers = School
57
+ @customers = School.all
60
58
  end
61
59
  end
62
60
 
@@ -71,21 +69,29 @@ module EducodeSales
71
69
  @customers = @customers.where(id: school_ids)
72
70
  end
73
71
 
74
- # if params[:q].present? && params[:q][:date].present?
75
- # department_ids =
76
- # business_ids = EducodeSales::Business.where(department_id: department_ids).ids
77
- # follow_ups = EducodeSales::FollowUp.where(business_id: business_ids)
78
- # customer_follows = EducodeSales::CustomerFollow.where(school_id: d.id)
79
- # a_last_follow_time = follow_ups.last&.created_at&.to_s(:date)
80
- # b_last_follow_time = customer_follows.last&.created_at&.to_s(:date)
81
- # if a_last_follow_time.present? && b_last_follow_time.present?
82
- # json.last_follow_time a_last_follow_time < b_last_follow_time ? b_last_follow_time : a_last_follow_time
83
- # else
84
- # json.last_follow_time a_last_follow_time || b_last_follow_time
85
- # end
86
- # date = params[:q][:date].split(" - ")
87
- # @customers = @customers.where("educode_sales_businesses.created_at > ? AND educode_sales_businesses.created_at < ?", date[0], date[1])
88
- # end
72
+ if params[:q].present? && params[:q][:date].present?
73
+ ids = EducodeSales::CustomerFollow.all.pluck(:school_id)
74
+ @customers = @customers.where(id: ids)
75
+ school_ids =[]
76
+ date = params[:q][:date].split(" - ")
77
+ @customers.each do |d|
78
+ business_ids = EducodeSales::Business.where(school_id: d.id).ids
79
+ follow_ups = EducodeSales::FollowUp.where(business_id: business_ids)
80
+ customer_follows = EducodeSales::CustomerFollow.where(school_id: d.id)
81
+ next if follow_ups.blank? && customer_follows.blank?
82
+ a_last_follow_time = follow_ups.last&.created_at&.to_s
83
+ b_last_follow_time = customer_follows.last&.created_at&.to_s
84
+ if a_last_follow_time.present? && b_last_follow_time.present?
85
+ last_follow_time = ((a_last_follow_time < b_last_follow_time) ? b_last_follow_time : a_last_follow_time)
86
+ else
87
+ last_follow_time = (a_last_follow_time || b_last_follow_time)
88
+ end
89
+ if last_follow_time.present? && last_follow_time > date[0] && last_follow_time < date[1]
90
+ school_ids << d.id
91
+ end
92
+ end
93
+ @customers = @customers.where(id: school_ids)
94
+ end
89
95
 
90
96
  @customers = @customers.order(id: :desc).page(params[:page]).per(params[:limit])
91
97
  end
@@ -109,11 +115,6 @@ module EducodeSales
109
115
  format.json do
110
116
  @follow_ups = EducodeSales::CustomerFollow.where(school_id: params[:id])
111
117
  @latest = @follow_ups.order(created_at: :desc).first
112
- # if params[:field]
113
- # @follow_ups = @follow_ups.order("#{params[:field]} #{params[:order]}")
114
- # else
115
- # @follow_ups = @follow_ups.order("created_at desc")
116
- # end
117
118
  @follow_ups = @follow_ups.order("created_at desc")
118
119
  @follow_ups = @follow_ups.page(params[:page]).per(params[:limit])
119
120
  end
@@ -122,11 +123,6 @@ module EducodeSales
122
123
 
123
124
  def show_department
124
125
  @departments = School.find(params[:id]).departments
125
- # if params[:field]
126
- # @follow_ups = @follow_ups.order("#{params[:field]} #{params[:order]}")
127
- # else
128
- # @follow_ups = @follow_ups.order("created_at desc")
129
- # end
130
126
  @departments = @departments.order("created_at desc")
131
127
  @departments = @departments.page(params[:page]).per(params[:limit])
132
128
  end
@@ -154,40 +150,55 @@ module EducodeSales
154
150
  end
155
151
 
156
152
  def create
157
- @school = School.find(params[:id])
158
153
  ActiveRecord::Base.transaction do
159
- property = SchoolProperty.find_or_create_by!(school_property_params)
154
+ property = SchoolProperty.find_or_create_by!(project_985: params[:project_985].present? ? 1 : 0,
155
+ project_211: params[:project_211].present? ? 1 : 0,
156
+ regular_college: params[:regular_college].present? ? 1 : 0,
157
+ junior_college: params[:junior_college].present? ? 1 : 0,
158
+ secondary_school: params[:secondary_school].present? ? 1 : 0,
159
+ military_school: params[:military_school].present? ? 1 : 0,
160
+ enterprise: params[:enterprise].present? ? 1 : 0)
160
161
  @school = School.new
161
162
  @school.attributes = school_params
162
163
  @school.school_property = property
163
164
  @school.save!
165
+ EducodeSales::CustomerExtension.create(customer_staff_id: @current_admin.id, school_id: @school.id)
164
166
  end
167
+ render_success
165
168
  end
166
169
 
167
170
  def edit
168
171
  @school = School.find(params[:id])
172
+ @school_property = @school.school_property
169
173
  render layout: false
170
174
  end
171
175
 
172
176
  def update
173
177
  @school = School.find(params[:id])
174
178
  ActiveRecord::Base.transaction do
175
- property = SchoolProperty.find_or_create_by!(school_property_params)
179
+ property = SchoolProperty.find_or_create_by!(project_985: params[:project_985].present? ? 1 : 0,
180
+ project_211: params[:project_211].present? ? 1 : 0,
181
+ regular_college: params[:regular_college].present? ? 1 : 0,
182
+ junior_college: params[:junior_college].present? ? 1 : 0,
183
+ secondary_school: params[:secondary_school].present? ? 1 : 0,
184
+ military_school: params[:military_school].present? ? 1 : 0,
185
+ enterprise: params[:enterprise].present? ? 1 : 0)
176
186
  @school.attributes = school_params
177
187
  @school.school_property = property
178
188
  @school.save!
179
189
  end
190
+ render_success
180
191
  end
181
192
 
182
193
  private
183
194
 
184
195
 
185
196
  def school_property_params
186
- params.require(:school).permit(:project_985, :project_211, :regular_college, :junior_college, :secondary_school, :military_school, :enterprise)
197
+ params.permit(:project_985, :project_211, :regular_college, :junior_college, :secondary_school, :military_school, :enterprise)
187
198
  end
188
199
 
189
200
  def school_params
190
- params.require(:school).permit(:name, :province, :city, :address)
201
+ params.permit(:name, :province, :city, :address)
191
202
  end
192
203
 
193
204
  end
@@ -34,7 +34,7 @@ module EducodeSales
34
34
  end
35
35
  if params[:q].present? && params[:q][:follows_date].present?
36
36
  date = params[:q][:follows_date].split(" - ")
37
- @follow_ups = @follow_ups.where("educode_sales_follow_ups.created_at > ? AND educode_sales_follow_ups.created_at < ?", date[0], date[1])
37
+ @follow_ups = @follow_ups.where("educode_sales_follow_ups.created_at > ? AND educode_sales_follow_ups.created_at < ?", date[0], date[1] + '23:59:59')
38
38
  end
39
39
  if params[:q].present? && params[:q][:staff_id].present?
40
40
  @follow_ups = @follow_ups.where(staff_id: params[:q][:staff_id])
@@ -8,7 +8,11 @@ module EducodeSales
8
8
  format.html do
9
9
  end
10
10
  format.json do
11
- @places = Place.page(params[:page]).per(params[:limit])
11
+ @places = EducodeSales::Place.all
12
+ if params[:q].present? && params[:q][:name].present?
13
+ @places = @places.where("name like ?", "%#{params[:q][:name]}%")
14
+ end
15
+ @places = @places.page(params[:page]).per(params[:limit])
12
16
  @x = Common.find_by(extras: EducodeSales::Common::XTYPE)&.id
13
17
  @stage_ids = Common.where(clazz: '商机阶段', name: ['已中标','已签单','已验收','回款中', '服务中','已结束']).pluck(:id)
14
18
  end
@@ -13,7 +13,7 @@ module EducodeSales
13
13
  x = Common.find_by(extras: EducodeSales::Common::XTYPE)&.id
14
14
  o = Common.find_by(extras: EducodeSales::Common::OTYPE)&.id
15
15
  @sale_trend = SaleTrend.find_or_create_by(year: @year)
16
- @business_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ? AND educode_sales_follow_ups.clazz_id != ?", x, o).sum(:total_amount).round(2)
16
+ @business_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).sum(:total_amount).round(2)
17
17
  stage_ids = Common.where(clazz: '商机阶段', name: ['已中标','已签单','已验收','回款中', '服务中','已结束']).pluck(:id)
18
18
  @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.bidded_date <= ? AND educode_sales_follow_ups.stage_id IN (?)", "#{@year}-01-01", "#{@year}-12-31", stage_ids).sum(:total_amount).round(2)
19
19
  @actual_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.bidded_date <= ? AND educode_sales_follow_ups.stage_id IN (?)", "#{@year}-01-01", "#{@year}-12-31", stage_ids).sum(:actual_amount).round(2)
@@ -72,6 +72,21 @@ module EducodeSales
72
72
  end
73
73
  end
74
74
 
75
+ #商机区域分布图表
76
+ provinces = EducodeSales::Common.where(clazz: 'area').pluck(:name)
77
+ @business_data = {
78
+ labels: provinces,
79
+ datasets:[
80
+ {
81
+ label: "商机总额",
82
+ data: provinces.map{|province| Business.joins(:last_follow_up).where("educode_sales_businesses.department_id in (?)", School.joins(:departments).where(province: province).pluck("departments.id")).where("educode_sales_follow_ups.clazz_id != ?", x).sum(:total_amount).round(2)},
83
+ backgroundColor: colors[0],
84
+ borderColor: colors[0],
85
+ borderWidth: 1
86
+ }
87
+ ]
88
+ }
89
+
75
90
 
76
91
  # 已中标图表
77
92
  goal_default_dates = ("#{Time.now.year}-01".."#{Time.now.year}-#{Time.now.month}").to_a
@@ -68,8 +68,8 @@ module EducodeSales
68
68
  def follow_up_schools
69
69
  staff = Staff.find(params[:id])
70
70
  # @schools = EducodeSales::Business.joins(:last_follow_up, :department).where("educode_sales_follow_ups.staff_id = #{staff.id}").group("school_id").select("school_id, max(educode_sales_follow_ups.updated_at) AS updated_at").page(params[:page]).per(params[:limit])
71
- @schools = EducodeSales::Teacher.joins(:follow_up, :department).where("educode_sales_teacher_follows.staff_id = #{staff.id}").group("school_id").select("school_id, max(educode_sales_teacher_follows.updated_at) AS updated_at")+EducodeSales::Business.joins(:last_follow_up, :department).where("educode_sales_follow_ups.staff_id = #{staff.id}").group("school_id").select("school_id, max(educode_sales_follow_ups.updated_at) AS updated_at")
72
- @count = EducodeSales::Business.joins(:last_follow_up, :department).where("educode_sales_follow_ups.staff_id = #{staff.id}").group("school_id").count
71
+ @schools = EducodeSales::Teacher.joins(:follow_up, :department).where("educode_sales_teacher_follows.staff_id = #{staff.id}").group("departments.school_id").select("departments.school_id, max(educode_sales_teacher_follows.updated_at) AS updated_at")+EducodeSales::Business.joins(:last_follow_up, :department).where("educode_sales_follow_ups.staff_id = #{staff.id}").group("departments.school_id").select("departments.school_id, max(educode_sales_follow_ups.updated_at) AS updated_at")
72
+ @count = EducodeSales::Business.joins(:last_follow_up, :department).where("educode_sales_follow_ups.staff_id = #{staff.id}").group("departments.school_id").count
73
73
  end
74
74
 
75
75
  def follow_up_departments
@@ -113,10 +113,21 @@ module EducodeSales
113
113
  @teachers = @teachers.where("educode_sales_teachers.created_at > ? AND educode_sales_teachers.created_at < ?", date[0], date[1])
114
114
  end
115
115
 
116
- @teachers = @teachers.order("educode_sales_teachers.created_at desc").page(params[:page]).per(params[:limit])
116
+ @teachers = @teachers.select("
117
+ educode_sales_teachers.*,
118
+ users.created_on,
119
+ users.last_login_on").joins("
120
+ LEFT JOIN users ON educode_sales_teachers.user_id = users.id
121
+ ")
122
+ if params[:sort].present? && params[:sort][:field]
123
+ @teachers = @teachers.order("#{params[:sort][:field]} #{params[:sort][:order]}")
124
+ else
125
+ @teachers = @teachers.order("educode_sales_teachers.created_at desc")
126
+ end
127
+ @teachers = @teachers.page(params[:page]).per(params[:limit])
128
+ end
117
129
 
118
130
  end
119
- end
120
131
  end
121
132
 
122
133
  def import
@@ -1,7 +1,7 @@
1
1
  module EducodeSales
2
2
  class Permission < ApplicationRecord
3
3
  enum clazz: {
4
- '市场态势': 'market',
4
+ '销售态势': 'market',
5
5
  '销售分工': 'sale_job',
6
6
  '商机管理': 'business',
7
7
  '渠道管理': 'place',
@@ -55,6 +55,9 @@
55
55
  <script type="text/html" id="business">
56
56
  <a href="javascript:void(0);" lay-event="business" class="layui-table-link">{{ d.business }}</a>
57
57
  </script>
58
+ <script type="text/html" id="school">
59
+ <a href="<%= base_url%>/colleges/{{d.school_id}}/statistics" class="layui-table-link" target="_blank">{{ d.school }}</a>
60
+ </script>
58
61
 
59
62
 
60
63
  <script>
@@ -130,7 +133,7 @@
130
133
  field: 'school',
131
134
  width: 120,
132
135
  title: '单位',
133
- templet:'<div><span title="{{d.school}}">{{d.school}}</span></div>'
136
+ templet:'#school'
134
137
  },
135
138
  {
136
139
  field: 'staff',
@@ -11,6 +11,9 @@
11
11
  <label class="layui-form-label required">单位部门</label>
12
12
  <div class="layui-input-block" id="department" style="width: 300px;"></div>
13
13
  </div>
14
+ <div class="layui-inline" >
15
+ <a href="/missions/customers" style=" color: #0000FF">添加单位/部门</a>
16
+ </div>
14
17
  <br>
15
18
  <div class="layui-inline" style="padding-top: 20px">
16
19
  <label class="layui-form-label ">商机来源</label>
@@ -18,6 +18,7 @@
18
18
  <label class="layui-form-label">商机名称</label>
19
19
  <div class="layui-input-inline">
20
20
  <input type="text" name="name" autocomplete="off" class="layui-input" value="<%=params[:name] %>">
21
+ <input type="text" style="display: none" name="place_id" autocomplete="off" class="layui-input" value="<%=params[:place_id] %>">
21
22
  </div>
22
23
  </div>
23
24
  <div class="layui-inline">
@@ -107,6 +108,9 @@
107
108
  <script type="text/html" id="show_follow">
108
109
  <a href="javascript:void(0);" lay-event="show_follow" class="layui-table-link">{{ d.follow_ups_count }}</a>
109
110
  </script>
111
+ <script type="text/html" id="school_name">
112
+ <a href="<%= base_url%>/colleges/{{d.school_id}}/statistics" class="layui-table-link" target="_blank">{{ d.school }}</a>
113
+ </script>
110
114
 
111
115
 
112
116
  <script>
@@ -203,7 +207,7 @@
203
207
  field: 'school',
204
208
  width: 150,
205
209
  title: '单位',
206
- templet:'<div><span title="{{d.school}}">{{d.school}}</span></div>'
210
+ templet:'#school_name'
207
211
  },
208
212
  {
209
213
  field: 'department',
@@ -235,6 +239,22 @@
235
239
  width: 90,
236
240
  title: '阶段'
237
241
  },
242
+ {
243
+ field: 'source',
244
+ width: 90,
245
+ title: '商机来源'
246
+ },
247
+ {
248
+ field: 'last_follow_person',
249
+ width: 100,
250
+ title: '最新跟进人'
251
+ },
252
+ {
253
+ field: 'latest_time',
254
+ width: 200,
255
+ title: '最新跟进时间',
256
+ sort: true
257
+ },
238
258
  {
239
259
  field: 'invitation_at',
240
260
  width: 105,
@@ -285,21 +305,6 @@
285
305
  width: 160,
286
306
  title: '渠道',
287
307
  },
288
- {
289
- field: 'source',
290
- width: 90,
291
- title: '商机来源'
292
- },
293
- {
294
- field: 'last_follow_person',
295
- width: 100,
296
- title: '最新跟进人'
297
- },
298
- {
299
- field: 'latest_time',
300
- width: 200,
301
- title: '最新跟进时间'
302
- },
303
308
  {
304
309
  title: '操作',
305
310
  minWidth: 170,
@@ -390,6 +395,7 @@
390
395
  });
391
396
  }
392
397
  function time_line(id,name) {
398
+ business_id = id
393
399
  var content = miniPage.getHrefContent('/missions/businesses/time_line?business_id=' + id);
394
400
  var openWH = miniPage.getOpenWidthHeight();
395
401
  sindex = layer.open({
@@ -5,6 +5,7 @@ json.data do
5
5
  json.name d.name
6
6
  json.department d.department.name
7
7
  json.school d.department.school.name
8
+ json.school_id d.department.school.id
8
9
  json.follow_ups_count d.follow_ups_count
9
10
  follow_ups_count += d.follow_ups_count
10
11
  json.follow_up_id d.last_follow_up_id
@@ -12,7 +12,7 @@
12
12
  <span class="table-label pull-right" style="padding-right: 20px">温馨提示:仅可以在24小时之内,编辑/删除最新的跟进记录</span>
13
13
  </div>
14
14
  </script>
15
- <div class="edit-table tool">
15
+ <div class=" tool">
16
16
  <div class="z-index">
17
17
  <table class="layui-hide" id="sale_plan_follow_table" lay-filter="sale_plan_follow_table"></table>
18
18
  </div>
@@ -43,7 +43,7 @@
43
43
  function demo(){
44
44
  layer.closeAll()
45
45
  business_id = parent.business_id
46
- var content = miniPage.getHrefContent('/missions/businesses/show_follow?id=' + parent.business_id);
46
+ var content = miniPage.getHrefContent('/missions/businesses/show_follow?id=' + business_id);
47
47
  var openWH = miniPage.getOpenWidthHeight();
48
48
  sindex = layer.open({
49
49
  title: '商机列表/'+ parent.business_name +'的跟进记录',
@@ -1,14 +1,57 @@
1
- <%#= Gon::Base.render_data %>
2
- <form class="layui-form " action="">
1
+ <form class="layui-form layuimini-form " action="">
3
2
  <div class="layui-form-item" style="padding: 25px">
3
+ <div class="layui-inline">
4
+ <label class="layui-form-label required">客户:</label>
5
+ <div class="layui-input-block" style="width: 500px;">
6
+ <input type="text" name="name" required lay-verify="required" value="<%=@school.name %>" placeholder="请输入客户" autocomplete="off"
7
+ class="layui-input" id="inputFocus">
8
+ </div>
9
+ </div>
10
+ <br>
11
+ <div class="layui-inline">
12
+ <label class="layui-form-label required">省:</label>
13
+ <div class="layui-input-block">
14
+ <%= select_tag "province", options_for_select(EducodeSales::Common.where(clazz: 'area').pluck(:name),@school.province), { include_blank: true } %>
15
+ </div>
16
+ </div>
17
+ <br>
18
+ <div class="layui-inline">
19
+ <label class="layui-form-label ">市:</label>
20
+ <div class="layui-input-block">
21
+ <input type="text" name="city" value="<%=@school.city %>" autocomplete="off"
22
+ class="layui-input" placeholder="请输入地址" style="width: 223px">
23
+ </div>
24
+ </div>
25
+ <br>
26
+ <div class="layui-inline">
27
+ <label class="layui-form-label ">地址:</label>
28
+ <div class="layui-input-block" style="width: 500px;">
29
+ <input type="text" name="address" value="<%=@school.address %>" autocomplete="off"
30
+ class="layui-input" placeholder="请输入地址" >
31
+ </div>
32
+ </div>
4
33
  <div class="layui-form-item">
5
- <label class="layui-form-label required">负责区域</label>
34
+ <label class="layui-form-label">学校性质:</label>
6
35
  <div class="layui-input-block">
7
- <div id="area_edit" class="demo-transfer"></div>
36
+ <input type="checkbox" name="project_985" lay-skin="primary" value="1" <%= 'checked' if @school_property&.project_985 %> title="985工程">
37
+ <input type="checkbox" name="project_211" lay-skin="primary" value="1" <%= 'checked' if @school_property&.project_211 %> title="211工程" >
38
+ <input type="checkbox" name="regular_college" lay-skin="primary" value="1" <%= 'checked' if @school_property&.regular_college %> title="本科院校">
8
39
  </div>
9
40
  </div>
10
- <div class="layui-inline" style="padding-left: 30px">
11
- <button type="submit" class="layui-btn layui-btn-normal" lay-submit lay-filter="submits">提交
41
+ <div class="layui-form-item">
42
+ <div class="layui-input-block">
43
+ <input type="checkbox" name="junior_college" lay-skin="primary" value="1" <%= 'checked' if @school_property&.junior_college %> title="大专院校">
44
+ <input type="checkbox" name="secondary_school" lay-skin="primary" value="1" <%= 'checked' if @school_property&.secondary_school %> title="中专院校" >
45
+ <input type="checkbox" name="military_school" lay-skin="primary" value="1" <%= 'checked' if @school_property&.military_school %> title="军事院校">
46
+ </div>
47
+ </div>
48
+ <div class="layui-form-item">
49
+ <div class="layui-input-block">
50
+ <input type="checkbox" name="enterprise" lay-skin="primary" value="1" <%= 'checked' if @school_property&.enterprise %> title="企业">
51
+ </div>
52
+ </div>
53
+ <div class="layui-inline" style="padding-left: 120px">
54
+ <button type="submit" class="layui-btn layui-btn-normal" lay-submit lay-filter="data-reset-btn">提交
12
55
  </button>
13
56
  </div>
14
57
  </div>
@@ -35,23 +78,13 @@
35
78
 
36
79
 
37
80
  //监听提交
38
- form.on('submit(submits)', function (data) {
39
-
40
- var area_ids = []
41
- layui.each(transfer.getData('area_list'), function (i, v) {
42
- area_ids.push(v.value)
43
- })
44
- if (area_ids.length == 0) {
45
- layer.alert("请选择负责区域");
46
- return false;
47
- }
48
- data.field['area_ids'] = area_ids;
49
- request.authPut("missions/places/" + data.field.id, data.field, function (res) {
50
- if (res.success == false) {
81
+ form.on('submit(data-reset-btn)', function (data) {
82
+ request.authPut("missions/customers/" + <%= @school.id %>, data.field, function (res) {
83
+ if (res.success === false) {
51
84
  layer.alert(res.msg)
52
85
  } else {
53
- layer.closeAll();
54
- table.reload('place')
86
+ layer.closeAll(); //关闭所有层
87
+ table.reload('customers_table')
55
88
  }
56
89
  })
57
90
  return false;
@@ -1,14 +1,16 @@
1
1
  <div class="layuimini-main">
2
2
  <form class="layui-form layuimini-form" action="">
3
+ <div class="layui-form-item" style="padding: 25px">
3
4
  <div class="layui-form-item" style="padding: 25px">
4
5
  <div class="layui-inline">
5
6
  <label class="layui-form-label required">部门名称</label>
6
- <div class="layui-input-block">
7
+ <div class="layui-input-block" style="width: 300px;">
7
8
  <input type="text" name="department_name" required lay-verify="required" autocomplete="off" placeholder="请输入"
8
9
  class="layui-input" id="inputFocus" value="<%=@department.name %>">
9
10
  </div>
10
11
  </div>
11
- <div class="layui-inline" style="padding-left: 30px">
12
+ </div>
13
+ <div class="layui-form-item" style="padding-left: 130px">
12
14
  <button type="submit" class="layui-btn layui-btn-normal" lay-submit lay-filter="data-edit">提交
13
15
  </button>
14
16
  </div>
@@ -1,18 +1,18 @@
1
1
  <h1 class="text-center" style="padding: 25px"><%=@school.name %></h1>
2
- <form class="layui-form " action="">
3
- <div class="layui-form-item layui-form-text">
4
- <label class="layui-form-label">跟进内容</label>
2
+ <form class="layui-form layuimini-form " action="">
3
+ <div class="layui-form-item layui-form-text" style="padding-right: 30px">
4
+ <label class="layui-form-label required">跟进内容</label>
5
5
  <div class="layui-input-block">
6
- <textarea name="content" placeholder="请输入跟进内容" class="layui-textarea" ><%=@follow_up.content %></textarea>
6
+ <textarea name="content" placeholder="请输入跟进内容" lay-verify="required" style="height: 200px" class="layui-textarea" ><%=@follow_up.content %></textarea>
7
7
  </div>
8
8
  </div>
9
- <div class="layui-inline">
9
+ <div class="layui-form-item ">
10
10
  <label class="layui-form-label">跟进部门</label>
11
- <div class="layui-input-inline">
11
+ <div class="layui-input-inline" style="width: 300px;">
12
12
  <%= select_tag "department_id",options_for_select(@school.departments.pluck(:name, :id),@follow_up.department_id)%>
13
13
  </div>
14
14
  </div>
15
- <div class="layui-inline" style="padding-left: 50px">
15
+ <div class="layui-form-item " style="padding-left: 110px">
16
16
  <button type="submit" class="layui-btn layui-btn-normal" lay-submit lay-filter="edit_follow_up">提交
17
17
  </button>
18
18
  </div>