writeOffList.vue
5.83 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
<template>
<div class="writeOff">
<div class="contain equity-wrap">
<GLButton size="small" fn="新增核赔" class="el-icon-plus" type="primary" @click="addWriteOff(1)">新增核赔</GLButton>
<div class="search-wrap">
<glsx-combi-form ref="showSearch" labelWidth="120px" defaultWidth="230px" :formObj="batchListSearch" :formData="writeOffForm">
<span slot="footer" class="footer-btns"></span>
</glsx-combi-form>
</div>
<div>
<div>
<el-button size="small" type="primary" icon="el-icon-search" @click="handleSearch">查询</el-button>
<el-button size="small" icon="el-icon-refresh" @click="handleReset('reset')">重置</el-button>
</div>
</div>
</div>
<div class="contain equity-wrap" style="margin-top: 10px">
<el-button type="primary" size="small" @click="handleExport" style="float: right; margin-right: 0; margin-bottom: 20px" class="selectBtn">导出Excel</el-button>
<GLTable ref="writeOffTable" :pageSizes="sizeList" :searchForm="searchForm" :tableParams="batchTableParams" :getListApi="getListApi" :pageConf="batchPageConf" :beforeSearchFn="beforeSearchFn">
<div class="table-btns" slot="table-btns" slot-scope="scope">
<el-button type="text" @click="handleView(scope.scope)">查看</el-button>
</div>
</GLTable>
</div>
</div>
</template>
<script type="text/ecmascript-6">
import glsxCombiForm from '@/components/glsx-combi-form'
import util from '@/util/util'
export default {
name: 'writeOffList',
data() {
return {
sizeList: [5, 10, 20, 30, 40],
getListApi: this.$apis.beforeSale.getWriteOffList,
batchListSearch: {
searchText: '',
activeTime: []
},
searchForm: {},
writeOffForm: [
{
label: '搜索内容',
name: 'searchText',
type: 'input',
placeholder: '请输入车主姓名、核销码、合同号',
isClear: true
},
{
label: '提交时间',
name: 'activeTime',
type: 'datePicker',
valueFormat: 'yyyy-MM-dd',
pickerOptions: 'beforeRangePickerOptions',
isClear: true
}
],
// 序号、核销码、客户名、合同号、价格区间、门店提交时间、服务名称、操作
batchTableParams: {
listName: 'list',
tableOption: false,
tableColumns: [
{
label: '核销码',
prop: 'writeOffCode',
width: 120,
formatter: cellValue => {
return cellValue.writeOffCode || '-'
}
},
{
label: '客户名',
prop: 'reporterName',
width: 200,
formatter: cellValue => {
return cellValue.reporterName || '-'
}
},
{
label: '合同号',
prop: 'contractNo',
width: 200,
formatter: cellValue => {
return cellValue.contractNo || '-'
}
},
{
label: '价格区间',
prop: 'priceSection',
width: 200,
formatter: cellValue => {
return cellValue.priceSection || '-'
}
},
{
label: '门店提交时间',
prop: 'commitTime',
width: 200,
formatter: cellValue => {
return cellValue.commitTime ? util.dateFormat(cellValue.commitTime, 'YYYY-MM-DD HH:mm:ss') : '-'
}
},
{
label: '服务名称',
prop: 'serviceName',
formatter: cellValue => {
return cellValue.serviceName || '-'
}
},
{
label: '操作',
prop: '',
width: '100px',
fixed: 'right',
addHtml: 'table-btns'
}
]
},
batchPageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' }
}
},
components: {
glsxCombiForm
},
mounted() {},
methods: {
handleView({ writeOffCode }) {
this.$router.push(`/ghPreSale/writeOff/writeOffDetail/${writeOffCode}`)
},
beforeSearchFn() {
return new Promise((resolve, reject) => {
this.searchForm = { ...this.setParams() }
resolve()
})
},
setParams() {
const params = {}
if (Array.isArray(this.batchListSearch.activeTime) && this.batchListSearch.activeTime.length > 0) {
params.commitTimeStart = util.dateFormat(this.batchListSearch.activeTime[0]) + ' 00:00:00'
params.commitTimeEnd = util.dateFormat(this.batchListSearch.activeTime[1]) + ' 23:59:59'
}
params.searchText = this.batchListSearch.searchText
return params
},
handleExport() {
const parmas = { ...this.setParams() }
this.$apis.beforeSale.exportWriteOffData(parmas).then(({ code, data, message }) => {
if (code == '0') {
var a = document.createElement('a')
a.setAttribute('id', 'exportToExport')
a.setAttribute('href', data)
a.setAttribute('target', '_blank')
document.body.appendChild(a)
a.click()
} else {
this.$message.error(message)
}
})
},
handleSearch() {
this.$refs.writeOffTable.refreshTable()
},
handleReset(type) {
this.batchListSearch = {
searchText: '',
activeTime: []
}
if (type === 'reset') {
this.handleSearch()
}
},
addWriteOff(type) {
this.$router.push('/ghPreSale/writeOff/addwriteOff')
}
}
}
</script>
<style lang="scss" scoped>
.writeOff {
margin-top: 17px;
.equity-wrap {
background-color: #fff;
padding: 20px;
.search-wrap {
margin-top: 20px;
// padding: 20px 20px 0;
}
}
}
</style>