From a79668095caeefcb5f79eebe18070e140adb63c5 Mon Sep 17 00:00:00 2001 From: fan Date: Tue, 25 Apr 2023 17:39:24 +0800 Subject: [PATCH] =?UTF-8?q?ncc=E9=80=BB=E8=BE=91=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jmapNew/shape/nccGraph/NccStation/index.js | 2 +- src/utils/subscribeCallback.js | 11 ++++++++--- src/views/newMap/display/terminals/index.vue | 15 +++++++++++++-- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/jmapNew/shape/nccGraph/NccStation/index.js b/src/jmapNew/shape/nccGraph/NccStation/index.js index 9ca27fa55..bcc80f045 100644 --- a/src/jmapNew/shape/nccGraph/NccStation/index.js +++ b/src/jmapNew/shape/nccGraph/NccStation/index.js @@ -73,7 +73,7 @@ export default class NccStation extends Group { if (this.stationMain) { return this.stationMain.getBoundingRect().clone(); } else { - return new BoundingRect(this.model.position.x, this.model.position.y, 0, 0); + return new BoundingRect(0, 0, 0, 0); } } diff --git a/src/utils/subscribeCallback.js b/src/utils/subscribeCallback.js index dddf8f9a5..a3f2a2c0c 100644 --- a/src/utils/subscribeCallback.js +++ b/src/utils/subscribeCallback.js @@ -19,6 +19,14 @@ export function iscsPaCallback(Response) { export function iscsPisCallback(Response) { store.dispatch('socket/handleIscsPisState', JSON.parse(Response.body)); } +export function diagramSimCallback(Response) { + const msg = JSON.parse(Response.body); + switch (msg.type) { + case 'SIMULATION_NCC_STATION_DIAGRAM': + store.dispatch('socket/handleNccRun', msg.body); + break; + } +} export function defaultCallback(Response) { handle(JSON.parse(Response.body)); } @@ -200,9 +208,6 @@ function handle(data) { case 'Simulation_Control_Transfer_Result': store.dispatch('socket/setControlTransfer', msg); break; - case 'SIMULATION_NCC_STATION_DIAGRAM': - store.dispatch('socket/handleNccRun', msg); - break; } } // 仿真内部聊天 diff --git a/src/views/newMap/display/terminals/index.vue b/src/views/newMap/display/terminals/index.vue index 6a5cb45d0..47bb888e4 100644 --- a/src/views/newMap/display/terminals/index.vue +++ b/src/views/newMap/display/terminals/index.vue @@ -53,7 +53,7 @@ import {getSimulationMemberList, getAllSimulationUser} from '@/api/simulation'; import {getToken} from '@/utils/auth'; import {creatSubscribe, clearSubscribe, getTopic} from '@/utils/stomp'; -import { defaultCallback, stateCallback } from '@/utils/subscribeCallback'; +import { defaultCallback, stateCallback, diagramSimCallback } from '@/utils/subscribeCallback'; import DispatcherWork from './dispatchWork'; import LocalWork from './localWork'; import InterlockWork from './interlockWork'; @@ -197,6 +197,11 @@ export default { if (val) { this.simulationReset(val); } + }, + '$store.state.socket.simulationAlarmInfo': function(val) { + if (val && val.handleMethod === 'NCC' && this.picture === 'nccWork') { + this.picture = 'lineMonitor'; + } } }, mounted() { @@ -231,7 +236,13 @@ export default { }, subscribe(type) { // 根据显示端分别订阅 const header = {group: this.group || '', 'X-Token': getToken()}; - creatSubscribe(getTopic(type, this.group), header, type === 'STATE' ? stateCallback : defaultCallback); + let callbackFun = defaultCallback; + if (type === 'STATE') { + callbackFun = stateCallback; + } else if (type === 'NCC') { + callbackFun = diagramSimCallback; + } + creatSubscribe(getTopic(type, this.group), header, callbackFun); }, clearSubscribe() { clearSubscribe(getTopic('COMMON', this.group));