diff --git a/supervise-message-ui/src/api/message/message.js b/supervise-message-ui/src/api/message/message.js index 09451fdc..64e04791 100644 --- a/supervise-message-ui/src/api/message/message.js +++ b/supervise-message-ui/src/api/message/message.js @@ -1,10 +1,9 @@ import request from '@/utils/request' -// 模板信息 + export default { // 查询分页列表 listPage: function(params) { return request({ - // baseURL: '/api', url: '/report/messagepushlog/listPageByPc', method: 'post', data: params, @@ -12,5 +11,24 @@ export default { 'Content-Type': 'application/json' } }) + }, + // 部分设置为已读消息 + changeRead: function(params) { + return request({ + url: '/report/messagepushlog/changeRead', + method: 'post', + data: params, + headers: { + 'Content-Type': 'application/json' + } + }) + }, + // 全部设置为已读消息 + allChangeRead: function(params) { + return request({ + url: '/report/messagepushlog/allChangeRead', + method: 'post', + params: params + }) } } diff --git a/supervise-message-ui/src/views/message/unreadmessage.vue b/supervise-message-ui/src/views/message/unreadmessage.vue index 713f877e..ce6c609b 100644 --- a/supervise-message-ui/src/views/message/unreadmessage.vue +++ b/supervise-message-ui/src/views/message/unreadmessage.vue @@ -102,13 +102,6 @@ export default { btnKey: 'toAllMark', btnLabel: '全部标记为已读' }, - { - type: 'danger', - size: 'small', - icon: 'del', - btnKey: 'doDel', - btnLabel: '删除' - }, { type: 'info', size: 'small', @@ -123,6 +116,7 @@ export default { tableKey: 0, list: [], sids: [], + multipleSelection: [], listLoading: false, listQuery: { params: { @@ -169,9 +163,6 @@ export default { case 'doClose': this.doClose() break - case 'doDel': - this.doDel() - break default: break } @@ -185,6 +176,7 @@ export default { // 信息条数 获取点击时当前的sid handleSelectionChange(row) { const aa = [] + this.multipleSelection = row row.forEach(element => { aa.push(element.sid) }) @@ -193,7 +185,7 @@ export default { // 查询列表信息 getList() { this.listLoading = true - this.listQuery.params.userSid = '5d4b06cd-9d5e-11ed-87ce-525401028fe6' + this.listQuery.params.userSid = window.sessionStorage.getItem('userSid') req.listPage(this.listQuery).then((response) => { this.listLoading = false if (response.success) { @@ -238,92 +230,66 @@ export default { }, // 部分标记为已读 toPartialMark() { - this.$message({ showClose: true, type: 'info', message: '功能正在开发中' }) - // if (this.sids.length === 0) { - // this.$message({ showClose: true, type: 'error', message: '请选择至少一条记录进行操作' }) - // return - // } - // const tip = '请确认是否标记所选 ' + this.sids.length + ' 条记录?' - // this.$confirm(tip, '提示', { - // confirmButtonText: '确定', - // cancelButtonText: '取消', - // type: 'warning' - // }).then(() => { - // const loading = this.$loading({ - // lock: true, - // text: 'Loading', - // spinner: 'el-icon-loading', - // background: 'rgba(0, 0, 0, 0.7)' - // }) - // req.ChangeRead(this.sids).then(resp => { - // if (resp.success) { - // this.$message({ type: 'success', message: resp.msg, showClose: true }) - // } - // this.getList() - // loading.close() - // }).catch(e => { - // loading.close() - // }) - // }).catch(() => { - // }) + if (this.sids.length === 0) { + this.$message({ showClose: true, type: 'error', message: '请选择至少一条记录进行操作' }) + return + } + const tip = '请确认是否标记所选 ' + this.sids.length + ' 条记录?' + this.$confirm(tip, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + const loading = this.$loading({ + lock: true, + text: 'Loading', + spinner: 'el-icon-loading', + background: 'rgba(0, 0, 0, 0.7)' + }) + const params = [] + this.multipleSelection.forEach((e) => { + params.push({ + type: e.type, + sid: e.sid + }) + }) + req.changeRead(params).then(resp => { + if (resp.success) { + this.$message({ type: 'success', message: '操作成功', showClose: true }) + } + this.getList() + loading.close() + }).catch(e => { + loading.close() + }) + }).catch(() => { + }) }, // 全部标记为已读 toAllMark() { - this.$message({ showClose: true, type: 'info', message: '功能正在开发中' }) - // const tip = '请确认是否标记全部记录?' - // this.$confirm(tip, '提示', { - // confirmButtonText: '确定', - // cancelButtonText: '取消', - // type: 'warning' - // }).then(() => { - // const loading = this.$loading({ - // lock: true, - // text: 'Loading', - // spinner: 'el-icon-loading', - // background: 'rgba(0, 0, 0, 0.7)' - // }) - // req.changeAll(this.sids).then(resp => { - // if (resp.success) { - // this.$message({ type: 'success', message: resp.msg, showClose: true }) - // } - // this.getList() - // loading.close() - // }).catch(e => { - // loading.close() - // }) - // }).catch(() => { - // }) - }, - // 删除 - doDel() { - this.$message({ showClose: true, type: 'info', message: '功能正在开发中' }) - // if (this.sids.length === 0) { - // this.$message({ showClose: true, type: 'error', message: '请选择至少一条记录进行删除操作' }) - // return - // } - // const tip = '请确认是否删除所选 ' + this.sids.length + ' 条记录?' - // this.$confirm(tip, '提示', { - // confirmButtonText: '确定', - // cancelButtonText: '取消', - // type: 'warning' - // }).then(() => { - // const loading = this.$loading({ - // lock: true, - // text: 'Loading', - // spinner: 'el-icon-loading', - // background: 'rgba(0, 0, 0, 0.7)' - // }) - // req.delete(this.sids).then(resp => { - // if (resp.success) { - // this.$message({ type: 'success', message: resp.msg, showClose: true }) - // } - // this.getList() - // loading.close() - // }).catch(e => { - // loading.close() - // }) - // }).catch(() => { - // }) + const tip = '请确认是否标记全部记录?' + this.$confirm(tip, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + const loading = this.$loading({ + lock: true, + text: 'Loading', + spinner: 'el-icon-loading', + background: 'rgba(0, 0, 0, 0.7)' + }) + req.allChangeRead({ userSid: window.sessionStorage.getItem('userSid') }).then(resp => { + if (resp.success) { + this.$message({ type: 'success', message: '操作成功', showClose: true }) + } + this.getList() + loading.close() + }).catch(e => { + loading.close() + }) + }).catch(() => { + }) }, resetState() { this.viewState = 1