PreferencePage.vue
10.1 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
<template>
<!--查询栏-->
<m-pagination-query-render :fields="pagination.filterFields" :form="pagination.queryForm" @onSearch="pageReload"
@onReset="handleReset" :simpleFieldNum="4">
<template #cityCodeName="{ record }">
<a-cascader v-model:value="carProvinceCity" :options="areaData" placeholder="请选择注册地区" />
</template>
</m-pagination-query-render>
<div class="table-download">
<div class="selectedList">已选 0 项</div>
<div class="selectedBut">
<a-button type="primary" @click="downloadExcel" :disabled="exporting">
导出
</a-button>
</div>
</div>
<a-table :columns="columns" :data-source="pagination.content" :loading="loading" :bordered="false"
@change="pageRefresh" @resizeColumn="this.$filters.tableResizeColumn" size="small" :pagination="pageState"
:row-key="record => record.transactionId" :scroll="{ y: 'calc(100vh - 400px)' }"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }">
<template #customFilterDropdown="{ setSelectedKeys, selectedKeys, confirm, clearFilters, column }">
<m-filter-text-render :pagination="pagination" :column="column" :confirm="confirm"></m-filter-text-render>
<m-filter-checkbox-group-render :pagination="pagination" :column="column"
:confirm="confirm"></m-filter-checkbox-group-render>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'">
<router-link v-sec="'deposit_7'"
:to="{ path: '/finance/deposit/view', query: { depositId: record.depositId } }">
<a-button type="link" size="small">详情</a-button>
</router-link>
<router-link v-sec="'deposit_5'"
:to="{ path: '/account/view', query: { accountId: record.account.accountId } }">
<a-button type="link" size="small">编辑</a-button>
</router-link>
</template>
<template v-if="column.key === 'vehicleCondition'">
<PageMultipleTag :listValue="'vehicleConditionList'" :tagValue="record.vehicleCondition" />
</template>
<template v-if="column.key === 'vehicleAge'">
<PageMultipleTag :listValue="'vehicleAgeList'" :tagValue="record.vehicleAge" />
</template>
<template v-if="column.key === 'vehicleFuelType'">
<PageMultipleTag :listValue="'vehicleFuelTypeList'" :tagValue="record.vehicleFuelType" />
</template>
<template v-if="column.key === 'vehicleModel'">
<PageMultipleTag :listValue="'vehicleModelList'" :tagValue="record.vehicleModel" />
</template>
</template>
</a-table>
</template>
<script lang="ts">
import { Component } from 'vue-facing-decorator';
import { EyeFilled } from "@ant-design/icons-vue";
import { PaginationComponent } from "autumn-vue/lib/core/page/PaginationComponent";
import { Deposit } from "lib/src/entity/finance/entity/Deposit";
import { message, TableColumnsType } from "ant-design-vue";
import { Operator, Order } from "autumn-vue/lib/core/page/Pagination";
import { DepositController } from "@/api/DepositController";
import { ExportUtil } from "@/common/ExportUtil";
import { Security } from "@/store";
import PageMultipleTag from "@/views/finance/preference/PageMultipleTag.vue";
import { returnPreferenceList } from "@/views/finance/preference/listData";
import { convertToTree } from "@/common/chinaarea";;
import { DefaultOptionType } from "ant-design-vue/es/vc-cascader/Cascader";
@Component({
components: { EyeFilled, PageMultipleTag }
})
export default class DepositPage extends PaginationComponent<Deposit> {
areaData: DefaultOptionType[] = [];
carProvinceCity = ''
selectedRowKeys = [];
exporting = false;
businessModelList = [
{ label: '全部', value: '0' },
{ label: '批发', value: '1' },
{ label: '零售', value: '2' }
]
researchStatusList = [
{ label: '未完成', value: '1' },
{ label: '已完成', value: '2' },
]
brands = [];
@Security.Getter hasPrivilege;
/**
* 表格列配置
*/
columns: TableColumnsType = [
{ title: '序号', dataIndex: 'index', key: 'index', align: 'left', width: 80, resizable: true, ellipsis: true, sorter: false },
{ title: '车商ID', dataIndex: 'id', key: 'id', align: 'center', width: 160, resizable: true, ellipsis: true, sorter: false },
{ title: '车商手机号', dataIndex: 'mobile', key: 'mobile', align: 'center', width: 160, resizable: true, ellipsis: true, sorter: false },
{ title: '车商昵称', dataIndex: 'nickName', key: 'nickName', align: 'center', width: 160, resizable: true, ellipsis: true, sorter: false },
{ title: '实名姓名', dataIndex: 'realName', key: 'realName', align: 'center', width: 160, resizable: true, ellipsis: true, sorter: false },
{ title: '经营模式', dataIndex: 'businessModel', key: 'businessModel', align: 'center', width: 160, resizable: true, ellipsis: true, sorter: false },
{ title: '注册地区', dataIndex: 'cityCode', key: 'cityCode', align: 'center', width: 160, resizable: true, ellipsis: true, sorter: false },
{ title: '偏好车况', dataIndex: 'vehicleCondition', key: 'vehicleCondition', align: 'center', width: 160, resizable: true, ellipsis: true, sorter: false },
{ title: '偏好车龄', dataIndex: 'vehicleAge', key: 'vehicleAge', align: 'center', width: 160, resizable: true, ellipsis: true, sorter: false },
{ title: '燃油类型', dataIndex: 'vehicleFuelType', key: 'vehicleFuelType', align: 'center', width: 160, resizable: true, ellipsis: true, sorter: false },
{ title: '收车车型', dataIndex: 'vehicleModel', key: 'vehicleModel', align: 'center', width: 160, resizable: true, ellipsis: true, sorter: false },
{ title: '偏好品牌', dataIndex: 'brand', key: 'brand', align: 'center', width: 160, resizable: true, ellipsis: true, sorter: false },
{ title: '调研状态', dataIndex: 'researchStatus', key: 'researchStatus', align: 'center', width: 160, resizable: true, ellipsis: true, sorter: false },
{ title: '更新时间', dataIndex: 'createTime', key: 'createTime', align: 'center', width: 160, resizable: true, ellipsis: true, sorter: true },
{ title: '编辑人', dataIndex: 'updateBy', key: 'updateBy', align: 'center', width: 160, resizable: true, ellipsis: true, sorter: false },
{ title: '操作', key: 'action', width: 90, align: 'center', fixed: 'right' },
];
/**
* 初始化配置
*/
created(): void {
this.init(this.axios, DepositController.PAGE_DEPOSIT);
this.buildQueryForm({
account: [null, { label: '车商信息', field: 'account', placeholder: '请输入用户ID/手机号/昵称', operator: Operator.like }],
cityCode: [null, {
name: 'cityCodeName', label: '注册地区', field: 'cityCode', type: 'slot', placeholder: '请选择省/市', operator: Operator.eq
}],
businessModel: ['0', {
label: '经营模式', field: 'businessModel', type: 'select', placeholder: '请选择经营模式', allowClear: true, optionItems: this.businessModelList, operator: Operator.eq
}],
vehicleCondition: [[], {
label: '偏好车况', field: 'vehicleCondition', type: 'select', mode: 'multiple', allowClear: true, optionItems: returnPreferenceList('vehicleConditionList'), operator: Operator.eq
}],
vehicleAge: [[], {
label: '偏好车龄', field: 'vehicleAge', type: 'select', mode: 'multiple', allowClear: true, optionItems: returnPreferenceList('vehicleAgeList'), operator: Operator.eq
}],
vehicleFuelType: [[], {
label: '燃油类型', field: 'vehicleFuelType', type: 'select', mode: 'multiple', allowClear: true, optionItems: returnPreferenceList('vehicleFuelTypeList'), operator: Operator.eq
}],
vehicleModel: [[], {
label: '收车车型', field: 'vehicleModel', type: 'select', mode: 'multiple', allowClear: true, optionItems: returnPreferenceList('vehicleModelList'), operator: Operator.eq
}],
brandList: [null, { label: '偏好品牌', field: 'account', placeholder: '请输入偏好品牌', operator: Operator.like }],
researchStatus: [null, {
label: '调研状态', field: 'researchStatus', type: 'select', allowClear: true, optionItems: this.researchStatusList, operator: Operator.eq
}],
createTime: [null, { label: '更新时间', field: 'createTime', operator: Operator.dateBetween, type: 'date-range' }],
});
this.pagination.setDefaultSort('createTime', Order.desc);
//this.pageLoad();
this.areaData = convertToTree(false);
// this.setFilterFieldOptionItems('cityCode', convertToTree(false));
}
//重置查询条件
handleReset() {
this.pageReset();
this.carProvinceCity = '';
}
downloadExcel(): void {
this.exporting = true;
DepositController.exportDeposit(this.axios, this.pagination.requestParams, { responseType: 'blob' }).then(response => {
message.success('导出任务已创建,请稍后在浏览器下载列表中查看');
ExportUtil.downloadExcelFile(response.data, '收车偏好列表');
}).catch(error => {
console.error('Error downloading Word file:', error);
}).finally(() => {
this.exporting = false;
});
}
onSelectChange(selectedRowKeys: Key[]) {
this.selectedRowKeys = selectedRowKeys;
}
}
</script>
<style scoped lang="less">
:deep(.ant-form-item-control) {
min-width: 120px;
}
.table-download {
width: 100%;
height: 32px;
margin-bottom: 12px;
}
.selectedList {
float: left;
height: 32px;
line-height: 32px;
color: #777c85;
font-size: 14px;
font-weight: 400;
}
.selectedBut {
float: right;
}
</style>