record.vue
6.37 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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
<script>
import { getList, syncMsg } from '@/api/groupMessage'
export default {
name: 'Operlog',
filters: {
sendInfo(data) {
if (data.timedTask == 1) {
return '定时任务 发送时间:' + data.settingTime
} else {
let unit = data.expectSend == 1 ? '个群' : '人'
return `预计发送${data.expectSend}${unit},已成功发送${data.actualSend}${unit}`
}
}
},
data() {
return {
// 遮罩层
loading: false,
// 选中数组
ids: [],
// 总条数
total: 0,
// 表格数据
list: [],
// 日期范围
dateRange: [],
// 查询参数
query: {
pageNum: 1,
pageSize: 10,
sender: undefined,
content: undefined,
pushType: undefined,
beginTime: undefined,
endTime: undefined
},
pushType: {
0: '发给客户',
1: '发给客户群'
},
pickerOptions: {
disabledDate(time) {
return time.getTime() > Date.now() // 选当前时间之前的时间
}
}
}
},
created() {
this.getList()
},
methods: {
getList(page) {
if (this.dateRange) {
this.query.beginTime = this.dateRange[0]
this.query.endTime = this.dateRange[1]
} else {
this.query.beginTime = ''
this.query.endTime = ''
}
page && (this.query.pageNum = page)
this.loading = true
getList(this.query)
.then(({ rows, total }) => {
this.list = rows
this.total = +total
this.loading = false
this.ids = []
})
.catch(() => {
this.loading = false
})
},
/** 重置按钮操作 */
resetQuery() {
this.dateRange = []
this.$refs['queryForm'].resetFields()
this.getList(1)
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id)
},
/** 删除按钮操作 */
handleDelete(row) {
const operIds = row.operId || this.ids
this.$confirm(
'是否确认删除日志编号为"' + operIds + '"的数据项?',
'警告',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}
)
.then(function() {})
.then(() => {
this.getList()
this.msgSuccess('删除成功')
})
.catch(function() {})
},
goRoute(id, path) {
this.$router.push({
path: path,
query: { id }
})
},
syncMsg(data) {
let { msgid, messageId } = data
syncMsg({ msgids: [msgid], messageId })
.then(({ data }) => {
this.msgSuccess('同步成功')
this.getList()
// this.list = rows
// this.total = +total
// this.loading = false
// this.ids = []
})
.catch(() => {
// this.loading = false
})
}
}
}
</script>
<template>
<div>
<el-form
:model="query"
ref="queryForm"
:inline="true"
class="top-search"
label-width="100px"
>
<el-form-item label="创建人" prop="sender">
<el-input
v-model="query.sender"
placeholder="请输入"
clearable
@keyup.enter.native="getList(1)"
/>
</el-form-item>
<el-form-item label="内容消息" prop="content">
<el-input
v-model="query.content"
placeholder="请输入"
clearable
@keyup.enter.native="getList(1)"
/>
</el-form-item>
<el-form-item label="群发类型" prop="pushType">
<el-select v-model="query.pushType" placeholder="请选择" size="small">
<el-option
v-for="(value, key, index) in pushType"
:label="value"
:value="key"
:key="index"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="创建日期">
<el-date-picker
:picker-options="pickerOptions"
v-model="dateRange"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</el-form-item>
<el-form-item label=" ">
<el-button type="primary" @click="getList(1)">查询</el-button>
<el-button type="success" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-table
v-loading="loading"
:data="list"
@selection-change="handleSelectionChange"
>
<!-- <el-table-column type="selection" width="55" align="center" /> -->
<el-table-column label="消息内容" align="center" prop="content" />
<el-table-column label="群发类型" align="center">
<template slot-scope="scope">
{{ pushType[scope.row.pushType] }}
</template>
</el-table-column>
<el-table-column label="创建人" align="center" prop="sender" />
<el-table-column
label="创建时间"
align="center"
prop="sendTime"
width="180"
>
</el-table-column>
<el-table-column label="发送情况" align="center" prop="sendInfo">
<template slot-scope="scope">
{{ scope.row | sendInfo }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="180">
<template slot-scope="scope">
<el-button
v-hasPermi="['enterpriseWechat:view']"
size="mini"
type="text"
@click="goRoute(scope.row.messageId, 'detail')"
>查看</el-button
>
<el-button
v-hasPermi="['enterpriseWechat:edit']"
size="mini"
type="text"
disabled=""
@click="goRoute(scope.row, 1)"
>编辑</el-button
>
<el-button
v-hasPermi="['enterpriseWechat:edit']"
size="mini"
type="text"
@click="syncMsg(scope.row)"
>同步</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="query.pageNum"
:limit.sync="query.pageSize"
@pagination="getList()"
/>
</div>
</template>
<style lang="scss" scoped></style>