From f32c25012b4158431e5d494801d82cd88e44405d Mon Sep 17 00:00:00 2001
From: fanluyan <754122931@qq.com>
Date: Thu, 31 Oct 2024 10:26:16 +0800
Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E5=91=8A=E8=AD=A6=E4=BF=A1?=
=?UTF-8?q?=E6=81=AF=E5=A4=84=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/utils/api/index.js | 9 +++++
.../warnMessage/components/warnDialog.vue | 40 ++++++++++++++++++-
src/views/homePage/warnMessage/index.vue | 39 +++++++++++++++---
3 files changed, 81 insertions(+), 7 deletions(-)
diff --git a/src/utils/api/index.js b/src/utils/api/index.js
index b37aef6f..93a54552 100644
--- a/src/utils/api/index.js
+++ b/src/utils/api/index.js
@@ -773,6 +773,15 @@ export function warningListApi(data) {
},
});
}
+//点击变成已处理 /warning/updateState
+
+export function updateStateApi(data) {
+ return request({
+ url: "/warning/updateState",
+ method: "post",
+ data,
+ });
+}
//I2配置
//字段映射列表
diff --git a/src/views/homePage/warnMessage/components/warnDialog.vue b/src/views/homePage/warnMessage/components/warnDialog.vue
index 52f6e4eb..e0843272 100644
--- a/src/views/homePage/warnMessage/components/warnDialog.vue
+++ b/src/views/homePage/warnMessage/components/warnDialog.vue
@@ -98,6 +98,17 @@
+
+
+ [未处理]
+ [已处理]
+
+
@@ -321,6 +352,13 @@ export default {
padding: 16px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
height: calc(100% - 114px);
+ .readbox {
+ color: #f56c6c;
+ cursor: pointer;
+ &:hover {
+ text-decoration: underline;
+ }
+ }
}
.pageNation {
margin-top: 6px;
diff --git a/src/views/homePage/warnMessage/index.vue b/src/views/homePage/warnMessage/index.vue
index eaa947c2..855b1007 100644
--- a/src/views/homePage/warnMessage/index.vue
+++ b/src/views/homePage/warnMessage/index.vue
@@ -74,7 +74,7 @@
{{ item.zsbName }}
{{ item.warnDesc }}
{{ item.warnValue }}
- {{ item.triggerDesc }}
+ {{ item.triggerDesc }}
{{ item.threshold }}
高
@@ -108,6 +108,7 @@ export default {
params: {},
isMoving: true,
isDuplicated: true, // 用于判断是否添加复制的项
+ intervalId: null, // 用于保存 setInterval 的 ID
};
},
created() {
@@ -122,16 +123,21 @@ export default {
currentDate.setMinutes(59); // 设置分钟为59
currentDate.setSeconds(59); // 设置秒数为59
this.endtime = currentDate;
+ },
+ mounted() {
this.getwarnList();
+ // 启动定时器(如果尚未启动)
+ this.startIntervalIfNeeded();
},
- created() {},
methods: {
lookMore() {
+ delete this.params.state; // 这将彻底删除 state 属性
this.params.startTime = this.starttime;
this.params.endTime = this.endtime;
this.params.pageSize = 20;
this.params.pageNum = 1;
+ console.log(this.params);
this.$refs.warnRef.display(this.params);
},
getwarnList() {
@@ -144,6 +150,7 @@ export default {
this.params.endTime = this.endtime;
this.params.pageSize = 20;
this.params.pageNum = 1;
+ this.params.state = 1;
warningListApi(this.params)
.then((res) => {
console.log(res);
@@ -153,6 +160,23 @@ export default {
console.log(err); //代码错误、请求失败捕获
});
},
+ startIntervalIfNeeded() {
+ // 如果定时器尚未启动,则启动它
+ if (this.intervalId === null) {
+ this.intervalId = setInterval(this.getwarnList, 10000);
+ }
+ },
+ stopInterval() {
+ // 停止定时器
+ if (this.intervalId !== null) {
+ clearInterval(this.intervalId);
+ this.intervalId = null;
+ }
+ },
+ },
+ beforeDestroy() {
+ // 在组件销毁前停止定时请求
+ this.stopInterval();
},
};
@@ -212,7 +236,7 @@ export default {
font-size: 12px;
text-align: center;
&:first-child {
- width: 12%;
+ width: 11%;
}
&:nth-child(2) {
width: 15%;
@@ -224,7 +248,7 @@ export default {
width: 10%;
}
&:nth-child(5) {
- width: 8%;
+ width: 9%;
}
&:nth-child(6) {
width: 8%;
@@ -257,7 +281,7 @@ export default {
width: 100%;
span {
&:first-child {
- width: 12%;
+ width: 11%;
}
&:nth-child(2) {
width: 15%;
@@ -269,7 +293,10 @@ export default {
width: 10%;
}
&:nth-child(5) {
- width: 8%;
+ width: 9%;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
}
&:nth-child(6) {
width: 8%;