writeOffList.vue
5.24 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
<template>
<div class="writeOff">
<GLButton size="small" style="margin-bottom: 10px;" fn="新增核赔" class="el-icon-plus" type="primary" @click="addWriteOff(1)">新增核赔</GLButton>
<div class="contain equity-wrap">
<div class="search-wrap">
<GLCombiForm :rowNumber="1" ref="showSearch" @handleOk="handleSearch" @handleRest="handleReset('reset')" labelWidth="100px" defaultWidth="230px" :formObj="batchListSearch" :formData="writeOffForm"></GLCombiForm>
</div>
<el-button size="small" plain style="float:right;margin-bottom:10px;" @click="handleExport" class="selectBtn">导出</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">
<GLButton fn="查看" type="text" @click="handleView(scope.scope)">查看</GLButton>
</div>
</GLTable>
</div>
</div>
</template>
<script type="text/ecmascript-6">
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',
formatter: cellValue => {
return cellValue.writeOffCode || '-'
}
},
{
label: '客户名',
prop: 'reporterName',
formatter: cellValue => {
return cellValue.reporterName || '-'
}
},
{
label: '合同号',
prop: 'contractNo',
formatter: cellValue => {
return cellValue.contractNo || '-'
}
},
{
label: '价格区间',
prop: 'priceSection',
formatter: cellValue => {
return cellValue.priceSection || '-'
}
},
{
label: '门店提交时间',
prop: 'commitTime',
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: '70px',
fixed: 'right',
addHtml: 'table-btns'
}
]
},
batchPageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' }
}
},
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 {
.equity-wrap {
background-color: #fff;
padding: 20px;
.search-wrap {
// padding: 20px 20px 0;
}
}
}
</style>