Blame view

src/main/resources/templates/monitor/online/online.html 5.19 KB
tangying authored
1
2
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org"
3
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
tangying authored
4
5
6
7
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
8
9
10
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 select-info">
11
            <form id="online-form" autocomplete="off">
12
13
14
                <div class="select-list">
                    <ul>
                        <li>
15
                            <label>登录地址:</label>
pengyongcheng authored
16
                            <input name="ipaddr" placeholder="请输入登录地址" type="text"/>
17
18
                        </li>
                        <li>
19
                            <label>操作人员:</label>
pengyongcheng authored
20
                            <input name="loginName" placeholder="请输入操作人员名称" type="text"/>
21
                        </li>
22
                        <li style="float: right; margin-right: 45px">
23
24
25
26
27
28
29
30
31
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('online-form')"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
tangying authored
32
33
34
35
36
37
38
        <div class="btn-group hidden-xs" id="toolbar" role="group">
            <a class="btn btn-outline btn-danger btn-rounded" onclick="javascript:batchForceLogout()"
               shiro:hasPermission="monitor:online:batchForceLogout">
                <i class="fa fa-trash-o"></i>批量强退
            </a>
        </div>
tangying authored
39
40
41
42
43
44
45
46
47
48
        <div class="col-sm-12 select-table">
            <table id="bootstrap-table" data-mobile-responsive="true" class="table table-bordered table-hover"></table>
        </div>
    </div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var forceFlag = [[${@permission.hasPermi('monitor:online:forceLogout')}]];
    var prefix = ctx + "monitor/online"
tangying authored
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
    $(function () {
        var options = {
            url: prefix + "/list",
            exportUrl: prefix + "/export",
            sortName: "lastAccessTime",
            sortOrder: "desc",
            search: false,
            columns: [{
                checkbox: true
            },
                {
                    field: 'sessionId',
                    title: '会话编号'
                },
                {
                    field: 'loginName',
pengyongcheng authored
66
                    title: '操作人员'
67
68
69
70
71
72
73
74
75
                },
                {
                    field: 'deptName',
                    title: '部门名称'
                },
                {
                    field: 'ipaddr',
                    title: '登录地址'
                },
pengyongcheng authored
76
                /*{
77
78
                    field: 'longinLocation',
                    title: '登录地点'
pengyongcheng authored
79
                },*/
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
                {
                    field: 'browser',
                    title: '浏览器'
                },
                {
                    field: 'os',
                    title: '操作系统'
                },
                {
                    field: 'status',
                    title: '会话状态',
                    align: 'center',
                    formatter: function (value, row, index) {
                        if (value == 'on_line') {
                            return '<span class="badge badge-primary">在线</span>';
                        } else if (value == 'off_line') {
                            return '<span class="badge badge-danger">离线</span>';
                        }
                    }
                },
                {
                    field: 'startTimestamp',
pengyongcheng authored
102
                    title: '登录时间'
103
104
105
                },
                {
                    field: 'lastAccessTime',
pengyongcheng authored
106
                    title: '最后访问时间'
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
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var msg = '<a class="btn btn-danger btn-xs ' + forceFlag + '" href="#" onclick="forceLogout(\'' + row.sessionId + '\')" ><i class="fa fa-sign-out"></i>强退</a> ';
                        return msg;
                    }
                }]
        };
        $.table.init(options);
    });

    // 单条强退
    function forceLogout(sessionId) {
        $.modal.confirm("确定要强制选中用户下线吗?", function () {
            var data = {"sessionId": sessionId};
            $.operate.post(prefix + "/forceLogout", data);
        })
    }

    // 批量强退
    function batchForceLogout() {
        var rows = $.table.selectColumns("sessionId");
        if (rows.length == 0) {
            $.modal.alertWarning("请选择要强退的用户");
            return;
        }
        $.modal.confirm("确认要强退选中的" + rows.length + "条数据吗?", function () {
            var url = prefix + "/batchForceLogout";
            var data = {"ids": rows};
            $.operate.post(url, data);
        });
    }
</script>
tangying authored
142
143
</body>
</html>