291 lines
12 KiB
Plaintext
291 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;
|
||
|
||
}
|
||
|
||
</style>
|
||
<script type="text/javascript">
|
||
$(function () {
|
||
|
||
});
|
||
var fileinput = function () {
|
||
$('#file').click();
|
||
};
|
||
var filedel = function (id) {
|
||
$('#fileName').val('');
|
||
console.log('-------------', )
|
||
$.post(ext.contextPath + '/safety/SafetyEducationVisitor/deleteFile.do', {id : '${bean.id}'}, function(data) {
|
||
let res = JSON.parse(data)
|
||
if(res.code==1){
|
||
$("#table").bootstrapTable('refresh');
|
||
}else{
|
||
showAlert('d',res.msg,'mainAlertdiv');
|
||
}
|
||
});
|
||
};
|
||
|
||
var fileSelected = function () {
|
||
var filename = $('#file').val();
|
||
$('#fileName').val(filename);
|
||
$('#fileId').val('');
|
||
};
|
||
|
||
function selectUsherFun() {
|
||
$.post(ext.contextPath + '/user/userForOneSelect.do',
|
||
{formId: "editForm", 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 updateFun() {
|
||
//console.log($("#editForm").serialize());
|
||
$("#editForm").bootstrapValidator('validate');//提交验证
|
||
if ($("#editForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||
var formData = new FormData($("#editForm")[0]);
|
||
$.ajax({
|
||
url: ext.contextPath + "/safety/SafetyEducationVisitor/update.do",
|
||
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) {
|
||
}
|
||
});
|
||
}
|
||
}
|
||
|
||
$("#editForm").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">
|
||
<!-- 新增界面formid强制为editForm -->
|
||
<form class="form-horizontal" id="editForm" enctype="multipart/form-data">
|
||
<div id="alertDiv"></div>
|
||
<%-- <input type="hidden" name="id" value="${user.id }" />--%>
|
||
<!-- 界面提醒div强制id为alertdiv -->
|
||
<div class="col-md-26">
|
||
|
||
<div class="form-group">
|
||
|
||
|
||
<label class="col-sm-2 control-label">* 培训记录编号:</label>
|
||
<div class="col-sm-4">
|
||
<input type="hidden" name="id" value="${bean.id}"/>
|
||
<input type="text" name="educationCode" class="form-control" placeholder="" readonly
|
||
value="${bean.educationCode}" style="width:350px;display:inline;border:none;background-color: #ffffff"/>
|
||
</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="educationDate" name="educationDate"
|
||
placeholder="请选择.." value="${bean.educationDate.substring(0,10)}"/>
|
||
</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()" value="${bean.usherName}">
|
||
<input type="hidden" id="usherId" name="usherId" class="form-control"
|
||
placeholder="请选择.." value="${bean.usherId}">
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">* 访客单位名称:</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" name="visitorCompany" class="form-control" placeholder="请输入.."
|
||
value="${bean.visitorCompany}">
|
||
</div>
|
||
|
||
<label class="col-sm-2 control-label">* 访客数量:</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" name="vistorNum" class="form-control" placeholder="请输入.."
|
||
value="${bean.vistorNum}">
|
||
</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="请选择" value="${bean.accessTime.substring(0,16)}"/>
|
||
</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="请选择" value="${bean.leaveTime.substring(0,16)}"/>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label ">附件资料:</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" name="fileName" id="fileName"
|
||
style="border: none;height: 30px;width: 380px;background-color: #ffffff"
|
||
value="${fileName}" readonly/>
|
||
</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>
|
||
<input type="file" id="file" name="file" onclick="fileSelected()"
|
||
style="display: none"/>
|
||
<input type="hidden" id="fileId" name="fileId" value="${bean.fileId}"/>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</form>
|
||
</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="updateFun()">保存
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<!-- /.modal-content -->
|
||
</div>
|
||
<!-- /.modal-dialog -->
|
||
</div> |