Blame view

src/main/resources/templates/system/notice/mailbox.html 7.01 KB
1
2
3
4
5
6
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head th:include="include :: header">
    <meta charset="UTF-8">
</head>
<body class="gray-bg">
7
8
9
10
11
12
<div class="col-sm-3" style="height: 100%;">
    <div class="select-info" style="height: 100%;">
        <img class="img-circle" th:src="@{/favicon.ico}"/>
        <hr style="border-top:1px solid  #C2C2C2;">
        <div class="col-sm-8">
            <h3><strong>[[${user.loginName}]]</strong></h3>
lector authored
13
14
15
16
17
18
                        <p><i class="fa fa-user"></i> [[${user.userName}]] / [[${#strings.defaultString(roleGroup,'无角色')}]]
                        <p><i class="fa fa-phone"></i> [[${user.phoneNumber}]]</p>
                        <p><i class="fa fa-group"></i> [[${user.dept.deptName}]] / [[${#strings.defaultString(postGroup,'无岗位')}]]</p>
                        <p><i class="fa fa-transgender"></i> 性别:[[${user.sex}]]</p>
                        <p><i class="fa fa-envelope-o"></i> [[${user.email}]]</p>
                        <p><i class="fa fa-calendar"></i> [[${#dates.format(user.createTime, 'yyyy-MM-dd HH:mm:ss')}]]</p>
19
20
21
22
23
24
25
        </div>
    </div>
</div>

<div class="col-sm-9" style="height: 100%">
    <div class="select-info">
        <ul id="myTab" class="nav nav-tabs">
26
27
28
            <li id="tabAllTap" class="active"><a href="#tabAll" data-toggle="tab">全部</a></li>
            <li id="tabNotReadTap"><a href="#tabNotRead" data-toggle="tab">未读</a></li>
            <li id="tabHavenReadTap"><a href="#tabHavenRead" data-toggle="tab">已读</a></li>
29
30
31
        </ul>
        <div id="myTabContent" class="tab-content">
            <div class="tab-pane fade in active" id="tabAll">
32
33
34
35
36
                <div class="btn-group hidden-xs" id="toolbar" role="group">
                    <a class="btn btn-outline btn-success btn-rounded" onclick="readAll()">
                        全部已读
                    </a>
                </div>
37
38
39
                <table class="table-bordered" id="bootstrap-table" data-mobile-responsive="true"></table>
            </div>
            <div class="tab-pane fade" id="tabNotRead">
40
41
42
43
44
                <div class="btn-group hidden-xs" id="toolbar1" role="group">
                    <a class="btn btn-outline btn-success btn-rounded" onclick="readAll()">
                        全部已读
                    </a>
                </div>
45
46
47
48
                <table class="table-bordered" id="bootstrap-table1" data-mobile-responsive="true"></table>
            </div>
            <div class="tab-pane fade" id="tabHavenRead">
                <table class="table-bordered" id="bootstrap-table2" data-mobile-responsive="true"></table>
49
50
51
52
53
54
            </div>
        </div>
    </div>
</div>
<div th:include="include :: footer"></div>
</body>
55
56
57
58
<script th:inline="javascript">

    var prefix = ctx + "system/notice"
59
    $(function () {
60
61
        var options = {
            url: prefix + "/list",
62
            method: "get",
63
            modalName: "消息表-全部",
64
            sidePagination: "server",
65
66
            search: false,
            pageSize: 10,
67
68
69
70
71
            onClickRow: function (row) {
                if (row.status == 0) {
                    readOne(row.id)
                }
            },
72
73
            columns: [
                {
74
75
76
77
78
79
80
81
82
83
                    field: 'content',
                    title: '消息',
                    width: 80,
                    formatter: function (value, row) {
                        if (row.status == 0) {
                            return value + "<span style='color:red'>*</span>"
                        } else {
                            return value
                        }
                    }
84
85
                },
                {
86
87
88
                    field: 'created',
                    title: '时间',
                    width: 20
89
                }
90
            ]
91
92
93
94
95
96
        };
        $.table.init(options);
    });

    $("#bootstrap-table1").bootstrapTable({
        url: prefix + "/list",
97
98
        method: "get",
        toolbar: "#toolbar1",
99
        iconSize: "outline",
100
        queryParams: {status: 0},
101
102
103
104
        showRefresh: true, //刷新
        showToggle: true, //视图切换
        showColumns: true, //列选择
        modalName: "消息表-未读",
105
106
107
108
109
        sidePagination: "server",
        onClickRow: function (row) {
            readOne(row.id)
        },
        responseHandler: responseHandler,
110
111
112
113
114
115
        search: false,
        pageList: [10, 25, 50, 100],
        pageNumber: 1,
        pageSize: 10,
        columns: [
            {
116
117
118
                field: 'content',
                title: '消息',
                width: 80
119
120
121

            },
            {
122
123
124
                field: 'created',
                title: '时间',
                width: 20
125
126
127
128
129
            }
        ]
    })
    $("#bootstrap-table2").bootstrapTable({
        url: prefix + "/list",
130
        method: "get",
131
132
133
134
135
136
        iconSize: "outline",
        showRefresh: true, //刷新
        showToggle: true, //视图切换
        showColumns: true, //列选择
        queryParams: function (params) {
            return {
137
138
139
                pageSize: params.limit,
                pageNum: params.offset / params.limit + 1,
                status: 1
140
141
142
143
            };
        },
        modalName: "消息表-已读",
        pagination: true,
144
145
        sidePagination: "server",
        responseHandler: responseHandler,
146
147
148
149
150
151
        search: false,
        pageList: [10, 25, 50, 100],
        pageNumber: 1,
        pageSize: 10,
        columns: [
            {
152
153
154
                field: 'content',
                title: '消息',
                width: 80
155
156
157

            },
            {
158
159
160
                field: 'created',
                title: '时间',
                width: 20
161
162
163
164
165
166
167
168
169
170
171
172
173
            }
        ]
    })

    function responseHandler(res) {
        if (res.code == 200) {
            return {rows: res.data, total: res.total, code: 0};
        } else {
            $.modal.alertWarning(res.msg);
            return {rows: [], total: 0};
        }
    }
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
    function readOne(id) {
        $.ajax({
            url: prefix + "/readOne",
            type: "get",
            data: {id: id},
            success: function (response) {
                if (response.code == 200) {
                    $("#bootstrap-table").bootstrapTable("refresh")
                    $("#bootstrap-table1").bootstrapTable("refresh")
                } else {
                    $.modal.alertError(response.msg)
                }
            },
            error: function (response) {
                $.modal.alertError("服务出错")
            }
        })
    }

    function readAll() {
        $.modal.confirm("是否已读所有消息?", function () {
            $.ajax({
                url: prefix + "/readAll",
                type: "get",
                success: function (response) {
                    if ($("#tabNotReadTap".hasClass("active"))) {
                        $("#bootstrap-table1").bootstrapTable("")
                    }
                },
                error: function (response) {
                    $.modal.alertError("服务出错")
                }
            })
        })
    }
209
210

</script>
211
</html>