111 lines
4.6 KiB
Plaintext
111 lines
4.6 KiB
Plaintext
<%@ page language="java" pageEncoding="UTF-8"%>
|
||
<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").bootstrapValidator('validate');//提交验证
|
||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||
$.post(ext.contextPath + "/equipment/equipmentUseAge/dosave.do", $("#subForm").serialize(), 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: '年限名称不能为空'
|
||
}
|
||
}
|
||
},
|
||
valueMin: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '最小值不能为空'
|
||
},
|
||
callback: {
|
||
message: '最小值不能大于最大值',
|
||
callback: function(value, validator) {//这里可以自定义value的判断规则
|
||
var maxV = $("#valueMax").val();
|
||
if(maxV != "" && maxV != null){
|
||
if(maxV < value){
|
||
return false;
|
||
}else {
|
||
return true;
|
||
}
|
||
}else {
|
||
return true;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
}
|
||
});
|
||
</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>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*年限名称</label>
|
||
<div class="col-sm-6">
|
||
<input type="text" class="form-control" id="name" name ="name" placeholder="请输入(例:1-3年)" >
|
||
</div>
|
||
</div>
|
||
<div class="form-group form-inline">
|
||
<label class="col-sm-2 control-label">*年限范围</label>
|
||
<div class="col-sm-3">
|
||
<label class="control-label">最小值</label>
|
||
<input type="number" class="form-control" style="width:60px" min="0" setp="1" id="valueMin" name ="valueMin" placeholder="" >
|
||
</div>
|
||
<div class="col-sm-3">
|
||
<label class="control-label">最大值</label>
|
||
<input type="number" class="form-control pull-right" style="width:60px" min="0" setp="1" id="valueMax" name ="valueMax" placeholder="" >
|
||
</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 ="remark" name ="remark" 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>
|