|
@@ -3,77 +3,74 @@
|
|
|
<el-card>
|
|
|
<div slot="header" class="clearfix">
|
|
|
<span>消息提醒</span>
|
|
|
- <el-button style="float: right; padding: 3px 0" type="text" @click="showList">更多<i class="el-icon-arrow-right" /></el-button>
|
|
|
+ <el-button style="float: right; padding: 3px 0" type="text" size="medium" @click="showList">更多<i class="el-icon-arrow-right" /></el-button>
|
|
|
</div>
|
|
|
<el-tabs v-model="curTab" class="message-content" @tab-click="getTablelist">
|
|
|
- <el-tab-pane :label="'待办('+ todoCount + ')'" name="Todo">
|
|
|
+ <el-tab-pane :label="'待办('+ messageCount.todo + ')'" name="Todo">
|
|
|
<div class="message-filter_box">
|
|
|
<span>筛选条件:</span>
|
|
|
<el-radio-group v-model="todoType" size="mini" @input="getTablelist">
|
|
|
<el-radio-button label="">全部</el-radio-button>
|
|
|
- <el-radio-button label="4">任务类</el-radio-button>
|
|
|
- <el-radio-button label="5">通知类</el-radio-button>
|
|
|
- <el-radio-button label="6">超期提醒类</el-radio-button>
|
|
|
+ <el-radio-button v-for="item in typeData" :key="item.id" :label="item.value">{{ item.label }}</el-radio-button>
|
|
|
</el-radio-group>
|
|
|
</div>
|
|
|
- <el-table v-loading="loading" :data="todoData" :show-header="false" size="mini" height="calc(100% - 30px)">
|
|
|
- <el-table-column width="40">
|
|
|
- <template>
|
|
|
- <el-avatar shape="square"><svg-icon icon-class="yujing" /></el-avatar>
|
|
|
+ <el-table v-loading="loading" :data="todoData" :show-header="false" size="medium" :cell-style="cellStyle" height="calc(100% - 30px)">
|
|
|
+ <el-table-column width="50">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-avatar :size="40" shape="square" class="msg-icon"><svg-icon :icon-class="formatTypeIcon(scope.row.messageType)" /></el-avatar>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column show-overflow-tooltip>
|
|
|
<template slot-scope="scope">
|
|
|
- <div>{{ scope.row.title }} <span :class="'priority-box priority-level'+ scope.row.priority">{{ scope.row.priorityName }}</span> </div>
|
|
|
- <div>{{ scope.row.appName }}</div>
|
|
|
+ <div>{{ scope.row.title }} <span v-if="scope.row.messageLevel + '' === '1'" class="priority-box priority-level1">{{ formatDictData('', scope.row.messageLevel) }}</span> </div>
|
|
|
+ <div>{{ scope.row.systemName }}</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="createDate" width="140" />
|
|
|
- <el-table-column prop="createUser" width="70" show-overflow-tooltip />
|
|
|
+ <el-table-column prop="createTime" width="150" />
|
|
|
+ <el-table-column prop="createUser" width="100" show-overflow-tooltip />
|
|
|
<el-table-column width="105">
|
|
|
- <template>
|
|
|
- <el-button size="mini">不再提醒</el-button>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button size="mini" @click="markRead(scope.$index, scope.row)">不再提醒</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
</el-tab-pane>
|
|
|
- <el-tab-pane :label="'已办('+ doneCount + ')'" name="Done">
|
|
|
+ <el-tab-pane :label="'已办('+ messageCount.done + ')'" name="Done">
|
|
|
<div class="message-filter_box">
|
|
|
<span>筛选条件:</span>
|
|
|
<el-radio-group v-model="doneType" size="mini" @input="getTablelist">
|
|
|
<el-radio-button label="">全部</el-radio-button>
|
|
|
- <el-radio-button label="4">任务类</el-radio-button>
|
|
|
- <el-radio-button label="5">通知类</el-radio-button>
|
|
|
- <el-radio-button label="6">超期提醒类</el-radio-button>
|
|
|
+ <el-radio-button v-for="item in typeData" :key="item.id" :label="item.value">{{ item.label }}</el-radio-button>
|
|
|
</el-radio-group>
|
|
|
</div>
|
|
|
- <el-table v-loading="loading" :data="doneData" :show-header="false" size="mini" height="calc(100% - 30px)">
|
|
|
- <el-table-column width="40">
|
|
|
- <template>
|
|
|
- <el-avatar shape="square"><svg-icon icon-class="yujing" /></el-avatar>
|
|
|
+ <el-table v-loading="loading" :data="doneData" :show-header="false" size="medium" height="calc(100% - 30px)">
|
|
|
+ <el-table-column width="50">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-avatar :size="40" shape="square" class="msg-icon"><svg-icon :icon-class="formatTypeIcon(scope.row.messageType)" /></el-avatar>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column show-overflow-tooltip>
|
|
|
<template slot-scope="scope">
|
|
|
- <div>{{ scope.row.title }} <span :class="'priority-box priority-level'+ scope.row.priority">{{ scope.row.priorityName }}</span> </div>
|
|
|
- <div>{{ scope.row.appName }}</div>
|
|
|
+ <div>{{ scope.row.title }} <span v-if="scope.row.messageLevel + '' === '1'" class="priority-box priority-level1">{{ formatDictData('', scope.row.messageLevel) }}</span> </div>
|
|
|
+ <div>{{ scope.row.systemName }}</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="createDate" width="140" />
|
|
|
- <el-table-column prop="createUser" width="70" show-overflow-tooltip />
|
|
|
+ <el-table-column prop="createTime" width="150" />
|
|
|
+ <el-table-column prop="createUser" width="100" show-overflow-tooltip />
|
|
|
</el-table>
|
|
|
</el-tab-pane>
|
|
|
</el-tabs>
|
|
|
</el-card>
|
|
|
- <message-list ref="messageList" />
|
|
|
+ <message-list ref="messageList" :type-data="typeData" @updateMessage="updateMessage" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import MessageList from './components/MessageList'
|
|
|
|
|
|
-import { fetchTableList } from '@/api/message'
|
|
|
-import { isNull } from '@/utils/convert'
|
|
|
+import { fetchDictData } from '@/api/dict'
|
|
|
+import { fetchTableList, pushMarkRead, fetchRealCount } from '@/api/message'
|
|
|
+import { hasValidRecords, isNull, formatDictData } from '@/utils/convert'
|
|
|
|
|
|
export default {
|
|
|
name: 'Message',
|
|
@@ -82,31 +79,60 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ cellStyle: {
|
|
|
+ color: 'rgba(0,0,0, 0.85)'
|
|
|
+ },
|
|
|
+ msgDictType: 'notice_type',
|
|
|
+ typeData: [],
|
|
|
+ messageLevelData: [{ 'value': '0', 'label': '正常' }, { 'value': '1', 'label': '紧急' }],
|
|
|
curTab: 'Todo',
|
|
|
todoType: '',
|
|
|
doneType: '',
|
|
|
- todoCount: '',
|
|
|
- doneCount: '',
|
|
|
todoData: [],
|
|
|
doneData: [],
|
|
|
loading: false
|
|
|
}
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ messageCount() {
|
|
|
+ return this.$store.getters.messageCount
|
|
|
+ }
|
|
|
+ },
|
|
|
created() {
|
|
|
this.getMessageCount()
|
|
|
this.getTablelist()
|
|
|
+ this.getTypeData()
|
|
|
},
|
|
|
methods: {
|
|
|
showList() {
|
|
|
this.$refs.messageList.open()
|
|
|
},
|
|
|
+ updateMessage() {
|
|
|
+ this.getTablelist()
|
|
|
+ },
|
|
|
getMessageCount() {
|
|
|
- this.todoCount = 10
|
|
|
- this.doneCount = 11
|
|
|
+ fetchRealCount().then(res => {
|
|
|
+ if (!isNull(res.data)) {
|
|
|
+ this.$store.dispatch('message/setMessgeCount', res.data)
|
|
|
+ }
|
|
|
+ }).catch(error => {
|
|
|
+ console.log(error)
|
|
|
+ this.$message.error({
|
|
|
+ type: 'error',
|
|
|
+ duration: 0,
|
|
|
+ showClose: true,
|
|
|
+ message: '获取消息数量出错: ' + error.message
|
|
|
+ })
|
|
|
+ })
|
|
|
},
|
|
|
addNewMessage(message) {
|
|
|
- this.todoCount++
|
|
|
- this.todoData.unshift(message)
|
|
|
+ this.$store.dispatch('message/addNewMessage', message.deptCode)
|
|
|
+ if (this.curTab === 'Todo') {
|
|
|
+ // this.getTablelist()
|
|
|
+ if (message.messageType + '' === this.todoType) {
|
|
|
+ this.todoData.unshift(message)
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
// 获取table数据
|
|
|
getTablelist() {
|
|
@@ -119,7 +145,7 @@ export default {
|
|
|
}
|
|
|
fetchTableList(params).then(response => {
|
|
|
this.loading = false
|
|
|
- if (!isNull(response.data)) {
|
|
|
+ if (hasValidRecords(response)) {
|
|
|
if (this.curTab === 'Done') {
|
|
|
this.doneData = response.data.records
|
|
|
} else {
|
|
@@ -142,6 +168,51 @@ export default {
|
|
|
message: '获取消息列表出错: ' + error.message
|
|
|
})
|
|
|
})
|
|
|
+ },
|
|
|
+ markRead(index, data) {
|
|
|
+ pushMarkRead(data.targetId).then(res => {
|
|
|
+ this.$store.dispatch('message/readMessage', data.deptCode)
|
|
|
+ this.todoData.splice(index, 1)
|
|
|
+ }).catch(error => {
|
|
|
+ console.log(error)
|
|
|
+ this.$message.error({
|
|
|
+ type: 'error',
|
|
|
+ duration: 0,
|
|
|
+ showClose: true,
|
|
|
+ message: '不再提醒操作出错: ' + error.message
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ formatTypeIcon(type) {
|
|
|
+ const typeStr = type + ''
|
|
|
+ if (typeStr === '4') {
|
|
|
+ return 'zhiliang'
|
|
|
+ } else if (typeStr === '5') {
|
|
|
+ return 'anjian'
|
|
|
+ } else {
|
|
|
+ return 'yujing'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getTypeData() {
|
|
|
+ fetchDictData(this.msgDictType).then(response => {
|
|
|
+ if (!isNull(response.data)) {
|
|
|
+ this.typeData = response.data
|
|
|
+ } else {
|
|
|
+ this.typeData = []
|
|
|
+ }
|
|
|
+ }).catch(error => {
|
|
|
+ console.log(error)
|
|
|
+ this.$message.error({
|
|
|
+ type: 'error',
|
|
|
+ duration: 0,
|
|
|
+ showClose: true,
|
|
|
+ message: '获取消息类型错误: ' + error.message
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ formatDictData(type, value) {
|
|
|
+ const data = this.messageLevelData
|
|
|
+ return formatDictData(data, value)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -157,6 +228,11 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ .msg-icon {
|
|
|
+ color: #0056dd;
|
|
|
+ background: rgba(0,86,221,0.1);
|
|
|
+ }
|
|
|
+
|
|
|
::v-deep {
|
|
|
.el-tabs__header {
|
|
|
height: 40px;
|
|
@@ -182,16 +258,10 @@ export default {
|
|
|
padding: 0 5px;
|
|
|
color: #ffffff;
|
|
|
}
|
|
|
+.priority-level0{
|
|
|
+ background: none;
|
|
|
+}
|
|
|
.priority-level1{
|
|
|
background: #F85252;
|
|
|
}
|
|
|
-.priority-level2{
|
|
|
- background: orange;
|
|
|
-}
|
|
|
-.priority-level3{
|
|
|
- background: yellow;
|
|
|
-}
|
|
|
-.priority-level4{
|
|
|
- background: blue;
|
|
|
-}
|
|
|
</style>
|