138 lines
6.3 KiB
HTML
138 lines
6.3 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="tmsubmitForm()"
|
|
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="tmff" method="post" name="tmff" enctype="multipart/form-data">
|
|
<div style="margin-bottom:5px">
|
|
<select id="level" class="easyui-combobox" name="level" style="width:480px;" data-options="label:'难度'"
|
|
required=true editable=false>
|
|
<option value="1">低</option>
|
|
<option value="2">中</option>
|
|
<option value="3">高</option>
|
|
</select>
|
|
</div>
|
|
<div style="margin-bottom:5px">
|
|
<input id="cate" name="cate" style="width:480px;" class="easyui-combotree" data-options="label:'分类',"
|
|
editable=false required = true/>
|
|
</div>
|
|
<!-- <div style="margin-bottom:5px">
|
|
<input id="station" name="station" style="width:480px;" class="easyui-combobox"
|
|
data-options="label:'岗位'," editable=false />
|
|
<script>
|
|
$.get('grouphandle?a=list', function (res) {
|
|
$("#station").combobox({
|
|
data: res.rows,
|
|
valueField: 'groupid',
|
|
textField: 'groupname',
|
|
});
|
|
})
|
|
|
|
</script>
|
|
</div> -->
|
|
<div style="margin-bottom:5px">
|
|
<input class="easyui-tagbox" value="" name="label" label="标签" style="width:480px;" data-options="prompt:'输入字符回车形成标签'">
|
|
</div>
|
|
<div style="margin-top:5px;margin-bottom:5px">
|
|
<input id="title" class="easyui-textbox" name="title" style="width:480px;height:60px"
|
|
data-options="label:'题目',multiline:true" required=true />
|
|
</div>
|
|
<div class="labeldiv">录入答案并在正确答案后打勾</div>
|
|
<div id="Adiv" style="margin-top:5px;margin-bottom:5px">
|
|
<input id="A" class="easyui-textbox" name="A" style="width:480px;" data-options="label:'选项A'," required = true/>
|
|
<input id="Acheck" name="right" type="radio" value="A" />
|
|
</div>
|
|
<div id="Bdiv" style="margin-top:5px;margin-bottom:5px">
|
|
<input id="B" class="easyui-textbox" name="B" style="width:480px;" data-options="label:'选项B'," required = true/>
|
|
<input id="Bcheck" name="right" type="radio" value="B" />
|
|
</div>
|
|
<div id="Cdiv" style="margin-top:5px;margin-bottom:5px">
|
|
<input id="C" class="easyui-textbox" name="C" style="width:480px;" data-options="label:'选项C'," />
|
|
<input id="Ccheck" name="right" type="radio" value="C" />
|
|
</div>
|
|
<div id="Ddiv" style="margin-top:5px;margin-bottom:5px">
|
|
<input id="D" class="easyui-textbox" name="D" style="width:480px;" data-options="label:'选项D'," />
|
|
<input id="Dcheck" name="right" type="radio" value="D" />
|
|
</div>
|
|
<div style="margin-top:5px;margin-bottom:5px">
|
|
<input id="resolution" class="easyui-textbox" name="resolution" style="width:480px;height:80px"
|
|
data-options="label:'解析',multiline:true" />
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
var id={{id}}
|
|
$("#cate").combotree({
|
|
url: 'api/questioncat?a=tree',
|
|
method: 'get',
|
|
//multiple: true,
|
|
loadFilter: function (rows) {
|
|
return convert(rows);
|
|
},
|
|
onBeforeSelect: function(node) {
|
|
if (!$(this).tree('isLeaf', node.target)) {
|
|
return false;
|
|
}
|
|
},
|
|
formatter: function (node) {
|
|
var s = node.text;
|
|
if (node.children) {
|
|
s += ' <span style=\'color:blue\'>(' + node.children.length + ')</span>';
|
|
}
|
|
return s;
|
|
},
|
|
editable: false,
|
|
});
|
|
$.get('api/question?a=detail&id='+id,function(res){
|
|
$('#level').combobox('setValue',res.level)
|
|
$('#cate').combotree('setValue',res.questioncat__id)
|
|
//$('#station').combobox('setValue',res.station__groupid)
|
|
$('#label').textbox('setValue',res.label)
|
|
$('#title').textbox('setValue',res.title)
|
|
$('#resolution').textbox('setValue',res.resolution)
|
|
for(var key in res.answer){
|
|
$('#'+key).textbox('setValue',res.answer[key])
|
|
}
|
|
$('#'+res.right+'check').attr('checked',true)
|
|
|
|
})
|
|
function tmsubmitForm(){
|
|
var tmdata = $('#tmff').serializeJSON();
|
|
tmdata['type'] = 1
|
|
tmdata['id'] = {{id}}
|
|
$.ajax({
|
|
type: "POST",
|
|
url: 'api/question?a=edit',
|
|
data: JSON.stringify(tmdata),
|
|
datatype: "json",
|
|
processData: false,
|
|
contentType: "application/json;charset=utf-8",
|
|
beforeSend: function () {
|
|
var bo = $('#tmff').form('validate')
|
|
if (bo == false) {
|
|
return bo
|
|
} else {
|
|
if (isEmpty(tmdata['right'])) {
|
|
$.messager.alert('提示', '未选择答案!');
|
|
return false
|
|
} else {
|
|
$('#submitb').linkbutton('disable');
|
|
}
|
|
}
|
|
},
|
|
success: function (data) {
|
|
if (data.code == 1) {
|
|
$('#tmtable').datagrid('reload');
|
|
$("#dd").dialog("close");
|
|
} else { $.messager.alert('提示', '失败!'); }
|
|
$('#submitb').linkbutton('enable');
|
|
},
|
|
});
|
|
}
|
|
|
|
|
|
</script> |