diff --git a/src/App.vue b/src/App.vue index e52f581..9c012f1 100644 --- a/src/App.vue +++ b/src/App.vue @@ -13,7 +13,11 @@ export default { this.initWebSocket(); window.addEventListener("onmessageWS", this.getSocketData); }, - + data() { + return { + recentAlerts: [], // 用于存储最近三个告警的数组 + }; + }, methods: { ...mapActions("cache", ["addCache", "removeCache"]), // 收集缓存(通过监听) @@ -56,12 +60,39 @@ export default { }, getSocketData(res) { console.log(res); - this.$notify({ - title: "告警", - message: res.detail.data, - position: "bottom-right", - type: "warning", - duration: 0, + const newAlert = res.detail.data; + + // 将新告警添加到数组中 + this.recentAlerts.push(newAlert); + + // 如果数组长度超过3,移除最旧的告警 + if (this.recentAlerts.length > 3) { + this.recentAlerts.shift(); // 移除数组的第一个元素 + } + + // 使用最新的三个告警来显示通知 + this.showAlerts(); + // this.$notify({ + // title: "告警", + // message: res.detail.data, + // position: "bottom-right", + // type: "warning", + // duration: 0, + // }); + }, + showAlerts() { + // 遍历最新的三个告警并显示它们 + this.recentAlerts.forEach((alert, index) => { + // 稍微延迟每个通知的显示,以便用户可以看到它们连续出现 + setTimeout(() => { + this.$notify({ + title: "告警", + message: alert, + position: "bottom-right", + type: "warning", + duration: 0, // 可以设置一个适当的持续时间,或者设置为0表示永久显示直到用户关闭 + }); + }, index * 1000); // 每个告警之间间隔1秒显示 }); }, }, diff --git a/src/views/homePage/index.vue b/src/views/homePage/index.vue index 4de7b10..ec32791 100644 --- a/src/views/homePage/index.vue +++ b/src/views/homePage/index.vue @@ -79,18 +79,14 @@ - + - {{ item.name }}-{{ item.id }} + {{ item.name }} - {{ item.id }} @@ -227,7 +223,7 @@ @keyup.enter.native="onSubmit()" v-model="formdata.activityId" filterable - @change="changeActive" + @change="changeActive2" > { console.log(res); + this.protocolOptions = [{ id: -1, name: "全部" }]; this.protocolOptions = this.protocolOptions.concat(res.data.list); this.formdata.protocol = this.protocolOptions[0].id; }) @@ -528,11 +525,20 @@ export default { }) .catch((err) => {}); }, + changeprotocol(val) { + console.log(val); + this.formdata.protocol = val; + }, changeActive(val) { console.log(this.activityOptions); console.log(val); localStorage.setItem("activeId", JSON.stringify(val)); }, + changeActive2(val) { + console.log(this.activityOptions); + console.log(val); + localStorage.setItem("activeId", JSON.stringify(val)); + }, onSubmit() { this.tableLoaidng = true; diff --git a/src/views/report/index.vue b/src/views/report/index.vue index 466fe17..b2e5363 100644 --- a/src/views/report/index.vue +++ b/src/views/report/index.vue @@ -150,8 +150,14 @@ >apk版本:{{ item.cmdMap.fileName }} cmd:{{ item.cmdMap }} + - +

{{ item.content }}

+ 查看目录查看内容
@@ -370,6 +376,7 @@ export default { //this.endCommand = res.data; //this.endCommand = res.data.list this.rightCommand = res.data.list; + // 组件挂载时立即解析数据 this.rightComLoading = false; this.updateTime = new Date();