188 lines
8.2 KiB
Plaintext
188 lines
8.2 KiB
Plaintext
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
|
||
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
|
||
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
|
||
<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() {
|
||
$("#alarmsendway").select2({minimumResultsForSearch: 10}).val("${msgAlarmlevel.sendway}").trigger("change");
|
||
//选择用户
|
||
$(function() {
|
||
$.post(ext.contextPath +"/user/selectUserForMsgAlarmlevel.do", {}, function(data) {
|
||
var selelct =$("#msgsend").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;} // 函数用于呈现当前的选择
|
||
});
|
||
var items = new Array();
|
||
var msguserids='${msguserids}'.split(",");
|
||
for(var i=0 ;i<msguserids.length;i++){
|
||
items.push(msguserids[i]);
|
||
}
|
||
selelct.val(items).trigger("change");
|
||
},'json');
|
||
|
||
$.post(ext.contextPath +"/user/selectUserForMsgAlarmlevel.do", {}, function(data) {
|
||
var selelct =$("#smssend").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;} // 函数用于呈现当前的选择
|
||
});
|
||
var items = new Array();
|
||
var smsuserids='${smsuserids}'.split(",");
|
||
for(var i=0 ;i<smsuserids.length;i++){
|
||
items.push(smsuserids[i]);
|
||
}
|
||
selelct.val(items).trigger("change");
|
||
},'json');
|
||
});
|
||
});
|
||
//输入框验证
|
||
$("#subAlarmlevelForm").bootstrapValidator({
|
||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||
fields: {
|
||
alarmLevel: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '报警级别不能为空'
|
||
},
|
||
}
|
||
},
|
||
msgsend: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '消息用户不能为空'
|
||
},
|
||
}
|
||
},
|
||
smssend: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '短信用户不能为空'
|
||
},
|
||
}
|
||
},
|
||
sendway: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '发送方式不能为空'
|
||
},
|
||
}
|
||
},
|
||
msgrole: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '发送条件不能为空'
|
||
},
|
||
}
|
||
},
|
||
}
|
||
});
|
||
function doupdateAlarmlevel() {
|
||
var msguserids = $('#msgsend').val();
|
||
var smsuserids = $('#smssend').val();
|
||
$("#subAlarmlevelForm").bootstrapValidator('validate');//提交验证
|
||
if ($("#subAlarmlevelForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||
$.post(ext.contextPath + "/msg/updateAlarmlevel.do", $("#subAlarmlevelForm").serialize()+"&msguserids="+msguserids+"&smsuserids="+smsuserids, function(data) {
|
||
if (data.res == 1) {
|
||
showAlert('s','保存成功');
|
||
closeModal('subAlarmlevelModal');
|
||
$("#table_user").bootstrapTable('refresh');
|
||
}else if(data.res == 0){
|
||
showAlert('d','保存失败');
|
||
}else{
|
||
showAlert('d',data.res);
|
||
}
|
||
},'json');
|
||
}
|
||
}
|
||
|
||
</script>
|
||
<div class="modal fade" id="subAlarmlevelModal">
|
||
<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="subAlarmlevelForm">
|
||
<div id="alertDiv"></div>
|
||
<!-- 界面提醒div强制id为alertdiv -->
|
||
<input id="state" name="state" type="hidden" value="${msgAlarmlevel.state }" />
|
||
<input id="id" name="id" type="hidden" value="${msgAlarmlevel.id }" />
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">报警级别</label>
|
||
<div class="col-sm-10">
|
||
<input type="text" class="form-control" id="alarmLevel" name ="alarmLevel" placeholder="请输入:一级报警、二级报警......" value="${msgAlarmlevel.alarmLevel }"/>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">消息用户</label>
|
||
<div class="col-sm-10">
|
||
<select class="form-control select2" id="msgsend" name ="msgsend" style="width:270px"></select>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">短信用户</label>
|
||
<div class="col-sm-10">
|
||
<select class="form-control select2" id="smssend" name ="smssend" style="width:270px"></select>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">发送方式</label>
|
||
<div class="col-sm-10">
|
||
<select id="alarmsendway" name="sendway" class="form-control select2" style="width:270px;">
|
||
<option value='msg'>仅消息发送</option>
|
||
<option value='sms'>仅短信发送</option>
|
||
<option value='both'>消息+短信发送</option>
|
||
</select>
|
||
</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="msgrole" name ="msgrole" placeholder="请以(>1,=1,1-2)的形式输入" value="${msgAlarmlevel.msgrole}"/>
|
||
</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="doupdateAlarmlevel()">保存</button>
|
||
</div>
|
||
</div>
|
||
<!-- /.modal-content -->
|
||
</div>
|
||
<!-- /.modal-dialog -->
|
||
</div> |