147 lines
6.0 KiB
Plaintext
147 lines
6.0 KiB
Plaintext
<%@ page language="java" pageEncoding="UTF-8"%>
|
||
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
|
||
<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(){
|
||
$('#colorContainer').colorpicker({format: null});
|
||
})
|
||
|
||
function dosave() {
|
||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||
setTimeout(function(){
|
||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||
$.post(ext.contextPath + "/alarm/config/doSave.do", $("#subForm").serialize(), function(data) {
|
||
if (data.res == 1){
|
||
closeModal('subModal');
|
||
$("#table").bootstrapTable('refresh');
|
||
showAlert('s','保存成功');
|
||
}else if(data.code == 0){
|
||
showAlert('d', data.msg);
|
||
}else{
|
||
showAlert('d', data.msg);
|
||
}
|
||
},'json');
|
||
}
|
||
}, 100);
|
||
|
||
}
|
||
//输入框验证
|
||
$("#subForm").bootstrapValidator({
|
||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||
fields: {
|
||
upperLimit: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '风险度上限'
|
||
}
|
||
}
|
||
},lowerLimit: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '风险度下限'
|
||
}
|
||
}
|
||
},level: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '风险等级'
|
||
}
|
||
}
|
||
},color: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '颜色'
|
||
}
|
||
}
|
||
},fraction: {
|
||
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强制为subForm -->
|
||
<form class="form-horizontal" id="subForm">
|
||
<!-- 界面提醒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 class="form-control" id="lowerLimit" name ="lowerLimit"></input>
|
||
</div>
|
||
<label class="col-sm-2 control-label">*风险度上限</label>
|
||
<div class="col-sm-4">
|
||
<input class="form-control" id="upperLimit" name ="upperLimit"></input>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*风险等级</label>
|
||
<div class="col-sm-4">
|
||
<select class="form-control select2" id="level" name="level">
|
||
<option value="A">A</option>
|
||
<option value="B">B</option>
|
||
<option value="C">C</option>
|
||
<option value="D">D</option>
|
||
</select>
|
||
</div>
|
||
<label class="col-sm-2 control-label">*颜色</label>
|
||
<div class="col-sm-4">
|
||
<div class="input-group " id="colorContainer">
|
||
<input name="color" type="text" class="form-control">
|
||
<div class="input-group-addon">
|
||
<i></i>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*扣分数</label>
|
||
|
||
<div class="col-sm-4">
|
||
<input type="number"
|
||
oninput="if(value>100)value=100;if(value.length>4)value=value.slice(0,4);if(value<0)value=0"
|
||
onKeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"
|
||
οnkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}"
|
||
onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'0')}else{this.value=this.value.replace(/\D/g,'')}"
|
||
max="100" min="1" class="form-control" id="fraction" name ="fraction" placeholder="扣分数" value="0">
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">备注</label>
|
||
<div class="col-sm-10">
|
||
<textarea maxlength="200" class="form-control select2" id="remark" name ="remark" style="width:100%;"></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>
|