first commit
This commit is contained in:
192
src/main/webapp/jsp/alarm/alarmInformationAdd.jsp
Normal file
192
src/main/webapp/jsp/alarm/alarmInformationAdd.jsp
Normal file
@ -0,0 +1,192 @@
|
||||
<%@ 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 alarmMoldCodeEnum=jQuery.parseJSON('${alarmMoldCodeEnum}');
|
||||
var selelct_ = $("#moldCode").select2({
|
||||
data: alarmMoldCodeEnum,
|
||||
cache: false,
|
||||
placeholder: '请选择',//默认文字提示
|
||||
allowClear: true,//允许清空
|
||||
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; } // 函数用于呈现当前的选择
|
||||
});
|
||||
if('${param.nowMoldCode}'!=''){
|
||||
selelct_.val('${param.nowMoldCode}').trigger("change");
|
||||
}else{
|
||||
selelct_.val('').trigger("change");
|
||||
}
|
||||
|
||||
selelct_.on("change", function (e) {
|
||||
var value = $('#moldCode').val();
|
||||
var text = $("#moldCode").find("option:selected").text();
|
||||
var value2 = $('#levelCode').val();
|
||||
var text2 = $("#levelCode").find("option:selected").text();
|
||||
$('#name').val(text+"_"+text2);
|
||||
$('#code').val(value+"_"+value2);
|
||||
});
|
||||
|
||||
var alarmLevelsCodeEnum=jQuery.parseJSON('${alarmLevelsCodeEnum}');
|
||||
var selelct_2 = $("#levelCode").select2({
|
||||
data: alarmLevelsCodeEnum,
|
||||
cache: false,
|
||||
placeholder: '请选择',//默认文字提示
|
||||
allowClear: true,//允许清空
|
||||
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_2.val('').trigger("change");
|
||||
selelct_2.on("change", function (e) {
|
||||
var value = $('#moldCode').val();
|
||||
var text = $("#moldCode").find("option:selected").text();
|
||||
var value2 = $('#levelCode').val();
|
||||
var text2 = $("#levelCode").find("option:selected").text();
|
||||
$('#name').val(text+"_"+text2);
|
||||
$('#code').val(value+"_"+value2);
|
||||
});
|
||||
|
||||
var alarmInformationAlarmModeEnum=jQuery.parseJSON('${AlarmInformationAlarmModeEnum}');
|
||||
var selelct_3 = $("#alarmMode").select2({
|
||||
data: alarmInformationAlarmModeEnum,
|
||||
cache: false,
|
||||
placeholder: '请选择',//默认文字提示
|
||||
allowClear: true,//允许清空
|
||||
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_3.val('').trigger("change");
|
||||
// if(alarmInformationAlarmModeEnum!=''){
|
||||
// selelct_3.val(alarmInformationAlarmModeEnum[0].id).trigger("change");
|
||||
// }else{
|
||||
// selelct_3.val('').trigger("change");
|
||||
// }
|
||||
selelct_3.on("change", function (e) {
|
||||
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
function dosave() {
|
||||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||||
setTimeout(function(){
|
||||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||||
$.post(ext.contextPath + "/alarm/alarmInformation/dosave.do", $("#subForm").serialize()+"&unitId="+unitId, function(data) {
|
||||
if (data.code == 1){
|
||||
informationTree();
|
||||
// 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: {
|
||||
moldCode: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '报警类型不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
levelCode: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '报警等级不能为空'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var showUser4SelectsFun = function() {
|
||||
var userIds= $("#alarmReceivers").val();
|
||||
$.post(ext.contextPath + '/user/userForSelectByStructure.do', {formId:"subForm",hiddenId:"alarmReceivers",textId:"alarmReceiversName",userIds:userIds} , function(data) {
|
||||
$("#user4SelectDiv").html(data);
|
||||
openModal("user4SelectModal");
|
||||
});
|
||||
};
|
||||
|
||||
</script>
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">新增</h3>
|
||||
|
||||
<div class="box-tools pull-right">
|
||||
<a onclick="dosave()" class="btn btn-box-tool" data-toggle="tooltip" title="保存"><i
|
||||
class="glyphicon glyphicon-floppy-disk"></i></a>
|
||||
<a onclick="dodel()" class="btn btn-box-tool" data-toggle="tooltip" title="删除"><i
|
||||
class="glyphicon glyphicon-trash"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-header -->
|
||||
<div class="box-body ">
|
||||
<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 type="text" class="form-control" id="name" name ="name" placeholder="名称" readonly>
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">*标识</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="code" name ="code" placeholder="标识" readonly>
|
||||
</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="moldCode" name ="moldCode" style="width:170px;"></select>
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">*报警等级</label>
|
||||
<div class="col-sm-4">
|
||||
<select class="form-control select2" id="levelCode" name ="levelCode" style="width:170px;"></select>
|
||||
</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="alarmMode" name ="alarmMode" style="width:170px;"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">报警接收人</label>
|
||||
<div class="col-sm-10">
|
||||
<textarea type="text" style="height: 80px;" class="form-control" id="alarmReceiversName" name ="alarmReceiversName" placeholder="报警接收人" onclick="showUser4SelectsFun();" readonly></textarea>
|
||||
<input id="alarmReceivers" name="alarmReceivers" type="hidden" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user