链接提示调整

This commit is contained in:
joylink_fanyuhong 2024-11-13 09:33:57 +08:00
parent 52fbdba1af
commit b26d213a0e

View File

@ -7,7 +7,7 @@ import {
cancelSubscribe,
} from 'src/drawApp/lineNetApp';
import { markRaw } from 'vue';
import { Notify, QTable } from 'quasar';
import { Notify, QNotifyUpdateOptions, QTable } from 'quasar';
import { state } from 'src/protos/system_warn_message';
export interface AlarmInfo {
id: string;
@ -22,6 +22,10 @@ export interface AlarmInfo {
alert_location_id: number;
alarmStatus?: number;
}
let msgNotify: null | ((props?: QNotifyUpdateOptions | undefined) => void) =
null;
let tip = '';
export const useLineNetStore = defineStore('lineNet', {
state: () => ({
selectedGraphics: null as JlGraphic[] | null,
@ -91,27 +95,24 @@ export const useLineNetStore = defineStore('lineNet', {
});
},
setConnectInfo(data: state.WarnLineMessage) {
let tip = '';
let newTip = '';
data.msgs.forEach((item: state.WarnMessage) => {
if (this.connectInfo) {
this.connectInfo.msgs.forEach((elem) => {
if (elem.lineId === item.lineId) {
if (elem.occRealConned && !item.occRealConned) {
tip =
tip +
`<div>${elem.lineId}号线路与卡斯柯的实时连接已断开;</div>`;
}
if (elem.occUnrealConned && !item.occUnrealConned) {
tip =
tip +
`<div>${elem.lineId}号线路与卡斯柯的非实时连接已断开</div>`;
}
}
});
if (!item.occRealConned) {
newTip =
newTip + `<div>${item.lineId}号线路与卡斯柯的实时连接已断开;</div>`;
}
if (!item.occUnrealConned) {
newTip =
newTip +
`<div>${item.lineId}号线路与卡斯柯的非实时连接已断开</div>`;
}
});
if (tip) {
const msgNotify = Notify.create({
if (newTip && (newTip !== tip || !msgNotify)) {
if (msgNotify) {
msgNotify();
}
tip = newTip;
msgNotify = Notify.create({
type: 'negative',
timeout: 0,
position: 'top',
@ -122,11 +123,17 @@ export const useLineNetStore = defineStore('lineNet', {
icon: 'close',
color: 'white',
handler: () => {
msgNotify();
if (msgNotify) {
msgNotify();
}
},
},
],
});
} else if (!newTip) {
if (msgNotify) {
msgNotify();
}
}
this.connectInfo = data;
const allConnectAmount = data.msgs.reduce((pre, cur) => {