Commit cbccb85c by liimin

将警情列表重构为「主列表(车辆维度)+ 抽屉详情(设备维度)」两层结构

1 parent 23400f2f
......@@ -234,10 +234,19 @@ const routes = [
keepAlive: true,
},
},
// {
// path: "/alarmCenter/hadoop",
// name: "hadoopAlarm",
// component: () => import("../views/alarmCenter/hadoop.vue"),
// meta: {
// title: "大数据研判警情",
// keepAlive: true,
// },
// },
{
path: "/alarmCenter/hadoop",
name: "hadoopAlarm",
component: () => import("../views/alarmCenter/hadoop.vue"),
name: "gatheringAlarm",
component: () => import("../views/alarmCenter/gatheringAlarm.vue"),
meta: {
title: "大数据研判警情",
keepAlive: true,
......
......@@ -12,6 +12,11 @@ export const GETJUDGMENTSEARCH = (params) => {
return request(params, "/trialdrive/judgment/search");
}
// 警情中心-大数据研判警情-警情车辆列表
export const GETJUDGMENTALARMVEHICLELIST = (params) => {
return request(params, "/trialdrive/judgment/alarmVehicleList");
}
// 警情中心-大数据研判警情-导出excel
export const ALARM_HADOOP_EXPORT = (params) => {
return request(params, "/trialdrive/judgment/export");
......
<template>
<div class="">
<div class="page_title">
<h2 class="h2">聚集报警</h2>
<h3 class="h3">用于统计展示车辆聚集警情,数据信息按自然日统计生成</h3>
</div>
<!-- 搜索区域 开始 -->
<div class="search_box">
<el-form :inline="true" size="small">
<el-form-item label="车辆归属:">
<el-popover v-model="filterVisible" placement="bottom-start" width="400" trigger="click">
<div>
<glsx-organization @change="onChange"></glsx-organization>
</div>
<el-input v-model="searchForm.orgName" :placeholder="searchForm.specialShopName || '所属组织'" slot="reference" readonly clearable>
</el-input>
</el-popover>
</el-form-item>
<el-form-item label="报警类型:">
<el-select v-model="searchForm.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 label="关键字">
<el-input v-model="searchForm.keywords" placeholder="设备号|车架号|姓名"></el-input>
</el-form-item>
<el-form-item>
<el-button icon="el-icon-search" type="primary" @click="getList()">搜索</el-button>
</el-form-item>
<el-form-item>
<el-button icon="el-icon-refresh" type="default" @click="rest()">重置</el-button>
</el-form-item>
</el-form>
</div>
<!-- 搜索区域 end -->
<!-- 操作区域 开始 -->
<div class="links_group">
<span class="name">聚集报警</span>
<el-button type="primary" size="small" icon="el-icon-download" :loading="dloading" @click="downloadExcel()">导出excel</el-button>
</div>
<!-- 操作区域 end -->
<!-- 表格区域 开始 -->
<div class="table_box">
<el-table class="el_table" :data="tableData" border size="small" v-loading="tloading">
<el-table-column label="序号" type="index" width="60" align="center"></el-table-column>
<el-table-column label="工单号" prop="workOrderNo"></el-table-column>
<el-table-column label="姓名" prop="ownerName"></el-table-column>
<el-table-column label="车架号" prop="vin"></el-table-column>
<el-table-column label="品牌车型" prop="modelName"></el-table-column>
<el-table-column label="车辆归属" prop="creator"></el-table-column>
<el-table-column label="设备号" prop="vehicleSns">
<template slot-scope="{row}">
{{row.vehicleSns && row.vehicleSns.length ? row.vehicleSns.join(', ') : '--'}}
</template>
</el-table-column>
<el-table-column label="报警次数" prop="alarmCount">
<template slot-scope="{row}">
{{row.alarmCount || 0}}
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="100px">
<template slot-scope="{row}">
<el-link class="el_link" type="primary" @click="lookDetail(row)">查看详情</el-link>
</template>
</el-table-column>
</el-table>
<div class="pagination_list">
<el-pagination background layout="sizes, total,prev, pager, next, jumper" :total="pageTotal" :page-size="pageSize" :page-sizes="pageSizes" @current-change="getList" @size-change="changePageSize" />
</div>
</div>
<!-- 表格区域 end -->
<!-- 详情抽屉 -->
<gathering-alarm-detail v-model="drawerVisible" :row="currentRow" />
</div>
</template>
<script>
import GlsxOrganization from "@/components/glsx-organization";
import GatheringAlarmDetail from "./gatheringAlarmDetail.vue";
import { GETJUDGMENTALARMVEHICLELIST, ALARM_HADOOP_EXPORT } from "@/services/alarmCenter";
import { deepClone, showToast } from "@/utils/util";
export default {
components: {
GlsxOrganization,
GatheringAlarmDetail,
},
data() {
return {
searchForm: { alarmType: "" },
currentPage: 1,
pageSizes: [10, 20, 30, 40],
pageSize: 10,
pageTotal: 0,
tableData: [],
filterVisible: false,
orgInfo: {},
dloading: false,
tloading: false,
drawerVisible: false,
currentRow: {},
};
},
mounted() {
this.getList();
},
methods: {
// 重置
rest() {
this.searchForm = { alarmType: "" };
this.getList();
},
// 获取查询参数
getParams() {
let oParams = deepClone(this.searchForm);
delete oParams.orgName;
return oParams;
},
// 获取数据列表
getList(current) {
let oParams = this.getParams();
oParams.pageSize = this.pageSize;
oParams.pageNumber = current || this.currentPage;
this.tloading = true;
GETJUDGMENTALARMVEHICLELIST(oParams).then((res) => {
this.tloading = false;
let obj = res.data || {};
this.tableData = obj.list;
this.pageTotal = obj.totalElements;
});
},
// 每页展示
changePageSize(e) {
this.pageSize = e;
this.getList();
},
// 监听组织树
onChange(e) {
this.filterVisible = false;
if (e) {
this.orgInfo = e.origin;
this.searchForm.orgId = e.origin.orgId;
this.searchForm.orgType = e.origin.type;
this.searchForm.orgName = e.origin.orgName;
}
},
// 导出excel
downloadExcel() {
let _this = this;
let oParams = this.getParams();
_this.dloading = true;
ALARM_HADOOP_EXPORT(oParams).then((res) => {
_this.dloading = false;
if (res.code != 200) {
return false;
}
window.open(res.data);
});
},
// 查看详情
lookDetail(row) {
this.currentRow = row;
this.drawerVisible = true;
},
},
};
</script>
<style lang="scss" scoped>
@import "@/styles/hadoop.scss";
</style>
<template>
<el-drawer
title="研判警情详情"
:visible.sync="visible"
direction="rtl"
size="70%"
: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.vin || '--' }}</span>
</div>
<div class="info-item">
<label>车辆归属:</label>
<span>{{ currentRow.orgName || '--' }}</span>
</div>
<div class="info-item">
<label>报警详情:</label>
<span>{{ currentRow.alarmDetail || '--' }}</span>
</div>
</div>
<div class="info-row">
<div class="info-item">
<label>设备号:</label>
<span>{{ currentRow.sn || '--' }}</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.sn" 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>
<el-button icon="el-icon-search" type="primary" @click="getDetailList()">搜索</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="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="durationStr"></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";
export default {
props: {
value: { type: Boolean, default: false },
row: { type: Object, default: () => ({}) },
},
data() {
return {
currentRow: {},
detailSearchForm: { alarmStatus: "" },
detailTableData: [],
detailPageTotal: 0,
detailPageSizes: [10, 20, 30, 40],
detailPageSize: 10,
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: {
handleClose(done) {
done();
},
handleClosed() {
this.detailSearchForm = { alarmStatus: "" };
this.detailTableData = [];
this.detailPageTotal = 0;
},
// 重置
restDetail() {
this.detailSearchForm = { alarmStatus: "" };
this.getDetailList();
},
// 获取查询参数
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.vin = this.currentRow.vin;
oParams.workOrderNo = this.currentRow.workOrderNo;
return oParams;
},
// 获取明细列表
getDetailList(current) {
let oParams = this.getDetailParams();
oParams.pageSize = this.detailPageSize;
oParams.pageNumber = current || 1;
this.tloading = true;
// TODO: 替换为实际明细列表接口
// GETJUDGMENTDETAILSEARCH(oParams)
// .then((res) => {
// this.tloading = false;
// let obj = res.data || {};
// this.detailTableData = obj.list || [];
// this.detailPageTotal = obj.totalElements || 0;
// });
// 临时模拟空数据
this.tloading = false;
this.detailTableData = [];
this.detailPageTotal = 0;
},
// 每页展示
changeDetailPageSize(e) {
this.detailPageSize = e;
this.getDetailList();
},
// 查看报警位置
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: 8px 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>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!