300 lines
12 KiB
Plaintext
300 lines
12 KiB
Plaintext
<!DOCTYPE html
|
||
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
<%@ page language="java" pageEncoding="utf-8" %>
|
||
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
|
||
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
|
||
<style type="text/css">
|
||
.select2-container .select2-selection--single {
|
||
height: 34px;
|
||
line-height: 34px;
|
||
}
|
||
|
||
.select2-selection__arrow {
|
||
margin-top: 3px;
|
||
}
|
||
|
||
.foot {
|
||
display: flex;
|
||
padding-left: 50px;
|
||
}
|
||
|
||
/*.layout{*/
|
||
/* display: flex;*/
|
||
/* padding-left: 15px;*/
|
||
/*}*/
|
||
.form-horizontal {
|
||
padding-top: 20px;
|
||
|
||
}
|
||
|
||
.right {
|
||
margin-left: 50px;
|
||
}
|
||
</style>
|
||
<script type="text/javascript">
|
||
$(function () {
|
||
|
||
|
||
});
|
||
var fileinput = function () {
|
||
$('#file').click();
|
||
};
|
||
var fileSelected = function () {
|
||
var filename = $('#file').val();
|
||
$('#fileName').val(filename);
|
||
};
|
||
|
||
function showUser4OneSelectFun() {
|
||
|
||
$.post(ext.contextPath + '/user/userForOneSelectByStructure.do', {
|
||
formId: "addForm",
|
||
hiddenId: "userid",
|
||
textId: "userName",
|
||
bean: "bean"
|
||
}, function (data) {
|
||
$("#user4SelectDiv").html(data);
|
||
openModal('user4SelectModal');
|
||
});
|
||
}
|
||
|
||
function userInfoChage() {
|
||
var userInfo = JSON.parse($('#bean').val());
|
||
var userInfo2;
|
||
$('#userCardId').val(userInfo.userCardId);
|
||
$('#deptId').val(userInfo.pid);
|
||
if (userInfo.sex == '1') {
|
||
$('#gender').val('男');
|
||
} else {
|
||
$('#gender').val('女');
|
||
}
|
||
$.post(ext.contextPath +'/safety/staffArchives/detail.do?id='+userInfo.id,function (res) {
|
||
console.log(res.result)
|
||
if(res.code==1){
|
||
userInfo2=res.result;
|
||
$('#post').val(userInfo2.post);
|
||
$('#deptName').val(userInfo2.deptName);
|
||
|
||
}else {
|
||
|
||
}
|
||
|
||
},'json')
|
||
|
||
}
|
||
|
||
$(function () {
|
||
$('#file').val();
|
||
//培训日期
|
||
$("#educationDate").datepicker({
|
||
language: 'zh-CN',
|
||
autoclose: true,
|
||
todayHighlight: true,
|
||
format: 'yyyy-mm-dd',
|
||
});
|
||
//培训有效日期
|
||
$("#deadline").datepicker({
|
||
language: 'zh-CN',
|
||
autoclose: true,
|
||
todayHighlight: true,
|
||
format: 'yyyy-mm-dd',
|
||
});
|
||
|
||
});
|
||
|
||
function saveFun() {
|
||
//console.log($("#addForm").serialize());
|
||
$("#addForm").bootstrapValidator('validate');//提交验证
|
||
if ($("#addForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||
var formData = new FormData($("#addForm")[0]);
|
||
$.ajax({
|
||
url: ext.contextPath + "/safety/SafetyEducationTrainee/save.do?unitId="+unitId,
|
||
type: 'POST',
|
||
data: formData,
|
||
async: false,
|
||
cache: false,
|
||
contentType: false,
|
||
processData: false,
|
||
dataType: 'json',
|
||
success: function (data) {
|
||
// console.log(data)
|
||
if (data.code == 1) {
|
||
$("#table").bootstrapTable('refresh');
|
||
closeModal('subModal');
|
||
} else {
|
||
showAlert('d', '保存失败!' + data.msg);
|
||
}
|
||
},
|
||
error: function (data) {
|
||
}
|
||
});
|
||
}
|
||
}
|
||
|
||
$("#addForm").bootstrapValidator({
|
||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||
fields: {
|
||
educationDate: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '请选择日期。'
|
||
}
|
||
}
|
||
},
|
||
name: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '请填写姓名'
|
||
}
|
||
}
|
||
},
|
||
deptName: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '请到【人员管理>人员档案管理】菜单维护该信息'
|
||
}
|
||
}
|
||
},
|
||
post: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '请到【人员管理>人员档案管理】菜单维护该信息'
|
||
}
|
||
}
|
||
},
|
||
company: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '请填写实习单位名称'
|
||
}
|
||
}
|
||
},
|
||
deadline: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '请选择培训有效期'
|
||
}
|
||
}
|
||
}
|
||
}
|
||
});
|
||
|
||
</script>
|
||
<div class="modal fade" id="subModal">
|
||
<div class="modal-dialog modal-lg" >
|
||
<div class="modal-content">
|
||
<div class="modal-header">
|
||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||
<span aria-hidden="true">×</span></button>
|
||
<h4 class="modal-title">新增实习人员</h4>
|
||
</div>
|
||
<div class="modal-body">
|
||
<div class="row">
|
||
<div class="col-md-12 col-xs-13">
|
||
<!-- 新增界面formid强制为addForm -->
|
||
<form class="form-horizontal" id="addForm" enctype="multipart/form-data">
|
||
<div id="alertDiv"></div>
|
||
<%-- <input type="hidden" name="id" value="${user.id }" />--%>
|
||
<!-- 界面提醒div强制id为alertdiv -->
|
||
|
||
<div class="form-group">
|
||
<%-- <label class="col-sm-2 control-label" >* 培训记录编号:</label>--%>
|
||
<%-- <div class="col-sm-3">--%>
|
||
<input type="hidden" id="educationCode" name="educationCode" class="form-control" placeholder="" readonly
|
||
value="${educationCode}">
|
||
<%-- </div>--%>
|
||
|
||
<label class="col-sm-2 control-label ">* 培训日期:</label>
|
||
<div class="col-sm-4">
|
||
<div class="input-group date">
|
||
<div class="input-group-addon">
|
||
<i class="fa fa-calendar"></i>
|
||
</div>
|
||
<input type="text" class="form-control" id="educationDate" name="educationDate"
|
||
placeholder="请选择.."/>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">* 姓名:</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" name="name" id="userName" class="form-control" placeholder="请选择..."
|
||
onclick="showUser4OneSelectFun();">
|
||
<input type="hidden" name="userid" id="userid" class="form-control" placeholder=""
|
||
readonly>
|
||
<input type="text" name="bean" id="bean" class="form-control" placeholder="" disabled
|
||
style="display:none;" onchange="userInfoChage();">
|
||
</div>
|
||
|
||
<label class="col-sm-2 control-label">* 性别:</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" name="gender" id="gender" class="form-control" placeholder="" readonly>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
|
||
<label class="col-sm-2 control-label ">* 所属部门:</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" name="deptName" id="deptName" class="form-control" placeholder=""
|
||
readonly>
|
||
<input type="hidden" name="deptId" id="deptId" class="form-control" placeholder=""
|
||
readonly>
|
||
</div>
|
||
<label class="col-sm-2 control-label">* 从事岗位:</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" name="post" id="post" class="form-control" placeholder="" readonly>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label ">* 实习单位名称:</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" name="company" id="company" class="form-control" placeholder=""
|
||
>
|
||
</div>
|
||
<label class="col-sm-2 control-label">* 培训有效期:</label>
|
||
<div class="col-sm-4">
|
||
<div class="input-group date">
|
||
<div class="input-group-addon">
|
||
<i class="fa fa-calendar"></i>
|
||
</div>
|
||
<input type="text" class="form-control" id="deadline" name="deadline"
|
||
placeholder="请选择.."/>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label ">附件资料:</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" class="form-control" name="fileName" id="fileName"
|
||
style="width:350px;display:inline;border:none"/>
|
||
</div>
|
||
<div class="col-sm-2" style="display: flex">
|
||
<button type="button" class="btn btn-default btn-file" onclick="fileinput()"
|
||
id="btn_save"><i class="fa fa-paperclip"></i></button>
|
||
<button type="button" class="btn btn-default btn-file" onclick="filedel()"
|
||
id="btn_save1"><i class="fa fa-trash-o"></i></button>
|
||
</div>
|
||
</div>
|
||
<div class="form-group" style="margin:8px;">
|
||
<input type="file" name="file" id="file" multiple class="file-loading"
|
||
onchange="fileSelected()"/>
|
||
</div>
|
||
|
||
</form>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button type="button" class="btn btn-default" data-dismiss="modal">关闭
|
||
</button>
|
||
<button type="button" class="btn btn-primary" style="margin-left: 10px"
|
||
onclick="saveFun()">保存
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<!-- /.modal-content -->
|
||
</div>
|
||
<!-- /.modal-dialog -->
|
||
</div> |