educode_sales 0.5.8 → 0.5.9

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 (46) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/educode_sales//345/256/242/346/210/267/347/256/241/347/220/206.png +0 -0
  3. data/app/controllers/educode_sales/businesses_controller.rb +1 -0
  4. data/app/controllers/educode_sales/customer_extensions_controller.rb +17 -0
  5. data/app/controllers/educode_sales/customer_follows_controller.rb +41 -0
  6. data/app/controllers/educode_sales/customers_controller.rb +194 -0
  7. data/app/controllers/educode_sales/roles_controller.rb +4 -1
  8. data/app/models/educode_sales/customer.rb +4 -0
  9. data/app/models/educode_sales/customer_extension.rb +7 -0
  10. data/app/models/educode_sales/customer_follow.rb +5 -0
  11. data/app/models/educode_sales/permission.rb +2 -1
  12. data/app/models/educode_sales/role_area.rb +1 -0
  13. data/app/views/educode_sales/businesses/_follows.html.erb +7 -4
  14. data/app/views/educode_sales/businesses/edit_follow_record.html.erb +2 -2
  15. data/app/views/educode_sales/businesses/index.html.erb +3 -2
  16. data/app/views/educode_sales/businesses/new.html.erb +3 -0
  17. data/app/views/educode_sales/businesses/new_follow_record.html.erb +2 -2
  18. data/app/views/educode_sales/businesses/show_follow.html.erb +6 -1
  19. data/app/views/educode_sales/businesses/show_follow.json.jbuilder +1 -0
  20. data/app/views/educode_sales/customers/edit.html.erb +60 -0
  21. data/app/views/educode_sales/customers/edit_department.html.erb +52 -0
  22. data/app/views/educode_sales/customers/edit_follow_record.html.erb +50 -0
  23. data/app/views/educode_sales/customers/give.html.erb +51 -0
  24. data/app/views/educode_sales/customers/index.html.erb +485 -0
  25. data/app/views/educode_sales/customers/index.json.jbuilder +25 -0
  26. data/app/views/educode_sales/customers/new.html.erb +89 -0
  27. data/app/views/educode_sales/customers/new_department.html.erb +53 -0
  28. data/app/views/educode_sales/customers/new_follow_record.html.erb +54 -0
  29. data/app/views/educode_sales/customers/show_department.json.jbuilder +13 -0
  30. data/app/views/educode_sales/customers/show_follow.html.erb +439 -0
  31. data/app/views/educode_sales/customers/show_follow.json.jbuilder +13 -0
  32. data/app/views/educode_sales/customers/show_follow_record.html.erb +17 -0
  33. data/app/views/educode_sales/places/index.json.jbuilder +1 -1
  34. data/app/views/educode_sales/roles/edit.html.erb +8 -0
  35. data/app/views/educode_sales/sales/index.html.erb +44 -20
  36. data/app/views/educode_sales/sales/index.json.jbuilder +7 -5
  37. data/app/views/educode_sales/teachers/index.json.jbuilder +2 -2
  38. data/app/views/educode_sales/teachers/show_follow.html.erb +10 -5
  39. data/app/views/educode_sales/teachers/show_follow.json.jbuilder +1 -0
  40. data/app/views/layouts/educode_sales/application.html.erb +8 -1
  41. data/config/routes.rb +25 -0
  42. data/db/migrate/20210902064109_create_educode_sales_role_permissions.rb +15 -0
  43. data/db/migrate/20211214100803_create_customer_extensions.rb +9 -0
  44. data/db/migrate/20211215025029_create_educode_sales_customer_follows.rb +12 -0
  45. data/lib/educode_sales/version.rb +1 -1
  46. metadata +24 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb7ba8647915177726d6f9f525ea700b0e7ca469bf8ff7460d27a8d3e5204c28
4
- data.tar.gz: d56bb7b39f7f44dc59b2d733ae60af4d3aee9135f8ee60e0721a5723bf20fc7a
3
+ metadata.gz: 82398cf1df1cb40215b1632031edfd6b6ffa4dfed2ff1c8f86c624fa938c917c
4
+ data.tar.gz: b11d133013cc1dfe416f77b26255709fb24b33061568380abf625012b13b4ee0
5
5
  SHA512:
6
- metadata.gz: 7b2d57743dbf47151f106931393b6e4e9671a8bba6b8393e3769954ddb8a82cb914c85ee926c16595ec546f2e7826a569590d6d9589d12d67d0858a77c2effc6
7
- data.tar.gz: 96d8209f672ee5118f30da45bb672db2139f9890148c0bfff46873df59329d8aa5b1c9e1763e7c063048e994f03399706fd8e850a8502e8cd8d08bcae3e44dc0
6
+ metadata.gz: ee3920c928e0d06ba4785d0a5ab091b9833d94c42eb881e879c378d36d71f6c75985299b225c198b9abf0f2d5d9a6e133a5afeb7147c87e6523bcde609f07f30
7
+ data.tar.gz: 14a4f1e5e7f23f94279b9023656d170fed8cf6b3d1a6a034b71cca658bc4d0ab13c27f8d82b589a747f02fca5f53fda1a224c7fb76d1a7f25db4552b2a9ac53d
@@ -35,6 +35,7 @@ module EducodeSales
35
35
  @staffs = Staff.joins(:user).where(job_type: common.id).map { |d| [d.user.real_name, d.id]}
36
36
  @more = can?(:create, EducodeSales::SalePlan) || can?(:update, EducodeSales::Business) || can?(:destroy, EducodeSales::Business)
37
37
  gon.menus = []
38
+ gon.place = params[:place_id].present? ? [{ value: params[:place_id], name: EducodeSales::Place.find(params[:place_id]).name }] : []
38
39
  if can?(:create, EducodeSales::SalePlan)
39
40
  gon.menus << { title: '添加周计划', event: 'week' }
40
41
  gon.menus << { title: '添加月计划', event: 'month' }
@@ -0,0 +1,17 @@
1
+ require_dependency "educode_sales/application_controller"
2
+
3
+ module EducodeSales
4
+ class CustomerExtensionsController < ApplicationController
5
+
6
+ def create
7
+ params[:school_ids].each do |d|
8
+ if EducodeSales::CustomerExtension.find_by(school_id: d).present?
9
+ EducodeSales::CustomerExtension.find_by(school_id: d).update(customer_staff_id: params[:staff_id])
10
+ else
11
+ EducodeSales::CustomerExtension.create(customer_staff_id: params[:staff_id], school_id: d)
12
+ end
13
+ end
14
+ render_success
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,41 @@
1
+ require_dependency "educode_sales/application_controller"
2
+
3
+ module EducodeSales
4
+ class CustomerFollowsController < ApplicationController
5
+ def create
6
+ follow_up = EducodeSales::CustomerFollow.new(follow_up_params)
7
+ follow_up.staff = @current_admin
8
+ if follow_up.save
9
+ render_success
10
+ else
11
+ render_failure follow_up
12
+ end
13
+ end
14
+
15
+ def destroy
16
+ follow_up = CustomerFollow.find(params[:id])
17
+ if follow_up.destroy
18
+ render_success
19
+ else
20
+ render_failure follow_up
21
+ end
22
+ end
23
+
24
+ def update
25
+ follow_up = CustomerFollow.find(params[:id])
26
+ follow_up.assign_attributes(follow_up_params)
27
+ if follow_up.save
28
+ render_success
29
+ else
30
+ render_failure follow_up
31
+ end
32
+ end
33
+
34
+ private
35
+
36
+ def follow_up_params
37
+ params.permit(:school_id, :department_id, :content)
38
+ end
39
+
40
+ end
41
+ end
@@ -0,0 +1,194 @@
1
+ require_dependency "educode_sales/application_controller"
2
+
3
+ module EducodeSales
4
+ class CustomersController < ApplicationController
5
+ # before_action :find_school, only: [:edit, :update]
6
+ # before_action :must_admin!, only: [:destroy]
7
+
8
+ def new_department
9
+ render layout: false
10
+ end
11
+ def create_department
12
+ department_name = params[:department_name].to_s.strip
13
+ school = School.find(params[:school_id])
14
+
15
+ return render_failure('部门名称重复') if school.departments.exists?(name: department_name)
16
+
17
+ ActiveRecord::Base.transaction do
18
+ department = school.departments.create!(name: department_name, is_auth: 1)
19
+ ApplyAddDepartment.create!(school_id: school.id, status: 1, name: department.name,
20
+ department_id: department.id, user_id: current_user.id)
21
+ end
22
+
23
+ render_success
24
+ end
25
+
26
+ def edit_department
27
+ @department = Department.find(params[:id])
28
+ render layout: false
29
+ end
30
+ def update_department
31
+ department = Department.find(params[:id])
32
+ department.update(name: params[:department_name])
33
+ render_success
34
+ end
35
+
36
+
37
+ def index
38
+ authorize! :read, Customer
39
+ respond_to do |format|
40
+ format.html do
41
+ common = Common.find_by(clazz: 'staff_type', name: '销售')
42
+ @staffs = Staff.joins(:user).where(job_type: common.id).map { |d| [d.user.real_name, d.id]}
43
+ end
44
+ format.json do
45
+ if @current_admin.is_admin?
46
+ @customers = School
47
+ else
48
+ level = @current_admin.role.role_areas.find_by(clazz: '客户管理').level
49
+ case level
50
+ when '自己'
51
+ school_ids = CustomerExtension.where(customer_staff_id: @current_admin.id).pluck(:school_id)
52
+ @customers = School.where(id: school_ids)
53
+ when '区域'
54
+ a_school_ids = School.where(province: @current_admin.areas.pluck(:name)).ids
55
+ b_school_ids = CustomerExtension.where(customer_staff_id: @current_admin.id).pluck(:school_id)
56
+ school_ids = a_school_ids + b_school_ids
57
+ @customers = School.where(id: school_ids)
58
+ else
59
+ @customers = School
60
+ end
61
+ end
62
+
63
+ if params[:q].present? && params[:q][:name].present?
64
+ @customers = @customers.where("schools.name like ?", "%#{params[:q][:name]}%")
65
+ end
66
+ if params[:q].present? && params[:q][:area].present?
67
+ @customers = @customers.where("schools.province = ?", "#{params[:q][:area]}")
68
+ end
69
+ if params[:q].present? && params[:q][:staff_id].present?
70
+ school_ids = EducodeSales::CustomerExtension.where(customer_staff_id: params[:q][:staff_id]).pluck(:school_id)
71
+ @customers = @customers.where(id: school_ids)
72
+ end
73
+
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
89
+
90
+ @customers = @customers.order(id: :desc).page(params[:page]).per(params[:limit])
91
+ end
92
+ end
93
+ end
94
+
95
+ def give
96
+ common = Common.find_by(clazz: 'staff_type', name: '销售')
97
+ @staffs = Staff.joins(:user).where(job_type: common.id).map { |d| [d.user.real_name, d.id]}
98
+ render layout: false
99
+ end
100
+
101
+ def show_follow
102
+ respond_to do |format|
103
+ format.html do
104
+ @school_name = School.find(params[:id]).name
105
+ @area = School.find(params[:id]).province
106
+ @staff = EducodeSales::CustomerExtension.find_by(school_id: params[:id])&.customer_staff&.user&.real_name
107
+ render layout: false
108
+ end
109
+ format.json do
110
+ @follow_ups = EducodeSales::CustomerFollow.where(school_id: params[:id])
111
+ @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
+ @follow_ups = @follow_ups.order("created_at desc")
118
+ @follow_ups = @follow_ups.page(params[:page]).per(params[:limit])
119
+ end
120
+ end
121
+ end
122
+
123
+ def show_department
124
+ @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
+ @departments = @departments.order("created_at desc")
131
+ @departments = @departments.page(params[:page]).per(params[:limit])
132
+ end
133
+
134
+
135
+ def new_follow_record
136
+ @school = School.find(params[:id])
137
+ render layout: false
138
+ end
139
+
140
+ def show_follow_record
141
+ @follow_up = EducodeSales::CustomerFollow.find(params[:id])
142
+ @school = School.find(@follow_up.school_id)
143
+ render layout: false
144
+ end
145
+
146
+ def edit_follow_record
147
+ @follow_up = EducodeSales::CustomerFollow.find(params[:id])
148
+ @school = School.find(@follow_up.school_id)
149
+ render layout: false
150
+ end
151
+
152
+ def new
153
+ render layout: false
154
+ end
155
+
156
+ def create
157
+ @school = School.find(params[:id])
158
+ ActiveRecord::Base.transaction do
159
+ property = SchoolProperty.find_or_create_by!(school_property_params)
160
+ @school = School.new
161
+ @school.attributes = school_params
162
+ @school.school_property = property
163
+ @school.save!
164
+ end
165
+ end
166
+
167
+ def edit
168
+ @school = School.find(params[:id])
169
+ render layout: false
170
+ end
171
+
172
+ def update
173
+ @school = School.find(params[:id])
174
+ ActiveRecord::Base.transaction do
175
+ property = SchoolProperty.find_or_create_by!(school_property_params)
176
+ @school.attributes = school_params
177
+ @school.school_property = property
178
+ @school.save!
179
+ end
180
+ end
181
+
182
+ private
183
+
184
+
185
+ def school_property_params
186
+ params.require(:school).permit(:project_985, :project_211, :regular_college, :junior_college, :secondary_school, :military_school, :enterprise)
187
+ end
188
+
189
+ def school_params
190
+ params.require(:school).permit(:name, :province, :city, :address)
191
+ end
192
+
193
+ end
194
+ end
@@ -16,7 +16,7 @@ module EducodeSales
16
16
 
17
17
  def create
18
18
  role = Role.new(name: params[:name])
19
- role.role_areas.build([{ clazz: 'Business' }, { clazz: 'SalePlan' }, { clazz: 'Teacher' }, { clazz: 'Operation' }])
19
+ role.role_areas.build([{ clazz: 'Business' }, { clazz: 'SalePlan' }, { clazz: 'Teacher' }, { clazz: 'Operation' }, {clazz:'Customer'}])
20
20
  if role.save
21
21
  render_success
22
22
  else
@@ -78,6 +78,9 @@ module EducodeSales
78
78
  role.role_areas.find_by(clazz: 'Operation').update(level: params[:operation])
79
79
  role.role_areas.find_by(clazz: 'SalePlan').update(level: params[:sale_plan])
80
80
  role.role_areas.find_by(clazz: 'Teacher').update(level: params[:teacher])
81
+ r = role.role_areas.find_or_initialize_by(clazz: 'Customer')
82
+ r.level = params[:customer]
83
+ r.save
81
84
  render_success
82
85
  end
83
86
 
@@ -0,0 +1,4 @@
1
+ module EducodeSales
2
+ class Customer < ApplicationRecord
3
+ end
4
+ end
@@ -0,0 +1,7 @@
1
+ module EducodeSales
2
+ class CustomerExtension < ApplicationRecord
3
+ belongs_to :customer_staff, class_name: 'Staff', optional: true
4
+ belongs_to :school
5
+
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ module EducodeSales
2
+ class CustomerFollow < ApplicationRecord
3
+ belongs_to :staff
4
+ end
5
+ end
@@ -10,7 +10,8 @@ module EducodeSales
10
10
  '运营分工': 'operation_job',
11
11
  '教师运营': 'teacher',
12
12
  '活动运营': 'activity',
13
- '运营计划': 'operation_plan'
13
+ '运营计划': 'operation_plan',
14
+ '客户管理': 'customer'
14
15
  }
15
16
  end
16
17
  end
@@ -8,6 +8,7 @@ module EducodeSales
8
8
  '销售计划': 'SalePlan',
9
9
  '教师运营': 'Teacher',
10
10
  '运营计划': 'Operation',
11
+ '客户管理': 'Customer',
11
12
  }
12
13
  end
13
14
  end
@@ -98,7 +98,7 @@
98
98
  },
99
99
  {
100
100
  field: 'advise',
101
- width: 170,
101
+ width: 120,
102
102
  title: '团队建议',
103
103
  templet:'<div><span title="{{d.advise}}">{{d.advise}}</span></div>'
104
104
  },
@@ -122,14 +122,15 @@
122
122
  },
123
123
  {
124
124
  field: 'business',
125
- width: 150,
125
+ width: 120,
126
126
  title: '所属商机',
127
127
  templet:'#business'
128
128
  },
129
129
  {
130
130
  field: 'school',
131
- width: 150,
131
+ width: 120,
132
132
  title: '单位',
133
+ templet:'<div><span title="{{d.school}}">{{d.school}}</span></div>'
133
134
  },
134
135
  {
135
136
  field: 'staff',
@@ -138,9 +139,11 @@
138
139
  },
139
140
  {
140
141
  field: 'created_at',
141
- width: 170,
142
+ width: 120,
142
143
  title: '跟进时间',
143
144
  sort: true,
145
+ templet:'<div><span title="{{d.created_at}}">{{d.created_at}}</span></div>'
146
+
144
147
  },
145
148
  {
146
149
  title: '操作',
@@ -91,9 +91,9 @@
91
91
  </div>
92
92
  <div class="layui-form-item">
93
93
  <div class="layui-inline">
94
- <label class="layui-form-label">所属年度</label>
94
+ <label class="layui-form-label required">所属年度</label>
95
95
  <div class="layui-input-inline">
96
- <input type="text" class="layui-input" name="year" autocomplete="off" id="edit_year"
96
+ <input type="text" class="layui-input" name="year" lay-verify="required" autocomplete="off" id="edit_year"
97
97
  value="<%= @follow_up&.year%>"
98
98
  placeholder="请选择年度"> </div>
99
99
  </div>
@@ -23,7 +23,7 @@
23
23
  <div class="layui-inline">
24
24
  <label class="layui-form-label">单位</label>
25
25
  <div class="layui-input-inline">
26
- <input type="text" name="department" autocomplete="off" class="layui-input">
26
+ <input type="text" name="department" autocomplete="off" value="<%=params[:school] %>" class="layui-input">
27
27
  </div>
28
28
  </div>
29
29
  <div class="layui-inline">
@@ -123,7 +123,7 @@
123
123
  range: true
124
124
  });
125
125
 
126
- var is_show = <%=params[:name].present? || params[:clazz_id].present? %>
126
+ var is_show = <%=params[:name].present? || params[:clazz_id].present? || params[:place_id].present? || params[:school].present? %>
127
127
  if(is_show){
128
128
  $('.follows_li').removeClass('layui-this');
129
129
  $('.follows_div').removeClass('layui-show');
@@ -174,6 +174,7 @@
174
174
  })
175
175
  }
176
176
  })
177
+ index_place_list.setValue(gon.place)
177
178
 
178
179
 
179
180
  table = layui.table;
@@ -10,6 +10,9 @@
10
10
  <label class="layui-form-label required">单位部门</label>
11
11
  <div class="layui-input-block" id="add_department" style="width: 300px;"></div>
12
12
  </div>
13
+ <div class="layui-inline" >
14
+ <a href="/missions/customers" style=" color: #0000FF">添加单位/部门</a>
15
+ </div>
13
16
  <br>
14
17
  <div class="layui-inline" style="padding-top: 20px">
15
18
  <label class="layui-form-label ">商机来源</label>
@@ -97,9 +97,9 @@
97
97
  </div>
98
98
  <div class="layui-form-item">
99
99
  <div class="layui-inline">
100
- <label class="layui-form-label">所属年度</label>
100
+ <label class="layui-form-label required">所属年度</label>
101
101
  <div class="layui-input-inline">
102
- <input type="text" class="layui-input" name="year" autocomplete="off" id="year"
102
+ <input type="text" class="layui-input" name="year" autocomplete="off" lay-verify="required" id="year"
103
103
  value="<%= @last_follow_up&.year%>"
104
104
  placeholder="请选择年度"> </div>
105
105
  </div>
@@ -117,6 +117,11 @@
117
117
  title: '回款计划',
118
118
  templet: '#edit_plan'
119
119
  },
120
+ {
121
+ field: 'description',
122
+ width: 120,
123
+ title: '最新进展',
124
+ },
120
125
  {
121
126
  field: 'invitation_at',
122
127
  width: 110,
@@ -160,7 +165,7 @@
160
165
 
161
166
  {
162
167
  field: 'place',
163
- width: 200,
168
+ width: 400,
164
169
  title: '渠道',
165
170
  },
166
171
  {
@@ -18,6 +18,7 @@ json.data do
18
18
  json.money d.money_plans.where(clazz: 1).sum(:amount).round(2)
19
19
  json.is_latest d.id == @latest&.id
20
20
  json.flag d.created_at.present? ? (Time.now - d.created_at).to_f/3600 < 24 : false
21
+ json.description d.description
21
22
  end
22
23
  end
23
24
 
@@ -0,0 +1,60 @@
1
+ <%#= Gon::Base.render_data %>
2
+ <form class="layui-form " action="">
3
+ <div class="layui-form-item" style="padding: 25px">
4
+ <div class="layui-form-item">
5
+ <label class="layui-form-label required">负责区域</label>
6
+ <div class="layui-input-block">
7
+ <div id="area_edit" class="demo-transfer"></div>
8
+ </div>
9
+ </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">提交
12
+ </button>
13
+ </div>
14
+ </div>
15
+ </form>
16
+
17
+
18
+ <script>
19
+
20
+ layui.use(['form', 'table', 'upload', 'laytpl', 'request', 'selectInput', 'transfer'], function () {
21
+ var form = layui.form,
22
+ layer = layui.layer,
23
+ table = layui.table,
24
+ transfer = layui.transfer,
25
+ laytpl = layui.laytpl,
26
+ request = layui.request,
27
+ $ = layui.$;
28
+
29
+ form.render();
30
+
31
+ // 当前弹出层,防止ID被覆盖
32
+ var parentIndex = layer.index;
33
+
34
+
35
+
36
+
37
+ //监听提交
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) {
51
+ layer.alert(res.msg)
52
+ } else {
53
+ layer.closeAll();
54
+ table.reload('place')
55
+ }
56
+ })
57
+ return false;
58
+ });
59
+ });
60
+ </script>
@@ -0,0 +1,52 @@
1
+ <div class="layuimini-main">
2
+ <form class="layui-form layuimini-form" action="">
3
+ <div class="layui-form-item" style="padding: 25px">
4
+ <div class="layui-inline">
5
+ <label class="layui-form-label required">部门名称</label>
6
+ <div class="layui-input-block">
7
+ <input type="text" name="department_name" required lay-verify="required" autocomplete="off" placeholder="请输入"
8
+ class="layui-input" id="inputFocus" value="<%=@department.name %>">
9
+ </div>
10
+ </div>
11
+ <div class="layui-inline" style="padding-left: 30px">
12
+ <button type="submit" class="layui-btn layui-btn-normal" lay-submit lay-filter="data-edit">提交
13
+ </button>
14
+ </div>
15
+ </div>
16
+ </form>
17
+ </div>
18
+
19
+ <script>
20
+
21
+ layui.use(['form', 'table', 'upload', 'laytpl', 'request', 'selectInput', 'transfer'], function () {
22
+ var form = layui.form,
23
+ layer = layui.layer,
24
+ table = layui.table,
25
+ transfer = layui.transfer,
26
+ laytpl = layui.laytpl,
27
+ request = layui.request,
28
+ laydate = layui.laydate,
29
+ $ = layui.$;
30
+
31
+
32
+
33
+ form.render();
34
+
35
+ // 当前弹出层,防止ID被覆盖
36
+ var parentIndex = layer.index;
37
+
38
+
39
+ //监听提交
40
+ form.on('submit(data-edit)', function (data) {
41
+ request.authPut("missions/customers/"+ parent.department_id +"/update_department", data.field, function (res) {
42
+ if (res.success === false) {
43
+ layer.alert(res.msg)
44
+ } else {
45
+ layer.close(parent.edit_index1);
46
+ table.reload('sale_plan_follow_table')
47
+ }
48
+ })
49
+ return false;
50
+ });
51
+ });
52
+ </script>
@@ -0,0 +1,50 @@
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>
5
+ <div class="layui-input-block">
6
+ <textarea name="content" placeholder="请输入跟进内容" class="layui-textarea" ><%=@follow_up.content %></textarea>
7
+ </div>
8
+ </div>
9
+ <div class="layui-inline">
10
+ <label class="layui-form-label">跟进部门</label>
11
+ <div class="layui-input-inline">
12
+ <%= select_tag "department_id",options_for_select(@school.departments.pluck(:name, :id),@follow_up.department_id)%>
13
+ </div>
14
+ </div>
15
+ <div class="layui-inline" style="padding-left: 50px">
16
+ <button type="submit" class="layui-btn layui-btn-normal" lay-submit lay-filter="edit_follow_up">提交
17
+ </button>
18
+ </div>
19
+ </form>
20
+ <script>
21
+ layui.use(['form', 'table', 'upload', 'layer', 'laytpl', 'request', 'laydate'], function () {
22
+ var form = layui.form,
23
+ layer = layui.layer,
24
+ table = layui.table,
25
+ laytpl = layui.laytpl,
26
+ request = layui.request,
27
+ laydate = layui.laydate,
28
+ $ = layui.$;
29
+
30
+
31
+ form.render();
32
+
33
+ form.on('submit(edit_follow_up)', function (data) {
34
+ request.authPut("missions/customer_follows/<%= @follow_up.id%>", data.field, function (res) {
35
+ if (res.success == false) {
36
+ layer.alert(res.msg)
37
+ } else {
38
+ layer.close(parent.editFollowIndex);
39
+ parent.layer.close(parent.layer.getFrameIndex(window.name))
40
+ parent.table.reload('customers_table')
41
+ parent.table.reload('unfinish_table')
42
+ }
43
+ })
44
+
45
+
46
+ return false;
47
+ });
48
+
49
+ });
50
+ </script>