425 lines
11 KiB
Vue
Raw Normal View History

<template>
<div class="bottomBox">
<div class="select-right">
<div class="day selected" @click="getDateData(1)" :class="checked == 1 ? 'active' : ''">今日记录</div>
<div class="week selected" @click="getDateData(2)" :class="checked == 2 ? 'active' : ''">历史记录</div>
2024-10-15 15:36:21 +08:00
<div class="week selected" @click="getDateitem(3)" :class="checked == 3 ? 'active' : ''">车辆超速记录</div>
</div>
<div class="title">
<i>出入场记录</i>
</div>
<div class="content">
2024-10-15 15:36:21 +08:00
<template v-if="checked == 1 || checked == 2">
<div class="tabList">
<div>序号</div>
<div>车牌号</div>
<div>进出时间</div>
<div>进出标识</div>
<div>进出位置</div>
<div>车辆颜色</div>
<div>车辆类型</div>
<div>进出场图片</div>
<div>全景图照片</div>
</div>
2025-04-02 19:05:24 +08:00
<el-scrollbar class="listBox" ref="refScrollbar">
2024-10-15 15:36:21 +08:00
<template v-if="vehicleData.length > 0">
2025-04-02 19:05:24 +08:00
<div v-infinite-scroll="load">
2024-11-15 13:53:37 +08:00
<div v-for="(item, index) in vehicleData" class="listStyle" :key="item.id">
<div>
<span>{{ index + 1 }}</span>
</div>
<div>
<span>{{ item.carNumber }}</span>
</div>
<div>
<span>{{ item.passTime }}</span>
</div>
<div>
<span>{{ item.type == 1 ? "出" : "进" }}</span>
</div>
<div>
<span>{{ item.location }}</span>
</div>
<div>
<span>{{ item.carColor }}</span>
</div>
<div>
<span>{{ item.carType ? carTypeList[item.carType - 1].name : "" }}</span>
</div>
<div class="list-img">
<el-image
v-if="item.imageUrl"
fit="contain"
class="el-img"
:src="BASEURL + '/image/' + item.imageUrl"
:preview-src-list="[BASEURL + '/image/' + item.imageUrl]"
>
<template #error>
<div class="image-slot">
<el-image :src="noDataImage" :preview-src-list="[noDataImage]" fit="contain" class="el-img" alt />
</div>
</template>
</el-image>
<!-- <img v-else src="@/assets/images/vehicleManagement/car.png" alt="" /> -->
<el-image v-else :src="noDataImage" :preview-src-list="[noDataImage]" fit="contain" class="el-img" alt />
</div>
<div class="list-img">
<el-image
v-if="item.panoramaUrl"
fit="contain"
class="el-img"
:src="BASEURL + '/image/' + item.panoramaUrl"
:preview-src-list="[BASEURL + '/image/' + item.panoramaUrl]"
>
<template #error>
<div class="image-slot">
<el-image :src="noDataImage" :preview-src-list="[noDataImage]" fit="contain" class="el-img" alt />
</div>
</template>
</el-image>
<!-- <img v-else src="@/assets/images/vehicleManagement/car.png" alt="" /> -->
<el-image v-else :src="noDataImage" :preview-src-list="[noDataImage]" fit="contain" class="el-img" alt />
</div>
2024-10-15 15:36:21 +08:00
</div>
2024-03-18 19:27:25 +08:00
</div>
2024-10-15 15:36:21 +08:00
</template>
<div class="notoDta" v-if="vehicleData.length == 0">
<img src="@/assets/images/noData.png" alt />
<p>暂无数据</p>
</div>
2024-10-15 15:36:21 +08:00
</el-scrollbar>
</template>
<!-- 车辆超速记录 -->
<template v-if="checked == 3">
<div class="tabList">
<div>序号</div>
<div>车牌号</div>
<div>是否超出阈值</div>
2024-11-06 17:10:25 +08:00
<div>当前车速km/h</div>
2024-10-15 15:36:21 +08:00
<div>超出阈值</div>
<div>抓拍照片</div>
</div>
2024-10-15 15:36:21 +08:00
<el-scrollbar class="listBox" ref="refScrollbar">
<template v-if="nametabledata.length > 0">
2025-04-02 19:05:24 +08:00
<div v-infinite-scroll="load">
2024-11-15 13:53:37 +08:00
<div v-for="(item, index) in nametabledata" class="listStyle" :key="item.id">
<div>
<span>{{ index + 1 }}</span>
</div>
<div>
<span>{{ item.carNumber }}</span>
</div>
<div>
<span>{{ item.isExceed == 1 ? "是" : "否" }}</span>
</div>
<div>
<span>{{ item.currentSpeed }}</span>
</div>
<div>
<span>{{ item.exceedingThreshold }}</span>
</div>
<div>
<el-image
:src="BASEURL + '/image/' + item.snapshotImage"
:preview-src-list="[BASEURL + '/image/' + item.snapshotImage]"
:initial-index="0"
fit="cover"
style="width: 30px; height: 30px"
>
<template #error>
<div class="image-slot">
<i class="el-icon-picture-outline"></i>
</div>
</template>
</el-image>
</div>
2024-10-15 15:36:21 +08:00
</div>
</div>
</template>
<div class="notoDta" v-if="nametabledata.length == 0">
<img src="@/assets/images/noData.png" alt />
<p>暂无数据</p>
</div>
</el-scrollbar>
</template>
</div>
</div>
</template>
<script lang="ts" setup>
import { reactive, ref, onMounted } from "vue";
2025-04-02 19:05:24 +08:00
import { getEntryAndExitListApi, carMeasureSpeedData } from "@/api/modules/vehicle";
import { GlobalStore } from "@/stores";
2024-04-09 21:16:36 +08:00
import noDataImage from "@/assets/images/vehicleManagement/car.png";
2024-11-15 13:53:37 +08:00
import { ElMessage } from "element-plus";
const store = GlobalStore();
const BASEURL = import.meta.env.VITE_API_URL;
2024-03-18 19:27:25 +08:00
const pageNo = ref(1 as any);
2025-04-02 19:05:24 +08:00
const pageSize = ref(30 as any);
2024-03-18 19:27:25 +08:00
const moreScroll = ref(true as any);
const refScrollbar = ref(null as any); // 绑定到滚动的盒子上
const carTypeList = ref([
{
value: "1",
name: "白名单"
},
{
value: "2",
name: "黑名单"
},
{
value: "3",
name: "临时车"
}
]);
const vehicleData = ref([] as any);
2024-10-15 15:36:21 +08:00
const nametabledata = ref([] as any);
//
// 选中
const checked = ref(1);
const getDateData = (type: any) => {
checked.value = type;
2024-03-18 19:27:25 +08:00
pageNo.value = 1;
moreScroll.value = true;
refScrollbar.value.wrapRef.scrollTop = 0; // 滚动条置顶
2024-11-15 13:53:37 +08:00
vehicleData.value = [];
2025-04-02 19:05:24 +08:00
getVehicleList("search");
2024-03-18 19:27:25 +08:00
};
2024-10-15 15:36:21 +08:00
// 车辆超速记录
const getDateitem = (type: any) => {
checked.value = type;
pageNo.value = 1;
2024-11-15 13:53:37 +08:00
vehicleData.value = [];
getAndExitListApi();
2024-10-15 15:36:21 +08:00
};
2025-04-02 19:05:24 +08:00
const load = async () => {
console.log("加载", pageNo.value * pageSize.value);
if(pageNo.value > 1 && vehicleData.value.length == 0) return
if(pageNo.value * pageSize.value > vehicleData.value.length) return ElMessage.warning("到底部了!");
if(checked.value == 1 || checked.value == 2){
2024-11-15 13:53:37 +08:00
getVehicleList();
} else {
getAndExitListApi();
}
2025-04-02 19:05:24 +08:00
pageNo.value += 1;
}
2024-11-15 13:53:37 +08:00
2024-10-15 15:36:21 +08:00
// 车辆超速记录
2025-04-02 19:05:24 +08:00
const getVehicleList = async (tip?: any) => {
const res: any = await getEntryAndExitListApi({
projectSn: store.sn,
2024-03-18 19:27:25 +08:00
timeType: checked.value,
pageNo: pageNo.value,
2025-04-02 19:05:24 +08:00
pageSize: pageSize.value
});
if (res.result) {
2025-04-02 19:05:24 +08:00
vehicleData.value = vehicleData.value.concat(res.result.records);
2024-11-15 13:53:37 +08:00
// if (tip == "more") {
// vehicleData.value = vehicleData.value.concat(res.result.records);
// } else {
// vehicleData.value = res.result.records;
// }
// if (res.result.pages == pageNo.value) {
// moreScroll.value = false;
// } else {
// pageNo.value = pageNo.value + 1;
// }
}
};
2024-10-15 15:36:21 +08:00
const getAndExitListApi = async () => {
const res: any = await carMeasureSpeedData({
2025-01-14 09:35:29 +08:00
projectSn: store.sn,
2024-10-15 15:36:21 +08:00
// timeType: checked.value,
2024-11-15 13:53:37 +08:00
// pageNo: 1,
// pageSize: 30
pageNo: pageNo.value,
pageSize: pageSize.value
2024-10-15 15:36:21 +08:00
});
console.log("测速-历史记录", res);
2025-04-02 19:05:24 +08:00
nametabledata.value = nametabledata.value.concat(res.result.records);
2024-10-15 15:36:21 +08:00
};
2024-04-13 11:08:23 +08:00
//将方法暴露给父组件
defineExpose({
getVehicleList
2024-10-15 15:36:21 +08:00
});
onMounted(async () => {
2024-03-18 19:27:25 +08:00
// console.log("滚动容器", refScrollbar.value);
2024-11-15 13:53:37 +08:00
// refScrollbar.value.wrapRef.addEventListener("scroll", (e: any) => {
// const scrollTop = e.target.scrollTop;
// const scrollHeight = e.target.scrollHeight;
// const clientHeight = e.target.clientHeight;
// // console.log("滚动容器", scrollTop, scrollHeight, clientHeight);
// // 向上加载更多
// if (scrollTop >= scrollHeight - clientHeight) {
// // console.log("加载更多");
// if (moreScroll.value) {
// getVehicleList("more");
// }
// }
// });
2025-04-02 19:05:24 +08:00
await getVehicleList("search");
await getAndExitListApi();
});
</script>
<style lang="scss" scoped>
.bottomBox {
width: 100%;
height: 100%;
position: relative;
.select-right {
2024-03-18 19:27:25 +08:00
width: 20%;
display: flex;
position: absolute;
z-index: 10;
color: #fff;
font-size: 10px;
text-align: center;
line-height: 20px;
left: 21%;
top: 2.7%;
.selected {
height: 5%;
background: url("@/assets/images/dustNoise/rightImg2.png") no-repeat;
background-size: 100% 100%;
cursor: pointer;
}
.day {
padding: 0 6%;
margin-right: 5%;
z-index: 99;
}
.week {
padding: 0 6%;
margin-right: 5%;
z-index: 99;
}
.month {
padding: 0 6%;
z-index: 99;
}
.active {
background: url("@/assets/images/dustNoise/rightImg.png") no-repeat;
background-size: 100% 100%;
}
2024-03-18 19:27:25 +08:00
}
.title {
height: 10%;
line-height: 35px;
text-align: left;
font-size: calc(100vw * 18 / 1920);
color: #ffffff;
background: url("@/assets/images/larborManagement/videoPlayer.webp") no-repeat;
background-size: 100% 100%;
i {
margin-left: 50px;
font-family: OPPOSansH;
}
}
.content {
height: 88%;
width: 100%;
margin-top: 10px;
background: url("@/assets/images/cardImg.png") no-repeat;
background-size: 100% 100%;
2024-10-15 15:36:21 +08:00
.tablist-item {
height: 100%;
::v-deep .el-table {
.el-table,
.el-table__row,
.el-table__cell,
.el-table__body,
.el-table__header {
background-color: transparent !important;
}
.el-table__row {
border: none !important;
}
}
}
.tabList {
display: flex;
width: 100%;
height: 10%;
background: url("@/assets/images/vehicleManagement/ListTitleImg.png") no-repeat;
background-size: 100% 100%;
// position: absolute;
left: 75.5%;
top: 75%;
color: #ccc;
font-size: calc(100vw * 14 / 1920);
line-height: 30px;
justify-content: space-around;
div {
text-align: center;
width: 11%;
}
}
.listBox {
2024-03-18 19:27:25 +08:00
height: 80%;
.listStyle {
display: flex;
justify-content: space-around;
color: #fff;
2024-04-09 20:58:48 +08:00
// line-height: 25px;
font-size: calc(100vw * 12 / 1920);
.list-img {
.el-img {
2024-03-18 19:27:25 +08:00
width: 50px;
height: 25px;
}
2024-04-09 21:16:36 +08:00
.image-slot {
width: 50px;
height: 25px;
img {
width: 100%;
height: 100%;
}
}
> img {
2024-04-09 20:58:48 +08:00
width: 62px;
height: 62px;
}
}
div {
text-align: center;
width: 11%;
2024-04-09 20:58:48 +08:00
display: flex;
align-items: center;
2024-04-09 21:16:36 +08:00
justify-content: center;
}
}
.listStyle:hover {
background: #091f3f;
}
}
}
}
.notoDta {
2025-04-02 19:05:24 +08:00
top: 45%;
2024-03-18 19:27:25 +08:00
width: 20%;
left: 39%;
position: absolute;
img {
width: 40%;
margin: 5% 30%;
}
2024-03-18 19:27:25 +08:00
p {
color: #fff;
font-size: calc(100vw * 14 / 1920);
margin: -6% 37%;
text-align: center;
}
}
</style>