educode_sales 1.10.73 → 1.10.74
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/educode_sales/activities_controller.rb +60 -0
- data/app/views/educode_sales/activities/_index.html.erb +1 -1
- data/app/views/educode_sales/activities/import.html.erb +40 -0
- data/config/routes.rb +2 -0
- data/lib/educode_sales/version.rb +1 -1
- metadata +7 -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: 5ec2d7381687c07a5b58b7ed90ffe76661f07306ce8a2f51f9039103395a7189
|
4
|
+
data.tar.gz: cc6976e822ae4f79e83b2520d2d1d4a5387589d41f3214b475b32afed729443c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb92d32d8e635cd97e9da876a7309499326c43384ffa2b2d2678a041fed7c59f909da1c9b6e3280df85a5b387398b4dc4d84039def13ee4dc78a026e9c5565f1
|
7
|
+
data.tar.gz: 3db12b9e7401c2f915f0376cccc4d97fb64b0d7508c3677bf5121c0b8b9fc1a0740634efc31dc19fad989e87215371af9e8d62a067fb41c825c2ee1ce61035f6
|
@@ -100,6 +100,66 @@ module EducodeSales
|
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
103
|
+
def import
|
104
|
+
render layout: false
|
105
|
+
end
|
106
|
+
|
107
|
+
def import_data
|
108
|
+
doc = SimpleXlsxReader.open(params[:file])
|
109
|
+
|
110
|
+
doc.sheets[0].rows.each_with_index do |d, i|
|
111
|
+
next if i == 0 || d[1].blank?
|
112
|
+
activity = @current_admin.activities.new({
|
113
|
+
name: d[0],
|
114
|
+
state_id: d[1],
|
115
|
+
clazz_id: d[2],
|
116
|
+
sponsor: d[5],
|
117
|
+
linkman: d[6],
|
118
|
+
phone: d[7],
|
119
|
+
scale: d[8],
|
120
|
+
address: d[9],
|
121
|
+
meeting_form: d[10],
|
122
|
+
start_at: d[13],
|
123
|
+
days: d[14]
|
124
|
+
})
|
125
|
+
activity.save
|
126
|
+
|
127
|
+
if d[4].present?
|
128
|
+
# 生态经理
|
129
|
+
d[4].gsub(/、|,|,/, "_").split("_").each do |c|
|
130
|
+
staff = EducodeSales::Staff.joins(:user).where("users.lastname =?", c).first
|
131
|
+
EducodeSales::ActivityStaff.create(staff_id: staff.id, clazz_id: 'manage', activity_id: activity.id) if staff
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
if d[11].present?
|
136
|
+
# 协助人员
|
137
|
+
d[11].gsub(/、|,|,/, "_").split("_").each do |c|
|
138
|
+
u = User.find_by(lastname: c)
|
139
|
+
if u
|
140
|
+
EducodeSales::ActivityStaff.create(name: u.real_name, clazz_id: 'assist', user_id: u.id, activity_id: activity.id)
|
141
|
+
else
|
142
|
+
EducodeSales::ActivityStaff.create(name: c, clazz_id: 'assist', activity_id: activity.id)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
if d[12].present?
|
148
|
+
# 邀请专家
|
149
|
+
d[12].gsub(/、|,|,/, "_").split("_").each do |c|
|
150
|
+
u = User.find_by(lastname: c)
|
151
|
+
if u
|
152
|
+
EducodeSales::ActivityStaff.create(name: u.real_name, clazz_id: 'invitation', user_id: u.id, activity_id: activity.id)
|
153
|
+
else
|
154
|
+
EducodeSales::ActivityStaff.create(name: c, clazz_id: 'invitation', activity_id: activity.id)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
render_success
|
161
|
+
end
|
162
|
+
|
103
163
|
def update
|
104
164
|
activity = Activity.find(params[:id])
|
105
165
|
activity.assign_attributes(
|
@@ -271,7 +271,7 @@
|
|
271
271
|
});
|
272
272
|
}
|
273
273
|
else if (obj.event === 'import') { //
|
274
|
-
var content = miniPage.getHrefContent('/missions/
|
274
|
+
var content = miniPage.getHrefContent('/missions/activities/import');
|
275
275
|
var openWH = miniPage.getOpenWidthHeight();
|
276
276
|
import_index = layer.open({
|
277
277
|
title: '导入数据',
|
@@ -0,0 +1,40 @@
|
|
1
|
+
<div style="padding-left: 50px">
|
2
|
+
<button type="button" class="layui-btn" id="test3"><i class="layui-icon"></i>选择文件</button>
|
3
|
+
</div>
|
4
|
+
<script>
|
5
|
+
layui.use(['form', 'table', 'upload', 'layer', 'laytpl', 'request', 'selectInput'], function () {
|
6
|
+
var form = layui.form,
|
7
|
+
layer = layui.layer,
|
8
|
+
table = layui.table,
|
9
|
+
laytpl = layui.laytpl,
|
10
|
+
upload = layui.upload,
|
11
|
+
request = layui.request,
|
12
|
+
$ = layui.$;
|
13
|
+
selectInput = layui.selectInput;
|
14
|
+
|
15
|
+
form.render();
|
16
|
+
|
17
|
+
//指定允许上传的文件类型
|
18
|
+
upload.render({
|
19
|
+
elem: '#test3'
|
20
|
+
,url: '/missions/activities/import_data' //此处配置你自己的上传接口即可
|
21
|
+
,accept: 'file', //普通文件
|
22
|
+
headers: {
|
23
|
+
'X-CSRF-Token': $('meta[name=csrf-token]').attr('content')
|
24
|
+
}
|
25
|
+
,before: function(obj){ //obj参数包含的信息,跟 choose回调完全一致,可参见上文。
|
26
|
+
layer.load(); //上传loading
|
27
|
+
}
|
28
|
+
,done: function(res){
|
29
|
+
layer.msg('导入成功');
|
30
|
+
table.reload('activities_table');
|
31
|
+
layer.close(parent.import_index)
|
32
|
+
layer.closeAll('loading'); //关闭loading
|
33
|
+
}
|
34
|
+
,error: function(index, upload){
|
35
|
+
layer.closeAll('loading'); //关闭loading
|
36
|
+
layer.alert('导入失败,请检查文件格式')
|
37
|
+
}
|
38
|
+
});
|
39
|
+
});
|
40
|
+
</script>
|
data/config/routes.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: educode_sales
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.10.
|
4
|
+
version: 1.10.74
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- anke1460
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -105,7 +105,6 @@ files:
|
|
105
105
|
- app/assets/images/educode_sales/icon-login.png
|
106
106
|
- app/assets/images/educode_sales/icon.png
|
107
107
|
- app/assets/images/educode_sales/indexLogo.png
|
108
|
-
- app/assets/images/educode_sales/indexlogo.png
|
109
108
|
- app/assets/images/educode_sales/loading-0.gif
|
110
109
|
- app/assets/images/educode_sales/loading-1.gif
|
111
110
|
- app/assets/images/educode_sales/loading-2.gif
|
@@ -291,6 +290,7 @@ files:
|
|
291
290
|
- app/views/educode_sales/activities/files.html.erb
|
292
291
|
- app/views/educode_sales/activities/files.json.jbuilder
|
293
292
|
- app/views/educode_sales/activities/follow_ups.json.jbuilder
|
293
|
+
- app/views/educode_sales/activities/import.html.erb
|
294
294
|
- app/views/educode_sales/activities/index.html.erb
|
295
295
|
- app/views/educode_sales/activities/index.json.jbuilder
|
296
296
|
- app/views/educode_sales/activities/new.html.erb
|
@@ -813,7 +813,7 @@ homepage: https://www.educoder.net
|
|
813
813
|
licenses:
|
814
814
|
- MIT
|
815
815
|
metadata: {}
|
816
|
-
post_install_message:
|
816
|
+
post_install_message:
|
817
817
|
rdoc_options: []
|
818
818
|
require_paths:
|
819
819
|
- lib
|
@@ -828,8 +828,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
828
828
|
- !ruby/object:Gem::Version
|
829
829
|
version: '0'
|
830
830
|
requirements: []
|
831
|
-
rubygems_version: 3.0.
|
832
|
-
signing_key:
|
831
|
+
rubygems_version: 3.0.0
|
832
|
+
signing_key:
|
833
833
|
specification_version: 4
|
834
834
|
summary: Summary of EducodeSales.
|
835
835
|
test_files: []
|
Binary file
|