diff --git a/src/api/rtSimulation.js b/src/api/rtSimulation.js new file mode 100644 index 000000000..6c9e74571 --- /dev/null +++ b/src/api/rtSimulation.js @@ -0,0 +1,94 @@ +import request from '@/utils/request'; +/** 创建仿真 */ +export function createSimulation(data) { + return request({ + url: `/rtSimulation?mapId=${data.mapId}&prdType=${data.prdType}`, + method: 'post' + }); +} +/** 根据仿真group获取仿真基础信息 */ +export function getSimulationInfoByGroup(groupId) { + return request({ + url: `/common/simulation/${groupId}`, + method: 'get' + }); +} +/** 根据仿真group获取仿真地图数据 */ +export function getMapDataByGroup(groupId) { + return request({ + url: `/rtSimulation/${groupId}/mapData`, + method: 'get' + }); +} +/** 仿真发送指令 */ +export function sendSimulationCommand(group, memberId, type, data) { + return request({ + url: `/common/simulation/${group}/member/${memberId}/operate/${type}`, + method: 'post', + data + }); +} +/** 获取仿真成员列表 */ +export function getMemberListCommon(group) { + return request({ + url: `/common/simulation/${group}/members`, + method: 'get' + }); +} +/** 获取仿真用户列表 */ +export function getUserListCommon(group) { + return request({ + url: `/common/simulation/${group}/users`, + method: 'get' + }); +} +/** 销毁仿真 */ +export function destroySimulation(group) { + return request({ + url: `/common/simulation/${group}/destroy`, + method: 'delete' + }); +} +/** 初始化仿真 */ +export function initSimulation(group) { + return request({ + url: `/common/simulation/${group}/init`, + method: 'put' + }); +} +/** 设置故障 */ +export function setSimulationFault(group, data) { + return request({ + url: `/common/simulation/${group}/fault`, + method: 'post', + data + }); +} +/** 取消故障 */ +export function cancelSimulationFault(group, deviceId, faultType) { + return request({ + url: `/common/simulation/${group}/device/${deviceId}/fault/${faultType}`, + method: 'delete' + }); +} +/** 仿真运行倍速 */ +export function timesSpeedPlayback(group, speed) { + return request({ + url: `/common/simulation/${group}/updateSpeed/${speed}`, + method: 'put' + }); +} +/** 仿真暂停 */ +export function simulationPause(group) { + return request({ + url: `/common/simulation/${group}/pause`, + method: 'put' + }); +} +/** 仿真开始 */ +export function simulationStart(group) { + return request({ + url: `/common/simulation/${group}/start`, + method: 'put' + }); +} diff --git a/src/api/trainingPlatform.js b/src/api/trainingPlatform.js index 277ffebb1..6a3d9a6b2 100644 --- a/src/api/trainingPlatform.js +++ b/src/api/trainingPlatform.js @@ -15,6 +15,13 @@ export function generateMapSystem(mapId) { method: 'post' }); } +/** 生成指定子系统 */ +export function generateAppointMapSystem(mapId, prdType) { + return request({ + url: `/api/mapSystem/generate/${mapId}/${prdType}`, + method: 'post' + }); +} /** 查询子系统信息 */ export function getSubSystemInfo(id) { return request({ diff --git a/src/jmapNew/config/skinCode/datie_01.js b/src/jmapNew/config/skinCode/datie_01.js index 8e3eb812c..9707823b8 100644 --- a/src/jmapNew/config/skinCode/datie_01.js +++ b/src/jmapNew/config/skinCode/datie_01.js @@ -168,6 +168,7 @@ class SkinCode extends defaultStyle { this[deviceType.Signal] = { distance: 10, // 设备距离区段的距离 + colorSpecial: true, // 特殊处理灯位颜色 post: { standardLength: 6, // 高柱长度 standardHeight: 6, // 灯柱高度 @@ -182,9 +183,18 @@ class SkinCode extends defaultStyle { fontSize: 11, // 信号机名称字体大小 fontWeight: 'bold', // 信号机名称字体粗细 defaultColor: '#FFFFFF', // 信号灯字体默认色 - blockColor: '#EF0C08', // 信号灯字体锁定颜色 + blockColor: '#FFFFFF', // 信号灯字体锁定颜色 checkColor: '#00FF00' // 信号保护区段检查颜色 }, + remainTimeColor: '#F00', + tText: { + offsetX: 0, + offsetY: -30, + fontSize: 11, // 信号机名称字体大小 + fontWeight: 'bold', // 信号机名称字体粗细 + defaultColor: '#F00', // 信号灯字体默认色 + defaultText: 0 + }, lamp: { bgShow: false, // 是否被选中 guidName: 'singleRY', // 成都三号线引导类型 diff --git a/src/jmapNew/config/skinCode/race_01.js b/src/jmapNew/config/skinCode/race_01.js index 1e2640fae..aa4da8d91 100644 --- a/src/jmapNew/config/skinCode/race_01.js +++ b/src/jmapNew/config/skinCode/race_01.js @@ -529,8 +529,8 @@ class SkinCode extends defaultStyle { core: { length: 6, // 道岔单边长度 graphShow: true, // 图形显示 - graphInversionColor: '#FFFF00', // 反位颜色 - graphLocalColor: '#00FF00' // 定位颜色 + graphInversionColor: '#FFFF00', // 反位颜色 + graphLocalColor: '#00FF00' // 定位颜色 }, jointImg: { // 道岔 A B C D四元素属性配置 trapezoidLength: 8, // 直角梯形元素默认长度 @@ -662,13 +662,14 @@ class SkinCode extends defaultStyle { changeTrainWidth: false, // 是否根据车身上车组号、服务号、车次号、目的地码显示情况改变列车长度 specialTrainType: [ { - type: '03', + type: 'MANUAL', serviceNumber: 'M0', nameFormat: 'serviceNumber:groupNumber' }, { - type: '02', - nameFormat: 'targetCode:groupNumber' + type: 'HEAD', + serviceNumber: 'M0', + nameFormat: 'serviceNumber:targetCode' } ], // 特殊列车类型需设置显示格式 lrPadding: 4, // 两边间隔 @@ -697,8 +698,8 @@ class SkinCode extends defaultStyle { textAContent: 'A'// textA文本 }, trainNumber: { - targetCodePrefix: '000', // 目的地码前缀 - trainNumberOffset: { x: 0, y: 1 }// 目的地码偏移量 + targetCodePrefix: '00', // 目的地码前缀 + trainNumberOffset: { x: 0, y: 4 }// 目的地码偏移量 }, trainServer: { serviceNumberPrefix: '00', // 服务号(表号)前缀 @@ -803,7 +804,7 @@ class SkinCode extends defaultStyle { }; this[deviceType.FloodGate] = {}; this[deviceType.DirectionRod] = {}; - this[deviceType.IndicatorLight] = {}; + this[deviceType.IndicatorLight] = {}; } } diff --git a/src/jmapNew/shape/Signal/ESigName.js b/src/jmapNew/shape/Signal/ESigName.js index 55c9feccf..b8025bd18 100644 --- a/src/jmapNew/shape/Signal/ESigName.js +++ b/src/jmapNew/shape/Signal/ESigName.js @@ -44,13 +44,23 @@ class ESigName extends Group { getNameText() { return this.name; } - hide() { this.name.hide(); } show() { this.name.show(); } + setAnimationStart(color) { + this.name && this.name.animateStyle(true) + .when(0, { textFill: this.model.style.backgroundColor }) + .when(1000, { textFill: color }) + .when(2000, { textFill: this.model.style.backgroundColor }) + .when(3000, { textFill: color }) + .start(); + } + setAnimationEnd() { + this.name && this.name.stopAnimation(false); + } } export default ESigName; diff --git a/src/jmapNew/shape/Signal/index.js b/src/jmapNew/shape/Signal/index.js index 0de7279be..e2222933c 100644 --- a/src/jmapNew/shape/Signal/index.js +++ b/src/jmapNew/shape/Signal/index.js @@ -18,6 +18,7 @@ import Text from 'zrender/src/graphic/Text'; import Isogon from 'zrender/src/graphic/shape/Isogon'; import deviceType from '../../constant/deviceType'; import { findDeviceByModelDepType } from '../utils/ShapeDepFind'; +import store from '@/store/index'; // import BoundingRect from 'zrender/src/core/BoundingRect'; // import background from './../../../ibp/shape/background'; @@ -164,6 +165,22 @@ const SignalAspectMap = { 3: () => {} }; exec(lampsMap[lamps.length]); + }, + // 12 红闪 + 12: (lamps, style) => { + const lampsMap = { + 1: () => { + lamps[0].setColor(style.Signal.lamp.redColor); + lamps[0].setAnimationStart(style.Signal.lamp.redColor); + }, + 2: () => { + lamps[0].setColor(style.Signal.lamp.redColor); + lamps[0].setAnimationStart(style.Signal.lamp.redColor); + lamps[1].setColor(style.backgroundColor); + }, + 3: () =>{} + }; + exec(lampsMap[lamps.length]); } }; @@ -262,8 +279,8 @@ class Signal extends Group { z: this.z, _val: '3', style: { - x: endPoint.x, - y: endPoint.y, + x: endPoint.x + (style.Signal.tText.offsetX || 0), + y: endPoint.y + (style.Signal.tText.offsetY || 0), fontWeight: style.Signal.tText.fontWeight, fontSize: style.Signal.tText.fontSize, fontFamily: style.fontFamily, @@ -359,7 +376,7 @@ class Signal extends Group { fontWeight: style.Signal.text.fontWeight, fontSize: 12, fontFamily: style.fontFamily, - textFill: '#FFF', + textFill: style.Signal.remainTimeColor || '#FFF', textAlign: 'center', textVerticalAlign: 'middle' }); @@ -682,7 +699,7 @@ class Signal extends Group { if (this.style.Signal.text.nameBorderShow) { this.sigName.setStyle({ textBorderWidth: 1 }); } - if (this.sigBack) { + if (this.sigBack && (!this.model.signalButtonList || !this.model.signalButtonList.length)) { this.sigBack.show(); this.sigBack.setStyle('fill', this.style.Signal.sigBack.fillColor); } @@ -690,6 +707,12 @@ class Signal extends Group { this.lamps[0].setBorderColor(this.style.Signal.lamp.borderColor); this.lamps[0].setAnimationStart(this.style.Signal.lamp.blockColor); } + if (this.model.signalButtonList && this.model.signalButtonList.length) { + this.model.signalButtonList.forEach(item => { + const button = store.getters['map/getDeviceByCode'](item); + button && button.instance && button.instance.blockShow(); + }); + } } reblock() { this.sigPost.setHorColor(this.style.Signal.post.reblockHorColor); @@ -835,6 +858,15 @@ class Signal extends Group { showRemainTime(number) { this.remainTImeName.show(); this.remainTImeName && this.remainTImeName.setStyle({ text: number }); + this.model.signalButtonList && this.model.signalButtonList.length && this.model.signalButtonList.forEach(item => { + const button = store.getters['map/getDeviceByCode'](item); + if (button.type === 'PICK') { + button && button.instance && button.instance.startAnimate(); + } + }); + if (this.model.type === 'SHUNTING') { + this.sigName && this.sigName.setAnimationStart(this.style.Signal.text.defaultColor); + } } setAshShow() { this.lamps.forEach(item=> { item.setStyle({fill: '#7F7F7F', stroke: '#7F7F7F'}); }); @@ -844,6 +876,7 @@ class Signal extends Group { } // 恢复状态 recover() { + this.sigName && this.sigName.setAnimationEnd(); this.lamps && this.lamps.forEach(item=> { item.show(); item.setGuideSectorShowHide(false); }); this.sigName.setStyle({ textBorderWidth: 0 }); this.sigName.setColor(this.style.Signal.text.defaultColor); @@ -883,9 +916,16 @@ class Signal extends Group { this.ciConfirm && this.ciConfirm.stopAnimation(false); this.ciConfirm && this.ciConfirm.hide(); this.sigBack && this.sigBack.hide(); + this.tText && this.tText.hide(); this.sigBack && this.sigBack.stopAnimation(false); this.lamps && this.lamps[0] && this.lamps[0].setAnimationEnd(); this.virtualSignal && this.virtualSignal.setColor(this.style.Signal.lamp.redColor); + if (this.model.signalButtonList && this.model.signalButtonList.length) { + this.model.signalButtonList.forEach(item => { + const button = store.getters['map/getDeviceByCode'](item); + button && button.instance && button.instance.recover(); + }); + } } setState(model) { @@ -913,10 +953,19 @@ class Signal extends Group { model.greenOpen && !model.redOpen && !model.yellowOpen && this.openPositive(model.logicLight); // 信号正向开放 model.yellowOpen && !model.redOpen && !model.greenOpen && this.openLateral(model.logicLight); // 信号侧向开放 model.redOpen && model.yellowOpen && !model.greenOpen && this.guid(); // 引导信号显示 + if (model.remainTime) { + this.showRemainTime(model.remainTime); + } else { + this.model.signalButtonList && this.model.signalButtonList.length && this.model.signalButtonList.forEach(item => { + const button = store.getters['map/getDeviceByCode'](item); + if (button.type === 'PICK') { + button && button.instance && button.instance.setState(button); + } + }); + } /** 信号机封锁 */ // 缺一个功能封锁 - model.blockade && this.block(); + model.blockade && this.block(); // 因大铁处理信号按钮状态 封锁处理需在延时解锁时间之后处理 model.reblockade && this.reblock(); - model.remainTime && this.showRemainTime(model.remainTime); if (!path.includes('/map/draw')) { // 联锁自动进路通过 model.fleetMode && this.setAutoRouteOpen(); @@ -980,9 +1029,15 @@ class Signal extends Group { // 灯是否点灯显示 this.lamps.forEach(lamp => { lamp.setStop(model.signalLight); }); } - + if (model.hasSelected) { + this.sigName && this.sigName.setAnimationStart(this.style.Signal.text.defaultColor); + } // 信号机故障 model.fault && this.fault(); + if (model.guideTime) { + this.tText && this.tText.setStyle('text', model.guideTime); + this.tText && this.tText.show(); + } // 设置灰显 if (model.noStatus || model.level === 0) { this.setAshShow(); diff --git a/src/jmapNew/shape/SignalButton/index.js b/src/jmapNew/shape/SignalButton/index.js index fd9756f45..e1d8d15e1 100644 --- a/src/jmapNew/shape/SignalButton/index.js +++ b/src/jmapNew/shape/SignalButton/index.js @@ -20,12 +20,7 @@ export default class SignalButton extends Group { create() { const model = this.model; - let fillColor = '#008000'; - if (model.type === 'GUIDE') { - fillColor = '#5050E1'; - } else if (model.type === 'FLEXIBLE' || model.type === 'SHUNT_TERMINAL') { - fillColor = '#808080'; - } + const fillColor = this.getTypeColor(); this.rectButton = new Rect({ zlevel: this.zlevel, z: this.z, @@ -75,7 +70,7 @@ export default class SignalButton extends Group { }); this.add(this.rightLine); this.rightLine.hide(); - if (model.name) { + if (model.type === 'PASS') { this.buttonText = new Text({ zlevel: this.zlevel, z: this.z, @@ -95,23 +90,42 @@ export default class SignalButton extends Group { } } startAnimate() { - let color = '#008000'; - if (this.model.type === 'TRAIN_TERMINAL') { - color = '#008000'; - } else if (this.model.type === 'FLEXIBLE' || this.model.type === 'SHUNT_TERMINAL') { - color = '#808080'; - } this.rectButton && this.rectButton.animateStyle(true) .when(0, { fill: '#000' }) - .when(1000, { fill: color }) + .when(1000, { fill: this.getTypeColor() }) .when(2000, { fill: '#000' }) .start(); } stopAnimation() { this.rectButton && this.rectButton.stopAnimation(true); } + getTypeColor() { + let color = ''; + if (this.model.type === 'FLEXIBLE' || this.model.type === 'SHUNT_TERMINAL') { + color = '#808080'; + } else if (this.model.type === 'GUIDE') { + color = '#5050E1'; + } else { + color = '#008000'; + } + return color; + } + recover() { + this.stopAnimation(); + this.rectButton && this.rectButton.setStyle({ fill:this.getTypeColor() }); + this.rightLine && this.rightLine.hide(); + this.leftLine && this.leftLine.hide(); + } + blockShow() { + this.rightLine && this.rightLine.show(); + this.leftLine && this.leftLine.show(); + } setState(model) { + this.recover(); if (!this.isShowShape) return; + if (model.hasSelected) { + this.startAnimate(); + } } // 设置显示模式 setShowMode() { diff --git a/src/jmapNew/shape/Switch/index.js b/src/jmapNew/shape/Switch/index.js index e1370ce0a..fdec3adfb 100644 --- a/src/jmapNew/shape/Switch/index.js +++ b/src/jmapNew/shape/Switch/index.js @@ -230,16 +230,16 @@ export default class Switch extends Group { offsetX = directx * this.style.Switch.rectLock.offset.x; offsetY = directy * this.style.Switch.rectLock.offset.y; } - let x = this.model.intersection.x - this.style.Switch.rectLock.rectWidth / 2 + offsetX; - let y = this.model.intersection.y - this.style.Switch.rectLock.rectWidth / 2 + offsetY; - if (this.style.Switch.rectLock.followName) { - const directx = this.triangle.drictx; - const rect = this.name.getBoundingRect(); - const wLen = this.style.Switch.rectLock.rectWidth - (directx > 0? rect.width: rect.width/2); - const hLen = this.style.Switch.rectLock.rectWidth - rect.height - x = rect.x - wLen/2; - y = rect.y - hLen/2 - } + let x = this.model.intersection.x - this.style.Switch.rectLock.rectWidth / 2 + offsetX; + let y = this.model.intersection.y - this.style.Switch.rectLock.rectWidth / 2 + offsetY; + if (this.style.Switch.rectLock.followName) { + const directx = this.triangle.drictx; + const rect = this.name.getBoundingRect(); + const wLen = this.style.Switch.rectLock.rectWidth - (directx > 0 ? rect.width : rect.width / 2); + const hLen = this.style.Switch.rectLock.rectWidth - rect.height; + x = rect.x - wLen / 2; + y = rect.y - hLen / 2; + } this.lockRect = new ELockRect({ // 单锁矩形框 zlevel: this.zlevel, @@ -326,7 +326,7 @@ export default class Switch extends Group { /** 恢复状态*/ recover() { this.lockRect && this.lockRect.hide(); // 矩形包围框 - this.lockCircle && this.lockCircle.hide(); // 圆形包围框 + this.lockCircle && this.lockCircle.hide(); // 圆形包围框 this.lockArc && this.lockArc.hide(); // 圆形单锁框 this.name.getNameText().stopAnimation(false); this.shapeModelC.hide(); // 形状 C @@ -703,6 +703,9 @@ export default class Switch extends Group { this.setInversionAction(model); /** 反位*/ } else { this.setLossAction(model.fault); // 失去 + if (model.switchSplit) { + this.setForkAction(); + } } model.isCiConfirm && this.setCiConfirm(); // 道岔使能显示 diff --git a/src/jmapNew/shape/Train/TrainBody.js b/src/jmapNew/shape/Train/TrainBody.js index dd8be5b04..3d1444c7d 100644 --- a/src/jmapNew/shape/Train/TrainBody.js +++ b/src/jmapNew/shape/Train/TrainBody.js @@ -40,21 +40,11 @@ export default class TrainBody extends Group { create() { const model = this.model; const style = this.model.style; - this.nameFormat = model.nameFormat; const tripNumber = style.Train.trainTarget.tripNumberPrefix + (style.Train.trainTarget.defaultDirectionCode ? (model.directionCode || style.Train.trainTarget.defaultDirectionCode) + (model.tripNumber || style.Train.trainTarget.defaultTripNumber) : model.tripNumber || style.Train.trainTarget.defaultTripNumber); // 车次号 const groupNumber = style.Train.trainTargetNumber.groupNumberPrefix + (style.Train.trainTargetNumber.lineNumber || '') + (model.groupNumber || style.Train.trainTargetNumber.defaultGroupNumber); // 车组号 - let serviceNumber = ''; // 服务号(表号) - if (this.model.type == 'PLAN') { // 计划车 - serviceNumber = style.Train.trainServer.serviceNumberPrefix + (model.serviceNumber || model.model.specialServiceNumber || style.Train.trainServer.defaultServiceNumber); - } else if (this.model.type == 'HEAD') { // 头码车 - serviceNumber = style.Train.trainServer.serviceNumberPrefix + (model.destinationCode || style.Train.trainNumber.defaultTargetCode); - this.nameFormat = 'serviceNumber:groupNumber'; - } else if (this.model.type == 'MANUAL') { // 人工车 - serviceNumber = style.Train.trainServer.serviceNumberPrefix + (model.serviceNumber || model.model.specialServiceNumber || style.Train.trainServer.defaultServiceHeadNum); - this.nameFormat = 'serviceNumber:groupNumber'; - } + const serviceNumber = style.Train.trainServer.serviceNumberPrefix + (model.serviceNumber || model.model.specialServiceNumber || style.Train.trainServer.defaultServiceNumber);// 服务号(表号) let targetCode = style.Train.trainNumber.targetCodePrefix + (model.destinationCode || style.Train.trainNumber.defaultTargetCode); // 目的地码 if (Vue.prototype.$jlmap.lineCode == '09') { // 暂时先写死 后面有了删掉就好 targetCode = '01'; diff --git a/src/jmapNew/theme/chengdu_01/model.js b/src/jmapNew/theme/chengdu_01/model.js index c7d80a99e..b7c5f905f 100644 --- a/src/jmapNew/theme/chengdu_01/model.js +++ b/src/jmapNew/theme/chengdu_01/model.js @@ -39,6 +39,9 @@ class Model { this['private'][deviceType.TrainWindow] = { trainWindowShow: true }; + this['private'][deviceType.SignalButton] = { + hasSelected: 0 + }; } initPublicProps(model) { diff --git a/src/jmapNew/theme/components/menus/dialog/setFault.vue b/src/jmapNew/theme/components/menus/dialog/setFault.vue index 868e92d7a..9e9aa69f8 100644 --- a/src/jmapNew/theme/components/menus/dialog/setFault.vue +++ b/src/jmapNew/theme/components/menus/dialog/setFault.vue @@ -110,7 +110,7 @@ export default { }, groupNumber: '', field: '', - selected: null, + selected: null, rules: { faultType: [ { required: true, message: '请选择故障类型', trigger: 'change'} @@ -172,8 +172,8 @@ export default { this.field = field == this.field ? '' : field; }, doShow(operate, selected, judge) { - this.$root.$emit('dialogOpen', selected); - this.selected = selected; + this.$root.$emit('dialogOpen', selected); + this.selected = selected; if (!this.dialogShow) { this.switchName = ''; this.stationName = ''; @@ -210,7 +210,7 @@ export default { this.dialogShow = false; this.form.faultType = ''; this.$refs.form.resetFields(); - this.$root.$emit('dialogClose', this.selected); + this.$root.$emit('dialogClose', this.selected); this.$store.dispatch('training/emitTipFresh'); }, commit() { diff --git a/src/jmapNew/theme/components/menus/dialog/setFaultNew.vue b/src/jmapNew/theme/components/menus/dialog/setFaultNew.vue new file mode 100644 index 000000000..86b662260 --- /dev/null +++ b/src/jmapNew/theme/components/menus/dialog/setFaultNew.vue @@ -0,0 +1,400 @@ + + + + + + + diff --git a/src/jmapNew/theme/datie_01/menus/dialog/childDialog/passwordInputBox.vue b/src/jmapNew/theme/datie_01/menus/dialog/childDialog/passwordInputBox.vue index 5d5a948dc..2f41411df 100644 --- a/src/jmapNew/theme/datie_01/menus/dialog/childDialog/passwordInputBox.vue +++ b/src/jmapNew/theme/datie_01/menus/dialog/childDialog/passwordInputBox.vue @@ -102,7 +102,7 @@ export default { return this.dialogShow && !this.$store.state.menuOperation.break; }, domIdCancel() { - return this.dialogShow ? OperationEvent.Command.cancel.password.domId : '' + return this.dialogShow ? OperationEvent.Command.cancel.password.domId : ''; }, domIdConfirm() { return this.dialogShow ? OperationHandler.getDomIdByOperation(this.operation) : ''; diff --git a/src/jmapNew/theme/datie_01/menus/index.vue b/src/jmapNew/theme/datie_01/menus/index.vue index e83faddc5..f72e31776 100644 --- a/src/jmapNew/theme/datie_01/menus/index.vue +++ b/src/jmapNew/theme/datie_01/menus/index.vue @@ -1,7 +1,7 @@