diff --git a/.env.sai b/.env.sai new file mode 100644 index 000000000..82235e634 --- /dev/null +++ b/.env.sai @@ -0,0 +1,9 @@ +# just a flag +NODE_ENV = 'production' +VUE_APP_PRO = 'common' + +# base api +# VUE_APP_BASE_API = 'http://160.20.60.15:9000' +# VUE_APP_VOICE_API = 'http://160.20.60.15/oss/joylink' +# VUE_APP_UPLOAD_API = 'http://160.20.60.15' +# VUE_APP_BASE_SITE='http://160.20.60.15' diff --git a/src/api/jmap/training.js b/src/api/jmap/training.js index 8d2c8339d..2067026e9 100644 --- a/src/api/jmap/training.js +++ b/src/api/jmap/training.js @@ -265,3 +265,11 @@ export function loadTrainingBg(group, trainingId) { method: 'post' }); } +/** 预备开始场景 */ +export function prepareScene(group, params) { + return request({ + url:`/api/training2Simulation/${group}/prepare/start`, + method: 'post', + params + }); +} diff --git a/src/api/trainingManage.js b/src/api/trainingManage.js index 81cb57a4c..97f016604 100644 --- a/src/api/trainingManage.js +++ b/src/api/trainingManage.js @@ -166,3 +166,26 @@ export function clearDesignTraining(trainingId, group) { method: 'delete' }); } +/** 导出实训数据 */ +export function exportTrainingData(data) { + return request({ + url: `/api/v2/training/published/export`, + method: 'post', + data + }); +} +/** 导入实训数据 */ +export function importTrainingData(data) { + return request({ + url: `/api/v2/training/published/import`, + method: 'post', + data + }); +} +/** 实训跳转到当前步骤*/ +export function jumpToTraining(group, stepId) { + return request({ + url: `/api/training2Simulation/${group}/jumpTo/${stepId}`, + method: 'put' + }); +} diff --git a/src/jmapNew/config/skinCode/ningbo_01.js b/src/jmapNew/config/skinCode/ningbo_01.js index b726598e5..abda1beef 100644 --- a/src/jmapNew/config/skinCode/ningbo_01.js +++ b/src/jmapNew/config/skinCode/ningbo_01.js @@ -635,6 +635,19 @@ class SkinCode extends defaultStyle { controlColor: 'red' // 控制灯颜色 (灰色) } }; + /* 上电解锁 */ + this[deviceType.PowerUnLock] = { + text: { + fontSize: 11, // 字体大小 + fontWeight: 'normal', // 字体粗细 + distance: 5 // 灯跟文字距离 + }, + lamp: { + fill: 'rgba(0,0,0,0)', // 填充色 + radiusR: 6, // 控制灯大小 + controlColor: 'red' // 控制灯颜色 (灰色) + } + }; /** 引导总锁 */ this[deviceType.GuideLock] = { diff --git a/src/jmapNew/constant/deviceRender.js b/src/jmapNew/constant/deviceRender.js index 19d6604bc..0a01e0071 100644 --- a/src/jmapNew/constant/deviceRender.js +++ b/src/jmapNew/constant/deviceRender.js @@ -347,4 +347,9 @@ deviceRender[deviceType.Counter] = { _type: deviceType.Counter, zlevel: 1 }; +/** PowerUnLock 上电解锁*/ +deviceRender[deviceType.PowerUnLock] = { + _type: deviceType.PowerUnLock, + zlevel: 1 +}; export default deviceRender; diff --git a/src/jmapNew/constant/deviceType.js b/src/jmapNew/constant/deviceType.js index acbf522e8..9a65ce5f9 100644 --- a/src/jmapNew/constant/deviceType.js +++ b/src/jmapNew/constant/deviceType.js @@ -63,6 +63,7 @@ const deviceType = { SectionOccupied: 'SectionOccupied', ThroatRoute: 'ThroatRoute', NoStatusLamp: 'NoStatusLamp', - Counter: 'Counter' + Counter: 'Counter', + PowerUnLock: 'PowerUnLock' }; export default deviceType; diff --git a/src/jmapNew/parser/parser-graph.js b/src/jmapNew/parser/parser-graph.js index c1298bca1..9216b42f0 100644 --- a/src/jmapNew/parser/parser-graph.js +++ b/src/jmapNew/parser/parser-graph.js @@ -122,6 +122,11 @@ export function parser(data, skinCode, showConfig) { mapDevice[elem.code] = createDevice(deviceType.AxleReset, elem, propConvert, showConfig); }, this); + zrUtil.each(data.powerUnLockButtonList || [], elem => { // 上电解锁列表 + mapDevice[elem.code] = createDevice(deviceType.PowerUnLock, elem, propConvert, showConfig); + mapDevice[elem.stationCode].powerUnLockCode = elem.code; + }, this); + zrUtil.each(data.totalGuideLockButtonVOList || [], elem => { // 引导总锁列表 mapDevice[elem.code] = createDevice(deviceType.GuideLock, elem, propConvert, showConfig); if (!elem.direction) { @@ -342,6 +347,7 @@ export function updateMapData(state, model) { case deviceType.Esp: updateForList(model, state, 'espList'); break; case deviceType.AutoTurnBack: updateForList(model, state, 'cycleButtonList'); break; case deviceType.AxleReset: updateForList(model, state, 'axleCounterResetButtonList'); break; + case deviceType.PowerUnLock: updateForList(model, state, 'powerUnLockButtonList'); break; case deviceType.GuideLock: updateForList(model, state, 'totalGuideLockButtonVOList'); break; case deviceType.OutFrame: updateForList(model, state, 'outerFrameList'); break; case deviceType.AutomaticRoute: updateForList(model, state, 'automaticRouteButtonList'); break; diff --git a/src/jmapNew/shape/graph/PowerUnLock/EMouse.js b/src/jmapNew/shape/graph/PowerUnLock/EMouse.js new file mode 100644 index 000000000..3dfd09e38 --- /dev/null +++ b/src/jmapNew/shape/graph/PowerUnLock/EMouse.js @@ -0,0 +1,57 @@ +import Group from 'zrender/src/container/Group'; +import Text from 'zrender/src/graphic/Text'; + +export default class EMouse extends Group { + constructor(device) { + super(); + this.device = device; + this.create(); + } + create() { + this.text = new Text({ + zlevel: this.device.zlevel, + z: this.device.z + 1, + position: [0, 0], + style: { + x: this.device.computedPosition.x, + y: this.device.computedPosition.y + this.device.style.LcControl.lamp.radiusR + this.device.style.LcControl.text.distance - 30, + fontWeight: 'normal', + fontSize: this.device.style.LcControl.mouseOverStyle.fontSize, + fontFamily: this.device.style.fontFamily, + text: this.device.model.name, + textFill: this.device.style.LcControl.mouseOverStyle.fontColor, + textAlign: this.device.style.LcControl.mouseOverStyle.textAlign, + textVerticalAlign: this.device.style.LcControl.mouseOverStyle.textVerticalAlign + } + }); + this.add(this.text); + this.text.hide(); + } + mouseover(e) { + if (e && + e.target && + e.target._subType == 'Text') { + this.text.show(); + } else { + // this.device.control.setControlColor(this.device.style.LcControl.mouseOverStyle.arcColor); + // this.device.control.setTextColor(this.device.style.LcControl.mouseOverStyle.textColor); + // this.device.control.setTextBorder(true); + // this.device.control.setArcBorder(true); + } + } + + mouseout(e) { + if (!this.device.__down) { + if (e && + e.target && + e.target._subType == 'Text') { + this.text.hide(); + } else { + // this.device.control.setControlColor(this.device.style.LcControl.lamp.controlColor); + // this.device.control.setTextColor('#FFFFFF'); + // this.device.control.setTextBorder(false); + // this.device.control.setArcBorder(false); + } + } + } +} diff --git a/src/jmapNew/shape/graph/PowerUnLock/index.js b/src/jmapNew/shape/graph/PowerUnLock/index.js new file mode 100644 index 000000000..07ac9a690 --- /dev/null +++ b/src/jmapNew/shape/graph/PowerUnLock/index.js @@ -0,0 +1,165 @@ +/* +* 上电解锁 控制器 +*/ +import Group from 'zrender/src/container/Group'; +import Arc from 'zrender/src/graphic/shape/Arc'; +import Text from 'zrender/src/graphic/Text'; +import EMouse from './EMouse'; +import BoundingRect from 'zrender/src/core/BoundingRect'; +import store from '@/store/index'; + +export default class PowerUnLock extends Group { + constructor(model, {style}) { + super(); + this.z = 20; + this._code = model.code; + this._type = model._type; + this.zlevel = model.zlevel; + const pictureDevice = store.getters['map/getPictureDeviceByCode'](model.code); + if (pictureDevice) { + this.computedPosition = pictureDevice.position; + } else { + this.computedPosition = model.position; + } + this.model = model; + this.style = style; + this.isShowShape = true; + this.create(); + this.createMouseEvent(); + this.setState(model); + } + + create() { + const powerUnLockStyle = this.style.PowerUnLock ? this.style.PowerUnLock : { lamp: {}, text: {}, subtitleText: {} }; + const model = this.model; + this.control = new Arc({ + _subType: 'Control', + zlevel: this.zlevel, + z: this.z, + shape: { + cx: this.computedPosition.x, + cy: this.computedPosition.y, + r: powerUnLockStyle.lamp.radiusR + }, + style: { + stroke: '##b5b3b3', + lineWidth: 1.5, + fill: powerUnLockStyle.lamp.controlColor + } + }); + + this.text = new Text({ + _subType: 'Text', + zlevel: this.zlevel, + z: this.z, + position: [0, 0], + style: { + x: this.computedPosition.x, + y: this.computedPosition.y + powerUnLockStyle.lamp.radiusR + powerUnLockStyle.text.distance, + fontWeight: powerUnLockStyle.text.fontWeight, + fontSize: powerUnLockStyle.text.fontSize, + fontFamily: this.style.fontFamily, + text: model.name, + textFill: '#fff', + textAlign: 'middle', + textVerticalAlign: 'top' + } + }); + + if (this.model.subtitleName) { + this.subtitleText = new Text({ + _subType: 'Text', + zlevel: this.zlevel, + z: this.z, + position: [0, 0], + style: { + x: this.computedPosition.x, + y: this.computedPosition.y + powerUnLockStyle.lamp.radiusR + powerUnLockStyle.subtitleText.distance, + fontWeight: powerUnLockStyle.subtitleText.fontWeight, + fontSize: powerUnLockStyle.subtitleText.fontSize, + fontFamily: this.style.fontFamily, + text: model.subtitleName, + textFill: '#fff', + textAlign: 'middle', + textVerticalAlign: 'top' + } + }); + this.add(this.subtitleText); + } + this.add(this.control); + this.add(this.text); + } + + setAshShow() { + this.control && this.control.setStyle({fill:'#FFF'}); + } + + // 设置状态 + setState(model) { + this.recover(); + // 只响应前端自定义类型的状态变化 + if (!store.getters['map/checkDeviceShow'](this._code)) { + this.control && this.control.hide(); + this.text && this.text.hide(); + this.subtitleText && this.subtitleText.hide(); + } else if (model._free) { + this.setAshShow(); + } + } + handleShowHide(powerUnLockCode) { + const path = window.location.href; + if (powerUnLockCode || path.includes('/map/draw')) { + this.control && this.control.show(); + this.text && this.text.show(); + this.subtitleText && this.subtitleText.show(); + } else { + this.control && this.control.hide(); + this.text && this.text.hide(); + this.subtitleText && this.subtitleText.hide(); + } + } + + recover() { + this.control && this.control.show(); + this.text && this.text.show(); + this.subtitleText && this.subtitleText.show(); + } + + createMouseEvent() { + if (this.style.LcControl.mouseOverStyle) { + this.mouseEvent = new EMouse(this); + this.add(this.mouseEvent); + this.on('mouseout', (e) => { this.mouseEvent.mouseout(e); }); + this.on('mouseover', (e) => { this.mouseEvent.mouseover(e); }); + } + } + getShapeTipPoint() { + if (this.control) { + var distance = 2; + var rect = this.control.getBoundingRect(); + return { + x: rect.x + rect.width / 2, + y: rect.y - distance + }; + } + return null; + } + + getBoundingRect() { // 计算自动折返包围框 + if (this.control) { + const rect = this.control.getBoundingRect().clone(); + if (this.text) { + const text = this.text.getBoundingRect().clone(); + rect.union(text); + return rect; + } else { + return rect; + } + } else { + return new BoundingRect(0, 0, 0, 0); + } + } + getAnchorPoint() { + return this.computedPosition; + } +} diff --git a/src/jmapNew/shape/graph/Psd/index.js b/src/jmapNew/shape/graph/Psd/index.js index 99efd2e16..22fd69f26 100644 --- a/src/jmapNew/shape/graph/Psd/index.js +++ b/src/jmapNew/shape/graph/Psd/index.js @@ -75,6 +75,9 @@ export default class Line2 extends Group { currentTypeList.forEach(element => { this[element].setState(model); }); + if (model.noStatus) { + this.setAshShow(); + } } } diff --git a/src/jmapNew/shape/graph/Section/index.js b/src/jmapNew/shape/graph/Section/index.js index 26790f43f..b7e4a3583 100644 --- a/src/jmapNew/shape/graph/Section/index.js +++ b/src/jmapNew/shape/graph/Section/index.js @@ -446,6 +446,10 @@ export default class Section extends Group { this.line && this.line.setStyle({stroke: '#7F7F7F'}); this.line && this.line.setCross({fill: '#7F7F7F'}); this.name && this.name.setStyle({textFill: '#7F7F7f'}); + this.standTrackText && this.standTrackText.setStyle({textFill: '#7F7F7f'}); + this.reentryTrackText && this.reentryTrackText.setStyle({textFill: '#7F7F7f'}); + this.transferTrackText && this.transferTrackText.setStyle({textFill: '#7F7F7f'}); + this.destinationText && this.destinationText.setStyle({textFill: '#7F7F7f'}); } /** 计轴预复位 */ preReset(blockade) { diff --git a/src/jmapNew/shape/graph/Station/EStationText.js b/src/jmapNew/shape/graph/Station/EStationText.js index 7d4c96574..601b92673 100644 --- a/src/jmapNew/shape/graph/Station/EStationText.js +++ b/src/jmapNew/shape/graph/Station/EStationText.js @@ -21,7 +21,7 @@ class EStationText extends Group { x: model.computedPosition.x, y: model.computedPosition.y, fontWeight: style.Station.stationText.fontWeight, - fontSize: isNaN(Number(model.nameFont)) ? 20 : Number(model.nameFont), + fontSize: model.nameFont || 20, fontFamily: style.fontFamily, text: model.number ? model.number + model.name : model.name, textAlign: 'middle', diff --git a/src/jmapNew/shape/graph/Station/index.js b/src/jmapNew/shape/graph/Station/index.js index 2a51a7314..c36946808 100644 --- a/src/jmapNew/shape/graph/Station/index.js +++ b/src/jmapNew/shape/graph/Station/index.js @@ -1008,6 +1008,7 @@ export default class Station extends Group { model.emergencyController != undefined && this.handleEmergencyChange(model.emergencyController); model.controlApplicant && this.handleControlApplicant(model); model.allowAutonomy && this.handleAllowAutonomy(model); + // this.handlePowerUnlockShow(model); this.handleGuideLock(model); if (this.style.Station.syncCentralizeStation && (model.controlMode || model.controller || model.emergencyController != undefined) && model.centralized) { model.chargeStationCodeList.forEach(item => { @@ -1062,6 +1063,12 @@ export default class Station extends Group { handleAllowAutonomy() { this.selfDiscipline && this.selfDiscipline.setColor(this.style.Station.StationControl.selfDiscipline.lightColor); } + // handlePowerUnlockShow(model) { + // if (model.powerUnLockCode) { + // const powerUnLock = store.getters['map/getDeviceByCode'](model.powerUnLockCode); + // powerUnLock && powerUnLock.instance && powerUnLock.instance.handleShowHide(model.powerUnlockButtonShow); + // } + // } handleControlApplicant(model) { if (this.style.Station.stationText.isSpecialType) { diff --git a/src/jmapNew/shape/graph/StationStand/safeStand/EHollowStand.js b/src/jmapNew/shape/graph/StationStand/safeStand/EHollowStand.js index a649688f8..d29aa12d5 100644 --- a/src/jmapNew/shape/graph/StationStand/safeStand/EHollowStand.js +++ b/src/jmapNew/shape/graph/StationStand/safeStand/EHollowStand.js @@ -1,5 +1,6 @@ import Group from 'zrender/src/container/Group'; import Rect from 'zrender/src/graphic/shape/Rect'; +import store from '@/store/index'; class EHollowStand extends Group { constructor(model) { @@ -52,6 +53,9 @@ class EHollowStand extends Group { model.trainParking && this.setColor(style.StationStand.hollowStand.doorOpenColor); // 紧急停车 model.emergencyClosed && this.setColor(style.StationStand.hollowStand.spareColor); + if (model.noStatus || (model.atsNoStatus && store.state.map.picture === '02')) { + this.setColor('#7F7F7F'); + } } } diff --git a/src/jmapNew/shape/graph/StationStand/safeStand/ELineStand.js b/src/jmapNew/shape/graph/StationStand/safeStand/ELineStand.js index fffa00868..531377ed9 100644 --- a/src/jmapNew/shape/graph/StationStand/safeStand/ELineStand.js +++ b/src/jmapNew/shape/graph/StationStand/safeStand/ELineStand.js @@ -2,6 +2,7 @@ import Group from 'zrender/src/container/Group'; import Polyline from 'zrender/src/graphic/shape/Polyline'; // import Rect from 'zrender/src/graphic/shape/Rect'; // import Text from 'zrender/src/graphic/Text'; +import store from '@/store/index'; class ESolidStand extends Group { constructor(model) { @@ -65,6 +66,9 @@ class ESolidStand extends Group { } setState(model) { + if (model.noStatus || (model.atsNoStatus && store.state.map.picture === '02')) { + this.setColor('#7F7F7F'); + } } } diff --git a/src/jmapNew/shape/graph/StationStand/safeStand/ESolidStand.js b/src/jmapNew/shape/graph/StationStand/safeStand/ESolidStand.js index e3672e9b2..8b36bff85 100644 --- a/src/jmapNew/shape/graph/StationStand/safeStand/ESolidStand.js +++ b/src/jmapNew/shape/graph/StationStand/safeStand/ESolidStand.js @@ -145,6 +145,10 @@ class ESolidStand extends Group { model.sysHoldTrain && this.setHoldTrain('System'); // 站台关闭 model.closed && this.setColor(style.StationStand.solidStand.closeColor); + + if (model.noStatus || (model.atsNoStatus && store.state.map.picture === '02')) { + this.setColor('#7F7F7F'); + } } else { this.handlePassagerColor(model.num); } diff --git a/src/jmapNew/shape/graph/Switch/index.js b/src/jmapNew/shape/graph/Switch/index.js index 044ea66f4..67955d493 100644 --- a/src/jmapNew/shape/graph/Switch/index.js +++ b/src/jmapNew/shape/graph/Switch/index.js @@ -318,11 +318,12 @@ export default class Switch extends Group { /** 名称动画*/ nameTextAnimation() { - this.name.getNameText().animateStyle(true) - .when(0, { textFill: this.style.backgroundColor }) - .when(1000, { textFill: this.style.Switch.text.lossColor }) - .when(2000, { textFill: this.style.backgroundColor }) - .start(); + if (this.name.getNameText()) { + this.name.getNameText().animateStyle(true) + .when(0, { textFill: this.style.backgroundColor }) + .when(1000, { textFill: this.style.Switch.text.lossColor }) + .when(2000, { textFill: this.style.backgroundColor }); + } this.name.getTextRect().animateStyle(true) .when(0, { textFill: this.style.backgroundColor }) diff --git a/src/jmapNew/shape/graph/index.js b/src/jmapNew/shape/graph/index.js index 0ce89fc8f..90cd12036 100644 --- a/src/jmapNew/shape/graph/index.js +++ b/src/jmapNew/shape/graph/index.js @@ -17,6 +17,7 @@ import Train from './Train/index.js'; import Line from './Line/index.js'; import Text2 from './Text/index.js'; import AxleReset from './AxleReset/index'; +import PowerUnLock from './PowerUnLock/index'; import GuideLock from './GuideLock/index'; import AutoTurnBack from './AutoTurnBack/index.js'; import OutFrame from './OutFrame/index.js'; @@ -99,5 +100,6 @@ mapShape[deviceType.FloodGate] = FloodGate; mapShape[deviceType.DirectionRod] = DirectionRod; mapShape[deviceType.Responder] = Responder; mapShape[deviceType.SignalButton] = SignalButton; +mapShape[deviceType.PowerUnLock] = PowerUnLock; export default mapShape; diff --git a/src/jmapNew/theme/beijing_01/menus/menuDialog/helpAbout.vue b/src/jmapNew/theme/beijing_01/menus/menuDialog/helpAbout.vue index 156d7779f..3281c7d96 100644 --- a/src/jmapNew/theme/beijing_01/menus/menuDialog/helpAbout.vue +++ b/src/jmapNew/theme/beijing_01/menus/menuDialog/helpAbout.vue @@ -24,7 +24,7 @@ >确定