ncc逻辑调整

This commit is contained in:
fan 2023-04-25 17:39:24 +08:00
parent 034199ec23
commit a79668095c
3 changed files with 22 additions and 6 deletions

View File

@ -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);
}
}

View File

@ -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;
}
}
// 仿真内部聊天

View File

@ -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));