|
|
1
|
+<%@page language="java" contentType="text/html;charset=utf-8" %>
|
|
|
2
|
+<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
|
|
3
|
+
|
|
|
4
|
+<%
|
|
|
5
|
+ String path = request.getContextPath();
|
|
|
6
|
+ String basePath = request.getScheme() + "://"
|
|
|
7
|
+ + request.getServerName() + ":" + request.getServerPort()
|
|
|
8
|
+ + path + "/";
|
|
|
9
|
+%>
|
|
|
10
|
+
|
|
|
11
|
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
|
12
|
+<html>
|
|
|
13
|
+<head>
|
|
|
14
|
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
|
15
|
+ <link rel="stylesheet" href="<%=basePath %>css/bootstrap.min.css"/>
|
|
|
16
|
+ <link rel="stylesheet" href="<%=basePath %>css/bootstrap-datetimepicker.css"/>
|
|
|
17
|
+ <link href="<%=basePath %>js/bootstrap-plugin/css/bootstrap.table.css" rel="stylesheet" media="screen"/>
|
|
|
18
|
+ <link rel="stylesheet" href="<%=basePath %>css/bootstrap-responsive.min.css"/>
|
|
|
19
|
+ <link rel="stylesheet" href="<%=basePath %>css/fullcalendar.css"/>
|
|
|
20
|
+ <link rel="stylesheet" href="<%=basePath %>css/unicorn.main.css"/>
|
|
|
21
|
+ <link rel="stylesheet" href="<%=basePath %>css/unicorn.grey.css"/>
|
|
|
22
|
+ <link rel="stylesheet" href="<%=basePath %>css/jquery-ui.css"/>
|
|
|
23
|
+ <link rel="stylesheet" href="<%=basePath %>css/uniform.css"/>
|
|
|
24
|
+ <link rel="stylesheet" href="<%=basePath %>css/select2.css"/>
|
|
|
25
|
+ <link rel="stylesheet" href="<%=basePath %>js/jstree/themes/proton/style.css"/>
|
|
|
26
|
+ <link rel="stylesheet" href="<%=basePath %>css/select2.css"/>
|
|
|
27
|
+ <link rel="stylesheet" href="<%=basePath %>css/yoho.css"/>
|
|
|
28
|
+ <script src="<%=basePath %>js/excanvas.min.js" charset="UTF-8" type="text/javascript"></script>
|
|
|
29
|
+ <script src="<%=basePath %>js/jquery-1.12.0.min.js" charset="UTF-8" type="text/javascript"></script>
|
|
|
30
|
+ <script src="<%=basePath %>js/jquery-ui.custom.js" charset="UTF-8" type="text/javascript"></script>
|
|
|
31
|
+ <script src="<%=basePath %>/js/bootstrap.min.js"></script>
|
|
|
32
|
+ <script src="<%=basePath %>/js/unicorn.js"></script>
|
|
|
33
|
+ <script src="<%=basePath %>js/bootstrap-plugin/datetimepicker/moment-with-locales.js" charset="UTF-8"
|
|
|
34
|
+ type="text/javascript"></script>
|
|
|
35
|
+ <script src="<%=basePath %>js/bootstrap-plugin/datetimepicker/bootstrap-datetimepicker.js" charset="UTF-8"
|
|
|
36
|
+ type="text/javascript"></script>
|
|
|
37
|
+ <script src="<%=basePath %>js/global.js" charset="UTF-8" type="text/javascript"></script>
|
|
|
38
|
+ <script src="<%=basePath %>js/bootstrap-plugin/bootstrap.pagination.js" charset="UTF-8"
|
|
|
39
|
+ type="text/javascript"></script>
|
|
|
40
|
+ <script src="<%=basePath %>js/bootstrap-plugin/bootstrap.table.js" charset="UTF-8" type="text/javascript"></script>
|
|
|
41
|
+ <script src="<%=basePath %>js/bootstrap-plugin/bootstrap.dialog.js" charset="UTF-8" type="text/javascript"></script>
|
|
|
42
|
+ <script src="<%=basePath %>js/bootstrap-plugin/bootstrap.form.js" charset="UTF-8" type="text/javascript"></script>
|
|
|
43
|
+ <script src="<%=basePath %>js/bootstrap-plugin/bootstrap.panel.js" charset="UTF-8" type="text/javascript"></script>
|
|
|
44
|
+ <script src="<%=basePath %>js/bootstrap-plugin/bootstrap.alerts.js" charset="UTF-8" type="text/javascript"></script>
|
|
|
45
|
+ <script src="<%=basePath %>js/bootstrap-plugin/bootstrap.accordion.js" charset="UTF-8"
|
|
|
46
|
+ type="text/javascript"></script>
|
|
|
47
|
+ <script src="<%=basePath %>js/bootstrap-plugin/bootstrap.breadcrumb.js" charset="UTF-8"
|
|
|
48
|
+ type="text/javascript"></script>
|
|
|
49
|
+ <script src="<%=basePath %>js/bootstrap-plugin/bootstrap.validate.js" charset="UTF-8"
|
|
|
50
|
+ type="text/javascript"></script>
|
|
|
51
|
+ <script src="<%=basePath %>js/bootstrap-plugin/bootstrap.form.js" charset="UTF-8" type="text/javascript"></script>
|
|
|
52
|
+ <script src="<%=basePath %>js/layer/layer.js" charset="UTF-8" type="text/javascript"></script>
|
|
|
53
|
+ <script src="<%=basePath %>js/bootstrap-plugin/bootstrap.select.js" charset="UTF-8" type="text/javascript"></script>
|
|
|
54
|
+ <script src="<%=basePath %>js/jstree/jstree.min.js"></script>
|
|
|
55
|
+ <script src="<%=basePath %>js/jquery.toaster.js"></script>
|
|
|
56
|
+ <script>
|
|
|
57
|
+ var contextPath = '<%=basePath %>';
|
|
|
58
|
+ </script>
|
|
|
59
|
+ <title>YOHO!运维</title>
|
|
|
60
|
+</head>
|
|
|
61
|
+<body>
|
|
|
62
|
+
|
|
|
63
|
+<!-- 头部 -->
|
|
|
64
|
+<div id="head">
|
|
|
65
|
+</div>
|
|
|
66
|
+<!-- 右侧具体内容 -->
|
|
|
67
|
+<div id="content">
|
|
|
68
|
+
|
|
|
69
|
+ <div id="breadcrumb">
|
|
|
70
|
+ <a href="#" title="Go to Home" class="tip-bottom"><i
|
|
|
71
|
+ class="icon-home"></i> Home</a> <a href="#" class="current">恶意ip规则管理</a>
|
|
|
72
|
+ </div>
|
|
|
73
|
+
|
|
|
74
|
+ <div class="container-fluid">
|
|
|
75
|
+
|
|
|
76
|
+
|
|
|
77
|
+ <div class="widget-box">
|
|
|
78
|
+ <div class="widget-title">
|
|
|
79
|
+ <h5>恶意Ip规则查询</h5>
|
|
|
80
|
+ </div>
|
|
|
81
|
+ <div class="widget-content nopadding">
|
|
|
82
|
+ <div class="widget-title" style="height: 53px;">
|
|
|
83
|
+ <div>
|
|
|
84
|
+ <button id="addRuleBtn" class="btn btn-success" style="margin-top: 12px;margin-left: 10px;" onclick="editRuleInfo(0)">新增规则</button>
|
|
|
85
|
+ </div>
|
|
|
86
|
+ </div>
|
|
|
87
|
+ <div id="malIpRulesInfoTable">
|
|
|
88
|
+
|
|
|
89
|
+ </div>
|
|
|
90
|
+ </div>
|
|
|
91
|
+ </div>
|
|
|
92
|
+ </div>
|
|
|
93
|
+</div>
|
|
|
94
|
+
|
|
|
95
|
+<%--新增规则模态框--%>
|
|
|
96
|
+<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" >
|
|
|
97
|
+ <div class="modal-dialog">
|
|
|
98
|
+ <div class="modal-content"style="width: 140%">
|
|
|
99
|
+ <div class="modal-header">
|
|
|
100
|
+ <button type="button" class="close" data-dismiss="modal"
|
|
|
101
|
+ aria-hidden="true">×</button>
|
|
|
102
|
+ <h4 class="modal-title" id="myModalLabel"></h4>
|
|
|
103
|
+ </div>
|
|
|
104
|
+ <div class="modal-body" style="height: 600px;overflow :auto" >
|
|
|
105
|
+ <form id="editRuleForm" class="form-horizontal">
|
|
|
106
|
+
|
|
|
107
|
+ <div class="form-group" >
|
|
|
108
|
+ <label class="col-sm-1 control-label"> <span style="color:red">*</span>规则名称:</label>
|
|
|
109
|
+ <div class="col-sm-9">
|
|
|
110
|
+ <input type="text" class="form-control " id="ruleName" name="ruleName" placeholder="规则名称" />
|
|
|
111
|
+ </div>
|
|
|
112
|
+ </div>
|
|
|
113
|
+
|
|
|
114
|
+
|
|
|
115
|
+
|
|
|
116
|
+ <div class="form-group">
|
|
|
117
|
+ <label class=" col-sm-1 control-label">生成规则:</label>
|
|
|
118
|
+ <div class="col-sm-2">
|
|
|
119
|
+ <input type="button" value="新增规则项" id="ruleItem" class="form-control btn btn-success" onclick="addRuleItem()"/>
|
|
|
120
|
+ </div>
|
|
|
121
|
+ </div>
|
|
|
122
|
+
|
|
|
123
|
+ <div class="form-group">
|
|
|
124
|
+ <label class=" col-sm-1 control-label"></label>
|
|
|
125
|
+ <div class="col-sm-9">
|
|
|
126
|
+ <table class="table table-striped table-hover table-bordered " id="table_rule_items" style="width: 100%">
|
|
|
127
|
+ <thead>
|
|
|
128
|
+ <tr>
|
|
|
129
|
+ <th style="width: 25%">规则</th>
|
|
|
130
|
+ <th style="width: 15%"> 比较符</th>
|
|
|
131
|
+ <th style="width: 15%">值</th>
|
|
|
132
|
+ <th style="width: 15%">规则连接符号</th>
|
|
|
133
|
+ <th style="width: 15%">删除</th>
|
|
|
134
|
+ </tr>
|
|
|
135
|
+ </thead>
|
|
|
136
|
+ <tbody>
|
|
|
137
|
+ <tr>
|
|
|
138
|
+ <td><select name='item_rule' class="form-control" style="height:80%"></select></td>
|
|
|
139
|
+ <td><select name='item_op' class="form-control" style="height:80%"></select></td>
|
|
|
140
|
+ <td><input type="text" name='item_val' class="form-control" ></input></td>
|
|
|
141
|
+ <td><select name='item_concat' class="form-control" style="display:none;height:80%"></select></td>
|
|
|
142
|
+ <td><a href="javascript:void(0)" class="btn mini black metric_delete" onclick="removeItem(this)">删除</a></td>
|
|
|
143
|
+ </tr>
|
|
|
144
|
+ </tbody>
|
|
|
145
|
+ </table>
|
|
|
146
|
+ </div>
|
|
|
147
|
+ </div>
|
|
|
148
|
+
|
|
|
149
|
+ <div class="form-group" >
|
|
|
150
|
+ <label class="col-sm-1 control-label"> <span style="color:red">*</span>所生成的规则:</label>
|
|
|
151
|
+ <div class="col-sm-9">
|
|
|
152
|
+ <textarea class="form-control " id="rule" name="rule" style="font-size: 15px" rows="4" disabled="true" ></textarea>
|
|
|
153
|
+ </div>
|
|
|
154
|
+ </div>
|
|
|
155
|
+
|
|
|
156
|
+
|
|
|
157
|
+ <div class="form-group">
|
|
|
158
|
+ <label class="col-sm-2 control-label"> </label>
|
|
|
159
|
+ <div class="col-sm-8" id="messageAlert"></div>
|
|
|
160
|
+ </div>
|
|
|
161
|
+ <input type="hidden" name="editGroupId"/>
|
|
|
162
|
+ </form>
|
|
|
163
|
+ </div>
|
|
|
164
|
+ <div class="modal-footer">
|
|
|
165
|
+ <button type="button" class="btn btn-danger" data-dismiss="modal" onclick="window.location.href='/maliciousIp/toMaliciousIpRules'">关闭</button>
|
|
|
166
|
+ <button type="button" class="btn btn-success" value="Validate" onclick="saveTask()">提交</button>
|
|
|
167
|
+ </div>
|
|
|
168
|
+ </div>
|
|
|
169
|
+ <!-- /.modal-content -->
|
|
|
170
|
+ </div>
|
|
|
171
|
+ <!-- /.modal -->
|
|
|
172
|
+</div>
|
|
|
173
|
+<script src="<%=basePath %>script/common/genarate_left_panel.js"></script>
|
|
|
174
|
+<script>
|
|
|
175
|
+ $("#li_config").addClass("active open");
|
|
|
176
|
+ $("#li_malicious_ips").addClass("active");
|
|
|
177
|
+</script>
|
|
|
178
|
+<script>
|
|
|
179
|
+ var items = ${items};//规则项
|
|
|
180
|
+ var operations = ${operations};//规则---比较符
|
|
|
181
|
+ var concats = ${concats};//规则连接符
|
|
|
182
|
+
|
|
|
183
|
+ $(function () {
|
|
|
184
|
+ initEvents();//初始化 绑定事件
|
|
|
185
|
+ initSelects(0);
|
|
|
186
|
+ //加载表格
|
|
|
187
|
+ $("#malIpRulesInfoTable").table({
|
|
|
188
|
+ columnAutoWidth : false,
|
|
|
189
|
+ url : "/maliciousIp/getIpRules",
|
|
|
190
|
+ striped : true,
|
|
|
191
|
+ title : "恶意ip规则列表",
|
|
|
192
|
+ dataType : "json",
|
|
|
193
|
+ pagination : true,
|
|
|
194
|
+ pageSize : 10,
|
|
|
195
|
+ loadFilter : function(data) {
|
|
|
196
|
+ return defaultLoadFilter(data);
|
|
|
197
|
+ },
|
|
|
198
|
+ columns : [{
|
|
|
199
|
+ title : "序号",
|
|
|
200
|
+ width : "12%",
|
|
|
201
|
+ formatter : function(value, rowData, rowIndex){
|
|
|
202
|
+ return rowIndex + 1;
|
|
|
203
|
+ }
|
|
|
204
|
+ },/*{
|
|
|
205
|
+ title : "id",
|
|
|
206
|
+ field : "id",
|
|
|
207
|
+ width : "12%"
|
|
|
208
|
+ },*/ {
|
|
|
209
|
+ title : "规则名称",
|
|
|
210
|
+ field : "name",
|
|
|
211
|
+ width : "20%"
|
|
|
212
|
+ }, {
|
|
|
213
|
+ title : "规则内容",
|
|
|
214
|
+ field : "rule",
|
|
|
215
|
+ width : "40%"
|
|
|
216
|
+ }, {
|
|
|
217
|
+ title : "操作",
|
|
|
218
|
+ field : "op",
|
|
|
219
|
+ formatter : function(value, rowData, rowIndex) {
|
|
|
220
|
+ var div = $("<div>");
|
|
|
221
|
+ var delBtn = $("<button>").addClass("btn btn-xs btn-danger").html("删除").appendTo(div);
|
|
|
222
|
+ delBtn.click(function() {
|
|
|
223
|
+ var dialog = $("<div>").appendTo($("body"));
|
|
|
224
|
+ dialog.dialog({
|
|
|
225
|
+ title : "你确定删除吗",
|
|
|
226
|
+ backdrop : "static",
|
|
|
227
|
+ content : "你确定要删除该条规则吗?",
|
|
|
228
|
+ buttons : [{
|
|
|
229
|
+ text : "否",
|
|
|
230
|
+ className : "btn-danger",
|
|
|
231
|
+ onclick : function() {
|
|
|
232
|
+ $(dialog).dialog("hide");
|
|
|
233
|
+ }
|
|
|
234
|
+ }, {
|
|
|
235
|
+ text : "是",
|
|
|
236
|
+ className : "btn-success",
|
|
|
237
|
+ onclick : function() {
|
|
|
238
|
+ $(dialog).dialog("hide");
|
|
|
239
|
+ $.ajax({
|
|
|
240
|
+ url : "/maliciousIp/deleteIpRule",
|
|
|
241
|
+ type : 'post',
|
|
|
242
|
+ async : false,
|
|
|
243
|
+ data : {
|
|
|
244
|
+ id : rowData.id
|
|
|
245
|
+ },
|
|
|
246
|
+ dataType : "json",
|
|
|
247
|
+ success : function(data) {
|
|
|
248
|
+ if (!data || data.code != 200) {
|
|
|
249
|
+ localAlert('删除失败',data.message);
|
|
|
250
|
+ }
|
|
|
251
|
+ $("#malIpRulesInfoTable").table("load");
|
|
|
252
|
+ },
|
|
|
253
|
+ error: function (data) {
|
|
|
254
|
+ localAlert('系统异常',data.message);
|
|
|
255
|
+ }
|
|
|
256
|
+ });
|
|
|
257
|
+ }
|
|
|
258
|
+ }]
|
|
|
259
|
+ });
|
|
|
260
|
+ });
|
|
|
261
|
+ return div;
|
|
|
262
|
+ },
|
|
|
263
|
+ width : "8%"
|
|
|
264
|
+ }]
|
|
|
265
|
+ });
|
|
|
266
|
+ $("#addRuleBtn").click(function() {
|
|
|
267
|
+ editRuleInfo(0);
|
|
|
268
|
+ });
|
|
|
269
|
+ });
|
|
|
270
|
+
|
|
|
271
|
+
|
|
|
272
|
+ //打开新增或修改页面
|
|
|
273
|
+ function editRuleInfo(id) {
|
|
|
274
|
+
|
|
|
275
|
+ $("#editRuleForm #messageAlert").hide();
|
|
|
276
|
+ if (id == 0) {//新增页面
|
|
|
277
|
+ $("#myModalLabel").text("新增恶意ip规则");
|
|
|
278
|
+ }
|
|
|
279
|
+ $("#myModal").modal('show');
|
|
|
280
|
+ }
|
|
|
281
|
+
|
|
|
282
|
+ //新增规则项
|
|
|
283
|
+ function addRuleItem(){
|
|
|
284
|
+ var contactTd = $("#table_rule_items").find("select[name='item_concat']").last();
|
|
|
285
|
+ contactTd.show();//展示拼接符
|
|
|
286
|
+ var tr = "<tr>" +
|
|
|
287
|
+ "<td><select name='item_rule' class='form-control' style='height:80%'></select></td>" +
|
|
|
288
|
+ "<td><select name='item_op' class='form-control'style='height:80%'></select></td>" +
|
|
|
289
|
+ "<td><input type='text' name='item_val' class='form-control'></input></td>" +
|
|
|
290
|
+ "<td><select name='item_concat' class='form-control'style='display:none;height:80%'></select></td>" +
|
|
|
291
|
+ "<td><a href='javascript:void(0)' class='btn mini black metric_delete' onclick='removeItem(this)'>删除</a></td>" +
|
|
|
292
|
+ "</tr>";
|
|
|
293
|
+ $("#table_rule_items tbody").append(tr);
|
|
|
294
|
+ initSelects(1);//给select赋值
|
|
|
295
|
+
|
|
|
296
|
+ }
|
|
|
297
|
+
|
|
|
298
|
+ //删除规则项
|
|
|
299
|
+ function removeItem(which){
|
|
|
300
|
+ var that = which;
|
|
|
301
|
+ $(that).closest("tr").remove();//移除
|
|
|
302
|
+ $("#table_rule_items").find("select[name='item_concat']").last().hide();//最后一个连接符设置为空并且隐藏
|
|
|
303
|
+ generateRules();//重新生成规则
|
|
|
304
|
+ }
|
|
|
305
|
+
|
|
|
306
|
+ //按照行 对下拉列表 进行 数据绑定
|
|
|
307
|
+ function initSelects(initOradd){
|
|
|
308
|
+ var select_item = "";
|
|
|
309
|
+ var select_op = "";
|
|
|
310
|
+ var select_concat = "";
|
|
|
311
|
+
|
|
|
312
|
+ if(initOradd == 0){//首次加载本页面--初始化 第一行
|
|
|
313
|
+ select_item = $("#table_rule_items tbody").find("select[name=\'item_rule\']").first();
|
|
|
314
|
+ select_op = $("#table_rule_items tbody").find("select[name=\'item_op\']").first();
|
|
|
315
|
+ select_concat = $("#table_rule_items tbody").find("select[name=\'item_concat\']").first();
|
|
|
316
|
+ }else{//新增规则项---最后一行
|
|
|
317
|
+ select_item = $("#table_rule_items tbody").find("select[name=\'item_rule\']").last();
|
|
|
318
|
+ select_op = $("#table_rule_items tbody").find("select[name=\'item_op\']").last();
|
|
|
319
|
+ select_concat = $("#table_rule_items tbody").find("select[name=\'item_concat\']").last();
|
|
|
320
|
+ }
|
|
|
321
|
+ //先清空
|
|
|
322
|
+ $(select_item).empty();
|
|
|
323
|
+// $(select_item).append("<option ></option>");
|
|
|
324
|
+ $(select_op).empty();
|
|
|
325
|
+// $(select_op).append("<option ></option>");
|
|
|
326
|
+ $(select_concat).empty();
|
|
|
327
|
+ /* $(select_concat).append("<option ></option>");*/
|
|
|
328
|
+ //再赋值
|
|
|
329
|
+ for(var i =0; i< items.length;i++){
|
|
|
330
|
+ $(select_item).append("<option value ='"+ items[i].value +"'>" + items[i].text + "</option>");
|
|
|
331
|
+ }
|
|
|
332
|
+ for(var i =0; i< operations.length;i++){
|
|
|
333
|
+ $(select_op).append("<option value ='"+ operations[i] +"'>" + operations[i] + "</option>");
|
|
|
334
|
+ }
|
|
|
335
|
+ for(var i =0; i<concats.length;i++){
|
|
|
336
|
+ $(select_concat).append("<option value ='"+ concats[i] +"'>" + concats[i] + "</option>");
|
|
|
337
|
+ }
|
|
|
338
|
+ }
|
|
|
339
|
+
|
|
|
340
|
+ //初始化 绑定事件---动态展示 生成的规则
|
|
|
341
|
+ function initEvents(){
|
|
|
342
|
+
|
|
|
343
|
+ $("#table_rule_items").on("change","select,input", function() {//下拉列表内容改变 绑定事件
|
|
|
344
|
+ generateRules();//生成规则文本
|
|
|
345
|
+ });
|
|
|
346
|
+ /* $("#table_rule_items").on("blur","input", function() {//文本框 获取焦点 绑定事件
|
|
|
347
|
+ generateRules();//生成规则文本
|
|
|
348
|
+ });*/
|
|
|
349
|
+ }
|
|
|
350
|
+ //生成规则文本
|
|
|
351
|
+ function generateRules(){
|
|
|
352
|
+ var ruleText = "";
|
|
|
353
|
+ var len = $("#table_rule_items").find("tr").length;
|
|
|
354
|
+ console.log("长度:"+len);
|
|
|
355
|
+ $("#table_rule_items").find("tr").each(function(i){//遍历table
|
|
|
356
|
+ if( i == 0 ) return true;//相当于continue
|
|
|
357
|
+
|
|
|
358
|
+ var text_rule = $(this).find("select[name='item_rule']").val() ;
|
|
|
359
|
+ var text_op = $(this).find("select[name='item_op']").val() ;
|
|
|
360
|
+ var text_val = $(this).find("input[name='item_val']").val();
|
|
|
361
|
+ ruleText = ruleText + text_rule + text_op +text_val ;
|
|
|
362
|
+ if( i!= len -1){//不是最后一行
|
|
|
363
|
+ var text_con= $(this).find("select[name='item_concat']").val();
|
|
|
364
|
+ ruleText = ruleText + text_con;
|
|
|
365
|
+ }
|
|
|
366
|
+
|
|
|
367
|
+
|
|
|
368
|
+
|
|
|
369
|
+
|
|
|
370
|
+ });
|
|
|
371
|
+ $("#rule").val(ruleText);
|
|
|
372
|
+
|
|
|
373
|
+ }
|
|
|
374
|
+ //提交保存
|
|
|
375
|
+ function saveTask(){
|
|
|
376
|
+ var ruleName = $("#ruleName").val();
|
|
|
377
|
+ var ruleContent = $("#rule").val();
|
|
|
378
|
+ //表单数据验证
|
|
|
379
|
+ if(ruleName == null || ruleName ==""){
|
|
|
380
|
+ $("#editRuleForm #messageAlert").alerts({
|
|
|
381
|
+ content: "请输入规则名称",
|
|
|
382
|
+ type: "danger"
|
|
|
383
|
+ });
|
|
|
384
|
+ return;
|
|
|
385
|
+ }
|
|
|
386
|
+
|
|
|
387
|
+ if(ruleContent == null || ruleContent ==""){
|
|
|
388
|
+ $("#editRuleForm #messageAlert").alerts({
|
|
|
389
|
+ content: "规则不能为空",
|
|
|
390
|
+ type: "danger"
|
|
|
391
|
+ });
|
|
|
392
|
+ return;
|
|
|
393
|
+ }
|
|
|
394
|
+
|
|
|
395
|
+ var param = {
|
|
|
396
|
+ name : ruleName,
|
|
|
397
|
+ rule : ruleContent
|
|
|
398
|
+ };
|
|
|
399
|
+ $.ajax({
|
|
|
400
|
+ url: '/maliciousIp/saveIpRules',
|
|
|
401
|
+// type: 'POST',
|
|
|
402
|
+ dataType: 'json',
|
|
|
403
|
+ contentType: "application/json",
|
|
|
404
|
+ data: JSON.stringify(param),
|
|
|
405
|
+ success: function (data) {
|
|
|
406
|
+ if (!data || data.code != 200) {
|
|
|
407
|
+ $("#taskForm #messageAlert").alerts({
|
|
|
408
|
+ content: data.message,
|
|
|
409
|
+ type: "danger"
|
|
|
410
|
+ });
|
|
|
411
|
+ return;
|
|
|
412
|
+ } else {
|
|
|
413
|
+// $("#myModal").modal('hide');
|
|
|
414
|
+ window.location.href = "/maliciousIp/toMaliciousIpRules";
|
|
|
415
|
+// $("#malIpRulesInfoTable").table("load");
|
|
|
416
|
+ }
|
|
|
417
|
+ },
|
|
|
418
|
+ error: function (data) {
|
|
|
419
|
+ localAlert('系统异常', data.message);
|
|
|
420
|
+ }
|
|
|
421
|
+ });
|
|
|
422
|
+ }
|
|
|
423
|
+</script> |
|
|
424
|
+ |