From 9060e0efe27bb826c066f6509781fc561722d685 Mon Sep 17 00:00:00 2001 From: fan <18706759286@163.com> Date: Thu, 9 Sep 2021 17:22:47 +0800 Subject: [PATCH] =?UTF-8?q?ISCS=E7=8A=B6=E6=80=81=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/iscs/iscs.js | 60 +++++++++++++++++-- src/iscs/painter.js | 2 +- src/iscs/shape/fuzhouPsd.js | 22 +++++-- src/store/modules/iscs.js | 6 ++ src/store/modules/socket.js | 7 +++ src/utils/baseUrl.js | 4 +- src/utils/stomp.js | 6 ++ .../iscs/iscsDraw/icscComponents/circle.vue | 3 + .../iscsDraw/iscsCommonElem/fuzhouPsd.vue | 3 + src/views/iscs/iscsSystem/index.vue | 17 ++++++ .../iscs/iscsSystem/stationConfig/index.vue | 3 + 11 files changed, 121 insertions(+), 12 deletions(-) diff --git a/src/iscs/iscs.js b/src/iscs/iscs.js index 45740d63e..0f5fd5f86 100644 --- a/src/iscs/iscs.js +++ b/src/iscs/iscs.js @@ -180,12 +180,62 @@ class Iscs { update(list) { (list || []).forEach(elem => { const code = elem.code; - const oDevice = this.iscsDevice[code]; - if (elem.dispose) { - this.$painter.delete(oDevice); + console.log(elem, '---------', elem.deviceType); + if (elem.deviceType === 'IBP') { + if (this.iscsDevice['IscsCircle_20']) { + elem.upStatus.operate ? this.iscsDevice['IscsCircle_20'].model.fillColor = '#00CC00' : this.iscsDevice['IscsCircle_20'].model.fillColor = '#008DCE'; + this.$painter.update(this.iscsDevice['IscsCircle_20']); + } + if (this.iscsDevice['IscsCircle_17']) { + elem.upStatus.openCommand ? this.iscsDevice['IscsCircle_17'].model.fillColor = '#00CC00' : this.iscsDevice['IscsCircle_17'].model.fillColor = '#008DCE'; + this.$painter.update(this.iscsDevice['IscsCircle_17']); + } + if (this.iscsDevice['IscsCircle_18']) { + elem.upStatus.openSideCommand ? this.iscsDevice['IscsCircle_18'].model.fillColor = '#00CC00' : this.iscsDevice['IscsCircle_18'].model.fillColor = '#008DCE'; + this.$painter.update(this.iscsDevice['IscsCircle_18']); + } + if (this.iscsDevice['IscsCircle_19']) { + elem.upStatus.closeCommand ? this.iscsDevice['IscsCircle_19'].model.fillColor = '#00CC00' : this.iscsDevice['IscsCircle_19'].model.fillColor = '008DCE'; + this.$painter.update(this.iscsDevice['IscsCircle_19']); + } + } else if (elem.deviceType === 'PSL') { + if (this.iscsDevice['IscsCircle_12']) { + elem.upStatus.operate ? this.iscsDevice['IscsCircle_12'].model.fillColor = '#00CC00' : this.iscsDevice['IscsCircle_12'].model.fillColor = '#008DCE'; + this.$painter.update(this.iscsDevice['IscsCircle_12']); + } + if (this.iscsDevice['IscsCircle_9']) { + elem.upStatus.openCommand ? this.iscsDevice['IscsCircle_9'].model.fillColor = '#00CC00' : this.iscsDevice['IscsCircle_9'].model.fillColor = '#008DCE'; + this.$painter.update(this.iscsDevice['IscsCircle_9']); + } + if (this.iscsDevice['IscsCircle_35']) { + elem.upStatus.closeCommand ? this.iscsDevice['IscsCircle_35'].model.fillColor = '#00CC00' : this.iscsDevice['IscsCircle_35'].model.fillColor = '#008DCE'; + this.$painter.update(this.iscsDevice['IscsCircle_35']); + } + if (this.iscsDevice['IscsCircle_37']) { + elem.upStatus.interlockRelease ? this.iscsDevice['IscsCircle_37'].model.fillColor = '#00CC00' : this.iscsDevice['IscsCircle_37'].model.fillColor = '#008DCE'; + this.$painter.update(this.iscsDevice['IscsCircle_37']); + } + } else if (elem.deviceType === 'SAFETY_CIRCLE') { + if (this.iscsDevice['IscsCircle_26']) { + elem.upStatus.pfdcFault ? this.iscsDevice['IscsCircle_26'].model.fillColor = '#00CC00' : this.iscsDevice['IscsCircle_26'].model.fillColor = '#008DCE'; + this.$painter.update(this.iscsDevice['IscsCircle_26']); + } + if (this.iscsDevice['IscsCircle_25']) { + elem.upStatus.busFault ? this.iscsDevice['IscsCircle_25'].model.fillColor = '#00CC00' : this.iscsDevice['IscsCircle_25'].model.fillColor = '#008DCE'; + this.$painter.update(this.iscsDevice['IscsCircle_25']); + } + if (this.iscsDevice['IscsCircle_27']) { + elem.upStatus.safetyCircle ? this.iscsDevice['IscsCircle_27'].model.fillColor = '#00CC00' : this.iscsDevice['IscsCircle_27'].model.fillColor = '#008DCE'; + this.$painter.update(this.iscsDevice['IscsCircle_27']); + } } else { - if (this.hookHandle(oDevice.model, elem)) { - this.$painter.update(oDevice); + const oDevice = this.iscsDevice[code]; + if (oDevice && elem.dispose) { + this.$painter.delete(oDevice); + } else if (oDevice) { + if (this.hookHandle(oDevice.model, elem)) { + this.$painter.update(oDevice); + } } } }); diff --git a/src/iscs/painter.js b/src/iscs/painter.js index 3871a39eb..6e5802628 100644 --- a/src/iscs/painter.js +++ b/src/iscs/painter.js @@ -97,7 +97,7 @@ class Painter { } else { const instance = device.instance; if (instance) { - instance.setState(device); + instance.setState(device.model); } } } diff --git a/src/iscs/shape/fuzhouPsd.js b/src/iscs/shape/fuzhouPsd.js index cb2ec3b66..ac85f6ead 100644 --- a/src/iscs/shape/fuzhouPsd.js +++ b/src/iscs/shape/fuzhouPsd.js @@ -68,15 +68,29 @@ export default class fuzhouPsd extends Group { this.add(this.grouper); } setState(model) { - if (model.alarm) { - this.fuzhouPsdBorder.setStyle('lineWidth', 1); - } - if (model.noStatus) { + // if (model.alarm) { + // this.fuzhouPsdBorder.setStyle('lineWidth', 1); + // } + if (model.status === 'UNDEFINED') { this.fuzhouPsdLeft.attr({shape:{x: 2}}); this.fuzhouPsdRight.attr({shape:{x: this.model.height * 0.9 - 0.4}}); this.fuzhouPsdBorder.setStyle('fill', '#0f96dc'); this.fuzhouPsdRight.setStyle('fill', '#0f96dc'); this.fuzhouPsdLeft.setStyle('fill', '#0f96dc'); + } else if (model.status === 'DCU_FAULT') { + this.fuzhouPsdBorder.setStyle('lineWidth', 1); + } else if (model.status === 'OPEN') { + this.fuzhouPsdLeft.attr({shape:{x: 2 + (this.model.height * 1.5 - 4) * 0.1}}); + this.fuzhouPsdRight.attr({shape:{x: (this.model.height * 1.5 - 4) * 0.5 + 2}}); + this.fuzhouPsdBorder.setStyle('fill', '#33CC00'); + this.fuzhouPsdRight.setStyle('fill', '#33CC00'); + this.fuzhouPsdLeft.setStyle('fill', '#33CC00'); + } else if (model.status === 'CLOSE') { + this.fuzhouPsdLeft.attr({shape:{x: 2 + (this.model.height * 1.5 - 4) * 0.1}}); + this.fuzhouPsdRight.attr({shape:{x: (this.model.height * 1.5 - 4) * 0.5 + 2}}); + this.fuzhouPsdBorder.setStyle('fill', '#33CC00'); + this.fuzhouPsdRight.setStyle('fill', '#33CC00'); + this.fuzhouPsdLeft.setStyle('fill', '#33CC00'); } } setModel(dx, dy) { diff --git a/src/store/modules/iscs.js b/src/store/modules/iscs.js index 93e2d9b26..2ad62748f 100644 --- a/src/store/modules/iscs.js +++ b/src/store/modules/iscs.js @@ -181,6 +181,9 @@ const iscs = { }, setCloseMusic: (state, num) => { state.closeMusicNum = num; + }, + updateIscsState: (state, deviceStatus) => { + Vue.prototype.$iscs && Vue.prototype.$iscs.update(deviceStatus); } }, @@ -188,6 +191,9 @@ const iscs = { setIscsData: ({ commit }, iscs) => { commit('setIscsData', iscs); }, + updateIscsState: ({ commit }, deviceStatus) => { + commit('updateIscsState', deviceStatus); + }, updateIscsDevices: ({ commit }, models) => { return new Promise((resolve) => { if (!(models instanceof Array)) { diff --git a/src/store/modules/socket.js b/src/store/modules/socket.js index 7fb2f2632..3e9ede246 100644 --- a/src/store/modules/socket.js +++ b/src/store/modules/socket.js @@ -340,6 +340,7 @@ const socket = { competitionPracticeFinish:0, // 竞赛场景结束标识 simulationAlarmInfo: [], // 仿真报警信息 deviceStateMessages: null, // 新版订阅设备状态消息 + iscsStateMessages: null, // iscs设备状态消息 simulationSpeed: 1, // 仿真倍速 simulationPause: false, simulationPslStatus: [], // PSL面板按钮状态信息 @@ -421,6 +422,9 @@ const socket = { }, setSimulationSpeed: (state, speed) => { state.simulationSpeed = speed; + }, + setIscsStateMessages: (state, speed) => { + state.iscsStateMessages = speed; } }, @@ -506,6 +510,9 @@ const socket = { }, setSimulationTimeSync:({ commit }, time) => { commit('setSimulationTimeSync', time); + }, + handleIscsState:({ commit }, state) => { + commit('setIscsStateMessages', state.body); } } }; diff --git a/src/utils/baseUrl.js b/src/utils/baseUrl.js index 6752e47ae..a919aec35 100644 --- a/src/utils/baseUrl.js +++ b/src/utils/baseUrl.js @@ -2,7 +2,7 @@ export function getBaseUrl() { let BASE_API; if (process.env.NODE_ENV === 'development') { // BASE_API = 'https://joylink.club/jlcloud'; - BASE_API = 'https://test.joylink.club/jlcloud'; + // BASE_API = 'https://test.joylink.club/jlcloud'; // BASE_API = 'http://192.168.8.107:9000'; // 袁琪 // BASE_API = 'http://192.168.2.175:9000'; // 旭强 有线 // BASE_API = 'http://192.168.8.167:9000'; // 旭强 无线 @@ -10,7 +10,7 @@ export function getBaseUrl() { // BASE_API = 'http://192.168.8.140:9000'; // 杜康 // BASE_API = 'http://b29z135112.zicp.vip'; // BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康 - // BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛 + BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛 } else { BASE_API = process.env.VUE_APP_BASE_API; } diff --git a/src/utils/stomp.js b/src/utils/stomp.js index ca44a20a3..ee8d0ecd7 100644 --- a/src/utils/stomp.js +++ b/src/utils/stomp.js @@ -8,6 +8,7 @@ export const perpetualTopic = '/user/topic/message'; // 公用topic export const roomTopic = '/user/queue/room'; // 房间topic export const jl3dTopic = '/user/queue/simulation/jl3d'; // 三维topic export const LPFTopic = '/user/queue/simulation/passenger'; // 客流topic +export const iscsTopic = '/topic/simulation/iscs'; // iscs topic export function getTopic(type, group) { let topic = ''; @@ -24,6 +25,9 @@ export function getTopic(type, group) { // topic = `/user/queue/simulation/${group}/state`; topic = `/queue/simulation/${group}/state`; break; + case 'ISCS': + topic = '/topic/simulation/iscs'; + break; } return topic; } @@ -49,6 +53,8 @@ function callback(Response) { store.dispatch('socket/setSimulationTimeSync', Number.parseInt(Response.body)); } else if (Response.headers.destination.includes('state')) { store.dispatch('socket/handleSimulationState', Number.parseInt(Response.body)); + } else if (Response.headers.destination.includes('iscs')) { + store.dispatch('socket/handleIscsState', JSON.parse(Response.body)); } else { const data = JSON.parse(Response.body); store.dispatch('socket/setStomp', data); diff --git a/src/views/iscs/iscsDraw/icscComponents/circle.vue b/src/views/iscs/iscsDraw/icscComponents/circle.vue index bb66ca737..76ae25455 100644 --- a/src/views/iscs/iscsDraw/icscComponents/circle.vue +++ b/src/views/iscs/iscsDraw/icscComponents/circle.vue @@ -1,6 +1,9 @@