|
@@ -73,6 +73,7 @@ export const useSystemStore = defineStore("systemStore", {
|
|
},
|
|
},
|
|
], // 预制点位
|
|
], // 预制点位
|
|
token: storage.local.get('t') || '', // token
|
|
token: storage.local.get('t') || '', // token
|
|
|
|
+ websocket: null
|
|
}),
|
|
}),
|
|
getters: {
|
|
getters: {
|
|
ipF() {
|
|
ipF() {
|
|
@@ -113,6 +114,7 @@ export const useSystemStore = defineStore("systemStore", {
|
|
},
|
|
},
|
|
// 退出登录
|
|
// 退出登录
|
|
async loginOut(router) {
|
|
async loginOut(router) {
|
|
|
|
+ this.websocket.close()
|
|
storage.session.clear();
|
|
storage.session.clear();
|
|
storage.local.clear();
|
|
storage.local.clear();
|
|
router.replace({ name: "Login" });
|
|
router.replace({ name: "Login" });
|
|
@@ -151,7 +153,6 @@ export const useSystemStore = defineStore("systemStore", {
|
|
this.typeObj = res
|
|
this.typeObj = res
|
|
const resUrl = await API_FREE_LOGIN_URL()
|
|
const resUrl = await API_FREE_LOGIN_URL()
|
|
// 模拟数据
|
|
// 模拟数据
|
|
-
|
|
|
|
// setTimeout(() => {
|
|
// setTimeout(() => {
|
|
// // const data = {
|
|
// // const data = {
|
|
// // AlarmTime: 1709274691,
|
|
// // AlarmTime: 1709274691,
|
|
@@ -199,7 +200,7 @@ export const useSystemStore = defineStore("systemStore", {
|
|
// }
|
|
// }
|
|
// useAlarm("警告⚠️", "", { default: () => h(Msg, { ...data, AlertType: '123123' }) }, {
|
|
// useAlarm("警告⚠️", "", { default: () => h(Msg, { ...data, AlertType: '123123' }) }, {
|
|
// itemClick: () => {
|
|
// itemClick: () => {
|
|
- // location.href = resUrl
|
|
|
|
|
|
+ // window.open('http://192.168.211.99:8081/#/alarm-center/output-result/algorithm-log?free=jJtp3xy1jJd3cqNqMB3Nvg1u')
|
|
// }
|
|
// }
|
|
// });
|
|
// });
|
|
// this.aiList.unshift({
|
|
// this.aiList.unshift({
|
|
@@ -211,33 +212,31 @@ export const useSystemStore = defineStore("systemStore", {
|
|
// }
|
|
// }
|
|
// }, 1000)
|
|
// }, 1000)
|
|
|
|
|
|
- let websocket
|
|
|
|
let that = this
|
|
let that = this
|
|
; (() => {
|
|
; (() => {
|
|
- websocket = new WebSocket(`wss://${this.ipF}/Ai/Alarm`)
|
|
|
|
- websocket.onopen = function (e) {
|
|
|
|
|
|
+ that.websocket = new WebSocket(`wss://${this.ipF}/Ai/Alarm`)
|
|
|
|
+ that.websocket.onopen = function (e) {
|
|
console.log('/Ai/Alarm 连接已经建立')
|
|
console.log('/Ai/Alarm 连接已经建立')
|
|
}
|
|
}
|
|
- websocket.onmessage = function (e) {
|
|
|
|
|
|
+ that.websocket.onmessage = function (e) {
|
|
const data = JSON.parse(e.data)
|
|
const data = JSON.parse(e.data)
|
|
that.aiList.unshift({
|
|
that.aiList.unshift({
|
|
...data,
|
|
...data,
|
|
state: 0
|
|
state: 0
|
|
})
|
|
})
|
|
- console.log(that.aiList)
|
|
|
|
if (that.aiList.length >= 100) {
|
|
if (that.aiList.length >= 100) {
|
|
that.aiList.splice(50, 10)
|
|
that.aiList.splice(50, 10)
|
|
}
|
|
}
|
|
useAlarm("警告⚠️", "", { default: () => h(Msg, { ...data, AlertType: that.typeObj[data.AlertType] }) }, {
|
|
useAlarm("警告⚠️", "", { default: () => h(Msg, { ...data, AlertType: that.typeObj[data.AlertType] }) }, {
|
|
itemClick: () => {
|
|
itemClick: () => {
|
|
- location.href = resUrl
|
|
|
|
|
|
+ window.open(resUrl)
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- websocket.onerror = function (e) {
|
|
|
|
|
|
+ that.websocket.onerror = function (e) {
|
|
console.log('Ai/Alarm 发生错误')
|
|
console.log('Ai/Alarm 发生错误')
|
|
}
|
|
}
|
|
- websocket.onclose = function (e) {
|
|
|
|
|
|
+ that.websocket.onclose = function (e) {
|
|
console.log('Ai/Alarm 连接断开')
|
|
console.log('Ai/Alarm 连接断开')
|
|
}
|
|
}
|
|
})()
|
|
})()
|