lastLocation.vue
12.8 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
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
<template>
<v-layout>
<template slot="breadcrumb">
<el-breadcrumb-item>统计报表</el-breadcrumb-item>
<el-breadcrumb-item>最后定位列表</el-breadcrumb-item>
</template>
<template slot="main">
<div class="ibox ibox-search">
<el-form>
<el-form-item>
<el-select v-model="query.dateType" class="pull-left" style="width: 160px;margin-right:5px;" placeholder="请选择" size="small">
<el-option label="最后GPS定位时间" value="1"></el-option>
<el-option label="最后基站定位时间" value="2"></el-option>
</el-select>
<!-- 时间范围选择组件 -->
<v-date-range
class="pull-left"
:date="query.dateRange"
activeType="all"
ref="dateRange"
:options="['all','last3', 'last7', 'thisMonth']"
@onDateRangeChange="(arr)=>query.dateRange=arr">
</v-date-range>
<!-- 时间范围选择组件 -->
</el-form-item>
<el-form-item label="激活时间:">
<!-- 时间范围选择组件 -->
<v-date-range
:date="query.activeDateRange"
activeType="all"
ref="activeDateRange"
:options="['all','last3', 'last7', 'thisMonth']"
@onDateRangeChange="(arr)=>query.activeDateRange=arr">
</v-date-range>
<!-- 时间范围选择组件 -->
</el-form-item>
</el-form>
<el-form :inline="true">
<!-- 车辆分组分类组件 -->
<v-vechicle-select ref="vechicle" label="车辆分组/分类:" @onVechicleChange="vechicleChange"></v-vechicle-select>
<!-- 车辆分组分类组件 /-->
<el-form-item label="设备类型:">
<el-select v-model="query.deviceModel" style="width: 80px;" size="small">
<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>
<el-input placeholder="请输入对应条件值" v-model="query.queryTerm" size="small" class="input-with-select" clearable>
<el-select v-model="query.queryType" slot="prepend" style="width:100px;" placeholder="请选择" size="small">
<el-option label="申请单号" value="sqbh"></el-option>
<el-option label="店面名称" value="shopName"></el-option>
<el-option label="姓名" value="name"></el-option>
<el-option label="车架号" value="standno"></el-option>
<el-option label="设备号" value="sn"></el-option>
</el-select>
</el-input>
</el-form-item>
<el-form-item>
<el-switch v-model="query.isIntelligence" active-color="#094" inactive-color="#ccc"></el-switch>
<span style="margin-right: 15px;">
最后定位数据过滤
<el-tooltip class="item" effect="dark" placement="top">
<div slot="content">
<p>最后定位数据过滤:</p>
<p>仅统计该账号权限下,对应车辆“最后定</p>
<p>位时间”并且配合展示定位类型,方便平</p>
<p>台使用者进行区分</p>
</div>
<i class="el-icon-question el-icon--right"></i>
</el-tooltip>
</span>
<el-button type="primary" size="small" @click="onSubmit">搜索</el-button>
<el-button type="primary" size="small" @click="tableReset">重置</el-button>
</el-form-item>
</el-form>
</div>
<div class="ibox">
<div class="ibox-title">
<h3 class="pull-left">最后定位列表</h3>
<el-button type="primary" plain size="small" class="pull-right ibox-ctrl" @click="exportExcel">导出excel <i class="fa fa-download"></i></el-button>
</div>
<div class="ibox-content">
<el-table
:data="tableData"
border
size="small"
v-loading="loading"
@selection-change="selectChange"
style="width: 100%">
<el-table-column type="selection" width="40" align="center"></el-table-column>
<el-table-column fixed type="index" label="序号" :index="getIndex" align="center" width="70"></el-table-column>
<el-table-column fixed prop="sqbh" label="申请单号" min-width="160" align="center"></el-table-column>
<el-table-column fixed prop="shopName" label="店面名称" min-width="200" align="center"></el-table-column>
<el-table-column fixed prop="name" label="姓名" min-width="180" align="center"></el-table-column>
<el-table-column prop="standno" label="车架号" min-width="160" align="center"></el-table-column>
<el-table-column prop="sn" label="设备号" min-width="120" align="center"></el-table-column>
<el-table-column prop="deviceModel" label="设备型号" min-width="140" align="center">
<template slot-scope="scope">
<span v-if="scope.row.deviceModel=='1'" class="ing">有线</span>
<span v-if="scope.row.deviceModel=='2'" class="stop">无线</span>
</template>
</el-table-column>
<el-table-column prop="activeDate" label="激活时间" min-width="240" align="center"></el-table-column>
<el-table-column v-if="!query.isIntelligence" prop="finalGPSPositioningTime" key="finalGPSPositioningTime" label="最后GPS定位时间" min-width="240" align="center"></el-table-column>
<el-table-column v-if="!query.isIntelligence" prop="finalRTPositioningTime" key="finalRTPositioningTime" label="最后基站定位时间" min-width="240" align="center"></el-table-column>
<el-table-column v-if="query.isIntelligence" prop="lastPoiTime" key="lastPoiTime" label="最后定位时间" min-width="240" align="center"></el-table-column>
<el-table-column v-if="query.isIntelligence" prop="poiType" key="poiType" label="最后定位类型" min-width="120" align="center"></el-table-column>
<el-table-column v-if="query.isIntelligence" prop="lastAddress" key="lastAddress" label="最后定位地址" min-width="240" align="center"></el-table-column>
</el-table>
<div class="table-page-wrap">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total">
</el-pagination>
</div>
</div>
</div>
</template>
</v-layout>
</template>
<script>
import vDateRange from 'components/DateRange.vue'
const vVechicleSelect = () => import(/* webpackChunkName: "vVechicleSelect" */ 'components/VechicleSelect.vue');
import {exportExcel} from 'utils'
import {services} from '../../api'
const REPORT_SERVICE = services.report;
export default{
data(){
return {
loading: true,
currentPage: 1,
pageSize: 10,
total: 0,
tableData: [],
selectedIds: [],
query: {
dateType: '1',
dateRange: [],
activeDateRange: [],
deviceModel: '',
queryTerm: '',
queryType: 'sqbh',
groupId: '',
classId: '',
isIntelligence: false
}
}
},
created(){
this.getData();
},
computed: {
},
watch: {
'query.isIntelligence'(){
this.onSubmit()
}
},
methods: {
getIndex(index){
return (this.currentPage-1)*this.pageSize+index+1;
},
getData(curr=this.currentPage, size=this.pageSize){
this.loading = true;
let params = this.getParams();
let param = this.getParams();
params.currentPage = curr;
params.pageSize = size;
REPORT_SERVICE.finalPostioning(params).then((response)=>{
if(Array.isArray(response.data)){
this.tableData = response.data;
//this.total = response.recordsTotal;
}else{
this.tableData = [];
//this.total = 0;
}
this.loading = false;
});
REPORT_SERVICE.finalTotal(param).then((response)=>{
if(response.data){
//this.tableData = response.data;
this.total = response.data;
}else{
//this.tableData = [];
this.total = 0;
}
//this.loading = false;
});
},
getParams(){
const query = this.query;
const params = {};
if(query.groupId){
params.groupId = query.groupId
}
if(query.classId){
params.classId = query.classId
}
if(query.dateRange&&query.dateRange.length){
if(query.dateType === '1'){
params.finalGPSPositioningTimeStart = moment(query.dateRange[0]).format('YYYY-MM-DD HH:mm:ss');
params.finalGPSPositioningTimeEnd = moment(query.dateRange[1]).endOf('day').format('YYYY-MM-DD HH:mm:ss')
}else if(query.dateType === '2'){
params.finalRTPositioningTimeStart = moment(query.dateRange[0]).format('YYYY-MM-DD HH:mm:ss');
params.finalRTPositioningTimeEnd = moment(query.dateRange[1]).endOf('day').format('YYYY-MM-DD HH:mm:ss')
}
}
if(query.activeDateRange&&query.activeDateRange.length){
params.activeDateStart = moment(query.activeDateRange[0]).format('YYYY-MM-DD HH:mm:ss');
params.activeDateEnd = moment(query.activeDateRange[1]).endOf('day').format('YYYY-MM-DD HH:mm:ss')
}
if(query.queryTerm){
params[query.queryType] = query.queryTerm
}
params.deviceModel = query.deviceModel;
params.filterFlag = query.isIntelligence?1:0
return params;
},
tableReset(){
this.query = {
dateType: '1',
dateRange: [],
activeDateRange: [],
deviceModel: '',
queryTerm: '',
queryType: 'sqbh',
groupId: '',
classId: ''
}
this.$refs.vechicle.resetSelet();
this.$refs.dateRange.reset();
this.$refs.activeDateRange.reset();
},
renderHeaderInput: function (h, { column, $index }) {
const self = this;
return h(
'p',{
class: 'table-header-ctrl'
},[
h('span', [column.label]),
h('br'),
h('el-input', {
props: {
size: 'mini',
value: self.query[column.property]
},
on: {
input(query) {
self.query[column.property] = query;
}
}
})
]
);
},
renderDatePicker: function (h, { column, $index }) {
const self = this;
const result = h('el-date-picker', {
props: {
size: 'mini',
type: 'daterange',
placeholder: '',
value: self.query[column.property]
},
on: {
input(val) {
self.query[column.property] = val;
}
}
})
return h(
'p',{
class: 'table-header-ctrl'
},[
h('span', [column.label]),
result
]
);
},
renderSelect(h, { column, $index }){
const self = this;
return h(
'p',{
class: 'table-header-ctrl'
},[
h('span', [column.label]),
h('br'),
h('el-select', {
props: {
size: 'mini',
value: self.query.deviceModel
},
on: {
change(val) {
self.query.deviceModel = val;
}
}
},[
h('el-option', {
props: {
value: '0',
label: '全部'
}
}),
h('el-option', {
props: {
value: '1',
label: '有线'
}
}),
h('el-option', {
props: {
value: '2',
label: '无线'
}
})
])
]
);
},
selectChange(selection){
this.selectedIds = [];
selection.map((obj)=>{
this.selectedIds.push(obj.trackerId)
});
},
handleSizeChange(val) {
this.pageSize = val;
this.getData(this.currentPage,this.pageSize)
},
handleCurrentChange(val) {
this.currentPage = val;
this.getData(val)
},
onSubmit(){
this.currentPage = 1;
this.pageSize = 10;
this.getData();
},
exportExcel(){
const url = 'finalPostioning/exportFinalPositingList';
if(this.selectedIds.length){
exportExcel(url, {idList: this.selectedIds.join(',')})
}else{
exportExcel(url, this.getParams())
}
},
vechicleChange(groupId, classId){
this.query.groupId = groupId;
this.query.classId = classId;
}
},
components:{
vDateRange,
vVechicleSelect
}
}
</script>
<style lang="scss">
</style>