1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<title>全网监控智能分析平台</title>
<script type="text/javascript" src="${ctx}/static/js/validation.js"></script>
<script language="javascript">
$(document).ready(function() {
/* <c:if test="${allProvince == true}">
changeAll(true);
</c:if>*/
<c:if test="${allProvince != true}">
<c:forEach items="${eWarningRule.provinceList}" var="province">
$("input:checkbox[name='provinces'][value='${province.provinceId}']").attr('checked','true');
</c:forEach>
</c:if>
parent.document.all('eWarningRuleFrame').style.height= document.body.scrollHeight + "px";
getModelByType();
});
function submitForm() {
var url = '${ctx}/BaseManage/EWarningRuleManage/checkNameAndCode';
var data = 'name=' + $('#name').val() + "&code=" + $('#code').val() + "&id=" + $('#ewarncrteruleId').val();
if (validate()) {
$.ajax({
type : 'POST',
url: url,
data:data,
success: function(data) {
if(data == '1') {
alert("规则名称已存在");
$('#name').focus();
} else if (data == '2') {
alert("规则代码已存在");
$('#code').focus();
} else if (data == '0'){
$('#detailForm').submit();
}
}
});
}
}
function validate() {
if(!checkNameAndCode()) {
return false;
}
if(!isNumber($('#correctRate'))) {
return false;
}
if(!isNumber($('#cycleMinutes'))) {
return false;
}
if(!checkRequired()) {
return false;
}
if(!checkKpi()) {
return false;
}
return true;
}
function changeAll(checked) {
if(checked) {
$(".province").attr("checked","checked");
$(".province").attr("disabled",true);
} else {
$(".province").attr("checked",false);
$(".province").attr("disabled",false);
}
}
function changeHeight() {
parent.document.all('eWarningRuleFrame').style.height= document.body.scrollHeight + "px";
}
function getModelByType() {
//alert($("#dataModelType option:selected").val());
//return false;
$.ajax({
type : 'POST',
url: "${ctx}/BaseManage/EWarningRuleManage/getModelByType",
data: "dataModelTypeId=" + $("#dataModelType option:selected").val(),
success: function(data) {
//alert(data.length);
$('#dataModel').empty();
for(var i=0;i<data.length;i++) {
var option = new Option(data[i].dataModelName,data[i].dataModelId);
$('#dataModel').append(option);
}
<c:if test="${not empty eWarningRule.dataModel}">
$("#dataModel").val('${eWarningRule.dataModel.dataModelId}');
</c:if>
}
});
}
</script>
</head>
<body>
<div class="col-xs-12" style="padding-top: 20px;">
<form id="detailForm" class="form-horizontal" role="form"
action="${ctx}/BaseManage/EWarningRuleManage/submitEWarningRuleFrame" method="post">
<input type="hidden" name="ewarncrteruleId" id="ewarncrteruleId" value="${eWarningRule.ewarncrteruleId}">
<div class="form-group">
<label class="col-sm-2 control-label">规则名称(<font color="red">必填</font>):</label>
<div class="col-xs-2">
<input type="input" class="form-control" id="name" name="name" value="${eWarningRule.name}" maxlength="33">
</div>
<label class="col-sm-2 control-label">规则代码(<font color="red">必填</font>):</label>
<div class="col-xs-2">
<input type="input" class="form-control" id="code" name="code" value="${eWarningRule.code}" maxlength="100">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">预警消除规则:</label>
<div class="col-xs-2">
<select class="form-control" name="eWarningDropRule.eWarningDropRuleId" id="eWarningDropRuleId">
<c:forEach items="${eWarningDropRuleList}" var="eWarningDropRule">
<option value="${eWarningDropRule.eWarningDropRuleId}"
<c:if test="${eWarningDropRule.eWarningDropRuleId == eWarningRule.eWarningDropRule.eWarningDropRuleId}">selected</c:if> >${eWarningDropRule.name}</option>
</c:forEach>
</select>
</div>
<label class="col-sm-2 control-label">预警发生场景:</label>
<div class="col-xs-2">
<select class="form-control" name="eWarningSence.ewarnsenceId" id="ewarnsenceId">
<c:forEach items="${eWarningSenceList}" var="eWarningSence">
<option value="${eWarningSence.ewarnsenceId}"
<c:if test="${eWarningSence.ewarnsenceId == eWarningRule.eWarningSence.ewarnsenceId}">selected</c:if> >${eWarningSence.name}</option>
</c:forEach>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">规则类型:</label>
<div class="col-xs-2">
<select class="form-control" name="ruleType" id="ruleType">
<option value="1" <c:if test="${eWarningRule.ruleType == '1'}">selected</c:if> >平台</option>
<option value="2" <c:if test="${eWarningRule.ruleType == '2'}">selected</c:if> >Capes</option>
<option value="3" <c:if test="${eWarningRule.ruleType == '3'}">selected</c:if> >网络流量</option>
</select>
</div>
<label class="col-sm-2 control-label">准确率:</label>
<div class="col-xs-2">
<input type="input" class="form-control" id="correctRate" name="correctRate" value="${eWarningRule.correctRate}" maxlength="10">
</div>
</div>
<div class="form-group">
<div><label class="col-sm-2 control-label">生效时间(<font color="red">必填</font>):</label></div>
<div class="col-xs-2">
<input type="input" title="生效时间" class="form-control Wdate required" id="validTime" name="validTimeStr" value="${eWarningRule.validTime}"
onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',readOnly:false,maxDate:'#F{$dp.$D(\'invalidTime\');}'})">
</div>
<label class="col-sm-2 control-label">失效时间(<font color="red">必填</font>):</label>
<div class="col-xs-2">
<input type="input" title="失效时间" class="form-control Wdate required" id="invalidTime" name="invalidTimeStr" value="${eWarningRule.validTime}"
onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',readOnly:false,minDate:'#F{$dp.$D(\'validTime\');}'})">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">模型类型:</label>
<div class="col-xs-2">
<select class="form-control" name="dataModelType.dataModelTypeId" id="dataModelType" onchange="getModelByType()">
<c:forEach items="${dataModelTypeList}" var="dataModelType">
<option value="${dataModelType.dataModelTypeId}"
<c:if test="${dataModelType.dataModelTypeId == eWarningRule.dataModelType.dataModelTypeId}">selected</c:if> >${dataModelType.dataModelTypeName}</option>
</c:forEach>
</select>
</div>
<label class="col-sm-2 control-label">关联模型:</label>
<div class="col-xs-2">
<select class="form-control" name="dataModel.dataModelId" id="dataModel">
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">时间间隔长度:</label>
<div class="col-xs-2">
<input type="input" class="form-control" id="cycleMinutes" name="cycleMinutes" value="${eWarningRule.cycleMinutes}" maxlength="10">
</div>
<label class="col-sm-2 control-label">统计时长:</label>
<div class="col-xs-2">
<select class="form-control" name="period.statisticstimeId" id="ewarningsenceId">
<c:forEach items="${periodList}" var="period">
<option value="${period.statisticstimeId}"
<c:if test="${period.statisticstimeId == eWarningRule.period.statisticstimeId}">selected</c:if> >${period.name}</option>
</c:forEach>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">高于阀值等级次数:</label>
<div class="col-xs-2">
<input type="input" class="form-control" id="thresholdhighStr" name="thresholdhighStr" value="${eWarningRule.thresholdhighStr}" maxlength="100">
</div>
<label class="col-sm-2 control-label">低于阀值等级次数:</label>
<div class="col-xs-2">
<input type="input" class="form-control" id="thresholdunderStr" name="thresholdunderStr" value="${eWarningRule.thresholdunderStr}" maxlength="100">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">是否可以手工关闭:</label>
<div class="col-xs-2">
<input type="checkbox" name="manucloseFlg" value="1" <c:if test="${eWarningRule.manucloseFlg == '1'}">checked</c:if> >
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">预警计算公式(<font color="red">必填</font>):</label>
<div class="col-xs-5">
<textarea id="calculateStr" name="calculateStr" title="预警计算公式" class="form-control input-large required" required="true" rows="6" maxlength="1333">${eWarningRule.calculateStr}</textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">变量计算公式:</label>
<div class="col-xs-5">
<textarea id="calculateResdata" name="calculateResdata" class="form-control input-large" rows="6" maxlength="1333">${eWarningRule.calculateResdata}</textarea>
</div>
</div>
<tags:WARN_PROVINCE />
<tags:WARN_KPI_NEW />
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="button" id="modelSubmit" class="btn btn-primary" onclick="saveForm('ewarncrteruleId');">确定</button>
<!-- <button type="reset" class="btn btn-default" id="modelReset">清空</button> -->
<button type="reset" class="btn btn-warning" id="modelBack" onclick="window.location.href='${ctx}/BaseManage/EWarningRuleManage/eWarningRuleListFrame'">返回</button>
</div>
</div>
</form>
</div>
</body>
</html>