index.vue
3.39 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
<template>
<div class="system-container">
<div class="container">
<search-form
class="searchTop border-shadow"
:formModel="searchForm"
:formList="worklogFormList"
>
<slot name="form-slot">
<el-button
type="primary"
:size="btn_size"
icon="el-icon-search"
:id="tableParams.btnId"
>搜索</el-button>
<el-button
type="primary"
:size="btn_size"
icon="el-icon-refresh"
@click="refresh"
>重置</el-button>
</slot>
</search-form>
<div class="table-btn">
<el-button
type="primary"
:size="btn_size"
@click="exportTable"
>导出</el-button>
</div>
<basic-table
ref="worklogTable"
:tableParams="tableParams"
:getListApi="getListApi"
:beforeSearchFn="beforeSearchFn"
:searchForm="searchDataForm"
:hasNum="false"
>
</basic-table>
</div>
</div>
</template>
<script>
import store from '@/store';
import { WORKLOG_API } from '@/config/config'
import { getWorkLogList, exportWorkLog } from 'services/worklog';
export default {
data() {
return {
WORKLOGSTATUS: this.$Constants.WORKLOG_STATUS,
searchForm: {},
searchDataForm: {},
worklogFormList: [
{
type: 'daterange',
prop: 'daterange',
pickerOptions: {
disabledDate(time) {
return time.getTime() > Date.now() || time.getTime() < new Date('2017-12-31').getTime()
}
}
}
],
tableParams: {
// mutiSelectName: 'worklog',
// mutiSelectUniqueKey: 'id',
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableColumns: [
{
label: '日志编号',
prop: 'id',
width: 200
}, {
label: '系统菜单',
prop: 'module'
}, {
label: '操作类型',
prop: 'action'
}, {
label: '操作账号',
prop: 'operatorName'
}, {
label: '所属组织',
prop: 'belongOrg'
}, {
label: '主机IP',
prop: 'ip',
}, {
label: '操作状态',
prop: 'result',
// addHtml: 'status'
}, {
label: '创建时间',
prop: 'createdDate',
width: 150
}
]
},
getListApi: getWorkLogList
}
},
methods: {
refresh() {
this.searchForm = {}
this.searchDataForm = {}
},
beforeSearchFn() {
return new Promise((resolve, reject) => {
if (this.searchForm.daterange) {
this.searchDataForm.sDate = this.searchForm.daterange[0]
this.searchDataForm.eDate = this.searchForm.daterange[1]
} else {
if (this.searchDataForm.sDate) delete this.searchDataForm.sDate && delete this.searchDataForm.eDate
}
resolve()
})
},
// 导出列表
exportTable() {
const params = this.$refs.worklogTable.page
this.$Common.exportExcel({
url: store.state.baseURL + WORKLOG_API.WORKLOG_EXPORT,
data: params,
method: 'GET',
fileName: '操作日志.xlsx'
})
}
}
}
</script>