forked from Gitlink/forgeplus
fix: 修复必填字段以及跳过key=0的数据
This commit is contained in:
parent
40e3606634
commit
9080c04699
|
@ -151,6 +151,7 @@ class CompetitionInfosController < ApplicationController
|
|||
if index == 0
|
||||
key_name = "key"
|
||||
member[key_name] = index
|
||||
next
|
||||
else
|
||||
key_name = "real_name" if i.end_with?("姓名")
|
||||
key_name = "org_name" if i.end_with?("单位")
|
||||
|
@ -163,7 +164,7 @@ class CompetitionInfosController < ApplicationController
|
|||
member_array << member
|
||||
end
|
||||
send_data["members"] = member_array
|
||||
login_index = column_names.index("用户标识*")
|
||||
login_index = column_names.index("*用户标识")
|
||||
user = User.find_by(login:row[login_index]) || User.find_by(phone: send_data['phone'])
|
||||
if user.present?
|
||||
begin
|
||||
|
@ -191,11 +192,11 @@ class CompetitionInfosController < ApplicationController
|
|||
format.xlsx {
|
||||
set_export_cookies
|
||||
enroll_fields = @competition_info.enroll_fields.except("ID")
|
||||
@table_columns = ["用户标识*"] | enroll_fields.keys
|
||||
@table_columns = ["*用户标识"] | enroll_fields.keys
|
||||
if EduSetting.get("is_local") == "true"
|
||||
@table_columns = @table_columns + ["成员姓名", "成员单位", "成员手机号"]
|
||||
@table_columns = @table_columns + ["*成员姓名", "*成员单位", "*成员手机号"]
|
||||
else
|
||||
@table_columns = @table_columns + ["成员姓名", "成员单位", "成员手机号", "职务", "jx"]
|
||||
@table_columns = @table_columns + ["*成员姓名", "*成员单位", "*成员手机号", "*职务", "*jx"]
|
||||
end
|
||||
render xlsx: "竞赛报名导入模板", template: "competition_infos/import_template.xlsx.axlsx", locals: { table_columns: @table_columns }
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue