index.vue
6.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<template>
<div class="NCC-common-layout MessageRecord-container">
<div class="NCC-common-layout-center">
<el-row class="NCC-common-search-box" :gutter="16">
<el-form @submit.native.prevent>
<el-col :span="6">
<el-form-item label="关键词">
<el-input v-model="keyword" placeholder="请输入关键词查询" clearable
@keyup.enter.native="search()" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="search()">
{{$t('common.search')}}</el-button>
<el-button icon="el-icon-refresh-right" @click="reset()">{{$t('common.reset')}}
</el-button>
</el-form-item>
</el-col>
</el-form>
</el-row>
<div class="NCC-common-layout-main NCC-flex-main">
<el-tabs type="border-card" v-model="activeName" class="messageRecord-tab">
<el-tab-pane label="全部" name="0"></el-tab-pane>
<el-tab-pane label="通知" name="1"></el-tab-pane>
<el-tab-pane label="私信" name="2"></el-tab-pane>
<div class="box">
<div class="NCC-common-head">
<div class="left-btn">
<el-button type="danger" @click="handleDel" icon="el-icon-delete">删除</el-button>
</div>
<div class="NCC-common-head-right">
<el-tooltip effect="dark" :content="$t('common.refresh')" placement="top">
<el-link icon="icon-ym icon-ym-Refresh NCC-common-head-icon" :underline="false"
@click="reset()" />
</el-tooltip>
<screenfull />
</div>
</div>
<NCC-table v-loading="listLoading" :data="list" hasC
@selection-change="handleSelectionChange">
<el-table-column prop="title" label="消息标题">
<template slot-scope="scope">
<el-link @click="readInfo(scope.row)" style="font-size:12px">{{ scope.row.title }}
</el-link>
</template>
</el-table-column>
<el-table-column prop="type" label="消息类型" width="120">
<template slot-scope="scope">
<!-- {{ scope.row.type==1?'系统公告':scope.row.type==2?"系统消息":"私信信息"}} -->
{{ scope.row.type==1?'系统消息':"私信信息"}}
</template>
</el-table-column>
<el-table-column prop="creatorUser" label="发送人员" width="120">
</el-table-column>
<el-table-column prop="lastModifyTime" label="发送时间" :formatter="ncc.tableDateFormat"
width="120" />
<el-table-column prop="isRead" label="状态" width="100">
<template slot-scope="scope">
<el-tag type="success" v-if="scope.row.isRead=='1'">已读</el-tag>
<el-tag type="info" v-else>未读</el-tag>
</template>
</el-table-column>
</NCC-table>
<pagination :total="total" :page.sync="listQuery.currentPage"
:limit.sync="listQuery.pageSize" @pagination="initData" />
</div>
</el-tabs>
</div>
</div>
<Form v-if="formVisible" ref="Form" @refreshDataList="initData" />
</div>
</template>
<script>
import { getMessageList, MessageDeleteRecord, ReadInfo } from '@/api/system/message'
import Form from './Form'
export default {
name: 'messageRecord',
components: { Form },
data() {
return {
visible: false,
formVisible: false,
keyword: '',
activeName: "0",
list: [],
multipleSelection: [],
total: 0,
listLoading: true,
listQuery: {
currentPage: 1,
pageSize: 20,
sort: 'desc',
}
}
},
watch: {
activeName(val) {
this.keyword = ''
this.search()
}
},
created() {
this.initData()
},
methods: {
search() {
this.listQuery = {
currentPage: 1,
pageSize: 20,
sort: 'desc',
}
this.initData()
},
reset() {
this.keyword = ''
this.search()
},
initData() {
this.listLoading = true
let type = this.activeName == '0' ? '' : this.activeName
let data = {
...this.listQuery,
keyword: this.keyword,
type
}
this.list = []
getMessageList(data).then(res => {
this.list = res.data.list
this.total = res.data.pagination.total
this.listLoading = false
})
},
handleDel() {
if (!this.multipleSelection.length) {
this.$message({ type: 'error', message: '请选择一条数据' });
return
}
let data = {
ids: this.multipleSelection.join(',')
}
this.$confirm('您确定要删除这些数据吗, 是否继续?', '提示', {
type: 'warning'
}).then(() => {
MessageDeleteRecord(data).then(res => {
this.$message({
type: 'success',
message: res.msg
});
this.initData();
})
}).catch(() => { });
},
handleSelectionChange(val) {
this.multipleSelection = val.map(item => item.id)
},
readInfo(item) {
if (item.type == 1) {
this.formVisible = true
item.isRead = '1'
this.$nextTick(() => {
this.$refs.Form.init(item.id)
})
} else {
ReadInfo(item.id).then(res => {
item.isRead = '1'
let body = res.data.bodyText ? JSON.parse(res.data.bodyText) : {}
let url = 'flowLaunch'
if (body.type == 2) url = 'flowTodo'
if (body.type == 3) url = 'flowCirculate'
this.$router.push(`/workFlow/${url}`)
})
}
}
}
}
</script>
<style lang="scss" scoped>
.MessageRecord-container {
.NCC-common-layout-main {
padding: 0;
}
.messageRecord-tab {
height: 100%;
>>> .el-tabs__content {
padding: 0;
height: calc(100% - 40px);
.box {
flex: 1;
height: 100%;
overflow: hidden;
display: flex;
flex-direction: column;
padding-bottom: 10px;
}
}
}
}
</style>