mailbox.html
7.29 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
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
<!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">
<!--<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>-->
<!--<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>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<div class="col-sm-12" style="height: 100%">
<div class="select-info">
<!--<ul id="myTab" class="nav nav-tabs">-->
<!--<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>-->
<!--</ul>-->
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade in active" id="tabAll">
<div class="btn-group hidden-xs" id="toolbar" role="group">
<a class="btn btn-outline btn-success btn-rounded" onclick="readAll()">
全部已读
</a>
</div>
<table class="table-bordered" id="bootstrap-table" data-mobile-responsive="true"></table>
</div>
<div class="tab-pane fade" id="tabNotRead">
<div class="btn-group hidden-xs" id="toolbar1" role="group">
<a class="btn btn-outline btn-success btn-rounded" onclick="readAll()">
全部已读
</a>
</div>
<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>
</div>
</div>
</div>
</div>
<div th:include="include :: footer"></div>
</body>
<script th:inline="javascript">
var prefix = ctx + "system/notice"
$(function () {
var options = {
url: prefix + "/list",
method: "get",
modalName: "消息表-全部",
sidePagination: "server",
search: false,
pageSize: 10,
onClickRow: function (row) {
if (row.status == 0) {
readOne(row.id)
}
},
columns: [
{
field: 'title',
title: '标题',
width: 100
},
{
field: 'content',
title: '消息',
width: 500,
formatter: function (value, row) {
if (row.status == 0) {
return value + "<span style='color:red'>*</span>"
} else {
return value
}
}
},
{
field: 'created',
title: '时间',
width: 20
}
]
};
$.table.init(options);
});
$("#bootstrap-table1").bootstrapTable({
url: prefix + "/list",
method: "get",
toolbar: "#toolbar1",
iconSize: "outline",
queryParams: {status: 0},
showRefresh: true, //刷新
showToggle: true, //视图切换
showColumns: true, //列选择
modalName: "消息表-未读",
sidePagination: "server",
onClickRow: function (row) {
readOne(row.id)
},
responseHandler: responseHandler,
search: false,
pageList: [10, 25, 50, 100],
pageNumber: 1,
pageSize: 10,
columns: [
{
field: 'content',
title: '消息',
width: 80
},
{
field: 'created',
title: '时间',
width: 20
}
]
})
$("#bootstrap-table2").bootstrapTable({
url: prefix + "/list",
method: "get",
iconSize: "outline",
showRefresh: true, //刷新
showToggle: true, //视图切换
showColumns: true, //列选择
queryParams: function (params) {
return {
pageSize: params.limit,
pageNum: params.offset / params.limit + 1,
status: 1
};
},
modalName: "消息表-已读",
pagination: true,
sidePagination: "server",
responseHandler: responseHandler,
search: false,
pageList: [10, 25, 50, 100],
pageNumber: 1,
pageSize: 10,
columns: [
{
field: 'content',
title: '消息',
width: 80
},
{
field: 'created',
title: '时间',
width: 20
}
]
})
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};
}
}
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("服务出错")
}
})
})
}
</script>
</html>