You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

321 lines
8.1 KiB
Vue

1 year ago
<template>
<div class="warnmessageBox">
<h3>
<span class="arrows1">&gt;</span><span class="arrows2">&gt;</span>
<span class="arrows3">&gt;</span> {{ pageCardTitle }}
<span class="arrows3">&lt;</span><span class="arrows2">&lt;</span>
<span class="arrows1">&lt;</span>
<el-button
type="text"
icon="el-icon-document"
class="lookMore"
@click="lookMore"
>查看全部</el-button
>
1 year ago
</h3>
<div class="cardContent">
<!-- <el-table
1 year ago
ref="restauranttable"
:data="tableData"
class="tableHi"
1 year ago
height="154px"
1 year ago
>
<el-table-column align="center" prop="warnTime" label="报警时间">
</el-table-column>
1 year ago
<el-table-column align="center" prop="zsbName" label="主设备名称">
1 year ago
</el-table-column>
1 year ago
<el-table-column
align="center"
prop="warnDesc"
label="告警信息"
min-width="200"
>
1 year ago
<template slot-scope="scope">
<el-tooltip
class="item"
effect="dark"
:content="scope.row.warnDesc"
placement="top"
>
<span> {{ scope.row.warnDesc }}</span>
</el-tooltip>
</template>
</el-table-column>
1 year ago
<el-table-column align="center" prop="warnValue" label="当前值">
</el-table-column>
<el-table-column align="center" prop="triggerDesc" label="触发条件">
</el-table-column>
<el-table-column align="center" prop="threshold" label="告警阈值">
</el-table-column>
1 year ago
<el-table-column align="center" prop="warnLevel" label="告警等级">
1 year ago
<template slot-scope="scope">
1 year ago
<span v-if="scope.row.warnLevel == 2"> </span>
<span v-else-if="scope.row.warnLevel == 1"> </span>
<span v-else-if="scope.row.warnLevel == 0"> </span>
1 year ago
</template>
</el-table-column>
</el-table> -->
<ul class="warntitle">
<li>报警时间</li>
<li>主设备名称</li>
<li>告警信息</li>
<li>当前值</li>
<li>触发条件</li>
<li>告警阈值</li>
<li>告警等级</li>
</ul>
<div class="marquee">
<ul class="scrollUl">
<li v-for="(item, index) in tableData" :key="index">
<span>{{ item.warnTime }}</span>
<span>{{ item.zsbName }}</span>
<span>{{ item.warnDesc }}</span>
<span>{{ item.warnValue }}</span>
<span>{{ item.triggerDesc }}</span>
<span>{{ item.threshold }}</span>
<span>
<span v-if="item.warnLevel == 2"> </span>
<span v-else-if="item.warnLevel == 1"> </span>
<span v-else-if="item.warnLevel == 0"> </span></span
>
</li>
</ul>
</div>
1 year ago
</div>
<warnDialog ref="warnRef"></warnDialog>
1 year ago
</div>
</template>
<script>
1 year ago
import { warningListApi } from "@/utils/api/index";
import warnDialog from "./components/warnDialog.vue";
1 year ago
export default {
name: "warnmessage",
components: {
warnDialog,
},
1 year ago
data() {
return {
pageCardTitle: "告警/故障信息",
tableData: [],
starttime: "",
endtime: "",
params: {},
isMoving: true,
isDuplicated: true, // 用于判断是否添加复制的项
1 year ago
};
},
1 year ago
created() {
const startDate = new Date(); // 获取当前时间
startDate.setHours(0); // 设置小时为23
startDate.setMinutes(0); // 设置分钟为59
startDate.setSeconds(0); // 设置秒数为59
this.starttime = startDate;
const currentDate = new Date(); // 获取当前时间
currentDate.setHours(23); // 设置小时为23
currentDate.setMinutes(59); // 设置分钟为59
currentDate.setSeconds(59); // 设置秒数为59
this.endtime = currentDate;
1 year ago
this.getwarnList();
},
1 year ago
mounted() {},
1 year ago
methods: {
lookMore() {
this.params.startTime = this.starttime;
this.params.endTime = this.endtime;
this.params.pageSize = 20;
this.params.pageNum = 1;
this.$refs.warnRef.display(this.params);
},
1 year ago
getwarnList() {
this.starttime = this.$moment(this.starttime).format(
"YYYY-MM-DD HH:mm:ss"
);
this.endtime = this.$moment(this.endtime).format("YYYY-MM-DD HH:mm:ss");
this.params.startTime = this.starttime;
this.params.endTime = this.endtime;
this.params.pageSize = 20;
this.params.pageNum = 1;
warningListApi(this.params)
1 year ago
.then((res) => {
console.log(res);
this.tableData = res.data.content;
})
.catch((err) => {
console.log(err); //代码错误、请求失败捕获
});
},
},
1 year ago
};
</script>
<style lang="less">
.warnmessageBox {
padding: 0px 10px;
height: 100%;
1 year ago
h3 {
height: 38px;
line-height: 38px;
box-sizing: border-box;
color: #fff;
font-weight: normal;
text-align: left;
display: flex;
1 year ago
font-size: 16px;
justify-content: space-between;
align-items: center;
border-bottom: 1px dashed #fff;
1 year ago
/* 警告标题箭头 */
.arrows3 {
color: #fff;
}
.arrows2 {
color: rgba(256, 256, 256, 0.5);
}
.arrows1 {
color: rgba(256, 256, 256, 0.15);
}
.lookMore {
margin-left: auto;
color: #fff;
margin-right: 4px;
font-size: 14px;
&:hover {
color: #03bcff;
text-decoration: underline;
}
}
1 year ago
}
.cardContent {
margin-top: 10px;
height: 100%;
.warntitle {
width: 100%;
display: flex;
line-height: 24px;
height: 24px;
border-bottom: 1px solid #eee;
align-items: center;
justify-content: space-around;
li {
list-style: none;
font-size: 12px;
text-align: center;
&:first-child {
width: 12%;
}
&:nth-child(2) {
width: 15%;
}
&:nth-child(3) {
width: 20%;
}
&:nth-child(4) {
width: 10%;
}
&:nth-child(5) {
width: 8%;
}
&:nth-child(6) {
width: 8%;
}
&:nth-child(7) {
width: 8%;
}
}
}
.marquee {
height: calc(100% - 80px);
display: flex;
overflow: hidden;
margin-top: 2px;
width: 100%;
.scrollUl {
animation: 10s scrollTop linear infinite; /* 根据需要调整动画时间和速度 */
width: 100%;
li {
list-style: none;
font-size: 12px;
text-align: center;
line-height: 24px;
height: 24px;
border-bottom: 1px solid #eee;
display: flex;
justify-content: space-around;
width: 100%;
span {
&:first-child {
width: 12%;
}
&:nth-child(2) {
width: 15%;
}
&:nth-child(3) {
width: 20%;
}
&:nth-child(4) {
width: 10%;
}
&:nth-child(5) {
width: 8%;
}
&:nth-child(6) {
width: 8%;
}
&:nth-child(7) {
width: 8%;
}
}
}
}
}
@keyframes scrollTop {
0% {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
100% {
-webkit-transform: translate3d(0, -100%, 0);
transform: translate3d(0, -100%, 0);
}
}
1 year ago
.el-table th.el-table__cell {
background-color: transparent;
}
.el-table thead {
color: #fff;
}
.el-table {
background-color: transparent;
color: #fff;
tr {
background: transparent;
}
}
.el-table--small .el-table__cell {
padding: 2px 0;
}
.el-table__empty-text {
color: #fff;
}
1 year ago
.el-table--enable-row-hover .el-table__body tr:hover > td.el-table__cell {
background-color: rgba(255, 27, 27, 0.2);
}
1 year ago
.el-table::before {
height: 0;
}
}
}
</style>