staffSendDetail.vue
3.58 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
<template>
<div>
<glsx-combi-form ref="staffSendFormRef" :formObj="searchForm" :formData="staffSendFormData" :inline="true">
<span slot="footer">
<el-button type="primary" :size="size" @click="getListApi">查询</el-button>
</span>
</glsx-combi-form>
<GLTable ref="staffSendDetailRef" :hasPage="false" :tableData="sendStaffTableData" @sortChange="sortChange" :beforeSearchFn="beforeSearchFn" :noDataImg="url" :searchForm="searchForm" :tableParams="tableParams"></GLTable>
</div>
</template>
<script>
import url from '@/assets/empty.png'
export default {
name: 'staffSendDetail',
props: ['materialId', 'startTime', 'endTime'],
data() {
return {
url,
searchForm: {
materialId: this.$route.query.id,
employeeName: '',
sortValue: '',
sort: ''
// startTime: this.$parent.startTime,
// endTime: this.$parent.endTime
},
staffSendFormData: [
{
label: '',
name: 'employeeName',
type: 'input',
placeholder: '请输入姓名',
prefixIcon: 'el-icon-search',
isClear: true
}
],
// getListApi: this.$apis.material.sendDetailPage,
// pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' },
sendStaffTableData: [],
tableParams: {
listName: 'data',
tableOption: false,
tableColumns: [
{
label: '姓名',
prop: 'employeeName'
},
{
label: '发送次数',
prop: 'sendNumber',
sortable: true
},
{
label: '阅读次数',
prop: 'readNumber',
sortable: true
},
{
label: '阅读人数',
prop: 'readPeopleNumber'
},
{
label: '打开率',
prop: 'openRate'
}
]
}
}
},
mounted() {
this.getListApi()
},
methods: {
// 搜索
// handleSearch() {
// this.$refs.staffSendDetailRef.refreshTable()
// },
// 重置
handleReset() {
this.searchForm = {
staffName: '',
materialId: this.$route.query.id
}
this.getListApi()
},
// 排序
sortChange({ column, prop, order }) {
order === 'ascending' ? (this.searchForm.sort = 2) : (this.searchForm.sort = 1)
prop === 'sendNumber' ? (this.searchForm.sortValue = 2) : (this.searchForm.sortValue = 1)
this.getListApi()
},
getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm))
return params
},
getListApi() {
var params = this.getParams()
params.startTime = this.$parent.startTime
params.endTime = this.$parent.endTime
this.$apis.material.sendDetailPage(params).then(res => {
this.sendStaffTableData = res
// 计算表格高度,数据10条以下自适应,10条以上固定高度,表格内滚动,无数据调用方法计算高度
res.length ? (res.length > 10 ? (this.$refs.staffSendDetailRef.tableHeightValues = '425px') : (this.$refs.staffSendDetailRef.tableHeightValues = '')) : (this.$refs.staffSendDetailRef.tableHeightValues = '325px')
// res.length > 10 ? (this.$refs.staffSendDetailRef.tableHeightValues = '425px') : (this.$refs.staffSendDetailRef.tableHeightValues = '')
})
}
}
}
</script>
<style lang="scss" scoped>
/deep/ .el-table .ascending .sort-caret.ascending {
border-bottom-color: #5850ff;
}
/deep/ .el-table .descending .sort-caret.descending {
border-top-color: #5850ff;
}
</style>