添加通信断开链接提示
This commit is contained in:
parent
9bc7f9870d
commit
6521def1d1
@ -1 +1 @@
|
|||||||
Subproject commit cbc4bd23a8a4bd5c1d00aea526fc5dc630a37836
|
Subproject commit 7fe73a8334f36cf917255a99d75c454abcb96d79
|
@ -63,6 +63,7 @@ import { LogicSectionTemplate } from 'src/graphics/logicSection/LogicSection';
|
|||||||
import { LogicSectionData } from './graphics/LogicSectionInteraction';
|
import { LogicSectionData } from './graphics/LogicSectionInteraction';
|
||||||
import { alert } from 'src/protos/alertInfo';
|
import { alert } from 'src/protos/alertInfo';
|
||||||
import { useLineNetStore } from 'src/stores/line-net-store';
|
import { useLineNetStore } from 'src/stores/line-net-store';
|
||||||
|
import { QNotifyUpdateOptions, Notify } from 'quasar';
|
||||||
|
|
||||||
// const QuickJumpMenu = new ContextMenu({
|
// const QuickJumpMenu = new ContextMenu({
|
||||||
// name: '快捷跳转',
|
// name: '快捷跳转',
|
||||||
@ -246,6 +247,19 @@ export async function loadLineDatas(app: GraphicApp) {
|
|||||||
return states;
|
return states;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
let msgNotify: null | ((props?: QNotifyUpdateOptions | undefined) => void) =
|
||||||
|
null;
|
||||||
|
app.on('websocket-connect-state-change', (connected) => {
|
||||||
|
if (!connected && !msgNotify) {
|
||||||
|
msgNotify = Notify.create({
|
||||||
|
type: 'negative',
|
||||||
|
timeout: 0,
|
||||||
|
message: '通信链接已断开!',
|
||||||
|
});
|
||||||
|
} else if (msgNotify && connected) {
|
||||||
|
msgNotify();
|
||||||
|
}
|
||||||
|
});
|
||||||
const lineNetStore = useLineNetStore();
|
const lineNetStore = useLineNetStore();
|
||||||
msgBroker.subscribe({
|
msgBroker.subscribe({
|
||||||
destination: '/queue/xian/ncc/alert',
|
destination: '/queue/xian/ncc/alert',
|
||||||
|
@ -34,6 +34,7 @@ import { toUint8Array } from 'js-base64';
|
|||||||
import { getWebsocketUrl } from 'src/configs/UrlManage';
|
import { getWebsocketUrl } from 'src/configs/UrlManage';
|
||||||
import { getJwtToken } from 'src/configs/TokenManage';
|
import { getJwtToken } from 'src/configs/TokenManage';
|
||||||
import { alert } from 'src/protos/alertInfo';
|
import { alert } from 'src/protos/alertInfo';
|
||||||
|
import { QNotifyUpdateOptions, Notify } from 'quasar';
|
||||||
|
|
||||||
let lineNetApp: GraphicApp | null = null;
|
let lineNetApp: GraphicApp | null = null;
|
||||||
let msgBroker: AppWsMsgBroker | null = null;
|
let msgBroker: AppWsMsgBroker | null = null;
|
||||||
@ -139,6 +140,19 @@ export async function loadLineNetDatas(app: GraphicApp) {
|
|||||||
lineNetStore.setAlarmInfo(storage.messages as []);
|
lineNetStore.setAlarmInfo(storage.messages as []);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
let msgNotify: null | ((props?: QNotifyUpdateOptions | undefined) => void) =
|
||||||
|
null;
|
||||||
|
app.on('websocket-connect-state-change', (connected) => {
|
||||||
|
if (!connected && !msgNotify) {
|
||||||
|
msgNotify = Notify.create({
|
||||||
|
type: 'negative',
|
||||||
|
timeout: 0,
|
||||||
|
message: '通信链接已断开!',
|
||||||
|
});
|
||||||
|
} else if (msgNotify && connected) {
|
||||||
|
msgNotify();
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
app.loadGraphic([]);
|
app.loadGraphic([]);
|
||||||
}
|
}
|
||||||
|
@ -288,7 +288,7 @@ export interface GraphicAppEvents extends GlobalMixins.GraphicAppEvents {
|
|||||||
drag_op_end: [event: AppDragEvent];
|
drag_op_end: [event: AppDragEvent];
|
||||||
'pre-menu-handle': [menu: MenuItemOptions];
|
'pre-menu-handle': [menu: MenuItemOptions];
|
||||||
'post-menu-handle': [menu: MenuItemOptions];
|
'post-menu-handle': [menu: MenuItemOptions];
|
||||||
'websocket-state-change': [app: GraphicApp, connected: boolean];
|
'websocket-connect-state-change': [connected: boolean];
|
||||||
destroy: [app: GraphicApp];
|
destroy: [app: GraphicApp];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,8 +65,7 @@ export class StompCli {
|
|||||||
|
|
||||||
StompCli.client.onConnect = () => {
|
StompCli.client.onConnect = () => {
|
||||||
// console.log('websocket连接(重连),重新订阅', StompCli.appMsgBroker.length)
|
// console.log('websocket连接(重连),重新订阅', StompCli.appMsgBroker.length)
|
||||||
StompCli.connected = true;
|
StompCli.emitConnectStateChangeEvent(true);
|
||||||
StompCli.emitConnectStateChangeEvent();
|
|
||||||
StompCli.appMsgBroker.forEach((broker) => {
|
StompCli.appMsgBroker.forEach((broker) => {
|
||||||
broker.resubscribe();
|
broker.resubscribe();
|
||||||
});
|
});
|
||||||
@ -87,13 +86,11 @@ export class StompCli {
|
|||||||
|
|
||||||
StompCli.client.onDisconnect = (frame: Frame) => {
|
StompCli.client.onDisconnect = (frame: Frame) => {
|
||||||
console.log('Stomp 断开连接', frame);
|
console.log('Stomp 断开连接', frame);
|
||||||
StompCli.connected = false;
|
StompCli.emitConnectStateChangeEvent(false);
|
||||||
StompCli.emitConnectStateChangeEvent();
|
|
||||||
};
|
};
|
||||||
StompCli.client.onWebSocketClose = (evt: CloseEvent) => {
|
StompCli.client.onWebSocketClose = (evt: CloseEvent) => {
|
||||||
console.log('websocket 关闭', evt);
|
console.log('websocket 关闭', evt);
|
||||||
StompCli.connected = false;
|
StompCli.emitConnectStateChangeEvent(false);
|
||||||
StompCli.emitConnectStateChangeEvent();
|
|
||||||
};
|
};
|
||||||
// websocket错误处理
|
// websocket错误处理
|
||||||
StompCli.client.onWebSocketError = (err: Event) => {
|
StompCli.client.onWebSocketError = (err: Event) => {
|
||||||
@ -103,9 +100,10 @@ export class StompCli {
|
|||||||
StompCli.client.activate();
|
StompCli.client.activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
static emitConnectStateChangeEvent() {
|
static emitConnectStateChangeEvent(connected: boolean) {
|
||||||
|
StompCli.connected = connected;
|
||||||
StompCli.appMsgBroker.forEach((broker) => {
|
StompCli.appMsgBroker.forEach((broker) => {
|
||||||
broker.app.emit('websocket-state-change', broker.app, StompCli.connected);
|
broker.app.emit('websocket-connect-state-change', connected);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,9 +52,6 @@ class CompleteMouseToolOptions implements IMouseToolOptions {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const DefaultSelectToolOptions: CompleteMouseToolOptions =
|
|
||||||
new CompleteMouseToolOptions();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通用交互工具
|
* 通用交互工具
|
||||||
*/
|
*/
|
||||||
@ -72,7 +69,7 @@ export class CommonMouseTool extends AppInteractionPlugin {
|
|||||||
|
|
||||||
constructor(graphicApp: GraphicApp) {
|
constructor(graphicApp: GraphicApp) {
|
||||||
super(CommonMouseTool.Name, graphicApp);
|
super(CommonMouseTool.Name, graphicApp);
|
||||||
this.options = DefaultSelectToolOptions;
|
this.options = new CompleteMouseToolOptions();
|
||||||
|
|
||||||
this.box = new Graphics();
|
this.box = new Graphics();
|
||||||
this.box.name = CommonMouseTool.SelectBox;
|
this.box.name = CommonMouseTool.SelectBox;
|
||||||
|
@ -87,7 +87,6 @@ watch(
|
|||||||
|
|
||||||
function onResize() {
|
function onResize() {
|
||||||
const dom = document.getElementById('line-app-container');
|
const dom = document.getElementById('line-app-container');
|
||||||
console.log(props.sizeWidth, props.sizeHeight, '===');
|
|
||||||
if (dom) {
|
if (dom) {
|
||||||
dom.style.width = props.sizeWidth + 'px';
|
dom.style.width = props.sizeWidth + 'px';
|
||||||
dom.style.height = props.sizeHeight + 'px';
|
dom.style.height = props.sizeHeight + 'px';
|
||||||
|
Loading…
Reference in New Issue
Block a user