2024-03-07 19:04:39 +08:00

299 lines
7.0 KiB
Vue

<template>
<div class="right-container">
<div class="right-box">
<Card title="风险清册">
<div class="today-warning-list">
<div class="list-content">
<div class="tab-list">
<div style="width: 10%">序号</div>
<div>工序</div>
<div style="width: 40%">风险可能导致的后果</div>
<div style="width: 15%">风险等级</div>
<div style="width: 15%">是否已销号</div>
</div>
<el-scrollbar class="list-box" ref="refScrollbar">
<div v-for="(item, index) in alarmList" class="list-style" :key="index">
<div style="width: 10%">{{ index + 1 }}</div>
<div :title="item.processName">{{ item.processName }}</div>
<div style="width: 40%" :title="item.riskPossibleConsequence">{{ item.riskPossibleConsequence }}</div>
<div style="width: 15%">{{ item.riskLevel }}</div>
<div style="width: 15%"><el-checkbox v-model="item.accountState" :true-value="2" :false-value="1" :true-label="2" :false-label="1" @change="stateEdit(item)"/></div>
</div>
<div class="not-data" v-if="false">
<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>
</div>
</template>
<script lang="ts" setup>
import Card from "@/components/card.vue";
import { ref, onMounted, computed } from "vue";
import { GlobalStore } from "@/stores";
import { getRiskList, riskDataEdit } from "@/api/modules/headNoise";
import { ElMessage } from "element-plus";
let pageNo = ref(1 as any);
let moreScroll = ref(true as any);
const refScrollbar = ref(null as any); // 绑定到滚动的盒子上
// 当前环境
const BASEURL = import.meta.env.VITE_API_URL;
const store = GlobalStore();
//弹窗
let showDialog = ref(false as any);
function handleClick(event: any) {
// console.log("点击", event.target.className);
if (event.target.className == "list-detail") {
closeDialog();
}
}
//获取风险清册
let alarmList = ref([] as any);
let detailData = ref({} as any);
// 销号数据编辑
const stateEdit = async (obj:any) => {
let data: any = {
...obj
};
const res: any = await riskDataEdit(data);
if (res.success) {
ElMessage({
showClose: true,
message: "操作成功",
type: "success"
});
await getAlarmListInfo("search");
}
}
const getAlarmListInfo = async (tip: any) => {
let data: any = {
projectSn: store.sn,
pageNo: tip == "search" ? 1 : pageNo.value,
pageSize: 20
};
const res: any = await getRiskList(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;
}
};
// 打开详情弹窗
function openDetailDialog(item: any) {
// console.log(item, "当前行数据");
detailData.value = item;
showDialog.value = true;
}
// 关闭详情弹窗
function closeDialog() {
showDialog.value = false;
detailData.value = {};
}
onMounted(async () => {
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>
.right-container {
width: 100%;
height: 100%;
// position: relative;
// display: flex;
// flex-direction: column;
.right-box {
width: 100%;
height: 107%;
.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: 6%;
background: url("@/assets/images/vehicleManagement/ListTitleImg.png") no-repeat;
background-size: 100% 100%;
// position: absolute;
left: 75.5%;
top: 75%;
color: #ccc;
font-size: 16px;
// line-height: 55px;
div {
display: flex;
justify-content: center;
align-items: center;
text-align: center;
width: 20%;
}
}
.list-box {
height: 91%;
line-height: 45px;
.list-style:nth-child(even) {
background: rgba(39, 88, 192, 0.06);
}
.list-style {
display: flex;
align-items: center;
color: #fff;
height: 10%;
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: 20%;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
}
.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%;
}
}
}
}
:deep() {
.h-card .content {
height: 87% !important;
}
.el-checkbox__inner {
background-color: transparent;
}
}
</style>