Browse Source

完善消息中心

master
yunuo970428 2 years ago
parent
commit
443d617756
  1. 54
      message-center-ui/src/api/messagelist/messagelist.js
  2. 16
      message-center-ui/src/router/index.js
  3. 108
      message-center-ui/src/views/messagelist/messageInfo.vue
  4. 208
      message-center-ui/src/views/messagelist/readmessage.vue
  5. 340
      message-center-ui/src/views/messagelist/unreadmessage.vue

54
message-center-ui/src/api/messagelist/messagelist.js

@ -0,0 +1,54 @@
import request from '@/utils/request'
export default {
verifyList: function(data) { // 获取未读消息列表
return request({
url: '/message/v1/messagelist/noreadListPage',
method: 'post',
data: data,
headers: { 'Content-Type': 'application/json' }
})
},
readVerifyList: function(data) { // 获取已读消息列表
return request({
url: '/message/v1/messagelist/readListPage',
method: 'post',
data: data,
headers: { 'Content-Type': 'application/json' }
})
},
ChangeRead: function(data) { // 未读消息列表批量设为已读
return request({
url: '/message/v1/messagelist/changeRead?sids=' + data,
method: 'get',
data: data
})
},
noChangeRead: function(data) { // 已读消息列表批量设为未读
return request({
url: '/message/v1/messagelist/noChangeRead?sids=' + data,
method: 'get',
data: data
})
},
delete: function(data) { // 删除
return request({
url: '/message/v1/messagelist/deleteBySids?sids=' + data,
method: 'get',
data: data
})
},
changeAll: function() { // 未读消息列表全部设为已读
return request({
url: '/message/v1/messagelist/allChangeRead/',
method: 'get'
})
},
OrgINfo: function(data) { // 获取消息详情
return request({
url: '/message/v1/messagelist/fetchByMsgSid/' + data.sid,
method: 'get',
params: data
})
}
}

16
message-center-ui/src/router/index.js

@ -59,6 +59,22 @@ export const constantRoutes = [
}
]
},
{
path: '/messagelist',
component: Layout,
redirect: '/messagelist',
meta: {
title: '消息列表'
},
children: [
{
path: '/messagelist/unreadmessage',
component: () => import('@/views/messagelist/unreadmessage.vue'),
name: 'UnreadMessage',
meta: { title: '消息列表', noCache: true }
}
]
}
// 404 page must be placed at the end !!!
// { path: '*', redirect: '/404', hidden: true }
]

108
message-center-ui/src/views/messagelist/messageInfo.vue

@ -0,0 +1,108 @@
<template>
<div class="app-container">
<div class="tab-header webtop">
<div>{{ viewTitle }}</div>
<div>
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button>
</div>
</div>
<div class="listconadd">
<el-form ref="form_obj" :model="formobj" class="formaddcopy02">
<el-row style="border-top: 1px solid #E0E3EB">
<el-col :span="24">
<div class="span-sty">消息标题</div>
<el-form-item><span class="addinputInfo">{{ formobj.msgTitle }}</span></el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<div class="span-sty">发送人</div>
<el-form-item><span class="addinputInfo">{{ formobj.senderName }}</span></el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<div class="span-sty">时间</div>
<el-form-item><span class="addinputInfo">{{ formobj.createTime }}</span></el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<div class="span-sty">消息类型</div>
<el-form-item><span class="addinputInfo">{{ formobj.msgType }}</span></el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<div class="span-sty">消息来源</div>
<el-form-item><span class="addinputInfo">{{ formobj.msgSource }}</span></el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<div class="span-sty">消息内容</div>
<el-form-item><span class="addinputInfo">{{ formobj.msgContent }}</span></el-form-item>
</el-col>
</el-row>
</el-form>
</div>
</div>
</template>
<script>
import req from '@/api/messagelist/messagelist'
export default {
data() {
return {
viewTitle: '消息详情',
formobj: {
msgTitle: '',
senderName: '',
createTime: '',
msgType: '',
msgSource: '',
msgContent: '',
sid: ''
}
}
},
methods: {
showUnRead(row) {
req.OrgINfo({ sid: row.sid }).then((resp) => {
if (resp.success) {
this.formobj = resp.data
}
})
},
showRead(row) {
req.OrgINfo({ sid: row.sid }).then((resp) => {
if (resp.success) {
this.formobj = resp.data
}
})
},
handleReturn() {
this.formobj = {
msgTitle: '',
senderName: '',
createTime: '',
msgType: '',
msgSource: '',
msgContent: '',
sid: ''
}
this.$emit('doback')
}
}
}
</script>
<style scoped>
.span-sty {
width: 140px !important;
}
.addinputInfo {
margin-left: 130px !important;
}
</style>

208
message-center-ui/src/views/messagelist/readmessage.vue

@ -0,0 +1,208 @@
<template>
<div class="app-container">
<!-- Start 列表页面 -->
<div v-show="viewState == 1">
<button-bar view-title="消息管理" ref="btnbar" :btndisabled="btndisabled" @btnhandle="btnHandle"/>
<div class="main-content">
<div class="switch_btn">
<el-button class="" @click="handleClick">未读消息</el-button>
<el-button :class="{btn_style:viewState === 1}">已读消息</el-button>
</div>
<div class="searchcon">
<el-button size="small" class="searchbtn" @click="clicksearchShow">{{ searchxianshitit }}</el-button>
<div v-show="isSearchShow" class="search">
<el-form ref="listQueryform" :inline="true" :model="listQuery" class="tab-header">
<el-form-item label="消息类型">
<el-input v-model="listQuery.params.msgType" clearable placeholder="" class="addinputw"></el-input>
</el-form-item>
<el-form-item label="消息来源">
<el-input v-model="listQuery.params.msgSource" clearable placeholder="" class="addinputw"></el-input>
</el-form-item>
<el-form-item label="消息标题">
<el-input v-model="listQuery.params.msgTitle" clearable placeholder="" class="addinputw"></el-input>
</el-form-item>
<el-form-item label="发送人">
<el-input v-model="listQuery.params.senderName" clearable placeholder="" class="addinputw"></el-input>
</el-form-item>
<el-form-item class="formItem" label="接收日期">
<el-date-picker value-format="yyyy-MM-dd" v-model="listQuery.params.createDateStart" clearable type="date" placeholder="开始日期" />
<span style="padding: 0 8px"></span>
<el-date-picker value-format="yyyy-MM-dd" v-model="listQuery.params.createDateEnd" clearable type="date" placeholder="结束日期" />
</el-form-item>
</el-form>
<div class="btn" style="text-align: center;">
<el-button type="primary" icon="el-icon-search" @click="handleFilter" size="small">查询</el-button>
<el-button type="primary" icon="el-icon-refresh" @click="handleReset" size="small">重置</el-button>
</div>
</div>
</div>
<div class="listtop">
<div class="tit">已读消息列表</div>
<pageye v-show="list.length > 0" :total="listQuery.total" :page.sync="listQuery.current" :limit.sync="listQuery.size" class="pagination" @pagination="getList"/>
</div>
<div class="">
<el-table :key="tableKey" v-loading="listLoading" :data="list" border style="width: 100%;">
<el-table-column fixed width="60" label="序号" type="index" :index="indexMethod" align="center"/>
<el-table-column prop="senderName" width="100" label="发送人" align="center" />
<el-table-column prop="msgTitle" label="标题" align="left" header-align="center">
<template slot-scope="scope">
<span class="bluezi" @click="lookInfo(scope.row)">{{scope.row.msgTitle}}</span>
</template>
</el-table-column>
<el-table-column prop="createTime" width="150" label="日期" align="center" />
<el-table-column prop="msgType" width="100" label="消息类别" align="center" />
<el-table-column prop="msgSource" width="100" label="消息来源" align="center" />
</el-table>
</div>
<div class="pages">
<!-- 翻页 -->
<pagination v-show="list.length > 0" :total="listQuery.total" :page.sync="listQuery.current" :limit.sync="listQuery.size" class="pagination" @pagination="getList"/>
</div>
</div>
</div>
<!-- End 列表页面 -->
<messageInfo v-show="viewState == 3" ref="divInfo" @doback="resetState"/>
</div>
</template>
<script>
import req from '@/api/messagelist/messagelist'
import Pagination from '@/components/pagination'
import pageye from '@/components/pagination/pageye'
import ButtonBar from '@/components/ButtonBar'
import messageInfo from './messageInfo'
export default {
name: 'ReadMessage',
components: {
Pagination,
pageye,
ButtonBar,
messageInfo
},
data() {
return {
viewState: 1,
btndisabled: false,
btnList: [
{
type: 'info',
size: 'small',
icon: 'cross',
btnKey: 'doClose',
btnLabel: '关闭'
}
],
isSearchShow: false,
searchxianshitit: '显示查询条件',
// -----------
tableKey: 0,
list: [],
listLoading: false,
listQuery: {
params: {
senderName: '',
msgTitle: '',
createDateStart: '',
createDateEnd: '',
msgType: '',
msgSource: '',
type: 1
},
current: 1,
size: 10,
total: 0
},
rules: {}
}
},
mounted() {
this.$refs['btnbar'].setButtonList(this.btnList)
},
methods: {
//
clicksearchShow() {
this.isSearchShow = !this.isSearchShow
if (this.isSearchShow) {
this.searchxianshitit = '隐藏查询条件'
} else {
this.searchxianshitit = '显示查询条件'
}
},
btnHandle(btnKey) {
console.log('XXXXXXXXXXXXXXX ' + btnKey)
switch (btnKey) {
case 'doClose':
this.doClose()
break
default:
break
}
},
//
indexMethod(index) {
var pagestart = (this.listQuery.current - 1) * this.listQuery.size
var pageindex = index + 1 + pagestart
return pageindex
},
//
getList() {
this.listLoading = true
req.readVerifyList(this.listQuery).then((response) => {
console.log('列表查询结果:', response)
this.listLoading = false
if (response.success) {
this.list = response.data.records
this.listQuery.total = response.data.total
} else {
this.list = []
this.listQuery.total = 0
}
})
},
handleClick() {
this.$parent.resetState()
},
//
handleFilter() {
this.listQuery.current = 1
this.getList()
},
lookInfo(row) {
this.viewState = 3
this.$refs['divInfo'].showRead(row)
},
resetState() {
this.viewState = 1
},
handleReset() {
this.listQuery = {
params: {
senderName: '',
msgTitle: '',
createDateStart: '',
createDateEnd: '',
msgType: '',
msgSource: '',
type: 1
},
current: 1,
size: 10,
total: 0
}
this.getList()
},
doClose() {
this.$store.dispatch('tagsView/delView', this.$route)
this.$router.go(-1)
}
}
}
</script>
<style scoped>
.btn_style {
background-color: #018ad2;
color: white;
font-weight: 600;
}
</style>

340
message-center-ui/src/views/messagelist/unreadmessage.vue

@ -0,0 +1,340 @@
<template>
<div class="app-container">
<!-- Start 列表页面 -->
<div v-show="viewState == 1">
<button-bar view-title="消息管理" ref="btnbar" :btndisabled="btndisabled" @btnhandle="btnHandle"/>
<div class="main-content">
<div class="switch_btn">
<el-button :class="{btn_style:viewState === 1}">未读消息</el-button>
<el-button class="" @click="handleClick">已读消息</el-button>
</div>
<div class="searchcon">
<el-button size="small" class="searchbtn" @click="clicksearchShow">{{ searchxianshitit }}</el-button>
<div v-show="isSearchShow" class="search">
<el-form ref="listQueryform" :inline="true" :model="listQuery" class="tab-header">
<el-form-item label="消息类型">
<el-input v-model="listQuery.params.msgType" clearable placeholder="" class="addinputw"></el-input>
</el-form-item>
<el-form-item label="消息来源">
<el-input v-model="listQuery.params.msgSource" clearable placeholder="" class="addinputw"></el-input>
</el-form-item>
<el-form-item label="消息标题">
<el-input v-model="listQuery.params.msgTitle" clearable placeholder="" class="addinputw"></el-input>
</el-form-item>
<el-form-item label="发送人">
<el-input v-model="listQuery.params.senderName" clearable placeholder="" class="addinputw"></el-input>
</el-form-item>
<el-form-item class="formItem" label="接收日期">
<el-date-picker value-format="yyyy-MM-dd" v-model="listQuery.params.createDateStart" clearable type="date" placeholder="开始日期" />
<span style="padding: 0 8px"></span>
<el-date-picker value-format="yyyy-MM-dd" v-model="listQuery.params.createDateEnd" clearable type="date" placeholder="结束日期" />
</el-form-item>
</el-form>
<div class="btn" style="text-align: center;">
<el-button type="primary" icon="el-icon-search" @click="handleFilter" size="small">查询</el-button>
<el-button type="primary" icon="el-icon-refresh" @click="handleReset" size="small">重置</el-button>
</div>
</div>
</div>
<div class="listtop">
<div class="tit">未读消息列表</div>
<pageye v-show="list.length > 0" :total="listQuery.total" :page.sync="listQuery.current" :limit.sync="listQuery.size" class="pagination" @pagination="getList"/>
</div>
<div class="">
<el-table :key="tableKey" v-loading="listLoading" :data="list" border style="width: 100%;" @selection-change="handleSelectionChange">
<el-table-column type="selection" align="center" width="50" />
<el-table-column fixed width="60" label="序号" type="index" :index="indexMethod" align="center"/>
<el-table-column prop="senderName" width="100" label="发送人" align="center" />
<el-table-column prop="msgTitle" label="标题" align="left" header-align="center">
<template slot-scope="scope">
<span class="bluezi" @click="lookInfo(scope.row)">{{scope.row.msgTitle}}</span>
</template>
</el-table-column>
<el-table-column prop="createTime" width="150" label="日期" align="center" />
<el-table-column prop="msgType" width="100" label="消息类别" align="center" />
<el-table-column prop="msgSource" width="100" label="消息来源" align="center" />
</el-table>
</div>
<div class="pages">
<!-- 翻页 -->
<pagination v-show="list.length > 0" :total="listQuery.total" :page.sync="listQuery.current" :limit.sync="listQuery.size" class="pagination" @pagination="getList"/>
</div>
</div>
</div>
<!-- End 列表页面 -->
<!-- 已选择列表 -->
<readmessage v-show="viewState == 2" ref="divRead" @doback="resetState"/>
<messageInfo v-show="viewState == 3" ref="divInfo" @doback="resetState"/>
</div>
</template>
<script>
import req from '@/api/messagelist/messagelist'
import Pagination from '@/components/pagination'
import pageye from '@/components/pagination/pageye'
import ButtonBar from '@/components/ButtonBar'
import readmessage from './readmessage'
import messageInfo from './messageInfo'
export default {
name: 'UnreadMessage',
components: {
Pagination,
pageye,
ButtonBar,
readmessage,
messageInfo
},
data() {
return {
viewState: 1,
btndisabled: false,
btnList: [
{
type: 'primary',
size: 'small',
icon: '',
btnKey: 'toPartialMark',
btnLabel: '部分标记为已读'
},
{
type: 'primary',
size: 'small',
icon: '',
btnKey: 'toAllMark',
btnLabel: '全部标记为已读'
},
{
type: 'danger',
size: 'small',
icon: 'del',
btnKey: 'doDel',
btnLabel: '删除'
},
{
type: 'info',
size: 'small',
icon: 'cross',
btnKey: 'doClose',
btnLabel: '关闭'
}
],
isSearchShow: false,
searchxianshitit: '显示查询条件',
// -----------
tableKey: 0,
list: [],
sids: [],
listLoading: false,
listQuery: {
params: {
senderName: '',
msgTitle: '',
createDateStart: '',
createDateEnd: '',
msgType: '',
msgSource: '',
type: 0
},
current: 1,
size: 10,
total: 0
}
}
},
created() {
this.getList()
},
mounted() {
this.$refs['btnbar'].setButtonList(this.btnList)
},
methods: {
//
clicksearchShow() {
this.isSearchShow = !this.isSearchShow
if (this.isSearchShow) {
this.searchxianshitit = '隐藏查询条件'
} else {
this.searchxianshitit = '显示查询条件'
}
},
btnHandle(btnKey) {
console.log('XXXXXXXXXXXXXXX ' + btnKey)
switch (btnKey) {
case 'toPartialMark':
this.toPartialMark()
break
case 'toAllMark':
this.toAllMark()
break
case 'doClose':
this.doClose()
break
case 'doDel':
this.doDel()
break
default:
break
}
},
//
indexMethod(index) {
var pagestart = (this.listQuery.current - 1) * this.listQuery.size
var pageindex = index + 1 + pagestart
return pageindex
},
// sid
handleSelectionChange(row) {
const aa = []
row.forEach(element => {
aa.push(element.sid)
})
this.sids = aa
},
//
getList() {
this.listLoading = true
req.verifyList(this.listQuery).then((response) => {
this.listLoading = false
if (response.success) {
this.list = response.data.records
this.listQuery.total = response.data.total
} else {
this.list = []
this.listQuery.total = 0
}
})
},
handleClick() {
this.viewState = 2
this.$refs['divSelect'].getList()
},
//
handleFilter() {
this.listQuery.current = 1
this.getList()
},
handleReset() {
this.listQuery = {
params: {
senderName: '',
msgTitle: '',
createDateStart: '',
createDateEnd: '',
msgType: '',
msgSource: '',
type: 0
},
current: 1,
size: 10,
total: 0
}
this.getList()
},
//
toPartialMark() {
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(() => {
})
},
//
toAllMark() {
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() {
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(() => {
})
},
lookInfo(row) {
this.viewState = 3
this.$refs['divInfo'].showUnRead(row)
},
resetState() {
this.viewState = 1
},
doClose() {
this.$store.dispatch('tagsView/delView', this.$route)
this.$router.go(-1)
}
}
}
</script>
<style scoped>
.btn_style {
background-color: #018ad2;
color: white;
font-weight: 600;
}
</style>
Loading…
Cancel
Save