101 lines
4.2 KiB
Plaintext
101 lines
4.2 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(){
|
||
var alarmInformationJson=jQuery.parseJSON('${alarmInformationJson}');
|
||
var selelct_ = $("#informationCode").select2({
|
||
data: alarmInformationJson,
|
||
cache: false,
|
||
placeholder: '请选择',//默认文字提示
|
||
allowClear: false,//允许清空
|
||
escapeMarkup: function (markup) { return markup; }, // 自定义格式化防止xss注入
|
||
language: "zh-CN",
|
||
minimumInputLength: 0,
|
||
minimumResultsForSearch: 10,//数据超过十个启用搜索框
|
||
formatResult: function formatRepo(repo) { return repo.text; }, // 函数用来渲染结果
|
||
formatSelection: function formatRepoSelection(repo) { return repo.text; } // 函数用于呈现当前的选择
|
||
});
|
||
selelct_.val('${param.informationCode}').trigger("change");
|
||
// selelct_.on("change", function (e) {
|
||
// var value = $(this).val();
|
||
// });
|
||
})
|
||
|
||
function doOwnPointsave() {
|
||
$("#owmPointsubForm").bootstrapValidator('validate');//提交验证
|
||
setTimeout(function(){
|
||
if ($("#owmPointsubForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||
$.post(ext.contextPath + "/alarm/alarmPoint/dosave.do", $("#owmPointsubForm").serialize()+"&unitId="+unitId+"&type=${param.addType}", function(data) {
|
||
if (data.code == 1){
|
||
closeModal('subModal');
|
||
$("#pointTable").bootstrapTable('refresh');
|
||
// showAlert('s','保存成功');
|
||
}else if(data.code == 0){
|
||
showAlert('d',data.msg);
|
||
}else{
|
||
showAlert('d',data.msg);
|
||
}
|
||
},'json');
|
||
}
|
||
}, 100);
|
||
|
||
}
|
||
//输入框验证
|
||
$("#owmPointsubForm").bootstrapValidator({
|
||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||
fields: {
|
||
alarmPoint: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '报警点不能为空'
|
||
}
|
||
}
|
||
}
|
||
}
|
||
});
|
||
|
||
</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强制为owmPointsubForm -->
|
||
<form class="form-horizontal" id="owmPointsubForm">
|
||
<!-- 界面提醒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" class="form-control" id="alarmPoint" name ="alarmPoint" placeholder="报警点" value="${alarmPoint.alarmPoint}" >
|
||
</div>
|
||
<label class="col-sm-2 control-label">*信息标识</label>
|
||
<div class="col-sm-4">
|
||
<select class="form-control select2" id="informationCode" name ="informationCode" style="width:170px;"></select>
|
||
</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="doOwnPointsave()" id="btn_save">保存</button>
|
||
</div>
|
||
</div>
|
||
<!-- /.modal-content -->
|
||
</div>
|
||
<!-- /.modal-dialog -->
|
||
</div>
|