|
|
|
@ -107,6 +107,34 @@ $(document).on('turbolinks:load', function(){
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var selectOptions = {
|
|
|
|
|
theme: 'bootstrap4',
|
|
|
|
|
placeholder: '请输入要添加的单位名称',
|
|
|
|
|
multiple: true,
|
|
|
|
|
minimumInputLength: 1,
|
|
|
|
|
ajax: {
|
|
|
|
|
delay: 500,
|
|
|
|
|
url: '/api/schools/for_option.json',
|
|
|
|
|
dataType: 'json',
|
|
|
|
|
data: function(params){
|
|
|
|
|
return { keyword: params.term };
|
|
|
|
|
},
|
|
|
|
|
processResults: function(data){
|
|
|
|
|
return { results: data.schools }
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
templateResult: function (item) {
|
|
|
|
|
if(!item.id || item.id === '') return item.text;
|
|
|
|
|
return item.name || item.text;
|
|
|
|
|
},
|
|
|
|
|
templateSelection: function(item){
|
|
|
|
|
return item.name || item.text;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$('.sponsor-select').select2(selectOptions);
|
|
|
|
|
$('.allow-school-select').select2(selectOptions);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -291,7 +319,7 @@ $(function () {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('form.stage-update-form').on('click', ".update-stage", function () {
|
|
|
|
|
$('.competition-chart-setting').on('click', ".update-stage", function () {
|
|
|
|
|
var updateForm = $(this).parents("form");
|
|
|
|
|
$(this).attr('disabled', 'disabled');
|
|
|
|
|
updateForm.find('.error').html('');
|
|
|
|
@ -450,9 +478,13 @@ function Del_tab(item) {
|
|
|
|
|
$(item).parents(".large_panel_part").remove();
|
|
|
|
|
}
|
|
|
|
|
//新增tab
|
|
|
|
|
function addNewTab() {
|
|
|
|
|
function addNewTab(competition_id) {
|
|
|
|
|
if($(".new-stage-form").length > 0){
|
|
|
|
|
alert("请先保存上一个tab");
|
|
|
|
|
} else {
|
|
|
|
|
var count = parseInt($("#large_panel").find(".large_panel_part").length)+1;
|
|
|
|
|
var html = '<div class="large_panel_part" attr_line="'+count+'"><div class="row d-flex mt-3">\n' +
|
|
|
|
|
var html = '<form class="stage-update-form new-stage-form flex-1" action="/admins/competitions/'+competition_id+'/competition_stages" accept-charset="UTF-8" data-remote="true" method="post">' +
|
|
|
|
|
'<div class="large_panel_part" attr_line="'+count+'"><div class="row d-flex mt-3">\n' +
|
|
|
|
|
' <span class="col-1 mt-2">tab标题</span>\n' +
|
|
|
|
|
' <div class="col-2 no_padding">\n' +
|
|
|
|
|
' <input type="text" class="form-control" name="stage_name"/>\n' +
|
|
|
|
@ -465,9 +497,64 @@ function addNewTab() {
|
|
|
|
|
' <a href="javascript:void(0)"class="btn btn-outline-primary export-action ml20 add_task_sub" onclick="add_task_sub(this)">新增子阶段</a>\n' +
|
|
|
|
|
' </div>\n' +
|
|
|
|
|
' <a href="javascript:void(0)" class="btn btn-default ml20" onclick="Del_tab(this)">删除</a>\n' +
|
|
|
|
|
' <a href="javascript:void(0)" class="btn btn-outline-primary export-action ml20">保存</a>\n' +
|
|
|
|
|
' <a href="javascript:void(0)" class="btn btn-outline-primary update-stage export-action ml20">保存</a>\n' +
|
|
|
|
|
' </div>\n' +
|
|
|
|
|
' <div id="small_panel_'+count+'" class="small_panel">\n' +
|
|
|
|
|
' <div class="row d-flex small_panel_item" attr_line="sub_new_new" count="1">\n' +
|
|
|
|
|
' <span class="col-1 mt-2 subName">第1阶段</span>\n' +
|
|
|
|
|
' <div class="flex-1">\n' +
|
|
|
|
|
' <div class="row">\n' +
|
|
|
|
|
' <span class="mt-2 ml20">有效时间:</span>\n' +
|
|
|
|
|
' <div class="col-2 no_padding input_middle">\n' +
|
|
|
|
|
' <input type="text" name="stage[][start_time]" id="stage__start_time" value="" autocomplete="off" class="section-start-time form-control" placeholder="有效开始时间">\n' +
|
|
|
|
|
' </div>\n' +
|
|
|
|
|
' <span class="mt-2">~</span>\n' +
|
|
|
|
|
' <div class="col-2 no_padding input_middle">\n' +
|
|
|
|
|
' <input type="text" name="stage[][end_time]" id="stage__end_time" value="" autocomplete="off" class="section-end-time form-control" placeholder="有效结束时间">\n' +
|
|
|
|
|
' </div>\n' +
|
|
|
|
|
' <span class="col-2 text-right mt-2 no_padding">任务完成要求:</span>\n' +
|
|
|
|
|
' <div class="col-1 no_padding input_small">\n' +
|
|
|
|
|
' <input type="number" class="form-control" name="stage[][mission_count]" value="1">\n' +
|
|
|
|
|
' </div>\n' +
|
|
|
|
|
' <span class="mt-2 ml10 mr10">/</span>\n' +
|
|
|
|
|
' <div class="col-1 no_padding input_small">\n' +
|
|
|
|
|
' <input type="number" class="form-control task_all" onchange="change_total(this)" value="3" name="stage[][entry]">\n' +
|
|
|
|
|
' </div>\n' +
|
|
|
|
|
' <div id="small_panel_'+count+'" class="small_panel"></div></div>';
|
|
|
|
|
' <span class=" mt-2">(总任务)</span>\n' +
|
|
|
|
|
' <span class="col-1 text-right mt-2 no_padding">成绩来源:</span>\n' +
|
|
|
|
|
' <div class="col-2 no_padding input_middle">\n' +
|
|
|
|
|
' <select class="form-control" name="stage[][score_source]">\n' +
|
|
|
|
|
' <option value="0">经验值</option>\n' +
|
|
|
|
|
' <option value="1">预测准确率</option>\n' +
|
|
|
|
|
' </select>\n' +
|
|
|
|
|
' </div>\n' +
|
|
|
|
|
' </div>\n' +
|
|
|
|
|
' <div class="row mt-2" id="task_Input_sub_new_new">\n' +
|
|
|
|
|
' <div class="col-4 row task_Input_div">\n' +
|
|
|
|
|
' <span class="col-3 text-center mt-3">任务1</span>\n' +
|
|
|
|
|
' <div class="col-8">\n' +
|
|
|
|
|
' <input type="text" class="form-control mt-2" name="stage[][identifiers][]" placeholder="请填写实训ID">\n' +
|
|
|
|
|
' </div>\n' +
|
|
|
|
|
' </div>\n' +
|
|
|
|
|
' <div class="col-4 row task_Input_div">\n' +
|
|
|
|
|
' <span class="col-3 text-center mt-3">任务2</span>\n' +
|
|
|
|
|
' <div class="col-8">\n' +
|
|
|
|
|
' <input type="text" class="form-control mt-2" name="stage[][identifiers][]" placeholder="请填写实训ID">\n' +
|
|
|
|
|
' </div>\n' +
|
|
|
|
|
' </div>\n' +
|
|
|
|
|
' <div class="col-4 row task_Input_div">\n' +
|
|
|
|
|
' <span class="col-3 text-center mt-3">任务3</span>\n' +
|
|
|
|
|
' <div class="col-8">\n' +
|
|
|
|
|
' <input type="text" class="form-control mt-2" name="stage[][identifiers][]" placeholder="请填写实训ID">\n' +
|
|
|
|
|
' </div>\n' +
|
|
|
|
|
' </div>\n' +
|
|
|
|
|
' </div>\n' +
|
|
|
|
|
' </div>\n' +
|
|
|
|
|
' <span>\n' +
|
|
|
|
|
' <a href="javascript:void(0)" class="btn btn-default ml20 small_panel_item_del">删除</a>\n' +
|
|
|
|
|
' </span>\n' +
|
|
|
|
|
' </div>\n' +
|
|
|
|
|
'</div></div></form>';
|
|
|
|
|
$("#large_panel").append(html);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|