183 lines
9.1 KiB
HTML
183 lines
9.1 KiB
HTML
<div class="easyui-layout" style="width:100%;height:100%;">
|
|
<div id='southdiv' data-options="region:'south'" style="height:50px;text-align:center;padding:5px">
|
|
<a href="javascript:void(0)" iconCls="fa-check" class="easyui-linkbutton" onclick="kssubmitForm()"
|
|
id="submitb">提交</a>
|
|
<a href="javascript:void(0)" iconCls="fa-close" class="easyui-linkbutton" onclick="closeForm()">取消</a>
|
|
</div>
|
|
<div data-options="region:'center'" style="height:100%;padding:15px 15px;">
|
|
<form id="ksff" method="post" name="ksff" enctype="multipart/form-data">
|
|
<div style="margin-bottom:5px;">
|
|
<input id="name" name="name" class="easyui-textbox" style="width:90%" data-options="label:'考试名称'"
|
|
required=true />
|
|
</div>
|
|
<div style="margin-bottom:5px;">
|
|
<label>允许与其他考试题目重复</label>
|
|
<input id="repeatbutton" class="easyui-switchbutton" data-options="onText:'允许',offText:'不允许'" style="width: 80px;">
|
|
<input id="repeat" name="repeat" val="yes" type="hidden"></input>
|
|
</div>
|
|
<div style="margin-bottom:5px;">
|
|
<input id="tmfls" editable="false" name="tmfls" class="easyui-combotree" style="width:90%"
|
|
data-options="label:'选择分类'" required=true />
|
|
</div>
|
|
<div style="margin-bottom:5px;text-align:center">
|
|
<div><span>单选题共</span><input id="dxnumt" value=0 disabled="disabled" style="width:50px" class="easyui-numberbox">道,选<input id="dxnum" name="dxnum" value=0 style="width:50px" class="easyui-numberbox" data-options="onChange:function(val){calnum2()}">道,每道<input id="dxs" name="dxs" value=1 style="width:50px" class="easyui-numberbox" data-options="onChange:function(val){calnum2()}">分</div>
|
|
<div><span>多选题共</span><input id="duoxnumt" value=0 disabled="disabled" style="width:50px" class="easyui-numberbox">道,选<input id="duoxnum" name="duoxnum" value=0 style="width:50px" class="easyui-numberbox" data-options="onChange:function(val){calnum2()}">道,每道<input id="duoxs" name="duoxs" value=2 style="width:50px" class="easyui-numberbox" data-options="onChange:function(val){calnum2()}">分</div>
|
|
<div><span>判断题共</span><input id="pdnumt" value=0 disabled="disabled" style="width:50px" class="easyui-numberbox">道,选<input id="pdnum" name="pdnum" value=0 style="width:50px" class="easyui-numberbox" data-options="onChange:function(val){calnum2()}">道,每道<input id="pds" name="pds" value=1 style="width:50px" class="easyui-numberbox" data-options="onChange:function(val){calnum2()}">分</div>
|
|
<div><span>共选择</span><input id="totalnum" value=0 disabled="disabled" style="width:50px" class="easyui-numberbox">道,共<input id="totals" value=0 style="width:50px" disabled="disabled" class="easyui-numberbox">分</div>
|
|
</div>
|
|
<div style="margin-bottom:5px;">
|
|
<input id="passscore" name="passscore" class="easyui-numberbox" style="width:90%"
|
|
data-options="label:'通过分数'" required=true />
|
|
</div>
|
|
<div style="margin-bottom:5px;">
|
|
<input id="duration" name="duration" class="easyui-numberbox" style="width:90%"
|
|
data-options="label:'答卷时长',prompt:'分钟'" required=true />
|
|
</div>
|
|
<div style="margin-bottom:5px;">
|
|
<input id="starttime" editable="false" name="starttime" class="easyui-datetimebox" style="width:90%"
|
|
data-options="label:'考试开启',currentText:'今天',closeText:'关闭',showSeconds: false,required:true" />
|
|
</div>
|
|
<div style="margin-bottom:5px;">
|
|
<input id="endtime" editable="false" name="endtime" class="easyui-datetimebox" style="width:90%"
|
|
data-options="label:'考试结束',currentText:'今天',closeText:'关闭',showSeconds: false,required:true" />
|
|
</div>
|
|
<div style="margin-bottom:5px;">
|
|
<label>是否公开</label>
|
|
<input id="ispublicbutton" class="easyui-switchbutton" data-options="onText:'公开',offText:'不公开'" style="width: 80px;">
|
|
<input id="ispublic" name="ispublic" value="yes" type="hidden"></input>
|
|
</div>
|
|
<div style="margin-bottom:5px" id="choosediv">
|
|
<input class="easyui-textbox" id="participantname" style="width:500px;height:120px" editable="false"
|
|
data-options="label:'通知人员',multiline:true,prompt:'请选择'" >
|
|
<input type="hidden" id="participant" name="participant" />
|
|
<a class='easyui-linkbutton' onclick="choseusers()" style="width:auto">选择</a>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
$('#choosediv').hide()
|
|
$('#ispublicbutton').switchbutton({
|
|
checked: true,
|
|
onChange: function(checked){
|
|
if (checked == true){
|
|
$('#ispublic').val('yes')
|
|
$('#choosediv').hide()
|
|
}
|
|
if (checked == false){
|
|
$('#ispublic').val('no')
|
|
$('#choosediv').show()
|
|
}
|
|
}
|
|
|
|
})
|
|
$('#repeatbutton').switchbutton({
|
|
checked: true,
|
|
onChange: function(checked){
|
|
if (checked == true){
|
|
$('#repeat').val('yes')
|
|
}
|
|
if (checked == false){
|
|
$('#repeat').val('no')
|
|
}
|
|
var tmfls = $('#tmfls').combotree('getValues')
|
|
if(tmfls.length>0){
|
|
var repeat = $('#repeat').val()
|
|
$.post('api/question?a=search',JSON.stringify({'tmfls':tmfls,'repeat':repeat}),function(res){
|
|
$('#dxnumt').textbox('setValue',res.dxnum)
|
|
$('#duoxnumt').textbox('setValue',res.duoxnum)
|
|
$('#pdnumt').textbox('setValue',res.pdnum)
|
|
})
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
$("#tmfls").combotree({
|
|
url: 'api/questioncat?a=tree',
|
|
method: 'get',
|
|
multiple: true,
|
|
loadFilter: function (rows) {
|
|
return convert(rows);
|
|
},
|
|
formatter: function (node) {
|
|
var s = node.text;
|
|
if (node.children) {
|
|
s += ' <span style=\'color:blue\'>(' + node.children.length + ')</span>';
|
|
}
|
|
return s;
|
|
},
|
|
editable: false,
|
|
onCheck:function(node){
|
|
var tmfls = $('#tmfls').combotree('getValues')
|
|
var repeat = $('#repeat').val()
|
|
$.post('api/question?a=search',JSON.stringify({'tmfls':tmfls,'repeat':repeat}),function(res){
|
|
$('#dxnumt').textbox('setValue',res.dxnum)
|
|
$('#duoxnumt').textbox('setValue',res.duoxnum)
|
|
$('#pdnumt').textbox('setValue',res.pdnum)
|
|
})
|
|
}
|
|
});
|
|
function calnum2(){
|
|
n1 = $('#dxnum').textbox('getValue')
|
|
n2 = $('#duoxnum').textbox('getValue')
|
|
n3 = $('#pdnum').textbox('getValue')
|
|
v1 = $('#dxs').textbox('getValue')
|
|
v2 = $('#duoxs').textbox('getValue')
|
|
v3 = $('#pds').textbox('getValue')
|
|
$('#totals').textbox('setValue', n1*v1+n2*v2+n3*v3)
|
|
$('#totalnum').textbox('setValue',parseInt(n1)+parseInt(n2)+parseInt(n3))
|
|
}
|
|
$.get('api/exampaper?a=listok', function (res) {
|
|
$('#exampaper').combobox({
|
|
valueField: 'id',
|
|
textField: 'name',
|
|
data: res.rows,
|
|
onSelect: function (node) {
|
|
$.get('api/exampaper?a=detail&id=' + node.id, function (res) {
|
|
$('#totalscore').textbox('setValue', res.total.score);
|
|
})
|
|
}
|
|
})
|
|
})
|
|
function kssubmitForm() {
|
|
if($('#ispublic').val()=='yes'){
|
|
$('#participant').val('')
|
|
}
|
|
var ksdata = $('#ksff').serializeJSON();
|
|
ksdata['tmfls'] = $('#tmfls').combotree('getValues')
|
|
console.log(ksdata)
|
|
$.ajax({
|
|
type: "POST",
|
|
url: 'api/examtest?a=add2',
|
|
data: JSON.stringify(ksdata),
|
|
datatype: "json",
|
|
processData: false,
|
|
contentType: "application/json;charset=utf-8",
|
|
beforeSend: function () {
|
|
var bo = $('#ksff').form('validate')
|
|
if (bo == false) {
|
|
return bo
|
|
} else {
|
|
$('#submitb').linkbutton('disable');
|
|
}
|
|
loading('自动组卷中,请稍等');
|
|
},
|
|
success: function (data) {
|
|
if (data.code == 1) {
|
|
$('#kstable').datagrid('reload');
|
|
$("#dd").dialog("close");
|
|
} else { $.messager.alert('提示', '失败!'); }
|
|
$('#submitb').linkbutton('enable');
|
|
removeLoading()
|
|
},
|
|
});
|
|
}
|
|
function aaa(x) {
|
|
if (x == "participant") {
|
|
$('#participant').attr('value', top.$('#in').val());
|
|
$('#participantname').textbox('setValue', top.$('#in').attr('show'));
|
|
$('#participantnum').textbox('setValue', top.$('#in').attr('total'));
|
|
}
|
|
}
|
|
</script> |