educode_sales 0.9.59 → 0.9.61
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 +4 -4
- data/app/controllers/educode_sales/activities_controller.rb +101 -2
- data/app/controllers/educode_sales/businesses_controller.rb +10 -0
- data/app/controllers/educode_sales/follow_ups_controller.rb +6 -0
- data/app/controllers/educode_sales/home_controller.rb +4 -0
- data/app/controllers/educode_sales/ideas_controller.rb +86 -1
- data/app/controllers/educode_sales/upload_files_controller.rb +1 -1
- data/app/models/educode_sales/activity.rb +8 -0
- data/app/models/educode_sales/activity_staff.rb +9 -0
- data/app/models/educode_sales/idea.rb +23 -10
- data/app/views/educode_sales/activities/edit.html.erb +96 -3
- data/app/views/educode_sales/activities/index.html.erb +86 -1
- data/app/views/educode_sales/activities/index.json.jbuilder +5 -0
- data/app/views/educode_sales/activities/new.html.erb +111 -16
- data/app/views/educode_sales/businesses/_follows.html.erb +34 -1
- data/app/views/educode_sales/businesses/index.html.erb +55 -20
- data/app/views/educode_sales/businesses/index.json.jbuilder +1 -0
- data/app/views/educode_sales/businesses/time_line.html.erb +30 -0
- data/app/views/educode_sales/home/search_edu_user.json.jbuilder +13 -0
- data/app/views/educode_sales/idea_recycles/detail.html.erb +25 -4
- data/app/views/educode_sales/idea_recycles/index.html.erb +3 -3
- data/app/views/educode_sales/idea_recycles/index.json.jbuilder +1 -1
- data/app/views/educode_sales/ideas/detail.html.erb +25 -4
- data/app/views/educode_sales/ideas/edit.html.erb +134 -27
- data/app/views/educode_sales/ideas/index.html.erb +3 -3
- data/app/views/educode_sales/ideas/index.json.jbuilder +4 -4
- data/app/views/educode_sales/ideas/new.html.erb +118 -15
- data/config/routes.rb +4 -0
- data/db/migrate/20230319050647_add_clazz_to_educode_sales_activities.rb +6 -0
- data/db/migrate/20230319105048_create_educode_sales_activity_staffs.rb +13 -0
- data/db/migrate/20230322034022_add_to_school_name_to_ideas.rb +17 -0
- data/lib/educode_sales/version.rb +1 -1
- metadata +11 -7
- data/app/assets/images/educode_sales/indexlogo.png +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dda4d36517f72a9d366af24dfad85dda17417676ff115c61337b4611b484474a
|
4
|
+
data.tar.gz: b7febeed63e1933ce7509f4ba708a0fbad03f543f4b71461d2b6994abafb6458
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd9c33cb2663078a0cb34d5114c5264b92d7146c55c9a80c2699b4010f0215cf37909d5746666697bb3b89bb805063fa3d13cacd96844f0e9b340ac80ba640e7
|
7
|
+
data.tar.gz: 0d03669ffb838bead64df8769417fa5ae627735676f941d44f089fcd7553ed57130249519ca172cede3484eaf757030f0beb2788db68816fa14aee08969f4064
|
@@ -5,31 +5,81 @@ module EducodeSales
|
|
5
5
|
def index
|
6
6
|
respond_to do |format|
|
7
7
|
format.html do
|
8
|
+
@staffs = Staff.all.map { |d| [ d.user&.real_name, d.id ]}
|
8
9
|
end
|
9
10
|
format.json do
|
10
11
|
@activities = Activity
|
12
|
+
if params[:q].present?
|
13
|
+
if params[:q][:staff_id].present?
|
14
|
+
@activities = @activities.where(staff_id: params[:q][:staff_id])
|
15
|
+
end
|
16
|
+
if params[:q][:clazz_id].present?
|
17
|
+
@activities = @activities.where(clazz_id: params[:q][:clazz_id])
|
18
|
+
end
|
19
|
+
|
20
|
+
if params[:q][:name].present?
|
21
|
+
@activities = @activities.where("educode_sales_activities.name like ?", "%#{params[:q][:name]}%")
|
22
|
+
end
|
23
|
+
if params[:q][:manage].present?
|
24
|
+
@activities = @activities.joins("JOIN educode_sales_activity_staffs AS m ON m.activity_id = educode_sales_activities.id AND m.clazz_id = 0").where("m.staff_id = ?", params[:q][:manage].to_i)
|
25
|
+
end
|
26
|
+
if params[:q][:assists].present?
|
27
|
+
@activities = @activities.joins("JOIN educode_sales_activity_staffs AS a ON a.activity_id = educode_sales_activities.id AND a.clazz_id = 1").where("a.staff_id = ?", params[:q][:assists].to_i)
|
28
|
+
end
|
29
|
+
if params[:q][:expert].present?
|
30
|
+
@activities = @activities.joins("JOIN educode_sales_activity_staffs AS e ON e.activity_id = educode_sales_activities.id AND e.clazz_id = 2").where("e.name like ?", "%#{params[:q][:expert]}%")
|
31
|
+
end
|
32
|
+
end
|
11
33
|
if params[:sort].present? && params[:sort][:field]
|
12
34
|
@activities = @activities.order("#{params[:sort][:field]} #{params[:sort][:order]}")
|
13
35
|
else
|
14
36
|
@activities = @activities.order("created_at desc")
|
15
37
|
end
|
16
|
-
@activities = @activities.page(params[:page]).per(params[:limit])
|
38
|
+
@activities = @activities.distinct.page(params[:page]).per(params[:limit])
|
17
39
|
end
|
18
40
|
end
|
19
41
|
end
|
20
42
|
|
21
43
|
def new
|
44
|
+
@clazz = ['全国会议', '区域会议', '单校会议', '国赛', '省赛', '夏令营']
|
45
|
+
gon.staff_manage = Staff.all.map { |d| {name: d.user&.real_name, value: d.id}}
|
22
46
|
render layout: false
|
23
47
|
end
|
24
48
|
|
25
49
|
def edit
|
26
50
|
@activity = Activity.find(params[:id])
|
51
|
+
manage_ids = @activity.manages.pluck(:staff_id)
|
52
|
+
assist_ids = @activity.assists.pluck(:staff_id)
|
53
|
+
gon.staff_manage = Staff.all.map { |d| {name: d.user&.real_name, value: d.id, selected: manage_ids.include?(d.id)}}
|
54
|
+
gon.assists = Staff.all.map { |d| {name: d.user&.real_name, value: d.id, selected: assist_ids.include?(d.id)}}
|
55
|
+
gon.experts = @activity.experts.map { |d| {name: d.name, value: d.user_id || d.name, selected: true}}
|
27
56
|
render layout: false
|
28
57
|
end
|
29
58
|
|
30
59
|
def create
|
31
|
-
activity = @current_admin.activities.new(
|
60
|
+
activity = @current_admin.activities.new(activity_params)
|
61
|
+
|
62
|
+
# render_success
|
32
63
|
if activity.save
|
64
|
+
params[:staff_manage_id].each do |d|
|
65
|
+
EducodeSales::ActivityStaff.create(staff_id: d, clazz_id: 'manage', activity_id: activity.id)
|
66
|
+
end
|
67
|
+
params[:staff_assist_id].each do |d|
|
68
|
+
EducodeSales::ActivityStaff.create(staff_id: d, clazz_id: 'assist', activity_id: activity.id)
|
69
|
+
end
|
70
|
+
params[:expert_ids].each do |d|
|
71
|
+
if d[0].to_i > 0
|
72
|
+
u = User.find(d[0].to_i)
|
73
|
+
EducodeSales::ActivityStaff.create(name: u.real_name, clazz_id: 'expert', user_id: d[0].to_i, activity_id: activity.id)
|
74
|
+
else
|
75
|
+
EducodeSales::ActivityStaff.create(name: d[1], clazz_id: 'expert', activity_id: activity.id)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
if params[:attachment_id].present?
|
79
|
+
attachment = @current_admin.user.attachments.find(params[:attachment_id])
|
80
|
+
attachment.container = activity
|
81
|
+
attachment.save
|
82
|
+
end
|
33
83
|
render_success
|
34
84
|
else
|
35
85
|
render_failure activity
|
@@ -39,6 +89,44 @@ module EducodeSales
|
|
39
89
|
def update
|
40
90
|
activity = Activity.find(params[:id])
|
41
91
|
activity.assign_attributes(name: params[:name], start_at: params[:start_at], days: params[:days])
|
92
|
+
manages = []
|
93
|
+
experts = []
|
94
|
+
assists = []
|
95
|
+
params[:staff_manage_id].each do |d|
|
96
|
+
manages << EducodeSales::ActivityStaff.find_or_initialize_by(staff_id: d, clazz_id: 'manage', activity_id: activity.id)
|
97
|
+
end
|
98
|
+
|
99
|
+
params[:staff_assist_id].each do |d|
|
100
|
+
assists << EducodeSales::ActivityStaff.find_or_initialize_by(staff_id: d, clazz_id: 'assist', activity_id: activity.id)
|
101
|
+
end
|
102
|
+
params[:expert_ids].each do |d|
|
103
|
+
if d[0].to_i > 0
|
104
|
+
u = User.find(d[0].to_i)
|
105
|
+
experts << EducodeSales::ActivityStaff.find_or_initialize_by(name: u.real_name, clazz_id: 'expert', user_id: d[0].to_i, activity_id: activity.id)
|
106
|
+
else
|
107
|
+
experts << EducodeSales::ActivityStaff.find_or_initialize_by(name: d[1], clazz_id: 'expert', activity_id: activity.id)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
activity.manages = manages
|
111
|
+
activity.assists = assists
|
112
|
+
activity.experts = experts
|
113
|
+
|
114
|
+
if params[:attachment_id].present?
|
115
|
+
if activity.attachment&.id && activity.attachment&.id != params[:attachment_id].to_i
|
116
|
+
file_path = File.join(Rails.root, "public", "files", 'educode_sales', activity.attachment.disk_filename)
|
117
|
+
File.delete(file_path) if File.exist?(file_path)
|
118
|
+
activity.attachment.destroy
|
119
|
+
end
|
120
|
+
attachment = @current_admin.user.attachments.find(params[:attachment_id])
|
121
|
+
attachment.container = activity
|
122
|
+
attachment.save
|
123
|
+
else
|
124
|
+
if activity.attachment
|
125
|
+
file_path = File.join(Rails.root, "public", "files", 'educode_sales', activity.attachment.disk_filename)
|
126
|
+
File.delete(file_path) if File.exist?(file_path)
|
127
|
+
activity.attachment.destroy
|
128
|
+
end
|
129
|
+
end
|
42
130
|
if activity.save
|
43
131
|
render_success
|
44
132
|
else
|
@@ -48,6 +136,11 @@ module EducodeSales
|
|
48
136
|
|
49
137
|
def destroy
|
50
138
|
activity = Activity.find(params[:id])
|
139
|
+
if activity.attachment
|
140
|
+
file_path = File.join(Rails.root, "public", "files", 'educode_sales', activity.attachment.disk_filename)
|
141
|
+
File.delete(file_path) if File.exist?(file_path)
|
142
|
+
activity.attachment.destroy
|
143
|
+
end
|
51
144
|
activity.destroy
|
52
145
|
render_success
|
53
146
|
rescue ActiveRecord::DeleteRestrictionError => e
|
@@ -58,5 +151,11 @@ module EducodeSales
|
|
58
151
|
render layout: false
|
59
152
|
end
|
60
153
|
|
154
|
+
private
|
155
|
+
|
156
|
+
def activity_params
|
157
|
+
params.permit(:name, :start_at, :days, :staff_assist_id, :staff_manage_id, :clazz_id, :expert)
|
158
|
+
end
|
159
|
+
|
61
160
|
end
|
62
161
|
end
|
@@ -1080,6 +1080,16 @@ module EducodeSales
|
|
1080
1080
|
end
|
1081
1081
|
end
|
1082
1082
|
|
1083
|
+
def update_advise
|
1084
|
+
business = Business.find(params[:id])
|
1085
|
+
if business.last_follow_up.present?
|
1086
|
+
business.last_follow_up.update(advise: params[:content])
|
1087
|
+
render_success
|
1088
|
+
else
|
1089
|
+
render_failure '无跟进动态,暂不能添加建议'
|
1090
|
+
end
|
1091
|
+
end
|
1092
|
+
|
1083
1093
|
private
|
1084
1094
|
|
1085
1095
|
def load_business
|
@@ -42,6 +42,10 @@ module EducodeSales
|
|
42
42
|
@data = User.joins(:user_extension).where("identity='teacher'").where("concat(lastname, firstname) like :q OR phone like :q OR mail like :q", q: "%#{params[:q]}%").limit(50)
|
43
43
|
end
|
44
44
|
|
45
|
+
def search_edu_user
|
46
|
+
@data = User.joins(:user_extension).where("identity='teacher'").where("concat(lastname, firstname) like :q OR phone like :q OR mail like :q", q: "%#{params[:q]}%").limit(20)
|
47
|
+
end
|
48
|
+
|
45
49
|
def sales_staff
|
46
50
|
@staffs = Staff
|
47
51
|
if params[:teacher_assist].present?
|
@@ -58,6 +58,8 @@ module EducodeSales
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def new
|
61
|
+
staffs = Staff.where.not(role_id: 11).includes(:user)
|
62
|
+
gon.staffs = staffs.map { |d| { name: d.user.real_name, value: d.id } }
|
61
63
|
gon.department = { value: '', name: '' }
|
62
64
|
gon.value = ''
|
63
65
|
render layout: false
|
@@ -67,6 +69,8 @@ module EducodeSales
|
|
67
69
|
idea = Idea.new(idea_params)
|
68
70
|
idea.school_id = Department.find_by_id(idea.department_id)&.school_id
|
69
71
|
idea.creator = current_user
|
72
|
+
assist_staff_ids = Array(params[:assist_staff_ids].to_s.split(","))
|
73
|
+
idea.assist_staff_ids = assist_staff_ids
|
70
74
|
idea.save
|
71
75
|
render_success
|
72
76
|
end
|
@@ -82,6 +86,8 @@ module EducodeSales
|
|
82
86
|
def update
|
83
87
|
@idea.assign_attributes(idea_params)
|
84
88
|
@idea.school_id = Department.find_by_id(@idea.department_id)&.school_id
|
89
|
+
assist_staff_ids = Array(params[:assist_staff_ids].to_s.split(","))
|
90
|
+
@idea.assist_staff_ids = assist_staff_ids
|
85
91
|
check_changes
|
86
92
|
@idea.save
|
87
93
|
render_success
|
@@ -93,6 +99,11 @@ module EducodeSales
|
|
93
99
|
end
|
94
100
|
|
95
101
|
def edit
|
102
|
+
staffs = Staff.where.not(role_id: 11).includes(:user)
|
103
|
+
gon.staffs = staffs.map { |d| { name: d.user.real_name, value: d.id } }
|
104
|
+
gon.staff_value = [{ name: @idea.staff&.user&.real_name, value: @idea.staff_id }]
|
105
|
+
gon.sale_staff_value = [{ name: @idea.sale_staff&.user&.real_name, value: @idea.sale_staff_id }]
|
106
|
+
gon.assist_staff_value = @idea.assist_staffs.map {|d|{ name: d&.user&.real_name, value: d.id }}
|
96
107
|
gon.department = { value: @idea&.department_id, name: "#{@idea&.department&.school&.name}-#{@idea&.department&.name}" }
|
97
108
|
gon.value = @idea.department_id
|
98
109
|
render layout: false
|
@@ -104,7 +115,7 @@ module EducodeSales
|
|
104
115
|
params.permit(:name, :level, :staff_id,
|
105
116
|
:status, :types, :model, :hardware, :project,
|
106
117
|
:money, :end_time, :content, :department_id,
|
107
|
-
:manager_name, :manager_phone)
|
118
|
+
:manager_name, :manager_phone,:school_name,:department_name,:sale_staff_id,:attachment_id)
|
108
119
|
end
|
109
120
|
|
110
121
|
def find_idea
|
@@ -126,5 +137,79 @@ module EducodeSales
|
|
126
137
|
end
|
127
138
|
end
|
128
139
|
|
140
|
+
# def upload_file(file)
|
141
|
+
# folder = File.join(Rails.root, "public", "files", 'educode_sales')
|
142
|
+
# upload_file = file
|
143
|
+
# raise "未上传文件" unless upload_file
|
144
|
+
# save_path = File.join(folder)
|
145
|
+
# ext = file_ext(upload_file.original_filename)
|
146
|
+
# local_path, digest = file_save_to_local(save_path, upload_file.tempfile, ext)
|
147
|
+
# content_type = upload_file.content_type.presence || 'application/octet-stream'
|
148
|
+
# disk_filename = local_path[save_path.size + 1, local_path.size]
|
149
|
+
# @attachment = Attachment.where(disk_filename: disk_filename,
|
150
|
+
# author_id: current_user.id).first
|
151
|
+
# if @attachment.blank?
|
152
|
+
# @attachment = Attachment.new
|
153
|
+
# @attachment.filename = upload_file.original_filename
|
154
|
+
# @attachment.description = "popup_windows"
|
155
|
+
# @attachment.disk_filename = local_path[save_path.size + 1, local_path.size]
|
156
|
+
# @attachment.filesize = upload_file.tempfile.size
|
157
|
+
# @attachment.content_type = content_type
|
158
|
+
# @attachment.digest = digest
|
159
|
+
# @attachment.author_id = current_user.id
|
160
|
+
# @attachment.container_id = current_user.id
|
161
|
+
# @attachment.save!
|
162
|
+
# else
|
163
|
+
# logger.info "文件已存在,id = #{@attachment.id}, filename = #{@attachment.filename}"
|
164
|
+
# end
|
165
|
+
# @attachment.id
|
166
|
+
# # render_ok
|
167
|
+
# end
|
168
|
+
# def edu_setting name
|
169
|
+
# EduSetting.get(name)
|
170
|
+
# end
|
171
|
+
#
|
172
|
+
#
|
173
|
+
# def file_ext(file_name)
|
174
|
+
# ext = ''
|
175
|
+
# exts = file_name.split(".")
|
176
|
+
# if exts.size > 1
|
177
|
+
# ext = ".#{exts.last}"
|
178
|
+
# end
|
179
|
+
# ext
|
180
|
+
# end
|
181
|
+
#
|
182
|
+
# def file_save_to_local(save_path, temp_file, ext)
|
183
|
+
# unless Dir.exists?(save_path)
|
184
|
+
# FileUtils.mkdir_p(save_path) ##不成功这里会抛异常
|
185
|
+
# end
|
186
|
+
#
|
187
|
+
# digest = md5_file(temp_file)
|
188
|
+
# digest = "#{digest}_#{(Time.now.to_f * 1000).to_i}"
|
189
|
+
# local_file_path = File.join(save_path, digest) + ext
|
190
|
+
# save_temp_file(temp_file, local_file_path)
|
191
|
+
#
|
192
|
+
# [local_file_path, digest]
|
193
|
+
# end
|
194
|
+
#
|
195
|
+
#
|
196
|
+
# def md5_file(temp_file)
|
197
|
+
# md5 = Digest::MD5.new
|
198
|
+
# temp_file.rewind
|
199
|
+
# while (buffer = temp_file.read(8192))
|
200
|
+
# md5.update(buffer)
|
201
|
+
# end
|
202
|
+
# md5.hexdigest
|
203
|
+
# end
|
204
|
+
#
|
205
|
+
# def save_temp_file(temp_file, save_file_path)
|
206
|
+
# File.open(save_file_path, 'wb') do |f|
|
207
|
+
# temp_file.rewind
|
208
|
+
# while (buffer = temp_file.read(8192))
|
209
|
+
# f.write(buffer)
|
210
|
+
# end
|
211
|
+
# end
|
212
|
+
# end
|
213
|
+
|
129
214
|
end
|
130
215
|
end
|
@@ -44,7 +44,7 @@ module EducodeSales
|
|
44
44
|
else
|
45
45
|
logger.info "文件已存在,id = #{@attachment.id}, filename = #{@attachment.filename}"
|
46
46
|
end
|
47
|
-
|
47
|
+
render json: { success: true, attachment_id: @attachment.id ,filename: @attachment.filename, url: folder + "/" + @attachment.disk_filename}
|
48
48
|
end
|
49
49
|
|
50
50
|
def destroy
|
@@ -3,5 +3,13 @@ module EducodeSales
|
|
3
3
|
belongs_to :staff
|
4
4
|
has_many :activity_teachers, dependent: :destroy
|
5
5
|
has_many :teachers, through: :activity_teachers, dependent: :restrict_with_exception
|
6
|
+
has_many :manages, -> {where("educode_sales_activity_staffs.clazz_id = 0")}, dependent: :destroy, class_name: 'ActivityStaff'
|
7
|
+
has_many :assists, -> {where("educode_sales_activity_staffs.clazz_id = 1")}, dependent: :destroy, class_name: 'ActivityStaff'
|
8
|
+
has_many :experts , -> {where("educode_sales_activity_staffs.clazz_id = 2")}, dependent: :destroy, class_name: 'ActivityStaff'
|
9
|
+
has_many :activity_staffs
|
10
|
+
|
11
|
+
has_one :attachment, as: :container, dependent: :destroy
|
12
|
+
|
13
|
+
enum clazz_id: ['全国会议', '区域会议', '单校会议', '国赛', '省赛', '夏令营']
|
6
14
|
end
|
7
15
|
end
|
@@ -3,8 +3,11 @@ module EducodeSales
|
|
3
3
|
belongs_to :department, optional: true
|
4
4
|
belongs_to :staff, optional: true
|
5
5
|
belongs_to :school, optional: true
|
6
|
+
belongs_to :attachment, optional: true
|
6
7
|
belongs_to :creator, class_name: 'Staff', optional: true
|
7
8
|
belongs_to :deleter, class_name: 'Staff', optional: true
|
9
|
+
belongs_to :sale_staff, class_name: 'Staff', optional: true
|
10
|
+
belongs_to :idea_staff, class_name: 'Staff', optional: true
|
8
11
|
|
9
12
|
has_many :idea_histories, dependent: :destroy
|
10
13
|
|
@@ -12,16 +15,22 @@ module EducodeSales
|
|
12
15
|
scope :not_deleted, -> { where(is_deleted: false) }
|
13
16
|
|
14
17
|
enum level: %w[高 中 低]
|
15
|
-
enum status: %w[已完成
|
18
|
+
enum status: %w[未完成 已完成]
|
16
19
|
enum types: %w[定制 非定制]
|
17
20
|
enum model: %w[本地版 线上版 混合版]
|
18
21
|
|
22
|
+
serialize :assist_staff_ids,Array
|
23
|
+
|
19
24
|
# before_save :check_changes
|
20
25
|
|
21
26
|
def recycle
|
22
27
|
self.update(deleted_at: nil, deleter_id: nil, is_deleted: false)
|
23
28
|
end
|
24
29
|
|
30
|
+
def assist_staffs
|
31
|
+
Staff.where(id: self.assist_staff_ids)
|
32
|
+
end
|
33
|
+
|
25
34
|
def soft_destroy(staff_id)
|
26
35
|
self.update(deleted_at: Time.now, deleter_id: staff_id, is_deleted: true)
|
27
36
|
end
|
@@ -43,10 +52,14 @@ module EducodeSales
|
|
43
52
|
|
44
53
|
def save_history(attr, old_value, new_value)
|
45
54
|
case attr
|
46
|
-
when "
|
47
|
-
old_value = School.find_by(id: old_value)&.name
|
48
|
-
new_value = School.find_by(id: new_value)&.name
|
55
|
+
when "school_name"
|
49
56
|
"学校/单位由“#{old_value}”变更为“#{new_value}”"
|
57
|
+
when "department_name"
|
58
|
+
"院系/部门由“#{old_value}”变更为“#{new_value}”"
|
59
|
+
# when "school_id"
|
60
|
+
# old_value = School.find_by(id: old_value)&.name
|
61
|
+
# new_value = School.find_by(id: new_value)&.name
|
62
|
+
# "学校/单位由“#{old_value}”变更为“#{new_value}”"
|
50
63
|
when "name"
|
51
64
|
"项目名称由“#{old_value}”变更为“#{new_value}”"
|
52
65
|
when "level"
|
@@ -54,7 +67,7 @@ module EducodeSales
|
|
54
67
|
when "staff_id"
|
55
68
|
old_value = Staff.find_by(id: old_value)&.user&.real_name
|
56
69
|
new_value = Staff.find_by(id: new_value)&.user&.real_name
|
57
|
-
"
|
70
|
+
"方案指派人由“#{old_value}”变更为“#{new_value}”"
|
58
71
|
when "status"
|
59
72
|
"状态由“#{old_value}”变更为“#{new_value}”"
|
60
73
|
when "types"
|
@@ -64,17 +77,17 @@ module EducodeSales
|
|
64
77
|
when "hardware"
|
65
78
|
"硬件规模(万)由“#{old_value}”变更为“#{new_value}”"
|
66
79
|
when "project"
|
67
|
-
"
|
80
|
+
"并发规模(人)由“#{old_value}”变更为“#{new_value}”"
|
68
81
|
when "money"
|
69
82
|
"项目预算(万)由“#{old_value}”变更为“#{new_value}”"
|
70
83
|
when "end_time"
|
71
84
|
"截止时间由“#{old_value}”变更为“#{new_value}”"
|
72
85
|
when "content"
|
73
86
|
"反馈情况由“#{old_value}”变更为“#{new_value}”"
|
74
|
-
when "department_id"
|
75
|
-
|
76
|
-
|
77
|
-
|
87
|
+
# when "department_id"
|
88
|
+
# old_value = Department.find_by(id: old_value)&.name
|
89
|
+
# new_value = Department.find_by(id: new_value)&.name
|
90
|
+
# "院系/部门由“#{old_value}”变更为“#{new_value}”"
|
78
91
|
when "manager_name"
|
79
92
|
"学校负责人由“#{old_value}”变更为“#{new_value}”"
|
80
93
|
when "manager_phone"
|
@@ -1,7 +1,7 @@
|
|
1
|
-
|
1
|
+
<%= Gon::Base.render_data %>
|
2
2
|
<div class="layuimini-main">
|
3
3
|
<form class="layui-form layuimini-form" action="">
|
4
|
-
<div class="layui-form-item"
|
4
|
+
<div class="layui-form-item">
|
5
5
|
<div class="layui-inline">
|
6
6
|
<label class="layui-form-label required">活动名称</label>
|
7
7
|
<div class="layui-input-block">
|
@@ -23,6 +23,39 @@
|
|
23
23
|
class="layui-input" value="<%= @activity.days %>">
|
24
24
|
</div>
|
25
25
|
</div>
|
26
|
+
<div class="layui-inline">
|
27
|
+
<label class="layui-form-label">生态经理</label>
|
28
|
+
<div class="layui-input-block">
|
29
|
+
<div id="staff_manage_list" style="width: 163px;"></div>
|
30
|
+
</div>
|
31
|
+
</div>
|
32
|
+
<div class="layui-inline">
|
33
|
+
<label class="layui-form-label">协助人员</label>
|
34
|
+
<div class="layui-input-block">
|
35
|
+
<div id="staff_assist_list" style="width: 193px;"></div>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
<div class="layui-inline">
|
39
|
+
<label class="layui-form-label">报告专家</label>
|
40
|
+
<div class="layui-input-block">
|
41
|
+
<div id="expert_list" style="width: 600px;"></div>
|
42
|
+
</div>
|
43
|
+
</div>
|
44
|
+
</div>
|
45
|
+
<div class="layui-form-item">
|
46
|
+
<div class="layui-inline">
|
47
|
+
<label class="layui-form-label">上传附件</label>
|
48
|
+
<div class="layui-input-block">
|
49
|
+
<%= hidden_field_tag 'attachment_id', @activity.attachment&.id %>
|
50
|
+
<span id="attachment">
|
51
|
+
<% if @activity.attachment %>
|
52
|
+
<%= link_to @activity.attachment&.filename.to_s, "/missions/upload_files/download?id=#{@activity.attachment&.id}", target: '_blank' %>
|
53
|
+
<a href="javascript:;" style="color:red;" id="delete">删除</a>
|
54
|
+
<% end %>
|
55
|
+
</span>
|
56
|
+
<button type="button" class="layui-btn" id="upload_file">上传文件</button>
|
57
|
+
</div>
|
58
|
+
</div>
|
26
59
|
<div class="layui-inline" style="padding-left: 30px">
|
27
60
|
<button type="submit" class="layui-btn layui-btn-normal" lay-submit lay-filter="data-reset-btn">提交
|
28
61
|
</button>
|
@@ -32,7 +65,7 @@
|
|
32
65
|
</div>
|
33
66
|
<script>
|
34
67
|
|
35
|
-
layui.use(['form', 'table', 'upload', 'laytpl', 'request', 'selectInput', 'transfer'], function () {
|
68
|
+
layui.use(['form', 'table', 'upload', 'laytpl', 'request', 'selectInput', 'transfer', 'xmSelect'], function () {
|
36
69
|
var form = layui.form,
|
37
70
|
layer = layui.layer,
|
38
71
|
table = layui.table,
|
@@ -40,6 +73,8 @@
|
|
40
73
|
laytpl = layui.laytpl,
|
41
74
|
request = layui.request,
|
42
75
|
$ = layui.$,
|
76
|
+
xmSelect = layui.xmSelect,
|
77
|
+
upload = layui.upload,
|
43
78
|
laydate = layui.laydate;
|
44
79
|
|
45
80
|
//常规用法
|
@@ -64,9 +99,67 @@
|
|
64
99
|
}
|
65
100
|
})
|
66
101
|
|
102
|
+
upload.render({
|
103
|
+
elem: '#upload_file',
|
104
|
+
url: '/missions/upload_files',
|
105
|
+
auto: true,
|
106
|
+
accept: 'file',
|
107
|
+
done: function (res) {
|
108
|
+
layer.msg('上传成功');
|
109
|
+
$("#attachment_id").val(res.attachment_id);
|
110
|
+
document.getElementById("attachment").innerHTML = '<a target="_blank" href="' + res.url+ '">' + res.filename + '</a><a href="javascript:;" style="color:red;" id="delete">删除</a>';
|
111
|
+
}
|
112
|
+
});
|
113
|
+
|
114
|
+
var staff_manage = xmSelect.render({
|
115
|
+
el: '#staff_manage_list',
|
116
|
+
data: gon.staff_manage,
|
117
|
+
filterable: true,
|
118
|
+
})
|
119
|
+
|
120
|
+
var staff_assist = xmSelect.render({
|
121
|
+
el: '#staff_assist_list',
|
122
|
+
data: gon.assists,
|
123
|
+
filterable: true,
|
124
|
+
})
|
125
|
+
var expert = xmSelect.render({
|
126
|
+
el: '#expert_list',
|
127
|
+
filterable: true,
|
128
|
+
name: 'expert_ids',
|
129
|
+
remoteSearch: true,
|
130
|
+
remoteMethod: function(val, cb, show){
|
131
|
+
if(!val){
|
132
|
+
return cb([]);
|
133
|
+
}
|
134
|
+
request.get('missions/search_edu_user?q=' + val, {}, function (res) {
|
135
|
+
if (res.data.length == 0) {
|
136
|
+
cb([{value: val, name: val}])
|
137
|
+
} else {
|
138
|
+
cb(res.data);
|
139
|
+
}
|
140
|
+
})
|
141
|
+
},
|
142
|
+
data: gon.experts
|
143
|
+
})
|
144
|
+
|
145
|
+
$(body).on("click", "#delete", function() {
|
146
|
+
document.getElementById("attachment").innerHTML = "";
|
147
|
+
$("#attachment_id").val('');
|
148
|
+
})
|
67
149
|
|
68
150
|
//监听提交
|
69
151
|
form.on('submit(data-reset-btn)', function (data) {
|
152
|
+
data.field.staff_manage_id = staff_manage.getValue('value');
|
153
|
+
data.field.staff_assist_id = staff_assist.getValue('value');
|
154
|
+
var expertids = [];
|
155
|
+
expert.getValue().forEach(function(d) {
|
156
|
+
if (typeof(d.value) == 'number') {
|
157
|
+
expertids.push([d.value, d.name]);
|
158
|
+
} else {
|
159
|
+
expertids.push(['', d.name]);
|
160
|
+
}
|
161
|
+
})
|
162
|
+
data.field.expert_ids = expertids;
|
70
163
|
request.authPut("missions/activities/" + <%= @activity.id %>, data.field, function (res) {
|
71
164
|
if (res.success === false) {
|
72
165
|
layer.alert(res.msg)
|