2025-04-10 19:02:38 +08:00

425 lines
11 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<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>
<div class="week selected" @click="getDateitem(3)" :class="checked == 3 ? 'active' : ''">车辆超速记录</div>
</div>
<div class="title">
<i>出入场记录</i>
</div>
<div class="content">
<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>
<el-scrollbar class="listBox" ref="refScrollbar">
<template v-if="vehicleData.length > 0">
<div v-infinite-scroll="load">
<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>
</div>
</div>
</template>
<div class="notoDta" v-if="vehicleData.length == 0">
<img src="@/assets/images/noData.png" alt />
<p>暂无数据</p>
</div>
</el-scrollbar>
</template>
<!-- 车辆超速记录 -->
<template v-if="checked == 3">
<div class="tabList">
<div>序号</div>
<div>车牌号</div>
<div>是否超出阈值</div>
<div>当前车速km/h</div>
<div>超出阈值</div>
<div>抓拍照片</div>
</div>
<el-scrollbar class="listBox" ref="refScrollbar">
<template v-if="nametabledata.length > 0">
<div v-infinite-scroll="load">
<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>
</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";
import { getEntryAndExitListApi, carMeasureSpeedData } from "@/api/modules/vehicle";
import { GlobalStore } from "@/stores";
import noDataImage from "@/assets/images/vehicleManagement/car.png";
import { ElMessage } from "element-plus";
const store = GlobalStore();
const BASEURL = import.meta.env.VITE_API_URL;
const pageNo = ref(1 as any);
const pageSize = ref(30 as any);
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);
const nametabledata = ref([] as any);
//
// 选中
const checked = ref(1);
const getDateData = (type: any) => {
checked.value = type;
pageNo.value = 1;
moreScroll.value = true;
refScrollbar.value.wrapRef.scrollTop = 0; // 滚动条置顶
vehicleData.value = [];
getVehicleList("search");
};
// 车辆超速记录
const getDateitem = (type: any) => {
checked.value = type;
pageNo.value = 1;
vehicleData.value = [];
getAndExitListApi();
};
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){
getVehicleList();
} else {
getAndExitListApi();
}
pageNo.value += 1;
}
// 车辆超速记录
const getVehicleList = async (tip?: any) => {
const res: any = await getEntryAndExitListApi({
projectSn: store.sn,
timeType: checked.value,
pageNo: pageNo.value,
pageSize: pageSize.value
});
if (res.result) {
vehicleData.value = vehicleData.value.concat(res.result.records);
// 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;
// }
}
};
const getAndExitListApi = async () => {
const res: any = await carMeasureSpeedData({
projectSn: store.sn,
// timeType: checked.value,
// pageNo: 1,
// pageSize: 30
pageNo: pageNo.value,
pageSize: pageSize.value
});
console.log("测速-历史记录", res);
nametabledata.value = nametabledata.value.concat(res.result.records);
};
//将方法暴露给父组件
defineExpose({
getVehicleList
});
onMounted(async () => {
// console.log("滚动容器", refScrollbar.value);
// 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");
// }
// }
// });
await getVehicleList("search");
await getAndExitListApi();
});
</script>
<style lang="scss" scoped>
.bottomBox {
width: 100%;
height: 100%;
position: relative;
.select-right {
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%;
}
}
.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%;
.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 {
height: 80%;
.listStyle {
display: flex;
justify-content: space-around;
color: #fff;
// line-height: 25px;
font-size: calc(100vw * 12 / 1920);
.list-img {
.el-img {
width: 50px;
height: 25px;
}
.image-slot {
width: 50px;
height: 25px;
img {
width: 100%;
height: 100%;
}
}
> img {
width: 62px;
height: 62px;
}
}
div {
text-align: center;
width: 11%;
display: flex;
align-items: center;
justify-content: center;
}
}
.listStyle:hover {
background: #091f3f;
}
}
}
}
.notoDta {
top: 45%;
width: 20%;
left: 39%;
position: absolute;
img {
width: 40%;
margin: 5% 30%;
}
p {
color: #fff;
font-size: calc(100vw * 14 / 1920);
margin: -6% 37%;
text-align: center;
}
}
</style>