first commit
This commit is contained in:
158
WebRoot/jsp/accident/accidentAdd.jsp
Normal file
158
WebRoot/jsp/accident/accidentAdd.jsp
Normal file
@ -0,0 +1,158 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<%@page import="com.sipai.entity.maintenance.MaintenanceDetail"%>
|
||||
<%request.setAttribute("Wait", MaintenanceDetail.Status_Wait); %>
|
||||
<style type="text/css">
|
||||
.select2-container .select2-selection--single{
|
||||
height:34px;
|
||||
line-height: 34px;
|
||||
}
|
||||
.select2-selection__arrow{
|
||||
margin-top:3px;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
function dosave() {
|
||||
$('#subForm').data('bootstrapValidator')
|
||||
.updateStatus('happenDate', 'NOT_VALIDATED',null)
|
||||
.validateField('happenDate');
|
||||
$('#subForm').data('bootstrapValidator')
|
||||
.updateStatus('accidentTypeName', 'NOT_VALIDATED',null)
|
||||
.validateField('accidentTypeName');
|
||||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||||
$.post(ext.contextPath + "/accident/accident/dosave.do", $("#subForm").serialize(), function(data) {
|
||||
if (data.code == 1){
|
||||
showAlert('s','保存成功');
|
||||
closeModal('subModal')
|
||||
$("#table").bootstrapTable('refresh');
|
||||
|
||||
}else if(data.code == 0){
|
||||
showAlert('d','保存失败');
|
||||
}else{
|
||||
showAlert('d',data.res);
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$("#subForm").bootstrapValidator({
|
||||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||||
fields: {
|
||||
happenDate: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '日期不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
happenPlace: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '地点不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
accidentTypeName: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '事故分类不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
emergencyPlanTrue: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '是否响应应急预案不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
$(function(){
|
||||
|
||||
$("#emergencyPlanTrue").select2({ minimumResultsForSearch: 10 }).val("0").trigger("change");
|
||||
|
||||
$("#happenDate").datetimepicker({
|
||||
// startDate: date,
|
||||
language:'zh-CN',
|
||||
format: 'yyyy-mm-dd',
|
||||
startView: "month", //初始化视图是‘年’
|
||||
minView: 2,
|
||||
maxView: "year",
|
||||
autoclose: true
|
||||
// todayBtn: "linked"
|
||||
});
|
||||
});
|
||||
|
||||
//选择设备,根据厂区id和工艺段id选择厂内设备,可多选
|
||||
var showEquipment4SelectsFun = function(formId,hiddenId,textId) {
|
||||
$.post(ext.contextPath + '/accident/accidentType/showAccidentType4Select4Use.do', { formId: formId, hiddenId: hiddenId, textId: textId }, function (data) {
|
||||
$("#equ4SelectDiv").html(data);
|
||||
openModal("equipment4SelectModal");
|
||||
});
|
||||
};
|
||||
</script>
|
||||
<div class="modal fade" id="subModal">
|
||||
<div class="modal-dialog">
|
||||
<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强制为subForm -->
|
||||
<form class="form-horizontal" id="subForm">
|
||||
<!-- 界面提醒div强制id为alertDiv -->
|
||||
<div id="alertDiv"></div>
|
||||
<input type="hidden" class="form-control" id="id" name ="id" value ="${accident.id}">
|
||||
<input type="hidden" class="form-control" id="unitId" name ="unitId" value ="${param.unitId}">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">*日期</label>
|
||||
<div class="col-sm-4">
|
||||
<input class="form-control" type="text" id="happenDate" name ="happenDate" value="${accident.happenDate}">
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">*地点</label>
|
||||
<div class="col-sm-4">
|
||||
<input class="form-control" type="text" id="happenPlace" name ="happenPlace" value="${accident.happenPlace}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">事故分类</label>
|
||||
<div class="col-sm-10">
|
||||
<input class="form-control" id="accidentTypeId" name="accidentTypeId" type="hidden" value="${accident.accidentTypeId}" />
|
||||
<input class="form-control" id="accidentTypeName" name ="accidentTypeName" value="${accident.accidentType.name}" onclick="showEquipment4SelectsFun('subForm','accidentTypeId','accidentTypeName');" placeholder="选择事故分类">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">是否响应应急预案</label>
|
||||
<div class="col-sm-4">
|
||||
<select id="emergencyPlanTrue" name="emergencyPlanTrue" class="form-control select2">
|
||||
<option value="1">是</option>
|
||||
<option value="0">否</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">处理结果</label>
|
||||
<div class="col-sm-10">
|
||||
<textarea class="form-control" rows="2" id ="handleResult" name ="handleResult" placeholder="处理结果">${accident.handleResult}</textarea>
|
||||
</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" onclick="dosave()" id="btn_save">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
Reference in New Issue
Block a user