gatheringAlarmDetail.vue
10.3 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
<template>
<el-drawer
title="研判警情详情"
:visible.sync="visible"
direction="rtl"
size="70%"
custom-class="gathering-alarm-detail-drawer"
:wrapper-closable="false"
:before-close="handleClose"
@closed="handleClosed"
>
<div class="detail-container">
<!-- 基本信息 -->
<div class="info-section">
<div class="info-row">
<div class="info-item">
<label>姓名/车架号:</label>
<span>{{ (currentRow.ownerName || '--') + '/' + (currentRow.vin || '--') }}</span>
</div>
<div class="info-item">
<label>车辆归属:</label>
<span>{{ currentRow.creator || '--' }}</span>
</div>
<div class="info-item">
<label>报警类型:</label>
<span>{{ currentRow.alarmTypeDesc || '--' }}</span>
</div>
</div>
<div class="info-row">
<div class="info-item">
<label>设备号:</label>
<span>{{ getVehicleSnsText() }}</span>
</div>
<div class="info-item">
<label>报警次数(合):</label>
<span>{{ currentRow.alarmCount || 0 }}</span>
</div>
<div class="info-item">
<label>风险等级:</label>
<span>{{ currentRow.alarmLevel || '--' }}</span>
</div>
</div>
</div>
<!-- 警情明细 -->
<div class="detail-section">
<h4 class="section-title">警情明细</h4>
<!-- 搜索区域 -->
<div class="search_box">
<el-form :inline="true" size="small">
<el-form-item label="报警时间:">
<el-date-picker
v-model="detailSearchForm.timeDate"
type="daterange"
class="data_picker"
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 label="设备号:">
<el-input v-model="detailSearchForm.keywords" placeholder="设备号"></el-input>
</el-form-item>
<el-form-item label="报警状态:">
<el-select v-model="detailSearchForm.alarmStatus" class="small_select" 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-select v-model="detailSearchForm.alarmType" class="small_select">
<el-option label="全部" value=""></el-option>
<el-option label="黑区报警" value="3"></el-option>
<el-option label="聚集报警" value="2"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button icon="el-icon-search" type="primary" @click="searchDetailList()">搜索</el-button>
</el-form-item>
<el-form-item>
<el-button icon="el-icon-refresh" type="default" @click="restDetail()">重置</el-button>
</el-form-item>
</el-form>
</div>
<!-- 列表 -->
<div class="table_box">
<el-table class="el_table" :data="detailTableData" border size="small" v-loading="tloading">
<el-table-column label="设备号" prop="sn"></el-table-column>
<el-table-column label="报警类型" prop="alarmTypeStr"></el-table-column>
<el-table-column label="风险等级" prop="alarmLevel"></el-table-column>
<el-table-column label="报警状态" prop="alarmStatusStr"></el-table-column>
<el-table-column label="报警编号" prop="geoCode"></el-table-column>
<el-table-column label="报警地点" prop="alarmAddress"></el-table-column>
<el-table-column label="进入区域时间" prop="alarmBeginTime"></el-table-column>
<el-table-column label="驶出区域时间" prop="alarmEndTime"></el-table-column>
<el-table-column label="停留时长" prop="alarmDuration"></el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="130px">
<template slot-scope="{row}">
<el-link class="el_link" type="primary" @click="lookLocation(row)" v-if="row.alarmLng">查看报警位置</el-link>
</template>
</el-table-column>
</el-table>
<div class="pagination_list">
<el-pagination
background
layout="sizes, total, prev, pager, next, jumper"
:total="detailPageTotal"
:page-size="detailPageSize"
:page-sizes="detailPageSizes"
@current-change="getDetailList"
@size-change="changeDetailPageSize"
/>
</div>
</div>
</div>
</div>
</el-drawer>
</template>
<script>
import moment from "moment";
import qs from "qs";
import { GETJUDGMENTSEARCH } from "@/services/alarmCenter";
export default {
props: {
value: { type: Boolean, default: false },
row: { type: Object, default: () => ({}) },
},
data() {
return {
currentRow: {},
detailSearchForm: { alarmStatus: "", alarmType: "" },
detailTableData: [],
detailPageTotal: 0,
detailPageSizes: [10, 20, 30, 40],
detailPageSize: 10,
detailCurrentPage: 1,
tloading: false,
pickerOptions: {
shortcuts: [
{
text: "全部",
onClick(picker) {
picker.$emit("pick", ["", ""]);
},
},
{
text: "今日",
onClick(picker) {
const today = new Date();
picker.$emit("pick", [today, today]);
},
},
{
text: "近3天",
onClick(picker) {
const end = moment().format("YYYY-MM-DD");
const start = moment().day(moment().day() - 3).format("YYYY-MM-DD");
picker.$emit("pick", [start, end]);
},
},
{
text: "近7天",
onClick(picker) {
const end = moment().format("YYYY-MM-DD");
const start = moment().day(moment().day() - 7).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]);
},
},
],
},
};
},
computed: {
visible: {
get() { return this.value; },
set(val) { this.$emit("input", val); },
},
},
watch: {
value(val) {
if (val) {
this.currentRow = { ...this.row };
this.$nextTick(() => {
this.getDetailList();
});
}
},
},
methods: {
getVehicleSnsText() {
return Array.isArray(this.currentRow.vehicleSns)
? this.currentRow.vehicleSns.join(",")
: "--";
},
handleClose(done) {
done();
},
handleClosed() {
this.detailSearchForm = { alarmStatus: "", alarmType: "" };
this.detailTableData = [];
this.detailPageTotal = 0;
this.detailCurrentPage = 1;
},
// 搜索(重置到第一页)
searchDetailList() {
this.detailCurrentPage = 1;
this.getDetailList(1);
},
// 重置
restDetail() {
this.detailSearchForm = { alarmStatus: "", alarmType: "" };
this.detailCurrentPage = 1;
this.getDetailList(1);
},
// 获取查询参数
getDetailParams() {
let oParams = JSON.parse(JSON.stringify(this.detailSearchForm));
let m = oParams.timeDate;
if (m && m.length > 0) {
oParams.startTime = m[0];
oParams.endTime = m[1];
}
delete oParams.timeDate;
// 带上当前行数据
oParams.vehicleId = this.currentRow.vehicleId;
// oParams.vin = this.currentRow.vin;
// oParams.workOrderNo = this.currentRow.workOrderNo;
return oParams;
},
// 获取明细列表
getDetailList(current) {
let oParams = this.getDetailParams();
oParams.pageSize = this.detailPageSize;
oParams.pageNumber = current || this.detailCurrentPage;
this.tloading = true;
GETJUDGMENTSEARCH(oParams)
.then((res) => {
let obj = res.data || {};
this.detailTableData = obj.list || [];
this.detailPageTotal = obj.totalElements || 0;
this.detailCurrentPage = oParams.pageNumber;
})
.finally(() => {
this.tloading = false;
});
},
// 每页展示
changeDetailPageSize(e) {
this.detailPageSize = e;
this.detailCurrentPage = 1;
this.getDetailList(1);
},
// 查看报警位置
lookLocation(row) {
let oParams = { ...row };
oParams.lng = row.alarmLng;
oParams.lat = row.alarmLat;
oParams.address = row.alarmAddress;
oParams.name = row.ownerName;
oParams.standNo = row.vin;
oParams.time = row.alarmBeginTime;
let path = `/oEshield/#/monitor/activeLocation?${qs.stringify(oParams)}`;
window.open(path);
},
},
};
</script>
<style lang="scss" scoped>
.detail-container {
padding: 0 20px;
}
.info-section {
margin-bottom: 24px;
.info-row {
display: flex;
padding: 12px 0;
//border-bottom: 1px solid #eee;
}
.info-item {
flex: 1;
font-size: 14px;
label {
color: #999;
margin-right: 4px;
}
span {
color: #333;
}
}
}
.detail-section {
.section-title {
font-size: 16px;
font-weight: bold;
color: #333;
margin: 0 0 16px 0;
padding-bottom: 10px;
//border-bottom: 1px solid #eee;
}
}
</style>
<style lang="scss">
.gathering-alarm-detail-drawer {
display: flex;
flex-direction: column;
}
.gathering-alarm-detail-drawer .el-drawer__body {
flex: 1;
min-height: 0;
overflow-y: auto !important;
overflow-x: hidden;
}
</style>