driverDetail.vue
8.13 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
<template>
<div class="system-container">
<div class="container">
<h1>试驶详情汇总</h1>
<!-- 搜索区域 开始 -->
<div class="search_box">
<el-form :model="searchForm" :inline="true" size="small">
<el-form-item label="关键字:">
<el-input v-model="searchForm.keywords" class="a_input" placeholder="特约店编码|店名称|车牌号|设备号"></el-input>
</el-form-item>
<el-form-item label="试驾是/否有效:">
<el-select v-model="searchForm.validDriveType" placeholder="请选择">
<el-option label="全部" value=""></el-option>
<el-option label="有效" value="1"></el-option>
<el-option label="无效" value="2"></el-option>
</el-select>
</el-form-item>
<el-form-item label="日期:">
<el-date-picker v-model="timeDate" type="daterange" unlink-panels range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd" :picker-options="pickerOptions">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="getList()">搜索</el-button>
<el-button type="primary" icon="el-icon-refresh" size="mini" @click="rest()">重置</el-button>
</el-form-item>
<!-- <el-form-item>
</el-form-item> -->
</el-form>
</div>
<!-- 搜索区域 end -->
<!-- 按钮区域 开始 -->
<div class="links_group">
<span>试驾详情</span>
<el-button class="pull-right" type="primary" icon="el-icon-download" size="mini" :loading="dloading" @click="downloadExcel()">导出Excel</el-button>
</div>
<!-- 按钮区域 end -->
<!-- 列表 开始 -->
<glsx-table ref="glsxTable" v-loading="loading" :list="tableData" :column="columnList" :pageTotal="pageTotal" @change="getList">
<div slot="operate" slot-scope="{scope}">
<!-- <el-button size="mini" :id="scope.id">试驾轨迹</el-button> -->
<el-link type="primary" :unline="false" :id="scope.id" @click="lookTrack(scope)">试驾轨迹</el-link>
</div>
</glsx-table>
<!-- 列表 end -->
</div>
</div>
</template>
<script>
import GlsxTable from "@/components/glsx-table";
import { DRIVE_DETAIL_SEARCH, DRIVE_STATISTICS_EXPORT } from "services/report";
import moment from "moment";
import { deepClone } from "@/utils/util";
export default {
data() {
return {
searchForm: {keywords:this.$route.query.vin},
loading: false,
tableData: [],
columnList: [
{ label: "特约店编码", prop: "account", align: "center" },
{ label: "特约店名称", prop: "username" },
{ label: "车牌号", prop: "licensePlate" },
{ label: "车架号", prop: "vin" },
{ label: "设备号", prop: "sn" },
{ label: "车型", prop: "typeName" },
{ label: "开始时间", prop: "journeyBeginTime" },
{ label: "结束时间", prop: "journeyEndTime" },
{ label: "是否有效", prop: "valid",formatter:row => {return row.valid?'是':'否'} },
{ label: "无效原因", prop: "reason",formatter:row => {return row.reason?row.reason:'--'} },
],
pageTotal: 0,
pickerOptions: {
shortcuts: [
{
text: "全部",
onClick(picker) {
const end = '';
const start = '';
picker.$emit("pick", [start, end]);
},
},
{
text: "昨日",
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 1);
picker.$emit("pick", [start, end]);
},
},
{
text: "本周",
onClick(picker) {
const end = moment().format("YYYY-MM-DD");
const start = moment().weekday(1).format("YYYY-MM-DD");
picker.$emit("pick", [start, end]);
},
},
{
text: "上周",
onClick(picker) {
let weekOfDay = parseInt(moment().format("E"));
const end = moment()
.subtract(weekOfDay, "days")
.format("YYYY-MM-DD");
const start = moment()
.subtract(weekOfDay + 7 - 1, "days")
.format("YYYY-MM-DD");
picker.$emit("pick", [start, end]);
},
},
{
text: "本月",
onClick(picker) {
const start = moment().add("month", 0).format("YYYY-MM") + "-01";
const end = moment().format("YYYY-MM-DD");
picker.$emit("pick", [start, end]);
},
},
{
text: "上月",
onClick(picker) {
const end = moment()
.month(moment().month() - 1)
.endOf("month")
.format("YYYY-MM-DD");
const start = moment()
.month(moment().month() - 1)
.startOf("month")
.format("YYYY-MM-DD");
picker.$emit("pick", [start, end]);
},
},
],
},
dloading: false,
timeDate: [],
};
},
components: {
GlsxTable,
},
watch:{
'$route.query':{
handler:function(n,o){
console.log(n)
this.searchForm.keywords = n.vin;
this.timeDate = n.day?[n.day,n.day]:[]
this.getList()
},
immediate: true,
}
},
created(){
let o = this.$route.query;
this.timeDate = o.day?[moment(o.day).format('yyyy-MM-DD'),moment(o.day).format('yyyy-MM-DD')]:[]
},
mounted() {
this.getList();
},
methods: {
// 获取查询参数
getParams() {
let oParams = deepClone(this.searchForm);
let o = this.timeDate || [];
if (o && o.length > 0) {
oParams.sDate = o[0];
oParams.eDate = o[1];
}
oParams.vin = this.$route.query.vin
return oParams;
},
// 获取列表
getList(options) {
let oParams = this.getParams();
console.log(this.$refs.glsxTable.pageSize)
oParams.pageSize = this.$refs.glsxTable.pageSize;
oParams.pageNumber = options ? options.pageNumber || 1 : 1;
this.loading = true
DRIVE_DETAIL_SEARCH(oParams).then((res) => {
this.loading = false
let { data } = res;
let { list, totalElements } = data;
this.pageTotal = totalElements;
this.tableData = list;
}).catch(error => {
this.loading = false
});
},
// 查看详情
lookDetail(row) {
console.log(row);
this.$router.push({ name: "mileageDetail" });
},
// 导出excel
downloadExcel() {
let _this = this;
let oParams = this.getParams();
_this.dloading = true;
_this.$Common.exportExcel({
url: `${_this.$store.state.baseURL}${DRIVE_STATISTICS_EXPORT}`,
method: "GET",
data: oParams,
fileName: "试驾详情报表",
success: () => {
_this.dloading = false;
},
fail: () => {
_this.dloading = false;
},
});
},
// 重置
rest(){
this.timeDate = []
this.searchForm = {};
this.getList();
this.$refs.glsxTable.rest();
},
// 查看轨迹
lookTrack(row) {
let path = `/oEshield#/monitor/replay?sn=${row.sn}&isInitFence=1&name=${row.ownerName}&standno=${row.vin}&startTime=${row.journeyBeginTime||''}&endTime=${row.journeyEndTime||''}&fenceId=${row.fenceId}`;
//let query = {sn:row.sn,isInitFence:1,name:row.name,standno:row.vin};
let query = {}
//this.$router.push({path:path})
// history.pushState(query, path, path);
window.open(path)
}
},
};
</script>
<style lang="scss" scoped>
.pre_select {
width: 100px;
}
.title_tips {
font-size: 14px;
}
.links_group {
display: flex;
align-items: center;
justify-content: space-between;
}
.search_box{
.a_input{
width:260px;
}
}
</style>>