first commit
This commit is contained in:
211
WebRoot/jsp/hqconfig/riskLevelAdd.jsp
Normal file
211
WebRoot/jsp/hqconfig/riskLevelAdd.jsp
Normal file
@ -0,0 +1,211 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<script type="text/javascript">
|
||||
|
||||
function dosave() {
|
||||
//保存前先赋值班组
|
||||
var val = $('#_place').val();
|
||||
console.log(val);
|
||||
var rolestr = "";
|
||||
if (val != null && val != '') {
|
||||
$.each(val, function (index, value, array) {
|
||||
if (rolestr != "") {
|
||||
rolestr += ","
|
||||
}
|
||||
rolestr += value;
|
||||
})
|
||||
$('#place').val(rolestr);
|
||||
}
|
||||
|
||||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||||
var param = $("#subForm").serialize();
|
||||
console.log(param);
|
||||
$.post(ext.contextPath + "/hqconfig/riskGrade/doSave.do", param, function(data) {
|
||||
if (data.res == 1) {
|
||||
closeModal('subModal')
|
||||
$("#table").bootstrapTable('refresh');
|
||||
|
||||
}else if(data.res == 0){
|
||||
showAlert('d','保存失败');
|
||||
}else{
|
||||
showAlert('d',data.res);
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$("#subForm").bootstrapValidator({
|
||||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||||
fields: {
|
||||
name: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '用户名不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
$.post(ext.contextPath + "/hqconfig/riskGrade/getAreaManage.do", {}, function(data) {
|
||||
|
||||
var selelct =$("#_place").select2({
|
||||
data: data,
|
||||
placeholder: '请选择',//默认文字提示
|
||||
allowClear: false,//允许清空
|
||||
escapeMarkup: function (markup) {
|
||||
return markup;
|
||||
}, // 自定义格式化防止xss注入
|
||||
language: "zh-CN",
|
||||
minimumInputLength: 0,
|
||||
minimumResultsForSearch: 10,//数据超过十个启用搜索框
|
||||
multiple: true,
|
||||
formatResult: function formatRepo(repo) {
|
||||
return repo.text;
|
||||
}, // 函数用来渲染结果
|
||||
formatSelection: function formatRepoSelection(repo) {
|
||||
return repo.text;
|
||||
} // 函数用于呈现当前的选择
|
||||
});
|
||||
},'json');
|
||||
|
||||
//获取巡检区域
|
||||
var selectAreaFun = function () {
|
||||
$.post(ext.contextPath + '/timeEfficiency/patrolPoint/selectAreasLayer.do', {
|
||||
|
||||
}, function (data) {
|
||||
$("#areaSubDiv").html(data);
|
||||
openModal('areaSubModal');
|
||||
});
|
||||
};
|
||||
|
||||
$(function(){
|
||||
$('#lvalue, #svalue').bind('input propertychange',function () {
|
||||
var lvalue = $('#lvalue').val();
|
||||
var svalue = $('#svalue').val();
|
||||
var rvalue = lvalue * svalue;
|
||||
$('#rvalue').val(rvalue);
|
||||
$.post(ext.contextPath + "/alarm/config/getConfigList.do", {rvalue: rvalue}, function(data) {
|
||||
if (data.rows.length == 0) {
|
||||
$('#risklevels').val("-");
|
||||
} else {
|
||||
$('#risklevel').val(data.rows[0].id);
|
||||
$('#risklevels').val(data.rows[0].level);
|
||||
}
|
||||
},'json');
|
||||
// if(rvalue >= 20 && rvalue <= 25){
|
||||
// $('#risklevel').val("A");
|
||||
// }else if(rvalue >= 13 && rvalue <= 19){
|
||||
// $('#risklevel').val("B");
|
||||
// }else if(rvalue >= 8 && rvalue <= 12){
|
||||
// $('#risklevel').val("C");
|
||||
// }else if(rvalue >= 4 && rvalue <= 7){
|
||||
// $('#risklevel').val("D");
|
||||
// }else{
|
||||
// }
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
var showAlarmTyps4SelectFun = function() {
|
||||
$.post(ext.contextPath + '/work/alarmTypes/showList4Select.do', {formId:"subForm",hiddenId:"safetyinspection",textId:"safetyinspectionname", type:"s"} , function(data) {
|
||||
$("#fault4SelectDiv").html(data);
|
||||
openModal('fault4SelectModal');
|
||||
});
|
||||
};
|
||||
</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">
|
||||
<input type="hidden" id="risklevel" name="risklevel" class="form-control pull-right">
|
||||
<!-- 界面提醒div强制id为alertDiv -->
|
||||
<div id="alertDiv"></div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">安全项内容</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" id="securitycontent" name="securitycontent" class="form-control pull-right" placeholder="安全项内容">
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">报警类型</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="safetyinspectionname" name ="safetyinspectionname" placeholder="请点击选择风险类型" onclick="showAlarmTyps4SelectFun();" readonly="readonly"></input>
|
||||
<input id="safetyinspection" name="safetyinspection" type="hidden"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">地点</label>
|
||||
<div class="col-sm-10">
|
||||
<%-- <input type="text" class="form-control" id="place" name="place"--%>
|
||||
<%-- onclick="selectAreaFun()" placeholder="点击选择">--%>
|
||||
<%-- <input type="hidden" class="form-control" id="areaid" name="areaid">--%>
|
||||
<input type="text" id="place" name="place" class="form-control pull-right" placeholder="地点">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">潜在的事故类别</label>
|
||||
<div class="col-sm-4">
|
||||
<select type="text" id="accidentcategory" class="form-control pull-right" name="accidentcategory" >
|
||||
<option value="1">中毒和窒息</option>
|
||||
<option value="2">触电</option>
|
||||
<option value="3">火灾</option>
|
||||
<option value="4">淹溺</option>
|
||||
<option value="7">坠落</option>
|
||||
<option value="8">爆炸</option>
|
||||
<option value="5">起重伤害</option>
|
||||
<option value="6">其它伤害</option>
|
||||
</select>
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">主要后果</label>
|
||||
<div class="col-sm-4">
|
||||
<select type="text" id="consequences" class="form-control pull-right" name="consequences" >
|
||||
<option value="1">轻伤</option>
|
||||
<option value="2">重伤</option>
|
||||
<option value="3">死亡</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">L</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" id="lvalue" name="lvalue" class="form-control pull-right" placeholder="L(事故发生的可能性)">
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">S</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" id="svalue" name="svalue" class="form-control pull-right" placeholder="S(事故发生的严重程度)">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">R(L*S)</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" id="rvalue" name="rvalue" class="form-control pull-right" placeholder="R(风险度)" readonly="readonly">
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">风险等级</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" id="risklevels" name="risklevels" class="form-control pull-right" placeholder="风险等级" readonly="readonly">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">应采取的行动</label>
|
||||
<div class="col-sm-10">
|
||||
<textarea class="form-control " id="actionstaken" name="actionstaken" rows="6" placeholder="应采取的行动"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default pull-left" 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