Commit c1f14e78 by liuwange1

告警

parent 4298a7f5
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div class="home"> <div class="home">
<header> <header>
<img @click="kc0" src="./assets/image/logo.png" alt="" /> <img @click="kc0" src="./assets/image/logo.png" alt="" />
<p>上海滨江中心IOC大屏控制台</p> <p @click="mockPost">上海滨江中心IOC大屏控制台</p>
</header> </header>
<main> <main>
<div class="left-nav"> <div class="left-nav">
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
<div class="pclose" @click="closeHandle" v-if="isShowClose"> <div class="pclose" @click="closeHandle" v-if="isShowClose">
<img src="./assets/image/close.png" alt="" /> <img src="./assets/image/close.png" alt="" />
</div> </div>
<div class="inner-list"> <div class="inner-list" @scroll="scrolll">
<div <div
class="item" class="item"
:class="{ :class="{
...@@ -54,9 +54,10 @@ ...@@ -54,9 +54,10 @@
<div class="key">{{ item.devName }}</div> <div class="key">{{ item.devName }}</div>
<div class="key">{{ item.devLocation }}</div> <div class="key">{{ item.devLocation }}</div>
<div class="key"> <div class="key">
{{ item.alarmTime.substring(item.alarmTime.length - 9) }} {{ item.alarmTime }}
<!-- {{ item.alarmTime.substring(item.alarmTime.length - 9) }} -->
</div> </div>
<div class="key">{{ item.devType }}</div> <div class="key">{{ item.status }}</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -93,53 +94,63 @@ export default { ...@@ -93,53 +94,63 @@ export default {
url: require("./assets/image/icon2.png"), url: require("./assets/image/icon2.png"),
label: "首页", label: "首页",
routerName: "homepage", routerName: "homepage",
menuCode: "",
}, },
{ {
url: require("./assets/image/icon3.png"), url: require("./assets/image/icon3.png"),
label: "智慧消防", label: "智慧消防",
routerName: "xiaofang", routerName: "xiaofang",
number: 2, number: 0,
menuCode: "XF",
}, },
{ {
url: require("./assets/image/icon4.png"), url: require("./assets/image/icon4.png"),
label: "智慧安防", label: "智慧安防",
routerName: "anfang", routerName: "anfang",
menuCode: "AF",
}, },
{ {
url: require("./assets/image/icon5.png"), url: require("./assets/image/icon5.png"),
label: "智慧能耗", label: "智慧能耗",
routerName: "nengyuan", routerName: "nengyuan",
menuCode: "NF",
}, },
{ {
url: require("./assets/image/icon6.png"), url: require("./assets/image/icon6.png"),
label: "智慧运营", label: "智慧运营",
routerName: "yunying", routerName: "yunying",
number: 5, number: 0,
menuCode: "",
}, },
{ {
url: require("./assets/image/icon7.png"), url: require("./assets/image/icon7.png"),
label: "智慧照明", label: "智慧照明",
routerName: "zhaoming", routerName: "zhaoming",
menuCode: "ZM",
}, },
{ {
url: require("./assets/image/icon8.png"), url: require("./assets/image/icon8.png"),
label: "智慧电梯", label: "智慧电梯",
routerName: "dianti", routerName: "dianti",
menuCode: "",
}, },
{ {
url: require("./assets/image/icon9.png"), url: require("./assets/image/icon9.png"),
label: "智慧通行", label: "智慧通行",
routerName: "tongxing", routerName: "tongxing",
menuCode: "",
}, },
{ {
url: require("./assets/image/icon10.png"), url: require("./assets/image/icon10.png"),
label: "智慧环境", label: "智慧环境",
routerName: "huanjing", routerName: "huanjing",
menuCode: "HJ",
}, },
{ {
url: require("./assets/image/icon11.png"), url: require("./assets/image/icon11.png"),
label: "智慧停车", label: "智慧停车",
routerName: "tingche", routerName: "tingche",
menuCode: "",
}, },
], ],
activeIndex: 0, activeIndex: 0,
...@@ -152,12 +163,14 @@ export default { ...@@ -152,12 +163,14 @@ export default {
isShowClose: false, isShowClose: false,
alarmList: [], alarmList: [],
alarmActiveIndex: -1, alarmActiveIndex: -1,
pageNum: 1,
isScrolling: false,
}; };
}, },
created() { created() {
// this.getBuildListData(); // this.getBuildListData();
this.initSocket(); this.initSocket();
this.getAlarmList(); this.getAlarmList("");
}, },
methods: { methods: {
getBuildListData() { getBuildListData() {
...@@ -176,15 +189,6 @@ export default { ...@@ -176,15 +189,6 @@ export default {
}, },
navClickHandle(index) { navClickHandle(index) {
this.activeIndex = index; this.activeIndex = index;
// if (index == 0) {
// // 开场动画 1
// this.$axios.post("/osc/sendInt", {
// arg: 1,
// name: "/KC",
// });
// } else {
// // 一级动画
// }
this.$axios this.$axios
.post("/osc/sendInt", { .post("/osc/sendInt", {
arg: 0, arg: 0,
...@@ -199,6 +203,8 @@ export default { ...@@ -199,6 +203,8 @@ export default {
let routerName = this.navList[index].routerName; let routerName = this.navList[index].routerName;
if (routerName && routerName != this.$route.name) { if (routerName && routerName != this.$route.name) {
this.$router.push({ name: routerName }); this.$router.push({ name: routerName });
this.pageNum = 1;
this.getAlarmList(this.navList[index].menuCode);
} }
}, },
// touchStart(e) { // touchStart(e) {
...@@ -286,14 +292,18 @@ export default { ...@@ -286,14 +292,18 @@ export default {
}); });
}, },
mockPost() { mockPost() {
let msgCode = "M02320211209095" + Math.floor(Math.random() * 999999);
this.$axios this.$axios
.post("/ws/sendAlarmMsg", { .post("/ws/sendAlarmMsg", {
actionType: "0",
alarmLevel: "102", alarmLevel: "102",
alarmType: "10004", alarmType: "10004",
content: content:
"您有一条报警消息。 2021-11-19 03:43:13 2_1区/N1\\A/地上2层/强电 照明回路报警,请尽快处理!", "您有一条报警消息。 2021-11-19 03:43:13 2_1区/N1\\A/地上2层/强电 照明回路报警,请尽快处理!",
devCode: "0230102001011701010040047", devCode: "0230102001011701010040047",
id: "MSG-01", id: "MSG-01",
isSendNow: "0",
msgCode: msgCode,
paramJson: "[object Object]", paramJson: "[object Object]",
projectCode: "023", projectCode: "023",
receivedTime: "2021-11-28 10:40:00", receivedTime: "2021-11-28 10:40:00",
...@@ -322,12 +332,14 @@ export default { ...@@ -322,12 +332,14 @@ export default {
}; };
websocket.onmessage = function (event) { websocket.onmessage = function (event) {
console.log("收到消息:" + event.data);
try { try {
let data = JSON.parse(event.data); let data = JSON.parse(event.data);
data.data.isNew = true; data.data.isNew = true;
_this.alarmList.push(data.data); _this.alarmList.unshift(data.data);
_this.goup(); _this.goup();
setTimeout(() => {
_this.alarmList[0].isNew = false;
}, 2000);
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
...@@ -343,9 +355,21 @@ export default { ...@@ -343,9 +355,21 @@ export default {
}; };
}, },
// 获取报警信息列表接口 // 获取报警信息列表接口
getAlarmList() { getAlarmList(menuCode) {
this.$axios.get("/alarmMsg/msgList").then((e) => { this.$axios
this.alarmList = e.data; .get("/alarmMsg/msgListWithPage", {
date: "2021-12-14",
pageNum: this.pageNum,
pageSize: 10,
menuCode: menuCode,
})
.then((e) => {
if (this.pageNum == 1) {
this.alarmList = e.data.list;
} else {
this.alarmList = [...this.alarmList, ...e.data.list];
}
this.isScrolling = false;
}); });
}, },
// 点击报警事件 // 点击报警事件
...@@ -364,6 +388,17 @@ export default { ...@@ -364,6 +388,17 @@ export default {
}); });
} }
}, },
scrolll(e) {
if (
e.srcElement.scrollTop + e.srcElement.offsetHeight >
e.srcElement.scrollHeight - 100
) {
if (this.isScrolling) return;
this.isScrolling = true;
this.pageNum++;
this.getAlarmList();
}
},
}, },
}; };
</script> </script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment