first commit
This commit is contained in:
278
WebRoot/jsp/safety/EducationVisitorAdd.jsp
Normal file
278
WebRoot/jsp/safety/EducationVisitorAdd.jsp
Normal file
@ -0,0 +1,278 @@
|
||||
<!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;
|
||||
}
|
||||
|
||||
/*.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 filedel = function () {
|
||||
$('#fileName').val('');
|
||||
};
|
||||
var fileSelected = function () {
|
||||
var filename = $('#file').val();
|
||||
$('#fileName').val(filename);
|
||||
};
|
||||
|
||||
function selectUsherFun() {
|
||||
$.post(ext.contextPath + '/user/userForOneSelect.do',
|
||||
{formId: "addForm", hiddenId: "usherId", textId: "usherName"},
|
||||
function (data) {
|
||||
$("#user4SelectDiv").html(data);
|
||||
openModal('user4SelectModal');
|
||||
});
|
||||
};
|
||||
$(function () {
|
||||
//培训日期
|
||||
$("#educationDate").datepicker({
|
||||
language: 'zh-CN',
|
||||
autoclose: true,
|
||||
todayHighlight: true,
|
||||
format: 'yyyy-mm-dd',
|
||||
});
|
||||
|
||||
//来访时间
|
||||
$('#accessTime').datetimepicker({
|
||||
format: "yyyy-mm-dd hh:ii",
|
||||
language: "zh-CN",
|
||||
todayHighlight: true,
|
||||
todayBtn: true,
|
||||
autoclose: true,
|
||||
});
|
||||
//离开时间
|
||||
$('#leaveTime').datetimepicker({
|
||||
format: "yyyy-mm-dd hh:ii",
|
||||
language: "zh-CN",
|
||||
todayHighlight: true,
|
||||
todayBtn: true,
|
||||
autoclose: true,
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
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/SafetyEducationVisitor/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: '培训日期不能为空。'
|
||||
}
|
||||
}
|
||||
},
|
||||
usherName: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '接洽人不能为空。'
|
||||
}
|
||||
}
|
||||
},
|
||||
visitorCompany: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '访客单位不能为空。'
|
||||
}
|
||||
}
|
||||
},
|
||||
vistorNum: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '访客数量不能为空。'
|
||||
},
|
||||
regexp: {
|
||||
regexp: "^[1-9]\\d*$",
|
||||
message: '访客数量不正确。'
|
||||
}
|
||||
}
|
||||
},
|
||||
accessTime: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '来访时间不能为空。'
|
||||
}
|
||||
}
|
||||
},
|
||||
leaveTime: {
|
||||
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" 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>
|
||||
|
||||
<label class="col-sm-2 control-label ">* 接洽人:</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" id="usherName" name="usherName" class="form-control"
|
||||
placeholder="请选择.." onclick="selectUsherFun()">
|
||||
<input type="hidden" id="usherId" name="usherId" class="form-control"
|
||||
placeholder="请选择..">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">* 访客单位名称:</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" id="visitorCompany" name="visitorCompany" class="form-control"
|
||||
placeholder="请输入..">
|
||||
</div>
|
||||
|
||||
<label class="col-sm-2 control-label">* 访客数量:</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" id="vistorNum" name="vistorNum" class="form-control" placeholder="请输入..">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<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="accessTime" name="accessTime"
|
||||
placeholder="请选择"/>
|
||||
</div>
|
||||
</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="leaveTime" name="leaveTime"
|
||||
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;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>
|
||||
Reference in New Issue
Block a user