risk_management.hbs
2.39 KB
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
<div class="pageheader">
<div class="media">
<div class="pageicon pull-left">
<i class="fa fa-th-list"></i>
</div>
<div class="media-body">
<ul class="breadcrumb">
<li><a href="/"><i class="glyphicon glyphicon-home"></i></a></li>
<li>风险控制</li>
</ul>
<h4>风险控制</h4>
</div>
</div>
<!-- media -->
</div>
<!-- pageheader -->
<div class="contentpanel servers-page">
<button type="button" class="btn btn-success add">新增配置</button>
<table class="table table-hover table-striped table-bordered" style="margin-top: 2rem">
<thead>
<tr>
<th>应用名称</th>
<th>路由路径</th>
<th>间隔时间</th>
<th>请求次数</th>
<th>状态</th>
<th>操作</th>
</tr>
</thead>
<tbody>
{{#list}}
<tr>
<td class="app">{{app}}</td>
<td class="route">{{route}}</td>
<td>{{interval}}</td>
<td>{{requests}}</td>
<td>{{state}}</td>
<td><button type="button" class="btn btn-success edit">编辑</button><button type="button" class="btn btn-danger ml10 del">删除</button></td>
</tr>
{{/list}}
{{#if noData}}
<tr>
<td colspan="4" class="text-center">无数据</td>
</tr>
{{/if}}
</tbody>
</table>
</div>
<script>
$('.add').on('click', function() {
location.href = '/risk_management/add_risk';
});
$('.del').on('click', function() {
var key = $(this).parents('tr').find('.app').html() + '/' + $(this).parents('tr').find('.route').html();
$.post('/risk_management/remove', {
key: key
}, function(ret) {
if (ret.code === 200) {
alert('删除成功!');
location.reload();
} else {
alert('删除失败!');
}
});
});
$('.edit').on('click', function() {
var key = $(this).parents('tr').find('.app').html() + '/' + $(this).parents('tr').find('.route').html();
location.href = '/risk_management/add_risk?key=' + key;
});
</script>