safesite/safesite/templates/abpart.html

82 lines
3.4 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 iconCls="fa-check" class="easyui-linkbutton" onclick="submitFormp()" id="submitFormp">确定</a>
<a iconCls="fa-close" class="easyui-linkbutton" onclick="closeForm()">取消</a>
</div>
</div>
<div data-options="region:'center'" style="width:100%;height:100%;padding:5px 15px;">
<form method="post" id="partff">
<div style="margin-bottom:5px">
<input id="partid" name="partid" type="hidden" style="width:90%;" data-options="label:'部门ID'" /></div>
<div style="margin-bottom:5px">
<input id="partname" class="easyui-textbox" name="partname" style="width:90%" data-options="label:'部门名称',required:true" /></div>
<div style="margin-bottom:5px">
<select id="parentid" name="parentid" style="width:90%" data-options="label:'上级部门',required:true"
editable="false">
</select></div>
</form>
</div>
<script>
var a = GetQueryString('a');
if (a == 'editparth') {
partid = GetQueryString('partid');
$('#parentid').combotree({
url: 'parthandle?a=tree4&expart='+ partid,
loadFilter: function (rows) {
return convert(rows);
},
});
$.ajax({
type: "GET",
url: 'parthandle?a=detail&partid=' + partid,
datatype: "json",
beforeSend: function () { },
success: function (data) {
$('#partid').attr('value', data.partid);
$('#partname').textbox('setValue', data.partname);
if(data.iscompany==1){
$('#parentid').combotree('disable');
}else{
$('#parentid').combotree('setValue', data.parentid);
}
}
});
}else{
$('#parentid').combotree({
url: 'parthandle?a=tree',
loadFilter: function (rows) {
return convert(rows);
},
});
}
function submitFormp() {
var form = new FormData(document.getElementById("partff"));
$.ajax({
type: "POST",
url: 'parthandle?a=addpart',
data: form,
datatype: "json",
processData: false,
contentType: false,
beforeSend: function () {
var bo = $('#partff').form('validate')
if(bo == false){
return bo
}else{
$('#submitFormp').linkbutton('disable');
}
},
success: function (data) {
if (data.code == 1) {
$('#parttree').tree('reload'); $("#dd").dialog("close"); $('#submitFormp').linkbutton('enable');
} else { $.messager.alert('提示', '失败!'); $('#submitFormp').linkbutton('enable'); }
},
});
}
</script>
</div>