Commit ccdeec60f3e5e2e8e3f76461e825cfcc3502345d
1 parent
ab692199
消息通知:所有功能完成-补充读消息功能
Showing
3 changed files
with
104 additions
and
48 deletions
src/main/java/com/huaheng/pc/system/notice/controller/SysNoticeController.java
... | ... | @@ -45,7 +45,8 @@ public class SysNoticeController extends BaseController { |
45 | 45 | PageDomain pageDomain = TableSupport.buildPageRequest(); |
46 | 46 | Integer pageNum = pageDomain.getPageNum(); |
47 | 47 | Integer pageSize = pageDomain.getPageSize(); |
48 | - lambdaQueryWrapper.eq(StringUtils.isNotEmpty(status), SysNotice::getStatus, status); | |
48 | + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(status), SysNotice::getStatus, status) | |
49 | + .orderByAsc(SysNotice::getStatus); | |
49 | 50 | if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) { |
50 | 51 | Page<SysNotice> page = new Page(pageNum, pageSize); |
51 | 52 | IPage<SysNotice> iPage = sysNoticeService.page(page, lambdaQueryWrapper); |
... | ... |
src/main/resources/templates/index.html
... | ... | @@ -296,11 +296,7 @@ |
296 | 296 | url:"system/notice/readAll", |
297 | 297 | type:"get", |
298 | 298 | success:function (response) { |
299 | - if (response.code == 200){ | |
300 | 299 | location.reload() |
301 | - }else { | |
302 | - $.modal.alertError(response.msg) | |
303 | - } | |
304 | 300 | }, |
305 | 301 | error:function (response) { |
306 | 302 | $.modal.alertError("服务出错") |
... | ... |
src/main/resources/templates/system/notice/mailbox.html
... | ... | @@ -10,12 +10,12 @@ |
10 | 10 | <hr style="border-top:1px solid #C2C2C2;"> |
11 | 11 | <div class="col-sm-8"> |
12 | 12 | <h3><strong>[[${user.loginName}]]</strong></h3> |
13 | -<!-- <p><i class="fa fa-user"></i> [[${user.userName}]] / [[${#strings.defaultString(roleGroup,'无角色')}]]--> | |
14 | -<!-- <p><i class="fa fa-phone"></i> [[${user.phoneNumber}]]</p>--> | |
15 | -<!-- <p><i class="fa fa-group"></i> [[${user.dept.deptName}]] / [[${#strings.defaultString(postGroup,'无岗位')}]]</p>--> | |
16 | -<!-- <p><i class="fa fa-transgender"></i> 性别:[[${user.sex}]]</p>--> | |
17 | -<!-- <p><i class="fa fa-envelope-o"></i> [[${user.email}]]</p>--> | |
18 | -<!-- <p><i class="fa fa-calendar"></i> [[${#dates.format(user.createTime, 'yyyy-MM-dd HH:mm:ss')}]]</p>--> | |
13 | + <!-- <p><i class="fa fa-user"></i> [[${user.userName}]] / [[${#strings.defaultString(roleGroup,'无角色')}]]--> | |
14 | + <!-- <p><i class="fa fa-phone"></i> [[${user.phoneNumber}]]</p>--> | |
15 | + <!-- <p><i class="fa fa-group"></i> [[${user.dept.deptName}]] / [[${#strings.defaultString(postGroup,'无岗位')}]]</p>--> | |
16 | + <!-- <p><i class="fa fa-transgender"></i> 性别:[[${user.sex}]]</p>--> | |
17 | + <!-- <p><i class="fa fa-envelope-o"></i> [[${user.email}]]</p>--> | |
18 | + <!-- <p><i class="fa fa-calendar"></i> [[${#dates.format(user.createTime, 'yyyy-MM-dd HH:mm:ss')}]]</p>--> | |
19 | 19 | </div> |
20 | 20 | </div> |
21 | 21 | </div> |
... | ... | @@ -23,15 +23,25 @@ |
23 | 23 | <div class="col-sm-9" style="height: 100%"> |
24 | 24 | <div class="select-info"> |
25 | 25 | <ul id="myTab" class="nav nav-tabs"> |
26 | - <li class="active"><a href="#tabAll" data-toggle="tab">全部</a></li> | |
27 | - <li ><a href="#tabNotRead" data-toggle="tab">未读</a></li> | |
28 | - <li ><a href="#tabHavenRead" data-toggle="tab">已读</a></li> | |
26 | + <li id="tabAllTap" class="active"><a href="#tabAll" data-toggle="tab">全部</a></li> | |
27 | + <li id="tabNotReadTap"><a href="#tabNotRead" data-toggle="tab">未读</a></li> | |
28 | + <li id="tabHavenReadTap"><a href="#tabHavenRead" data-toggle="tab">已读</a></li> | |
29 | 29 | </ul> |
30 | 30 | <div id="myTabContent" class="tab-content"> |
31 | 31 | <div class="tab-pane fade in active" id="tabAll"> |
32 | + <div class="btn-group hidden-xs" id="toolbar" role="group"> | |
33 | + <a class="btn btn-outline btn-success btn-rounded" onclick="readAll()"> | |
34 | + 全部已读 | |
35 | + </a> | |
36 | + </div> | |
32 | 37 | <table class="table-bordered" id="bootstrap-table" data-mobile-responsive="true"></table> |
33 | 38 | </div> |
34 | 39 | <div class="tab-pane fade" id="tabNotRead"> |
40 | + <div class="btn-group hidden-xs" id="toolbar1" role="group"> | |
41 | + <a class="btn btn-outline btn-success btn-rounded" onclick="readAll()"> | |
42 | + 全部已读 | |
43 | + </a> | |
44 | + </div> | |
35 | 45 | <table class="table-bordered" id="bootstrap-table1" data-mobile-responsive="true"></table> |
36 | 46 | </div> |
37 | 47 | <div class="tab-pane fade" id="tabHavenRead"> |
... | ... | @@ -46,94 +56,108 @@ |
46 | 56 | |
47 | 57 | var prefix = ctx + "system/notice" |
48 | 58 | |
49 | - $(function() { | |
59 | + $(function () { | |
50 | 60 | var options = { |
51 | 61 | url: prefix + "/list", |
52 | - method:"get", | |
62 | + method: "get", | |
53 | 63 | modalName: "消息表-全部", |
54 | - sidePagination:"server", | |
64 | + sidePagination: "server", | |
55 | 65 | search: false, |
56 | 66 | pageSize: 10, |
67 | + onClickRow: function (row) { | |
68 | + if (row.status == 0) { | |
69 | + readOne(row.id) | |
70 | + } | |
71 | + }, | |
57 | 72 | columns: [ |
58 | 73 | { |
59 | - field : 'content', | |
60 | - title : '消息', | |
61 | - width:80 | |
62 | - | |
74 | + field: 'content', | |
75 | + title: '消息', | |
76 | + width: 80, | |
77 | + formatter: function (value, row) { | |
78 | + if (row.status == 0) { | |
79 | + return value + "<span style='color:red'>*</span>" | |
80 | + } else { | |
81 | + return value | |
82 | + } | |
83 | + } | |
63 | 84 | }, |
64 | 85 | { |
65 | - field : 'created', | |
66 | - title : '时间', | |
67 | - width:20 | |
86 | + field: 'created', | |
87 | + title: '时间', | |
88 | + width: 20 | |
68 | 89 | } |
69 | - ] | |
90 | + ] | |
70 | 91 | }; |
71 | 92 | $.table.init(options); |
72 | 93 | }); |
73 | 94 | |
74 | 95 | $("#bootstrap-table1").bootstrapTable({ |
75 | 96 | url: prefix + "/list", |
76 | - method:"get", | |
97 | + method: "get", | |
98 | + toolbar: "#toolbar1", | |
77 | 99 | iconSize: "outline", |
78 | - queryParams:{status:0}, | |
100 | + queryParams: {status: 0}, | |
79 | 101 | showRefresh: true, //刷新 |
80 | 102 | showToggle: true, //视图切换 |
81 | 103 | showColumns: true, //列选择 |
82 | 104 | modalName: "消息表-未读", |
83 | - sidePagination:"server", | |
84 | - responseHandler:responseHandler, | |
105 | + sidePagination: "server", | |
106 | + onClickRow: function (row) { | |
107 | + readOne(row.id) | |
108 | + }, | |
109 | + responseHandler: responseHandler, | |
85 | 110 | search: false, |
86 | 111 | pageList: [10, 25, 50, 100], |
87 | 112 | pageNumber: 1, |
88 | 113 | pageSize: 10, |
89 | 114 | columns: [ |
90 | 115 | { |
91 | - field : 'content', | |
92 | - title : '消息', | |
93 | - width:80 | |
116 | + field: 'content', | |
117 | + title: '消息', | |
118 | + width: 80 | |
94 | 119 | |
95 | 120 | }, |
96 | 121 | { |
97 | - field : 'created', | |
98 | - title : '时间', | |
99 | - width:20 | |
122 | + field: 'created', | |
123 | + title: '时间', | |
124 | + width: 20 | |
100 | 125 | } |
101 | 126 | ] |
102 | 127 | }) |
103 | 128 | $("#bootstrap-table2").bootstrapTable({ |
104 | 129 | url: prefix + "/list", |
105 | - method:"get", | |
130 | + method: "get", | |
106 | 131 | iconSize: "outline", |
107 | 132 | showRefresh: true, //刷新 |
108 | 133 | showToggle: true, //视图切换 |
109 | 134 | showColumns: true, //列选择 |
110 | 135 | queryParams: function (params) { |
111 | - console.log(params) | |
112 | 136 | return { |
113 | - pageSize: params.limit, | |
114 | - pageNum: params.offset / params.limit + 1, | |
115 | - status:1 | |
137 | + pageSize: params.limit, | |
138 | + pageNum: params.offset / params.limit + 1, | |
139 | + status: 1 | |
116 | 140 | }; |
117 | 141 | }, |
118 | 142 | modalName: "消息表-已读", |
119 | 143 | pagination: true, |
120 | - sidePagination:"server", | |
121 | - responseHandler:responseHandler, | |
144 | + sidePagination: "server", | |
145 | + responseHandler: responseHandler, | |
122 | 146 | search: false, |
123 | 147 | pageList: [10, 25, 50, 100], |
124 | 148 | pageNumber: 1, |
125 | 149 | pageSize: 10, |
126 | 150 | columns: [ |
127 | 151 | { |
128 | - field : 'content', | |
129 | - title : '消息', | |
130 | - width:80 | |
152 | + field: 'content', | |
153 | + title: '消息', | |
154 | + width: 80 | |
131 | 155 | |
132 | 156 | }, |
133 | 157 | { |
134 | - field : 'created', | |
135 | - title : '时间', | |
136 | - width:20 | |
158 | + field: 'created', | |
159 | + title: '时间', | |
160 | + width: 20 | |
137 | 161 | } |
138 | 162 | ] |
139 | 163 | }) |
... | ... | @@ -147,6 +171,41 @@ |
147 | 171 | } |
148 | 172 | } |
149 | 173 | |
174 | + function readOne(id) { | |
175 | + $.ajax({ | |
176 | + url: prefix + "/readOne", | |
177 | + type: "get", | |
178 | + data: {id: id}, | |
179 | + success: function (response) { | |
180 | + if (response.code == 200) { | |
181 | + $("#bootstrap-table").bootstrapTable("refresh") | |
182 | + $("#bootstrap-table1").bootstrapTable("refresh") | |
183 | + } else { | |
184 | + $.modal.alertError(response.msg) | |
185 | + } | |
186 | + }, | |
187 | + error: function (response) { | |
188 | + $.modal.alertError("服务出错") | |
189 | + } | |
190 | + }) | |
191 | + } | |
192 | + | |
193 | + function readAll() { | |
194 | + $.modal.confirm("是否已读所有消息?", function () { | |
195 | + $.ajax({ | |
196 | + url: prefix + "/readAll", | |
197 | + type: "get", | |
198 | + success: function (response) { | |
199 | + if ($("#tabNotReadTap".hasClass("active"))) { | |
200 | + $("#bootstrap-table1").bootstrapTable("") | |
201 | + } | |
202 | + }, | |
203 | + error: function (response) { | |
204 | + $.modal.alertError("服务出错") | |
205 | + } | |
206 | + }) | |
207 | + }) | |
208 | + } | |
150 | 209 | |
151 | 210 | </script> |
152 | 211 | </html> |
... | ... |