2024-03-02 22:45:25 +08:00

428 lines
11 KiB
Vue

<template>
<div class="middle-container">
<div class="middle-top">
<Card title="实时检测">
<div class="ai-center-bottom">
<div class="today-warn" @click="alarmCountDataOpen({type: 1, data: 3})">
<i
>今日告警: <span style="padding-left: 1%">{{ realTimeTotal.todayAlarmNum || 0 }}</span></i
>
</div>
<div class="icon" @click="alarmCountDataOpen({type: 1, data: 3})"></div>
<div class="week-warn" @click="alarmCountDataOpen({type: 1, data: 1})">
<div class="text">近7日告警</div>
<div class="num">{{ realTimeTotal.past7AlarmNum || 0 }}</div>
</div>
<div class="month-warn" @click="alarmCountDataOpen({type: 1, data: 2})">
<div class="text">历史告警次数</div>
<div class="num">{{ realTimeTotal.allAlarmNum || 0 }}</div>
</div>
</div>
</Card>
</div>
<div class="middle-bottom">
<Card title="今日报警统计">
<div class="today-warning-list">
<div class="list-content">
<div class="tab-list">
<div style="width: 10%">序号</div>
<div style="width: 15%">抓拍照片</div>
<div>违章人员</div>
<div style="width: 18%">告警类型</div>
<div style="width: 30%">告警时间</div>
<div style="width: 10%">操作</div>
</div>
<el-scrollbar class="list-box" ref="refScrollbar">
<div v-for="(item, index) in alarmList" class="list-style" :key="item.id">
<div style="width: 10%">{{ index + 1 }}</div>
<div class="list-img" style="width: 15%">
<div class="img-style" @click="openDetailDialog(item)">
<img :src="BASEURL + '/image/' + item.imageUrl" />
</div>
</div>
<div :title="item.workerInfoStr">{{item.workerInfoStr}}</div>
<!-- <div>{{ item.alarmType ? getWarnName(item.alarmType) : "" }}</div> -->
<div style="width: 18%">{{ item.alarmTypeName }}</div>
<div style="width: 30%">{{ item.createTime }}</div>
<div style="width: 10%" @click="openPeopleCountDialog({type: 1,data: item})" v-if="!item.handleResult">去处置</div>
</div>
<div class="not-data" v-if="alarmList.length == 0">
<img src="@/assets/images/noData.png" />
<p>暂无数据</p>
</div>
</el-scrollbar>
</div>
</div>
<div class="list-detail" v-show="showDialog" @click="handleClick">
<div class="dialog-content">
<div class="dialog-icon"><img src="@/assets/images/titleIcon.png" /></div>
<div class="dialog-title"><i>抓拍详情</i></div>
<div class="big-pic">
<img :src="BASEURL + '/image/' + detailData.imageUrl" />
</div>
<div class="close-icon" @click="closeDialog">
<el-icon><Close /></el-icon>
</div>
</div>
</div>
</Card>
</div>
<dataDialog ref="partyBuildRefMore" @updateList="getAlarmListInfo"></dataDialog>
<dataListDialog ref="partyBuildRefCount"></dataListDialog>
</div>
</template>
<script lang="ts" setup>
import Card from "@/components/card.vue";
import { ref, onMounted, computed } from "vue";
import { getRealTimeTotal, getAlarmPage } from "@/api/modules/securityManagement";
import { GlobalStore } from "@/stores";
import dataDialog from "./data-dialog.vue";
import dataListDialog from "./data-list-dialog.vue";
const emits = defineEmits(["updateListData"])
const dealVal = ref(0);
// 当前环境
const BASEURL = import.meta.env.VITE_API_URL;
const store = GlobalStore();
const partyBuildRefMore = ref();
const partyBuildRefCount = ref();
let pageNo = ref(1 as any);
let moreScroll = ref(true as any);
const refScrollbar = ref(null as any); // 绑定到滚动的盒子上
//弹窗
let showDialog = ref(false as any);
const alarmCountDataOpen = (obj:any) => {
partyBuildRefCount.value.openDialog(obj);
}
// 弹窗
const openPeopleCountDialog = (obj:any) => {
partyBuildRefMore.value.openDialog(obj);
// console.log(partyBuildRef.value);
};
function handleClick(event: any) {
// console.log("点击", event.target.className);
if (event.target.className == "list-detail") {
closeDialog();
}
}
const realTimeTotal = ref({} as any);
//获取实时监测
const getMemberCareList = async () => {
const res: any = await getRealTimeTotal({ projectSn: store.sn });
if (res.success) {
realTimeTotal.value = res.result;
}
};
//获取今日报警记录列表
let alarmList = ref([] as any);
let detailData = ref({} as any);
const getAlarmListInfo = async (tip:any) => {
let data:any = {
projectSn: store.sn,
pageNo: tip == 'search'?1:pageNo.value,
pageSize: 20
};
const res: any = await getAlarmPage(data);
if (tip == "more") {
alarmList.value = alarmList.value.concat(res.result.records);
} else {
alarmList.value = res.result.records;
}
if (res.result.pages == pageNo.value) {
moreScroll.value = false;
} else {
pageNo.value = pageNo.value + 1;
}
dealVal.value = dealVal.value + 1;
emits("updateListData",dealVal.value)
};
// 打开详情弹窗
function openDetailDialog(item: any) {
// console.log(item, "当前行数据");
detailData.value = item;
showDialog.value = true;
}
// 关闭详情弹窗
function closeDialog() {
showDialog.value = false;
detailData.value = {};
}
onMounted(async () => {
await getMemberCareList();
await getAlarmListInfo('search');
refScrollbar.value.wrapRef.addEventListener("scroll", (e: any) => {
// console.log("滚动容器", e);
const scrollTop = e.target.scrollTop;
const scrollHeight = e.target.scrollHeight;
const clientHeight = e.target.clientHeight;
// console.log("滚动容器", scrollTop, scrollHeight, clientHeight);
// 向上加载更多
if (scrollTop >= scrollHeight - clientHeight - 1) {
// console.log("加载更多");
if (moreScroll.value) {
getAlarmListInfo("more");
}
}
});
});
</script>
<style lang="scss" scoped>
.middle-container {
width: 100%;
height: 100%;
.middle-top {
width: 100%;
height: 32%;
.ai-center-bottom {
width: 100%;
height: 100%;
position: relative;
.today-warn {
display: flex;
justify-content: center;
align-items: center;
font-size: 20px;
font-family: OPPOSansH;
color: #ffffff;
top: 10%;
left: 20%;
position: absolute;
width: 30%;
height: 36px;
background: url("@/assets/images/aIEarlyWarning/todayWarn.png") no-repeat;
background-size: 100% 100%;
white-space: nowrap;
cursor: pointer;
}
.week-warn {
right: 8%;
top: 10%;
text-align: center;
position: absolute;
width: 20%;
height: 40%;
background: url("@/assets/images/aIEarlyWarning/monthWarn.png") no-repeat;
background-size: 100% 100%;
cursor: pointer;
.text {
margin-top: 10%;
font-size: 16px;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #65d7f9;
}
.num {
margin-top: 10%;
font-weight: bold;
font-family: sadigitalNumber;
font-size: 24px;
background: linear-gradient(180deg, #65d7f9 0%, #ffffff 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
}
.month-warn {
right: 8%;
bottom: 8%;
text-align: center;
position: absolute;
width: 20%;
height: 40%;
background: url("@/assets/images/aIEarlyWarning/weekWarn.png") no-repeat;
background-size: 100% 100%;
cursor: pointer;
.text {
margin-top: 10%;
font-size: 16px;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: rgba(255, 255, 255, 0.85);
}
.num {
margin-top: 10%;
font-family: sadigitalNumber;
font-weight: bold;
font-size: 24px;
background-image: linear-gradient(180deg, #dad8b4 0%, #f4d065 100%);
background-clip: text;
-webkit-text-fill-color: transparent;
}
}
.icon {
left: 17%;
bottom: 5%;
position: absolute;
width: 35%;
height: 90%;
background: url("@/assets/images/aIEarlyWarning/warnMonitor.png") no-repeat;
background-size: 100% 100%;
}
}
:deep() {
.content {
height: 78% !important;
}
}
}
.middle-bottom {
margin-top: 3%;
width: 100%;
height: 66%;
// background-color: #fff;
:deep() {
.content {
height: 89.5% !important;
}
}
}
}
.today-warning-list {
width: 100%;
height: 100%;
box-sizing: border-box;
padding: 2%;
.list-content {
height: 100%;
width: 100%;
// background: url("@/assets/images/cardImg.png") no-repeat;
// background-size: 100% 100%;
.tab-list {
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: 18px;
// line-height: 55px;
div {
display: flex;
justify-content: center;
align-items: center;
text-align: center;
width: 17%;
}
}
.list-box {
height: 91%;
.list-style:nth-child(even) {
background: rgba(39, 88, 192, 0.06);
}
.list-style {
display: flex;
align-items: center;
color: #fff;
font-size: 16px;
.list-img {
// width: 4%;
display: flex;
justify-content: center;
align-items: center;
.img-style {
width: 40px;
height: 60px;
img {
width: 100%;
height: 100%;
object-fit: contain;
}
}
}
div {
text-align: center;
width: 17%;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
>div:last-child{
cursor: pointer;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
color: #4ac0f3;
}
}
.list-style:hover {
background: #091f3f;
}
}
}
}
.list-detail {
position: absolute;
width: 100%;
height: 100%;
top: 0%;
left: 0%;
background: rgba(7, 28, 49, 0.5);
z-index: 20;
.dialog-content {
position: absolute;
box-sizing: border-box;
padding: 1%;
left: 30%;
top: 30%;
width: 40%;
height: 50%;
background: url("@/assets/images/aIEarlyWarning/dialogBg.png") no-repeat;
background-size: 100% 100%;
z-index: 21;
.dialog-icon {
position: absolute;
left: 3%;
top: 3%;
width: 7%;
height: 7%;
img {
width: 100%;
height: 100%;
}
}
.dialog-title {
color: #ffffff;
font-weight: bold;
margin-left: 8%;
font-size: 18px;
font-family: "OPPOSans-Bold";
}
.big-pic {
width: 100%;
height: 85%;
margin-top: 3%;
img {
width: 100%;
height: 100%;
}
}
.close-icon {
position: absolute;
right: 3%;
top: 3%;
cursor: pointer;
color: #ffffff;
font-size: 18px;
}
}
}
.not-data {
top: 35%;
width: 30%;
left: 35%;
position: absolute;
text-align: center;
img {
width: 60%;
margin: 5%;
}
p {
color: #fff;
font-size: 14px;
margin: -6% 37%;
}
}
</style>