DetectionReportPage.vue
14.4 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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
<template>
<a-card class="tabs-card" :bordered="false">
<!--查询栏-->
<m-pagination-query-render :fields="pagination.filterFields" :form="pagination.queryForm"
@onSearch="handlePageReload" @onReset="handleReset" :simpleFieldNum="4">
<template #keyword="{ record }">
<a-popover>
<template #content>
<p>搜索报告编号、工单号、车源号、VIN码、车牌</p>
</template>
<a-input v-model:value="pagination.queryForm.keyword" placeholder="搜索报告编号、工单号、车源号、VIN码、车牌" autocomplete="off" />
</a-popover>
</template>
</m-pagination-query-render>
<!--查询栏end-->
<!--库存车辆列表start-->
<div class="table-operations" style="margin-bottom: 16px;width: 100%;float: left;">
<div class="flex justify-end" style="float: left;">
已选 {{ selectedItems.length }} 项
<a-button @click="handleBatchBind(1)">批量绑定</a-button>
<a-button @click="handleBatchBind(2)">批量解绑</a-button>
</div>
<div class="flex justify-end" style="float: right;">
<a-button type="primary" @click="modalVisible = true, excelValue = '1'" :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.id" :scroll="{ y: 'calc(100vh - 350px)' }"
:row-selection="{ selectedRowKeys: selectIds, onChange: onSelectChange, type: 'checkbox', preserveSelectedRowKeys: true, }">
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'vehicleState'">
<vehicle-state-tag :vehicle-state="record.vehicle.vehicleState"></vehicle-state-tag>
</template>
<template v-if="column.key === 'carTypeName'">
<div class="carTypeNameBox">
<div class="carTypeNameBox_image">
<a-image v-if="record.vehicle?.cover?.url" :width="60" style="border-radius: 4px;"
:src="record.vehicle?.cover?.url" />
</div>
<div class="carTypeNameBox_text">
<div class="carTypeNameBox_name"
:title="record.vehicle?.baseInfo?.carSeriesName + record.vehicle?.baseInfo?.carTypeName || '-'">
{{ record.vehicle?.baseInfo?.carSeriesName }} {{ record.vehicle?.baseInfo?.carTypeName
||
'-' }}
</div>
<div class="carTypeNameBox_vin" :title="record.vehicle?.baseInfo?.vin || '-'">VIN码:{{
record.vehicle?.baseInfo?.vin || '-' }}</div>
</div>
</div>
</template>
<template v-if="column.key === 'bindStatus'">
<a-tag v-if="record.bindStatus == 1" color="#E8F8F2" :style="{ color: '#00AD74' }"
:bordered="false">已绑定</a-tag>
<a-tag v-if="record.bindStatus == 2" color="#F0F2F5" :style="{ color: '#777C85' }"
:bordered="false">未绑定</a-tag>
</template>
<template v-if="column.key === 'scoreLevel'">
<div>
<span>{{ (record.inspectionRecord?.overallScore ?? '') === '' ? '-' : `${record.inspectionRecord?.overallScore} 分`}}</span>
</div>
</template>
<template v-if="column.key === 'woId'">
<router-link
:to="{ path: '/detection/order/view', query: { id: record.id, page: 'report', action: 'VIEW' } }">
<a-button type="link" size="small">{{ record.woId }}</a-button>
</router-link>
</template>
<template v-if="column.key === 'action'">
<router-link
:to="{ path: '/detection/order/view', query: { id: record.id, page: 'report', action: 'VIEW' } }">
<a-button type="link" size="small">预览</a-button>
</router-link>
<a-button type="link" @click="handleBind(record, 2)" v-if="record.bindStatus == 1"
size="small">解绑</a-button>
<a-button type="link" @click="handleBind(record, 1)" v-if="record.bindStatus == 2"
size="small">绑定</a-button>
</template>
</template>
</a-table>
<bind-dialog ref="bindDialogRef" @emitOk="handlePageReload" />
<a-modal :visible="modalVisible" @ok="handleVisibleOk" @cancel="modalVisible = false" title="导出范围"
width="420px">
<div>
<div class="visible-title">请选择导出范围 <span class="validate">*</span> </div>
<a-select v-model:value="excelValue" style="width: 100%" placeholder="请选择导出范围">
<a-select-option value="1">导出全部</a-select-option>
<a-select-option value="2">导出当前勾选的结果</a-select-option>
</a-select>
</div>
</a-modal>
</a-card>
</template>
<script lang="ts">
import { Component } from 'vue-facing-decorator';
import { message, TableColumnsType } from "ant-design-vue";
import { Operator, Order } from "lib/src/core/page/Pagination";
import VehicleStateTag from "@/views/vehicle/inventory/VehicleStateTag.vue";
import { PaginationComponent } from "@/components/PaginationComponent";
import { Vehicle } from "lib/src/entity/vehicle/entity/Vehicle";
import { ExportUtil } from "@/common/ExportUtil";
import { DetectionController } from "@/api/DetectionController";
import bindDialog from "@/views/detection/report/components/bindDialog.vue";
@Component({
components: { VehicleStateTag, bindDialog }
})
export default class DetectionReportPage extends PaginationComponent<Vehicle> {
exporting = false;
selectIds: number[] = [];
selectedItems = [];
bindStatusList = [
{ label: '已绑定', value: 1 },
{ label: '未绑定', value: 2 },
];
modalVisible = false;
excelValue = '1';
vehicleStateList = [
{ label: '待入库', value: 'INVENTORY' },
{ label: '场地待维护', value: 'VENUE' },
{ label: '待定价', value: 'TO_BE_PRICED' },
{ label: '待关联拍场', value: 'PRICED' },
{ label: '待上拍', value: 'PENDING_AUCTION' },
{ label: '待拍卖', value: 'WAIT_AUCTION' },
{ label: '预展中', value: 'PREVIEW' },
{ label: '拍卖中', value: 'AUCTIONING' },
{ label: '待签署合同', value: 'CONTRACT_UNSIGNED' },
{ label: '待付车款', value: 'UNPAID' },
{ label: '待提车', value: 'WAIT_PICKUP' },
{ label: '待过户', value: 'TRANSFERRING' },
{ label: '已完成', value: 'COMPLETED' },
{ label: '已取消', value: 'CANCELED' },
];
/**
* 表格列配置
*/
columns: TableColumnsType = [
{
title: '序号', key: 'index', width: 70, align: 'center', fixed: 'left', sorter: false,
customRender: ({ index }) => {
return (this.getPagination().pageIndex - 1) * this.getPagination().pageSize + index + 1;
},
},
{ title: '报告编号', dataIndex: 'reportNo', key: 'reportNo', align: 'center', fixed: 'left', width: 150, resizable: true, ellipsis: true },
{ title: '生成时间', dataIndex: 'createTime', key: 'createTime', align: 'center', width: 170, resizable: true, ellipsis: true, sorter: true },
{ title: '工单单号', dataIndex: "woId", key: 'woId', align: 'center', width: 150, resizable: true, ellipsis: true },
{ title: '车源号', dataIndex: ['vehicle', 'baseInfo', "sourceNo"], key: 'sourceNo', align: 'center', width: 170, resizable: true, ellipsis: true },
{ title: '车型名称', dataIndex: ['vehicle', 'baseInfo', "carTypeName"], key: 'carTypeName', align: 'left', width: 240, resizable: true, ellipsis: true },
{ title: '车牌号', dataIndex: ['vehicle', 'baseInfo', "licensePlate"], key: 'licensePlate', align: 'center', width: 170, resizable: true, ellipsis: true },
{ title: '车辆状态', dataIndex: ['vehicle', "vehicleState"], key: 'vehicleState', align: 'center', width: 170, resizable: true, ellipsis: true },
{ title: '评分', dataIndex: 'scoreLevel', key: 'scoreLevel', align: 'center', width: 170, resizable: true, ellipsis: true, sorter: true },
{ title: '绑定状态', dataIndex: 'bindStatus', key: 'bindStatus', align: 'center', width: 170, resizable: true, ellipsis: true },
{ title: '更新时间', dataIndex: 'updateTime', key: 'updateTime', align: 'center', width: 170, resizable: true, ellipsis: true, sorter: true },
{ title: '操作', key: 'action', width: 170, align: 'center', fixed: 'right' },
];
getPagination() {
return this.pagination;
}
/**
* 初始化配置
*/
created(): void {
this.init(this.axios, DetectionController.PAGE_INSPECTOR_REPORT);
this.buildQueryForm({
keyword: [null, {
name: 'keyword', label: '关键字', field: 'keyword', type: 'slot', placeholder: '搜索报告编号、工单号、车源号、VIN码、车牌', operator: Operator.eq
}],
bindStatus: [null, {
label: '绑定状态', field: 'bindStatus', type: 'select', allowClear: true, optionItems: this.bindStatusList, operator: Operator.eq
}],
vehicleState: [null, { label: '车辆状态', type: 'select', optionItems: this.vehicleStateList, allowClear: true, field: 'vehicleState', operator: Operator.eq }],
createTime: [null, { label: '生成时间', field: 'createTime', operator: Operator.dateBetween, type: 'date-range' }],
});
this.pagination.setDefaultSort('createTime', Order.desc);
this.pageLoad();
}
//查询
handlePageReload() {
this.selectIds = [];
this.selectedItems = [];
this.pageReload();
}
//重置查询条件
handleReset() {
this.selectIds = [];
this.selectedItems = [];
this.pageReset();
}
//选择数据
onSelectChange(selectedRowKeys: number[], selectedRows: []): void {
this.selectIds = selectedRowKeys;
this.selectedItems = selectedRows;
}
//批量绑定/解绑
handleBatchBind(bindStatus: number) {
if (this.selectedItems.length === 0) {
message.warning(bindStatus == 1 ? '请选择需要绑定的数据' : '请选择需要解绑的数据');
return;
}
const list = (this.selectedItems || []).filter(item => item.bindStatus == bindStatus);
if (list.length > 0) {
message.warning(bindStatus == 1 ? '选择的项存在已绑定的数据,请重新选择' : '选择的项存在未绑定的数据,请重新选择');
return;
}
this.$refs.bindDialogRef.init({
bindList: this.selectedItems,
bindStatus: bindStatus
});
}
//绑定/解绑
handleBind(record: Vehicle, bindStatus: number) {
this.$refs.bindDialogRef.init({
bindList: [record],
bindStatus: bindStatus
});
}
handleVisibleOk() {
this.modalVisible = false;
this.downloadExcel();
}
downloadExcel(): void {
this.exporting = true;
let paramsData = {
...this.pagination.requestParams,
}
if (this.excelValue == '2') {
if (!this.selectIds.length) {
message.error('请选择需要导出的数据');
this.exporting = false;
return false
} else {
if (!paramsData.filters) {
paramsData.filters = []
}
paramsData.filters.push({ field: "id", logic: "and", operator: "in", value: this.selectIds, })
}
}
DetectionController.inspectReportExport(this.axios, paramsData, { responseType: 'blob' }).then(response => {
message.success('导出任务已创建,请在下载中心查看');
ExportUtil.downloadExcelFile(response.data, this.getNewTime() + '-检测报告管理');
}).catch(error => {
console.error('Error downloading Word file:', error);
}).finally(() => {
this.exporting = false;
});
}
getNewTime() {
//获取当前年月日时分秒
const date = new Date();
const year = date.getFullYear();
const month = date.getMonth() + 1;
const monthStr = month < 10 ? '0' + month : month;
const day = date.getDate();
const dayStr = day < 10 ? '0' + day : day;
const hour = date.getHours();
const minute = date.getMinutes();
const minuteStr = minute < 10 ? '0' + minute : minute;
return `${year}-${monthStr}-${dayStr}-${hour}-${minuteStr}`
}
}
</script>
<style scoped lang="less">
.carTypeNameBox {
width: 100%;
display: flex;
}
.carTypeNameBox_image {
width: 60px;
height: 60px;
border-radius: 4px;
float: left;
}
.carTypeNameBox_text {
width: 200px;
float: left;
margin-left: 8px;
}
.carTypeNameBox_name {
width: 100%;
height: 22px;
color: #2f3133;
font-size: 14px;
font-weight: 400;
font-family: "HarmonyOSSansSC";
text-align: left;
line-height: 22px;
margin-top: 9px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.carTypeNameBox_vin {
width: 100%;
height: 20px;
opacity: 1;
color: #777c85;
font-size: 12px;
font-weight: 400;
font-family: "HarmonyOSSansSC";
text-align: left;
line-height: 20px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.color_A {
color: #00ad74;
}
.color_B {
color: #fc8b0a;
}
.color_C {
color: #eb2f2f;
}
</style>