Merge branch 'dev_trainings' into develop

dev_trainings
p31729568 6 years ago
commit 64cc6c9fb4

@ -4161,7 +4161,7 @@ end
sheet1 = book.create_worksheet :name => "sheet"
blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10
sheet1.row(0).default_format = blue
sheet1.row(0).concat(["姓名", "手机号","邮箱","单位名称", "职位","专业", "学号", '培训类型', '授课/研究领域' "支付方式","支付状态","支付时间", "发票类型", "发票抬头","税务登记号", "发票内容", "备注", "微信支付单号", "报名时间"])
sheet1.row(0).concat(["姓名", "手机号","邮箱","单位名称", "职位","专业", "学号", '授课/研究领域' "支付方式","支付状态","支付时间", "发票类型", "发票抬头","税务登记号", "发票内容", "备注", "微信支付单号", "报名时间"])
count_row = 1
trainings.find_each do |t|
sheet1[count_row, 0] = t.name
@ -4171,18 +4171,17 @@ end
sheet1[count_row, 4] = t.position
sheet1[count_row, 5] = t.major
sheet1[count_row, 6] = t.student_id
sheet1[count_row, 7] = t.training_category
sheet1[count_row, 8] = t.research_field
sheet1[count_row, 9] = t.training_payinfo.try(:pay_type_str)
sheet1[count_row, 10] = t.training_payinfo.try(:pay_status_str)
sheet1[count_row, 11] = format_time t.training_payinfo.try(:pay_time)
sheet1[count_row, 12] = t.training_payinfo.try(:invoice_title).present? ? '需要' : '不需要'
sheet1[count_row, 13] = t.training_payinfo.try(:invoice_title)
sheet1[count_row, 14] = t.training_payinfo.try(:invoice_no)
sheet1[count_row, 15] = t.training_payinfo.try(:invoice_content)
sheet1[count_row, 16] = t.training_payinfo.try(:info)
sheet1[count_row, 17] = t.training_payinfo.try(:out_trade_no)
sheet1[count_row, 18] = format_time t.created_at
sheet1[count_row, 7] = t.research_field
sheet1[count_row, 8] = t.training_payinfo.try(:pay_type_str)
sheet1[count_row, 9] = t.training_payinfo.try(:pay_status_str)
sheet1[count_row, 10] = format_time t.training_payinfo.try(:pay_time)
sheet1[count_row, 11] = t.training_payinfo.try(:invoice_title).present? ? '需要' : '不需要'
sheet1[count_row, 12] = t.training_payinfo.try(:invoice_title)
sheet1[count_row, 13] = t.training_payinfo.try(:invoice_no)
sheet1[count_row, 14] = t.training_payinfo.try(:invoice_content)
sheet1[count_row, 15] = t.training_payinfo.try(:info)
sheet1[count_row, 16] = t.training_payinfo.try(:out_trade_no)
sheet1[count_row, 17] = format_time t.created_at
count_row += 1
end
book.write xls_report

@ -108,7 +108,6 @@ class TrainingsController < ApplicationController
@training.training_type = @training_type
if @training_type == 3
@training.research_field = params[:research_field].select(&:present?).uniq.join(",")
@training.training_category = params[:training_category]
end
@training.openid = session[:wechat_open_id]
@training.save!
@ -128,7 +127,6 @@ class TrainingsController < ApplicationController
@training.assign_attributes(params)
if @training.training_type == 3
@training.research_field = params[:research_field].select(&:present?).uniq.join(",")
@training.training_category = params[:training_category]
end
@training.save!

@ -5,6 +5,8 @@
<option value="-1">选择活动名称</option>
<option value="1">2018深圳培训会</option>
<option value="2">2019湖南警察学院大数据培训</option>
<option value="3">信息技术新工科产学研联盟师资培训班</option>
<option value="4">工程教育认证</option>
</select>
<select class="fl mr10 winput-120-30" name="pay_type">
<option value="-1">选择支付方式</option>

@ -153,28 +153,6 @@
value="<%= @training.position %>"/>
</li>
<% if @training_type == 3 %>
<p class="subtitle">培训类型</p>
<li class="clearfix infoBar">
<span class="left_tag fl">大数据方向</span>
<span class="fr">
<%= radio_button_tag(:training_category, '大数据方向', @training.training_category == '大数据方向', id: 'type_1', class: 'magic-radio') %>
<label for="type_1" style="top:8px">&nbsp;</label>
</span>
</li>
<li class="clearfix infoBar">
<span class="left_tag fl">人工智能方向</span>
<span class="fr">
<%= radio_button_tag(:training_category, '人工智能方向', @training.training_category == '人工智能方向', id: 'type_2', class: 'magic-radio') %>
<label for="type_2" style="top:8px">&nbsp;</label>
</span>
</li>
<li class="clearfix infoBar">
<span class="left_tag fl">大数据+人工智能方向</span>
<span class="fr">
<%= radio_button_tag(:training_category, '大数据+人工智能方向', @training.training_category == '大数据+人工智能方向', id: 'type_3', class: 'magic-radio') %>
<label for="type_3" style="top:8px">&nbsp;</label>
</span>
</li>
<p class="subtitle">您的授课/研究领域最少选1项</p>
<li class="clearfix infoBar">
<span class="left_tag fl">机器学习/深度学习</span>
@ -295,12 +273,6 @@
}
<% if @training_type == 3 %>
var trainingCategory = $('input[type="radio"][name="training_category"]:checked').val();
if (trainingCategory == undefined || trainingCategory == '') {
alert('请选择培训类型');
return;
}
if ($("input[type='checkbox'][name='research_field[]']:checked").length == 0) {
alert('请选择授课类型/研究领域');
return;

@ -0,0 +1,9 @@
class RemoveTrainingCategoryInTrainings < ActiveRecord::Migration
def up
remove_column :trainings, :training_category
end
def down
add_column :trainings, :training_category, :string
end
end
Loading…
Cancel
Save