69 lines
3.0 KiB
HTML
69 lines
3.0 KiB
HTML
<div class="easyui-layout" style="width:100%;height:100%">
|
|
<div id='southdiv' data-options="region:'south'" style="width:100%;height:50px;padding:5px">
|
|
<div style="text-align:center;padding:2px">
|
|
<a id="submitb" class="easyui-linkbutton" iconCls="fa-floppy-o" onclick="submitform()">保存</a>
|
|
<a class="easyui-linkbutton" iconCls="fa-close" onclick="javascript:$('#dd').dialog('close')">取消</a>
|
|
</div>
|
|
</div>
|
|
<div data-options="region:'center'" style="width:100%;height:100%;padding:5px 15px;">
|
|
<form method="post" id="tmflff">
|
|
<input id="tmflid" name="id" style="display:none"></input>
|
|
<div style="margin-bottom:10px">
|
|
<input id="name" name="name" style="width:90%;height:40px"
|
|
data-options="label:'分类名',multiline:true,required:true" class="easyui-textbox"></input>
|
|
</div>
|
|
<div style="margin-bottom:10px">
|
|
<select id="parent" name="parent" style="width:90%" data-options="label:'上级分类'"
|
|
editable="false">
|
|
</select>
|
|
</div>
|
|
<div style="margin-bottom:10px">
|
|
<label>是否共享</label>
|
|
<input type="checkbox" id="isopen" name="isopen" value="1">
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<script>
|
|
$('#parent').combotree({
|
|
url: 'api/questioncat?a=tree2',
|
|
loadFilter: function (rows) {
|
|
return convert(rows);
|
|
},
|
|
});
|
|
$.get('api/questioncat?a=detail&id='+{{id}},function(res){
|
|
$('#name').textbox('setValue',res.name)
|
|
$('#tmflid').val(res.id)
|
|
$('#parent').combotree('setValue',res.parent__id)
|
|
if(res.isopen == 1){
|
|
$('#isopen').attr("checked", 'checked');
|
|
}
|
|
})
|
|
function submitform() {
|
|
$.ajax({
|
|
type: "POST",
|
|
url: 'api/questioncat?a=edit',
|
|
data: JSON.stringify($('#tmflff').serializeJSON()),
|
|
datatype: "json",
|
|
processData: false,
|
|
contentType: "application/json;charset=utf-8",
|
|
beforeSend: function () {
|
|
var bo = $('#tmflff').form('validate')
|
|
if (bo == false) {
|
|
return bo
|
|
} else {
|
|
$('#submitb').linkbutton('disable');
|
|
}
|
|
},
|
|
success: function (data) {
|
|
if (data.code == 1) {
|
|
$("#mrfltree").tree('reload');
|
|
$("#zjfltree").tree('reload');
|
|
$("#dd").dialog("close");
|
|
$('#gxfltree').tree("reload")
|
|
} else { $.messager.alert('提示', '失败,该选项不可编辑!'); }
|
|
$('#submitb').linkbutton('enable');
|
|
},
|
|
});
|
|
}
|
|
</script>
|
|
</div> |