Merge pull request #714 from dataease/pr@dev@feat_unread_list_setAllReaded

feat:未读消息列表增加一键全部已读
This commit is contained in:
fit2cloud-chenyw 2021-08-27 13:27:53 +08:00 committed by GitHub
commit 30339f9253
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 33 additions and 3 deletions

View File

@ -6,7 +6,6 @@ import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.base.domain.SysMsgChannel;
import io.dataease.base.domain.SysMsgSetting;
import io.dataease.base.domain.SysMsgType;
import io.dataease.commons.exception.DEException;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.PageUtils;
import io.dataease.commons.utils.Pager;
@ -71,6 +70,12 @@ public class MsgController {
sysMsgService.setBatchReaded(msgIds);
}
@ApiOperation("全部设置已读")
@PostMapping("/allRead")
public void allRead() {
sysMsgService.setAllRead();
}
@ApiOperation("批量删除")
@PostMapping("/batchDelete")
public void batchDelete(@RequestBody List<Long> msgIds) {

View File

@ -312,4 +312,12 @@ public class SysMsgService {
return sourceLists;
}
public void setAllRead() {
SysMsg record = new SysMsg();
record.setStatus(true);
SysMsgExample example = new SysMsgExample();
example.createCriteria().andUserIdEqualTo(AuthUtils.getUser().getUserId()).andStatusEqualTo(false);
sysMsgMapper.updateByExampleSelective(record, example);
}
}

View File

@ -35,6 +35,14 @@ export function batchRead(data) {
})
}
export function allRead() {
return request({
url: '/api/sys_msg/allRead',
method: 'post',
loading: true
})
}
export function batchDelete(data) {
return request({
url: '/api/sys_msg/batchDelete',

View File

@ -1351,6 +1351,7 @@ export default {
read_time: 'Read Time',
type: 'Message Type',
mark_readed: 'Mark As Read',
all_mark_readed: 'Mark All As Read',
please_select: 'Please select at least one message',
mark_success: 'Mark read successfully',
receive_manage: 'Receive Manage',

View File

@ -1350,6 +1350,7 @@ export default {
read_time: '查看時間',
type: '消息類型',
mark_readed: '標記已讀',
all_mark_readed: '全部已讀',
please_select: '請至少選擇一條消息',
mark_success: '標記已讀成功',
receive_manage: '接收管理',

View File

@ -1353,6 +1353,7 @@ export default {
read_time: '查看时间',
type: '消息类型',
mark_readed: '标记已读',
all_mark_readed: '全部已读',
please_select: '请至少选择一条消息',
mark_success: '标记已读成功',
receive_manage: '接收管理',

View File

@ -18,7 +18,7 @@
>
<template #toolbar>
<el-button :disabled="multipleSelection.length === 0" @click="markReaded">{{ $t('webmsg.mark_readed') }}</el-button>
<!-- <fu-table-button v-permission="['user:add']" icon="el-icon-circle-plus-outline" :label="$t('user.create')" @click="create" /> -->
<el-button @click="allMarkReaded">{{ $t('webmsg.all_mark_readed') }}</el-button>
</template>
<el-table-column
type="selection"
@ -61,7 +61,7 @@
import LayoutContent from '@/components/business/LayoutContent'
import ComplexTable from '@/components/business/complex-table'
import { query, updateStatus, batchRead } from '@/api/system/msg'
import { query, updateStatus, batchRead, allRead } from '@/api/system/msg'
import { msgTypes, getTypeName, loadMsgTypes } from '@/utils/webMsg'
import bus from '@/utils/bus'
import { addOrder, formatOrders } from '@/utils/index'
@ -166,6 +166,12 @@ export default {
this.search()
})
},
allMarkReaded() {
allRead().then(res => {
this.$success(this.$t('webmsg.mark_success'))
this.search()
})
},
markReaded() {
if (this.multipleSelection.length === 0) {
this.$warning(this.$t('webmsg.please_select'))