264 lines
6.2 KiB
Vue
264 lines
6.2 KiB
Vue
<template>
|
|
<div class="political-outlook">
|
|
<div class="content">
|
|
<div class="top-search">
|
|
<div class="search-item">
|
|
<span>报警类型</span>
|
|
<el-select class="m-2" placeholder="请选择" size="small" v-model="searchForm.alarmType"
|
|
:clearable="true">
|
|
<el-option
|
|
v-for="(item, index) in alarmTypeList"
|
|
:key="index"
|
|
:label="item"
|
|
:value="index"
|
|
/>
|
|
</el-select>
|
|
</div>
|
|
<div class="search-item">
|
|
<span>设备名称</span>
|
|
<el-select class="m-2" placeholder="请选择" size="small" v-model="searchForm.name"
|
|
:clearable="true">
|
|
<el-option
|
|
v-for="(item, index) in deviceList"
|
|
:key="index"
|
|
:label="item.deviceName"
|
|
:value="item.deviceId"
|
|
/>
|
|
</el-select>
|
|
</div>
|
|
<div class="search-item">
|
|
<span>时间筛选</span>
|
|
<el-date-picker
|
|
v-model="searchForm.rangeTime"
|
|
type="daterange"
|
|
range-separator="至"
|
|
start-placeholder="开始日期"
|
|
end-placeholder="结束日期"
|
|
value-format="YYYY-MM-DD"
|
|
:clearable="true"
|
|
/>
|
|
</div>
|
|
<el-button @click="getHistoryAlarmList('search')">查询</el-button>
|
|
</div>
|
|
<div class="tabList">
|
|
<div>报警类型</div>
|
|
<div>报警名称</div>
|
|
<div>设备名称</div>
|
|
<div>报警值</div>
|
|
<div>阈值</div>
|
|
<div>超标时间</div>
|
|
<div>超标量</div>
|
|
</div>
|
|
|
|
<el-scrollbar class="listBox" ref="refScrollbar">
|
|
<div v-for="(item, index) in partyMemberList" class="listStyle" :key="item.id">
|
|
<div>{{alarmTypeList[item.type]}}</div>
|
|
<div>{{item.alarmTypeName}}</div>
|
|
<div>{{item.deviceName}}</div>
|
|
<div>{{item.avgData}}</div>
|
|
<div>{{item.alarmValue}}</div>
|
|
<div>{{item.tempAlarmTime}}</div>
|
|
<div>{{item.exceedVal}}</div>
|
|
</div>
|
|
<div class="notoDta" v-if="partyMemberList.length == 0">
|
|
<img src="@/assets/images/noData.png" alt="" />
|
|
<p>暂无数据</p>
|
|
</div>
|
|
</el-scrollbar>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { ref, onMounted } from "vue";
|
|
import { GlobalStore } from "@/stores";
|
|
import { environmentDevList, getAlarmCountTotalList } from "@/api/modules/headNoise";
|
|
const store = GlobalStore();
|
|
const props = defineProps(["typeId"])
|
|
const alarmTypeList = ref(['报警', '预警'])
|
|
let pageNo = ref(1 as any);
|
|
let moreScroll = ref(true as any);
|
|
const refScrollbar = ref(null as any); // 绑定到滚动的盒子上
|
|
const deviceList = ref([] as any); // 设备列表
|
|
const searchForm = ref({
|
|
alarmType: '',
|
|
name: "",
|
|
rangeTime: ""
|
|
})
|
|
|
|
const partyMemberList = ref({} as any);
|
|
//获取设备下拉
|
|
const getDevList = async () => {
|
|
const res:any = await environmentDevList({ projectSn: store.sn });
|
|
console.log("获取设备下拉", res);
|
|
if (res.result.length > 0) {
|
|
deviceList.value = res.result;
|
|
searchForm.value.name = res.result[0].deviceId
|
|
}
|
|
};
|
|
//获取历史报警数据
|
|
const getHistoryAlarmList = async (tip:any) => {
|
|
let requestData:any = {
|
|
deviceId: searchForm.value.name,
|
|
projectSn: store.sn,
|
|
alarmTypeId: props.typeId,
|
|
type: searchForm.value.alarmType,
|
|
pageNo: tip == 'search'?1:pageNo.value,
|
|
pageSize: 100
|
|
}
|
|
if(searchForm.value.rangeTime){
|
|
requestData.startTime = searchForm.value.rangeTime[0];
|
|
requestData.endTime = searchForm.value.rangeTime[1];
|
|
}
|
|
const res: any = await getAlarmCountTotalList(requestData);
|
|
console.log("获取历史数据", res);
|
|
if(tip == 'more'){
|
|
partyMemberList.value = partyMemberList.value.concat(res.result.records);
|
|
} else {
|
|
partyMemberList.value = res.result.records;
|
|
}
|
|
if (res.result.pages == pageNo.value) {
|
|
moreScroll.value = false;
|
|
} else {
|
|
pageNo.value = pageNo.value + 1;
|
|
}
|
|
};
|
|
|
|
onMounted(async () => {
|
|
await getDevList();
|
|
await getHistoryAlarmList('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) {
|
|
getHistoryAlarmList('more');
|
|
}
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
@mixin flex{
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
.political-outlook {
|
|
width: 100%;
|
|
height: 100%;
|
|
.content {
|
|
height: 95%;
|
|
width: 100%;
|
|
margin-top: 10px;
|
|
// background: url("@/assets/images/cardImg.png") no-repeat;
|
|
background-size: 100% 100%;
|
|
.top-search{
|
|
@include flex;
|
|
justify-content: flex-end;
|
|
margin-bottom: 15px;
|
|
.search-item{
|
|
@include flex;
|
|
margin-right: 20px;
|
|
span{
|
|
color: white;
|
|
margin-right: 10px;
|
|
}
|
|
}
|
|
}
|
|
.tabList {
|
|
display: flex;
|
|
width: 100%;
|
|
height: 5%;
|
|
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;
|
|
align-items: center;
|
|
div {
|
|
text-align: center;
|
|
width: 15%;
|
|
}
|
|
}
|
|
.listBox {
|
|
overflow-x: scroll;
|
|
height: 90%;
|
|
.listStyle {
|
|
display: flex;
|
|
align-items: center;
|
|
text-align: center;
|
|
color: #fff;
|
|
font-size: 12px;
|
|
margin-bottom: 5px;
|
|
.list-img {
|
|
.el-img {
|
|
width: 30px;
|
|
height: 30px;
|
|
img {
|
|
display: flex;
|
|
align-items: center;
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
}
|
|
}
|
|
div {
|
|
width: 15%;
|
|
white-space: nowrap; //单行
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
}
|
|
}
|
|
.listStyle:hover {
|
|
background: #091f3f;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.notoDta {
|
|
top: 35%;
|
|
width: 20%;
|
|
left: 40%;
|
|
position: absolute;
|
|
text-align: center;
|
|
img {
|
|
width: 40%;
|
|
margin: 5% 30%;
|
|
}
|
|
p {
|
|
color: #fff;
|
|
font-size: calc(100vw * 14 / 1920);
|
|
margin: -6% 37%;
|
|
}
|
|
}
|
|
// element 组件样式
|
|
:deep(){
|
|
.el-date-editor .el-range-input,.el-range-separator{
|
|
color: #fff;
|
|
}
|
|
.el-input__wrapper {
|
|
background: #112d59;
|
|
}
|
|
.el-input__inner {
|
|
color: #fff;
|
|
}
|
|
.el-button{
|
|
background-color: #2758C0;
|
|
color: white;
|
|
border-color: transparent;
|
|
}
|
|
}
|
|
// ::v-deep .el-select .el-input .el-select__caret {
|
|
// color: #fff;
|
|
// }
|
|
</style>
|