From 0cdaa7a6ed58ab18d6289471c39a275db8c0b1ef Mon Sep 17 00:00:00 2001 From: fan Date: Fri, 21 Apr 2023 17:46:58 +0800 Subject: [PATCH] =?UTF-8?q?ncc=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jmapNew/constant/nccGraphRender.js | 31 ++ src/jmapNew/constant/nccGraphType.js | 10 + src/jmapNew/constant/pathsvg.js | 25 +- src/jmapNew/constant/systemGraphRender.js | 17 - src/jmapNew/constant/systemGraphType.js | 8 - src/jmapNew/map.js | 22 +- src/jmapNew/mouseController.js | 4 +- src/jmapNew/painter.js | 8 +- src/jmapNew/parser/index.js | 6 +- src/jmapNew/parser/parser-nccGraph.js | 96 +++++ src/jmapNew/parser/parser-systemGraph.js | 65 ---- src/jmapNew/shape/index.js | 4 +- .../{systemGraph => nccGraph}/Line/index.js | 0 .../shape/nccGraph/NccStation/Transfer.js | 22 ++ .../shape/nccGraph/NccStation/index.js | 88 +++++ src/jmapNew/shape/nccGraph/NccTrain/index.js | 114 ++++++ .../{systemGraph => nccGraph}/Rect/index.js | 0 src/jmapNew/shape/nccGraph/RunLine/index.js | 117 ++++++ .../{systemGraph => nccGraph}/Text/index.js | 0 src/jmapNew/shape/nccGraph/index.js | 18 + src/jmapNew/shape/systemGraph/Arrow/index.js | 61 --- src/jmapNew/shape/systemGraph/index.js | 15 - src/jmapNew/utils/parser.js | 4 +- src/router/index.js | 4 +- src/store/modules/map.js | 47 ++- src/store/modules/socket.js | 9 +- src/utils/stomp.js | 3 + src/utils/subscribeCallback.js | 3 + .../display/stationDiagram/jlmap/index.vue | 11 +- src/views/newMap/display/terminals/index.vue | 35 +- .../newMap/display/terminals/nccWork.vue | 94 +++++ .../newMap/display/terminals/terminalMenu.vue | 8 +- src/views/newMap/newDesignUser/demonList.vue | 32 +- src/views/newMap/newMapdraftSystem/index.vue | 258 ++----------- src/views/newMap/newMapdraftSystem/jlmap.vue | 349 ++++++++++++++++++ .../mapoperate/components/operateProperty.vue | 2 +- .../mapoperate/config/list.vue | 5 + .../newMapdraftSystem/mapoperate/index.vue | 20 +- .../mapoperate/nccStation.vue | 289 +++++++++++++++ .../newMapdraftSystem/mapoperate/runLine.vue | 261 +++++++++++++ 40 files changed, 1671 insertions(+), 494 deletions(-) create mode 100644 src/jmapNew/constant/nccGraphRender.js create mode 100644 src/jmapNew/constant/nccGraphType.js delete mode 100644 src/jmapNew/constant/systemGraphRender.js delete mode 100644 src/jmapNew/constant/systemGraphType.js create mode 100644 src/jmapNew/parser/parser-nccGraph.js delete mode 100644 src/jmapNew/parser/parser-systemGraph.js rename src/jmapNew/shape/{systemGraph => nccGraph}/Line/index.js (100%) create mode 100644 src/jmapNew/shape/nccGraph/NccStation/Transfer.js create mode 100644 src/jmapNew/shape/nccGraph/NccStation/index.js create mode 100644 src/jmapNew/shape/nccGraph/NccTrain/index.js rename src/jmapNew/shape/{systemGraph => nccGraph}/Rect/index.js (100%) create mode 100644 src/jmapNew/shape/nccGraph/RunLine/index.js rename src/jmapNew/shape/{systemGraph => nccGraph}/Text/index.js (100%) create mode 100644 src/jmapNew/shape/nccGraph/index.js delete mode 100644 src/jmapNew/shape/systemGraph/Arrow/index.js delete mode 100644 src/jmapNew/shape/systemGraph/index.js create mode 100644 src/views/newMap/display/terminals/nccWork.vue create mode 100644 src/views/newMap/newMapdraftSystem/jlmap.vue create mode 100644 src/views/newMap/newMapdraftSystem/mapoperate/nccStation.vue create mode 100644 src/views/newMap/newMapdraftSystem/mapoperate/runLine.vue diff --git a/src/jmapNew/constant/nccGraphRender.js b/src/jmapNew/constant/nccGraphRender.js new file mode 100644 index 000000000..3bc26d370 --- /dev/null +++ b/src/jmapNew/constant/nccGraphRender.js @@ -0,0 +1,31 @@ +import nccGraphType from './nccGraphType'; + +const nccGraphRender = {}; + +/** Line渲染配置*/ +nccGraphRender[nccGraphType.NccLine] = { + _type: nccGraphType.NccLine, + zlevel: 1 +}; + +/** Text渲染配置*/ +nccGraphRender[nccGraphType.NccText] = { + _type: nccGraphType.NccText, + zlevel: 1 +}; +/** RunLine渲染配置 */ +nccGraphRender[nccGraphType.RunLine] = { + _type: nccGraphType.RunLine, + zlevel: 1 +}; +/** NccStation渲染配置 */ +nccGraphRender[nccGraphType.NccStation] = { + _type: nccGraphType.NccStation, + zlevel: 1 +}; +/** NccTrain渲染配置 */ +nccGraphRender[nccGraphType.NccTrain] = { + _type: nccGraphType.NccTrain, + zlevel: 1 +}; +export default nccGraphRender; diff --git a/src/jmapNew/constant/nccGraphType.js b/src/jmapNew/constant/nccGraphType.js new file mode 100644 index 000000000..db0193b5e --- /dev/null +++ b/src/jmapNew/constant/nccGraphType.js @@ -0,0 +1,10 @@ +const nccGraphType = { + NccLine: 'NccLine', + NccText: 'NccText', + NccRect: 'NccRect', + RunLine: 'RunLine', + NccStation: 'NccStation', + NccTrain: 'NccTrain' +}; + +export default nccGraphType; diff --git a/src/jmapNew/constant/pathsvg.js b/src/jmapNew/constant/pathsvg.js index 6a0d73674..fe4197cde 100644 --- a/src/jmapNew/constant/pathsvg.js +++ b/src/jmapNew/constant/pathsvg.js @@ -11,15 +11,27 @@ const map = { ControlSwitch: { width: 90, path: 'M6.429,40.85H0V15.05H51.429L64.286,0H77.143L90,15.05V31L79,43H64.286L51.429,30.1h-30V40.85H12.857V30.1H6.429V40.85ZM60,17.2l4.286-4.3H77.143l4.286,4.3V27.95l-4.286,4.3H64.286L60,27.95V17.2Z' + }, + TransferSign: { + width: 1024, + path: 'M366.592 302.592c41.984-31.744 92.16-48.128 144.384-48.128 132.608 0 240.64 109.056 247.296 245.248l-26.112-27.136c-9.728-9.728-25.088-9.728-34.304 0s-9.728 26.112 0 35.84l64 66.56c5.12 5.632 11.776 7.68 18.944 7.168 6.656 0.512 13.824-2.048 18.944-7.168l64-66.56c9.728-9.728 9.728-26.112 0-35.84s-25.088-9.728-34.304 0l-26.624 27.648c-6.656-161.792-134.656-291.84-291.328-291.84-61.44 0-119.808 19.456-169.472 56.832-28.672 21.504-53.248 48.128-73.216 78.848-2.56 4.096-3.584 8.192-3.584 12.8 0 7.168 3.584 14.336 9.728 18.944 10.24 7.168 23.552 4.096 30.208-6.144 15.872-26.112 36.864-48.64 61.44-67.072z m144.896 514.56c61.44 0 119.808-19.456 169.472-56.832 28.672-21.504 53.248-48.128 73.216-78.848 2.56-4.096 3.584-8.192 3.584-12.8 0-7.168-3.584-14.336-9.728-18.944-10.24-7.168-23.552-4.096-30.208 6.144-16.896 26.112-37.888 48.64-61.952 67.072-42.496 31.744-92.16 48.128-144.384 48.128-132.096 0-240.64-109.056-247.296-245.76l25.6 27.136c9.728 9.728 25.088 9.728 34.304 0s9.728-26.112 0-35.84l-64-66.56c-5.12-5.632-11.776-7.68-18.944-7.168-6.656-0.512-13.824 2.048-18.944 7.168l-64 66.56c-9.728 9.728-9.728 26.112 0 35.84s25.088 9.728 34.304 0l26.624-27.648c7.68 162.304 135.68 292.352 292.352 292.352z' + }, + NccTrainBody: { + width: 195, + path: 'M21.7305 69.7461H181.789C184.211 69.7461 186.164 67.793 186.164 65.3711L194.289 5.11719C194.289 2.69531 192.336 0.742188 189.914 0.742188H59.6797C33.1367 0.742188 0.792966 22.2656 0.792966 48.8086C0.792966 58.8672 16.125 69.7461 21.7305 69.7461Z' + // path: 'M24.6484 134.746H184.707C187.129 134.746 189.082 132.793 189.082 130.371L197.207 70.1172C197.207 67.6953 195.254 65.7422 192.832 65.7422H62.5977C36.0547 65.7422 3.71094 87.2656 3.71094 113.809C3.71094 123.867 19.043 134.746 24.6484 134.746Z' + // path: 'M62.6442 298H480.377C486.697 298 491.795 293.669 491.795 288.299L513 154.701C513 149.331 507.903 145 501.582 145H161.687C92.413 145 7.99999 192.723 7.99999 251.576C7.99999 273.879 48.0146 298 62.6442 298Z' + // path: 'M -23.77657 -22.3304 C -69.33338 -9.394520000000002 -108.70345 6.915939999999999 -97.45486 19.851829999999996 C -86.20626999999999 32.78771 -83.95655 26.600989999999996 -83.95655 26.600989999999996 L 85.89722 26.600989999999996 L 99.39553000000001 -22.33039 C 99.39553000000001 -22.33039 21.780230000000003 -35.26627 -23.776569999999992 -22.33039 z' + // path: 'M 897.8 689.9 L 78.3 689.9 C 65.89999999999999 689.9 55.9 679.9 55.9 667.5 L 14.3 359 C 14.3 346.6 24.3 336.6 36.7 336.6 L 703.5 336.6 C 839.4 336.6 1005 446.8 1005 582.7 C 1005 634.2 926.5 689.9000000000001 897.8 689.9000000000001 z' + // path: 'M897.8 689.9H78.3c-12.4 0-22.4-10-22.4-22.4L14.3 359c0-12.4 10-22.4 22.4-22.4h666.8c135.9 0 301.5 110.2 301.5 246.1 0 51.5-78.5 107.2-107.2 107.2z' } }; - +// M 897.8 689.9 L 78.3 689.9 C 65.89999999999999 689.9 55.9 679.9 55.9 667.5 L 14.3 359 C 14.3 346.6 24.3 336.6 36.7 336.6 L 703.5 336.6 C 839.4 336.6 1005 446.8 1005 582.7 C 1005 634.2 926.5 689.9000000000001 897.8 689.9000000000001 z export default function createPathSvg(model) { const svg = path.createFromString(map[model._subType].path, { - shape: { - zlevel: model.zlevel, - z: model.z - }, + zlevel: model.zlevel, + z: model.z, + shape: {}, style: { fill: model.fill } @@ -27,5 +39,8 @@ export default function createPathSvg(model) { const scaleX = model.width / map[model._subType].width; svg.scale = [scaleX, scaleX]; svg.position = [model.x, model.y]; + if (model.rotation) { + svg.rotation = model.rotation; + } return svg; } diff --git a/src/jmapNew/constant/systemGraphRender.js b/src/jmapNew/constant/systemGraphRender.js deleted file mode 100644 index f50ddf19a..000000000 --- a/src/jmapNew/constant/systemGraphRender.js +++ /dev/null @@ -1,17 +0,0 @@ -import systemGraphType from './systemGraphType'; - -const systemGraphRender = {}; - -/** Line渲染配置*/ -systemGraphRender[systemGraphType.Line] = { - _type: systemGraphType.Line, - zlevel: 1 -}; - -/** Text渲染配置*/ -systemGraphRender[systemGraphType.Text] = { - _type: systemGraphType.Text, - zlevel: 1 -}; - -export default systemGraphRender; diff --git a/src/jmapNew/constant/systemGraphType.js b/src/jmapNew/constant/systemGraphType.js deleted file mode 100644 index df98413a2..000000000 --- a/src/jmapNew/constant/systemGraphType.js +++ /dev/null @@ -1,8 +0,0 @@ -const systemGraphType = { - Line: 'Line', - Text: 'Text', - Rect: 'Rect', - Arrow: 'Arrow' -}; - -export default systemGraphType; diff --git a/src/jmapNew/map.js b/src/jmapNew/map.js index dd6ec8207..e8c594f54 100644 --- a/src/jmapNew/map.js +++ b/src/jmapNew/map.js @@ -507,6 +507,25 @@ class Jlmap { } } } + updateNccTrain(list) { + list.forEach(item => { + let oDevice = null; + if (this.mapDevice[item.groupNum]) { + oDevice = this.mapDevice[item.groupNum]; + Object.assign(oDevice, item); + } else { + oDevice = deviceFactory('NccTrain', item, this.showConfig); + this.mapDevice[item.groupNum] = oDevice; + } + if (!item.showTrainDiagram) { + this.$painter.delete(oDevice); + delete this.mapDevice[item.groupNum]; + } else { + this.$painter.updateNccTrain(oDevice); + } + }); + + } update(list = [], fetch = true) { this.setUpdateMapDevice(list, fetch); // 增加一个 前数据 处理 为了在区段中 获取全部的 道岔信息 @@ -536,6 +555,7 @@ class Jlmap { } } else if (elem.deviceType == 'OVERLAP') { const overlapRoute = this.mapDevice[elem.code]; + if (!overlapRoute || !overlapRoute.pathList || overlapRoute.pathList[0]) { return; } const model = this.mapDevice[overlapRoute.pathList[0].sectionList[0]]; if (overlapRoute.pathList[0].right) { overlapRoute['points'] = { x: model.points[0].x, y: model.points[0].y }; @@ -674,7 +694,7 @@ class Jlmap { store.commit('map/updateActiveTrainList', elem); } else if (elem.deviceType === 'STAND') { store.dispatch('map/updateStationStand', elem); - const psdDevice = this.mapDevice[this.mapDevice[elem.code].psdCode]; + const psdDevice = this.mapDevice[(this.mapDevice[elem.code] || {}).psdCode]; if (psdDevice) { psdDevice.fault = elem.fault; this.$painter.update(psdDevice); diff --git a/src/jmapNew/mouseController.js b/src/jmapNew/mouseController.js index 08c2dd787..6e19b761b 100644 --- a/src/jmapNew/mouseController.js +++ b/src/jmapNew/mouseController.js @@ -1,4 +1,5 @@ import deviceType from './constant/deviceType'; +import nccGraphType from './constant/nccGraphType'; import Eventful from 'zrender/src/mixin/Eventful'; import * as eventTool from 'zrender/src/core/event'; import store from '@/store/index'; @@ -10,7 +11,8 @@ class EventModel { let view = e.target; while (view) { - if (Object.values(deviceType).includes(view._type)) { + const types = {...deviceType, ...nccGraphType}; + if (Object.values(types).includes(view._type)) { this.deviceCode = view._code; this.deviceType = view._type; this.eventTarget = view; diff --git a/src/jmapNew/painter.js b/src/jmapNew/painter.js index 271c5f914..51d2a7696 100644 --- a/src/jmapNew/painter.js +++ b/src/jmapNew/painter.js @@ -2,7 +2,7 @@ import * as zrUtil from 'zrender/src/core/util'; // import * as vector from 'zrender/src/core/vector'; import Group from 'zrender/src/container/Group'; import deviceType from './constant/deviceType'; -import systemGraphType from './constant/systemGraphType'; +import nccGraphType from './constant/nccGraphType'; import transitionDeviceStatus from './constant/stateTransition'; // import shapefactory from './shape/factory'; import Graphic from './shape'; @@ -43,7 +43,7 @@ class Painter { // 添加子级图层 zrUtil.each([ ...Object.values(deviceType), - ...Object.values(systemGraphType)], (type) => { + ...Object.values(nccGraphType)], (type) => { const level = new Group({ name: `__${type}__` }); this.mapInstanceLevel[type] = level; this.parentLevel.add(level); @@ -162,6 +162,10 @@ class Painter { this.$transformHandleScreen.transformView(device.instance); } } + updateNccTrain(device) { + this.delete(device); + this.add(device); + } /** 画面更新 */ updatePicture(device) { if (device) { diff --git a/src/jmapNew/parser/index.js b/src/jmapNew/parser/index.js index f97d19690..e06e3269e 100644 --- a/src/jmapNew/parser/index.js +++ b/src/jmapNew/parser/index.js @@ -1,15 +1,15 @@ import * as parserGraph from './parser-graph.js'; -import * as parserSystemGraph from './parser-systemGraph.js'; +import * as parserNccGraph from './parser-nccGraph.js'; export const ParserType = { Graph: { name: '绘图', value: 'Graph' }, - systemGraph: { name: '系统绘图', value: 'systemGraph' } + nccGraph: { name: '系统绘图', value: 'NccGraph' } }; export function parserFactory(type) { switch (type) { case ParserType.Graph.value : return parserGraph; - case ParserType.systemGraph.value: return parserSystemGraph; + case ParserType.nccGraph.value: return parserNccGraph; } return parserGraph; diff --git a/src/jmapNew/parser/parser-nccGraph.js b/src/jmapNew/parser/parser-nccGraph.js new file mode 100644 index 000000000..60ca30225 --- /dev/null +++ b/src/jmapNew/parser/parser-nccGraph.js @@ -0,0 +1,96 @@ +import * as zrUtil from 'zrender/src/core/util'; +import nccGraphType from '../constant/nccGraphType'; +import nccGraphRender from '../constant/nccGraphRender'; +import Vue from 'vue'; +import { deepClone } from '@/utils/index'; + +export function deviceFactory(type, elem, showConfig) { + return {...nccGraphRender[type], ...elem, ...showConfig}; +} + +export function createDevice(type, elem, propConvert, showConfig) { + const device = deviceFactory(type, Object.assign(elem, { _type: type } ), showConfig); + return propConvert ? propConvert.initPrivateProps(device) : device; +} + +export function parser(nccData, skinCode, showConfig) { + const nccDevice = {}; + const runPositionData = {}; + const propConvert = skinCode ? Vue.prototype.$theme.loadPropConvert(skinCode) : null; + if (nccData) { + zrUtil.each(nccData.lineList || [], elem => { + nccDevice[elem.code] = createDevice(nccGraphType.NccLine, elem, propConvert, showConfig); + }, this); + + zrUtil.each(nccData.textList || [], elem => { + nccDevice[elem.code] = createDevice(nccGraphType.NccText, elem, propConvert, showConfig); + }, this); + + zrUtil.each(nccData.rectList || [], elem => { + nccDevice[elem.code] = createDevice(nccGraphType.NccRect, elem, propConvert, showConfig); + }, this); + + zrUtil.each(nccData.nccStationList || [], elem => { + nccDevice[elem.code] = createDevice(nccGraphType.NccStation, elem, propConvert, showConfig); + if (elem.stationCode) { + runPositionData[elem.stationCode] = handleRunPositionData(elem, nccData.runLineList); + if (elem.stationCode === 'Station43447') { + console.log(runPositionData[elem.stationCode], elem, nccData.runLineList, '******Station43447'); + } + } + }, this); + + zrUtil.each(nccData.runLineList || [], elem => { + nccDevice[elem.code] = createDevice(nccGraphType.RunLine, elem, propConvert, showConfig); + }, this); + + } + console.log(nccDevice, 'nccDevice', runPositionData); + return { nccDevice, runPositionData }; +} +function handleRunPositionData(nccStation, runLineList) { + let positionData = []; + nccStation.lineNames.forEach(lineName => { + const runLine = runLineList.find(elem => elem.lineName === lineName); + if (runLine) { + const pointIndex = runLine.points.findIndex(point => point.x === nccStation.position.x && point.y === nccStation.position.y); + positionData = [{runLineCode: runLine.code, pointIndex: pointIndex}]; + } + }); + return positionData; +} + +// 同步绘制数据到原始数据 +export function updateForList(model, state, lstName) { + if (!state.nccData) { state.nccData = {nccStationList: [], runLineList:[]}; } + const list = state.nccData[lstName]; + if (list && list instanceof Array) { + const i = list.findIndex(elem => elem.code == model.code ); + if (i < 0) { + list.push(deepClone(model)); // 新增 + } else { + if (model._dispose) { + list.splice(i, 1); + } else { + list.splice(i, 1, deepClone(model)); + } + } + state.nccData[lstName] = [...list]; + } else { + state.nccData[lstName] = [model]; + } + console.log(state.nccData, '********'); + state.map.nccData = JSON.stringify(state.nccData); +} + +export function updateMapData(state, model) { + if (state.map && model) { + switch (model._type) { + case nccGraphType.NccLine: updateForList(model, state, 'lineList'); break; + case nccGraphType.NccText: updateForList(model, state, 'textList'); break; + case nccGraphType.NccRect: updateForList(model, state, 'rectList'); break; + case nccGraphType.RunLine: updateForList(model, state, 'runLineList'); break; + case nccGraphType.NccStation: updateForList(model, state, 'nccStationList'); break; + } + } +} diff --git a/src/jmapNew/parser/parser-systemGraph.js b/src/jmapNew/parser/parser-systemGraph.js deleted file mode 100644 index 3b49fcbce..000000000 --- a/src/jmapNew/parser/parser-systemGraph.js +++ /dev/null @@ -1,65 +0,0 @@ -import * as zrUtil from 'zrender/src/core/util'; -import systemGraphType from '../constant/systemGraphType'; -import systemGraphRender from '../constant/systemGraphRender'; -import Vue from 'vue'; -import { deepClone } from '@/utils/index'; - -export function deviceFactory(type, elem, showConfig) { - return {...systemGraphRender[type], ...elem, ...showConfig}; -} - -export function createDevice(type, elem, propConvert, showConfig) { - const device = deviceFactory(type, Object.assign(elem, { _type: type } ), showConfig); - return propConvert ? propConvert.initPrivateProps(device) : device; -} - -export function parser(data, skinCode, showConfig) { - var mapDevice = {}; - var propConvert = skinCode ? Vue.prototype.$theme.loadPropConvert(skinCode) : null; - if (data) { - zrUtil.each(data.lineList || [], elem => { - mapDevice[elem.code] = createDevice(systemGraphType.Line, elem, propConvert, showConfig); - }, this); - - zrUtil.each(data.textList || [], elem => { - mapDevice[elem.code] = createDevice(systemGraphType.Text, elem, propConvert, showConfig); - }, this); - - zrUtil.each(data.rectList || [], elem => { - mapDevice[elem.code] = createDevice(systemGraphType.Rect, elem, propConvert, showConfig); - }, this); - - } - - return mapDevice; -} - -// 同步绘制数据到原始数据 -export function updateForList(model, state, lstName) { - const list = state.map[lstName]; - if (list && list instanceof Array) { - const i = list.findIndex(elem => elem.code == model.code ); - if (i < 0) { - list.push(deepClone(model)); // 新增 - } else { - if (model._dispose) { - list.splice(i, 1); - } else { - list.splice(i, 1, deepClone(model)); - } - } - state.map[lstName] = [...list]; - } else { - state.map[lstName] = [model]; - } -} - -export function updateMapData(state, model) { - if (state.map && model) { - switch (model._type) { - case systemGraphType.Line: updateForList(model, state, 'lineList'); break; - case systemGraphType.Text: updateForList(model, state, 'textList'); break; - case systemGraphType.Rect: updateForList(model, state, 'rectList'); break; - } - } -} diff --git a/src/jmapNew/shape/index.js b/src/jmapNew/shape/index.js index 007863479..e9adb0c3a 100644 --- a/src/jmapNew/shape/index.js +++ b/src/jmapNew/shape/index.js @@ -1,10 +1,10 @@ import graphMapShape from './graph'; -import systemGraphShape from './systemGraph'; +import nccGraphShape from './nccGraph'; export default { __Shape: { ...graphMapShape, - // ...systemGraphShape + ...nccGraphShape }, getBuilder(type) { const ShapeClazz = this.__Shape[type]; diff --git a/src/jmapNew/shape/systemGraph/Line/index.js b/src/jmapNew/shape/nccGraph/Line/index.js similarity index 100% rename from src/jmapNew/shape/systemGraph/Line/index.js rename to src/jmapNew/shape/nccGraph/Line/index.js diff --git a/src/jmapNew/shape/nccGraph/NccStation/Transfer.js b/src/jmapNew/shape/nccGraph/NccStation/Transfer.js new file mode 100644 index 000000000..bef1d535b --- /dev/null +++ b/src/jmapNew/shape/nccGraph/NccStation/Transfer.js @@ -0,0 +1,22 @@ +import Group from 'zrender/src/container/Group'; +import createPathSvg from '../../../constant/pathsvg'; + +export default class Transfer extends Group { + constructor(model) { + super(); + this.model = model; + this.zlevel = model.zlevel; + this.z = model.z; + this._subType = model._subType; + this.create(); + } + create() { + this.path = createPathSvg(this.model); + this.add(this.path); + } + setControlColor(color) { + this.path.setStyle({fill: color}); + } + recover() { + } +} diff --git a/src/jmapNew/shape/nccGraph/NccStation/index.js b/src/jmapNew/shape/nccGraph/NccStation/index.js new file mode 100644 index 000000000..d8a801b23 --- /dev/null +++ b/src/jmapNew/shape/nccGraph/NccStation/index.js @@ -0,0 +1,88 @@ +import Circle from 'zrender/src/graphic/shape/Circle'; +import Text from 'zrender/src/graphic/Text'; +import Group from 'zrender/src/container/Group'; +import BoundingRect from 'zrender/src/core/BoundingRect'; +import Transfer from './Transfer'; + +export default class NccStation extends Group { + constructor(model, {style, lineCode}) { + super(); + this._code = model.code; + this.stationCode = model.stationCode; + this._type = model._type; + this.name = model.name; + this.zlevel = model.zlevel; + this.model = model; + this.style = style; + this.z = 6; + this.lineCode = lineCode; + this.create(); + this.setState(model); + } + + create() { + const model = this.model; + this.stationMain = new Circle({ + zlevel: this.zlevel, + z: this.z, + shape: { + cx: model.position.x, + cy: model.position.y, + r: model.radius + }, + style: { + fill: model.fillColor, + lineWidth: model.lineWidth, + stroke: model.lineColor + } + }); + this.stationName = new Text({ + zlevel: this.zlevel, + z: this.z + 1, + style: { + x: model.position.x + model.snOffset.x, + y: model.position.y + model.snOffset.y, + text: model.name, + fontFamily: this.style.fontFamily, + fontSize: Number(model.font), + textFill: model.fontColor, + textAlign: 'middle' + } + }); + if (model.isTransfer) { + this.transferSign = new Transfer({ + zlevel: this.zlevel, + z: this.z + 2, + x: model.position.x - model.radius, + y: model.position.y - model.radius, + _subType: 'TransferSign', + width: model.radius * 2, + fill: '#f00' + }); + this.add(this.transferSign); + this.add(this.transferSign); + } + this.add(this.stationMain); + this.add(this.stationName); + } + + setState(model) { + } + getBoundingRect() { + if (this.stationMain) { + return this.stationMain.getBoundingRect().clone(); + } else { + return new BoundingRect(this.model.position.x, this.model.position.y, 0, 0); + } + } + + setShowStation(stationCode) { + + } + screenShow() { + + } + getAnchorPoint() { + return this.model.position; + } +} diff --git a/src/jmapNew/shape/nccGraph/NccTrain/index.js b/src/jmapNew/shape/nccGraph/NccTrain/index.js new file mode 100644 index 000000000..a3decf59e --- /dev/null +++ b/src/jmapNew/shape/nccGraph/NccTrain/index.js @@ -0,0 +1,114 @@ +import Group from 'zrender/src/container/Group'; +import BoundingRect from 'zrender/src/core/BoundingRect'; +import createPathSvg from '../../../constant/pathsvg'; +import store from '@/store/index'; + +export default class NccTrain extends Group { + constructor(model, {style, lineCode}) { + super(); + this._code = model.groupNum; + this._type = model._type; + this.name = model.groupNum; + this.zlevel = model.zlevel; + this.model = model; + this.style = style; + this.z = 6; + this.lineCode = lineCode; + this.point = []; + this.create(); + this.setState(model); + } + + create() { + const model = this.model; + const nccRunPositionData = store.state.map.nccRunPositionData; + const startPositions = nccRunPositionData[model.startStationCode]; + const endPositions = nccRunPositionData[model.targetStationCode]; + let runLineCode = ''; + let pointIndexs = []; + let runLinePoints = []; + startPositions.forEach(item =>{ + const position = endPositions.find(el => el.runLineCode === item.runLineCode); + if (position) { + runLineCode = position.runLineCode; + pointIndexs = [item.pointIndex, position.pointIndex]; + } + }); + if (runLineCode) { + const runLine = store.getters['map/getNccDeviceByCode'](runLineCode); + runLinePoints = runLine.points; + } + let px = 0; + let py = 0; + let angle = 0; + if (pointIndexs.length && Math.abs(pointIndexs[0] - pointIndexs[1]) > 1) { + let stateI = pointIndexs[0]; + const endI = pointIndexs[1]; + const step = Math.sign( endI - stateI); + const lengthList = []; + let totalLength = 0; + while (stateI !== endI) { + const p1 = runLinePoints[stateI]; + const p2 = runLinePoints[stateI + step]; + const length = Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2)); + lengthList.push(length); + totalLength += length; + stateI += step; + } + const complateLength = totalLength * model.stationComplateRatio; + let nowIndex = 0; + let nowLength = complateLength; + while (nowLength > lengthList[nowIndex]) { + nowLength -= lengthList[nowIndex]; + nowIndex++; + } + const startP = runLinePoints[pointIndexs[0] + nowIndex]; + const endP = runLinePoints[pointIndexs[0] + nowIndex + 1]; + const nowRatio = nowLength / lengthList[nowIndex]; + px = startP.x + Math.round(nowRatio * (endP.x - startP.x)); + py = startP.y + Math.round(nowRatio * (endP.y - startP.y)); + angle = Math.atan2(startP.y - endP.y, startP.x - endP.x); + angle = -angle; + } else if (pointIndexs.length) { + const startP = runLinePoints[pointIndexs[0]]; + const endP = runLinePoints[pointIndexs[1]]; + px = startP.x + Math.round(model.stationComplateRatio * (endP.x - startP.x)); + py = startP.y + Math.round(model.stationComplateRatio * (endP.y - startP.y)); + angle = Math.atan2( startP.y - endP.y, startP.x - endP.x); + angle = -angle; + } + const trainWidth = 15; + const offset = -10; + this.tranBody = createPathSvg({ + zlevel: this.zlevel, + z: this.z + 5, + x: px + Math.sin(angle) * offset, + y: py + Math.cos(angle) * offset, + _subType: 'NccTrainBody', + width: trainWidth, + fill: '#D381CA', + rotation: angle + }); + this.point = [px + Math.sin(angle) * offset, py + Math.cos(angle) * offset]; + if (!this.point[0]) { + console.log(this.point[0], this.point[1], '--------', this.model, startPositions, endPositions, nccRunPositionData); + } + this.add(this.tranBody); + } + + setState(model) { + } + getBoundingRect() { + return new BoundingRect(this.point[0], this.point[1], 0, 0); + } + + setShowStation(stationCode) { + + } + screenShow() { + + } + getAnchorPoint() { + return this.model.position; + } +} diff --git a/src/jmapNew/shape/systemGraph/Rect/index.js b/src/jmapNew/shape/nccGraph/Rect/index.js similarity index 100% rename from src/jmapNew/shape/systemGraph/Rect/index.js rename to src/jmapNew/shape/nccGraph/Rect/index.js diff --git a/src/jmapNew/shape/nccGraph/RunLine/index.js b/src/jmapNew/shape/nccGraph/RunLine/index.js new file mode 100644 index 000000000..2fc06829f --- /dev/null +++ b/src/jmapNew/shape/nccGraph/RunLine/index.js @@ -0,0 +1,117 @@ +import Group from 'zrender/src/container/Group'; +import Polyline from 'zrender/src/graphic/shape/Polyline'; +import Sector from 'zrender/src/graphic/shape/Sector'; + +export default class RunLine extends Group { + constructor(model, {style}) { + super(); + this._code = model.code; + this._type = model._type; + this.zlevel = model.zlevel; + this.z = 0; + this.model = model; + this.backgroundColor = style.backgroundColor; + this.style = style.Line; + this.create(); + this.setState(model); + } + isRightAngle(x1, y1, x2, y2, x3, y3) { + const distance12 = (x2 - x1) ** 2 + (y2 - y1) ** 2; + const distance13 = (x3 - x1) ** 2 + (y3 - y1) ** 2; + const distance23 = (x3 - x2) ** 2 + (y3 - y2) ** 2; + console.log(distance12, distance13, distance23, 'isRightAngle', x1, y1, x2, y2, x3, y3); + if (distance12 >= distance13 && distance12 >= distance23) { + return distance12 === distance13 + distance23; + } else if (distance13 >= distance12 && distance13 >= distance23) { + return distance13 === distance12 + distance23; + } else { + return distance23 === distance12 + distance13; + } + } + create() { + const model = this.model; + const roundPointIndexList = []; + if (model && model.points && model.points.length > 1) { + const points = []; + const modelPoints = model.points; + const length = modelPoints.length; + for (let i = 0; i < length; i++) { + points.push([modelPoints[i].x, modelPoints[i].y]); + if (i > 0 && i < length - 1) { + const isRight = this.isRightAngle(modelPoints[i - 1].x, modelPoints[i - 1].y, modelPoints[i].x, modelPoints[i].y, modelPoints[i + 1].x, modelPoints[i + 1].y ); + isRight && roundPointIndexList.push(i); + } + } + this.segment = new Polyline({ + zlevel: this.zlevel, + z:this.z, + shape: { + points:points + }, + style: { + lineWidth: model.width, + stroke: model.lineColor + } + }); + this.add(this.segment); + } + if (roundPointIndexList.length) { + roundPointIndexList.forEach(pointIndex => { + console.log(pointIndex, model.points, 'modelPoints'); + const simpx = model.points[pointIndex - 1].x + model.points[pointIndex + 1].x - model.points[pointIndex].x; + const simpy = model.points[pointIndex - 1].y + model.points[pointIndex + 1].y - model.points[pointIndex].y; + const preAngle = Math.atan2(model.points[pointIndex - 1].y - simpy, model.points[pointIndex - 1].x - simpx ); + const nextAngle = Math.atan2(model.points[pointIndex + 1].y - simpy, model.points[pointIndex + 1].x - simpx); + const startAngle = Math.min(preAngle, nextAngle); + const endAngle = Math.max(preAngle, nextAngle); + console.log(startAngle, endAngle, '****'); + const embellishSector1 = new Sector({ + zlevel: this.zlevel, + z: this.z + 1, + shape: { + cx: model.points[pointIndex].x + Math.sign(simpx - model.points[pointIndex].x) * model.width, + cy: model.points[pointIndex].y + Math.sign(simpy - model.points[pointIndex].y) * model.width, + r: model.width / 2 * 3 * Math.sqrt(2), + r0: model.width / 2 * 3, + startAngle: startAngle, + endAngle:endAngle, + clockwise: !(endAngle - startAngle > Math.PI) + }, + style: { + fill: this.backgroundColor + } + }); + const embellishSector2 = new Sector({ + zlevel: this.zlevel, + z: this.z + 1, + shape: { + cx: model.points[pointIndex].x + Math.sign(simpx - model.points[pointIndex].x) * model.width, + cy: model.points[pointIndex].y + Math.sign(simpy - model.points[pointIndex].y) * model.width, + r: model.width, + r0: model.width / 2, + startAngle: startAngle, + endAngle: endAngle, + clockwise: !(endAngle - startAngle > Math.PI) + }, + style: { + fill: model.lineColor + } + }); + this.add(embellishSector1); + this.add(embellishSector2); + }); + } + console.log(this, 'runline'); + } + + setState(model) { + } + getAnchorPoint() { + if (this.segment) { + const rect = this.segment.getBoundingRect(); + return {x:rect.x, y:rect.y}; + } else { + return {x:0, y:0}; + } + } +} diff --git a/src/jmapNew/shape/systemGraph/Text/index.js b/src/jmapNew/shape/nccGraph/Text/index.js similarity index 100% rename from src/jmapNew/shape/systemGraph/Text/index.js rename to src/jmapNew/shape/nccGraph/Text/index.js diff --git a/src/jmapNew/shape/nccGraph/index.js b/src/jmapNew/shape/nccGraph/index.js new file mode 100644 index 000000000..0d8d8e979 --- /dev/null +++ b/src/jmapNew/shape/nccGraph/index.js @@ -0,0 +1,18 @@ +import nccGraphType from '../../constant/nccGraphType'; + +import Line from './Line'; +import Text2 from './Text'; +import Rect2 from './Rect'; +import NccStation from './NccStation'; +import RunLine from './RunLine'; +import NccTrain from './NccTrain'; +/** 图库*/ +const mapShape = {}; +mapShape[nccGraphType.NccLine] = Line; +mapShape[nccGraphType.NccText] = Text2; +mapShape[nccGraphType.NccRect] = Rect2; +mapShape[nccGraphType.NccStation] = NccStation; +mapShape[nccGraphType.RunLine] = RunLine; +mapShape[nccGraphType.NccTrain] = NccTrain; + +export default mapShape; diff --git a/src/jmapNew/shape/systemGraph/Arrow/index.js b/src/jmapNew/shape/systemGraph/Arrow/index.js deleted file mode 100644 index f9ce4b30d..000000000 --- a/src/jmapNew/shape/systemGraph/Arrow/index.js +++ /dev/null @@ -1,61 +0,0 @@ -import Group from 'zrender/src/container/Group'; -import Polygon from 'zrender/src/graphic/shape/Polygon'; - -export default class Arrow extends Group { - constructor(model, {style}) { - super(); - this._code = model.code; - this._type = model._type; - this.zlevel = model.zlevel; - this.z = 0; - this.model = model; - // this.style = style; - this.isShowShape = true; - this.create(); - this.setState(model); - } - - create() { - const model = this.model; - this.arrow = new Polygon({ - zlevel: this.zlevel, - z: this.z, - origin: [model.position.x, model.position.y], - rotation: -Math.PI / 180 * Number(model.rotate), - shape: { - points: [ - [model.position.x, model.position.y], - [model.position.x + model.triangleLength, model.position.y - model.triangleHeight / 2], - [model.position.x + model.triangleLength, model.position.y - model.lineWidth / 2], - [model.position.x + model.length, model.position.y - model.lineWidth / 2], - [model.position.x + model.length, model.position.y + model.lineWidth / 2], - [model.position.x + model.triangleLength, model.position.y + model.lineWidth / 2], - [model.position.x + model.triangleLength, model.position.y + model.triangleHeight / 2] - ] - }, - style: { - fill: model.color - } - }); - this.add(this.arrow); - } - - setState(model) { - if (!this.isShowShape) return; - } - - setShowStation(stationCode) { - if (!stationCode || this.model.stationCode === stationCode) { - this.show(); - this.isShowShape = true; - this.setState(this.model); - } else { - this.hide(); - this.isShowShape = false; - } - } - getAnchorPoint() { - const rect = this.arrow.getBoundingRect(); - return { x:rect.x, y:rect.y }; - } -} diff --git a/src/jmapNew/shape/systemGraph/index.js b/src/jmapNew/shape/systemGraph/index.js deleted file mode 100644 index 69ea2220e..000000000 --- a/src/jmapNew/shape/systemGraph/index.js +++ /dev/null @@ -1,15 +0,0 @@ -import systemGraphType from '../../constant/systemGraphType'; - -import Line from './Line/index.js'; -import Text2 from './Text/index.js'; -import Rect2 from './Rect/index.js'; -import Arrow from './Arrow/index.js'; - -/** 图库*/ -const mapShape = {}; -mapShape[systemGraphType.Line] = Line; -mapShape[systemGraphType.Text] = Text2; -mapShape[systemGraphType.Rect] = Rect2; -mapShape[systemGraphType.Arrow] = Arrow; - -export default mapShape; diff --git a/src/jmapNew/utils/parser.js b/src/jmapNew/utils/parser.js index f602d77be..94dddad98 100644 --- a/src/jmapNew/utils/parser.js +++ b/src/jmapNew/utils/parser.js @@ -1,5 +1,6 @@ import * as matrix from 'zrender/src/core/matrix'; import deviceRender from '../constant/deviceRender'; +import nccGraphRender from '../constant/nccGraphRender'; export function createTransform(opts) { let transform = matrix.create(); @@ -34,5 +35,6 @@ export function calculateDCenter(viewRect, offsetX) { } export function deviceFactory(type, elem, showConfig) { - return {...deviceRender[type], ...elem, ...showConfig}; + const renderConfig = { ...nccGraphRender, ...deviceRender }; + return {...renderConfig[type], ...elem, ...showConfig}; } diff --git a/src/router/index.js b/src/router/index.js index 3d7b474ab..a990d1e3a 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -1349,8 +1349,8 @@ export const asyncRouter = [ component: NewMapDraft, hidden: true }, - { // 地图系统绘制 - path: 'usermap/map/systemDraw/:mapId/:view', + { // ncc地图绘制 + path: 'usermap/map/nccDraw/:mapId/:view', component: NewMapDraftSystem, hidden: true }, diff --git a/src/store/modules/map.js b/src/store/modules/map.js index 4c20295aa..e7a27d9ff 100644 --- a/src/store/modules/map.js +++ b/src/store/modules/map.js @@ -221,8 +221,11 @@ const map = { trainWindowSectionCode: '', // 选择车次窗所属区段code flankProtectList: [], // 侧防列表 map: null, // 地图数据 + nccData: null, // ncc数据 dataZoom: {}, // 缩放位置 mapDevice: {}, // 解析后的地图数据 + nccDevice: {}, + nccRunPositionData: {}, mapList: {}, // 地图数据列表 mapViewLoadedCount: 0, // 地图视图加载完成标识 initJlmapLoadedCount: 0, // Jlmap初始化表示 @@ -604,6 +607,20 @@ const map = { return []; } }, + nccStationList: state => { + if (state.nccData) { + return state.nccData.nccStationList || []; + } else { + return []; + } + }, + runLineList: state => { + if (state.nccData) { + return state.nccData.runLineList || []; + } else { + return []; + } + }, // trainDetails: (state) => { // return state.trainDetails; // }, @@ -616,6 +633,9 @@ const map = { getDeviceByCode: state => code => { return state.mapDevice[code]; }, + getNccDeviceByCode: state => code => { + return state.nccDevice[code]; + }, getPictureDeviceByCode: state => code => { return state.pictureDeviceMap[code]; }, @@ -822,6 +842,13 @@ const map = { state.foldLineMap = foldLineMap; const parser = parserFactory(ParserType.Graph.value); state.mapDevice = parser.parser(map, map.skinVO.code, showConfig); + if (map.nccData) { + const nccParser = parserFactory(ParserType.nccGraph.value); + state.nccData = JSON.parse(map.nccData); + const parserData = nccParser.parser(state.nccData, map.skinVO.code, showConfig); + state.nccDevice = parserData.nccDevice; + state.nccRunPositionData = parserData.runPositionData; + } state.stationControlMap = {}; map.stationList.forEach(station => { if (station.ciStation) { @@ -872,7 +899,7 @@ const map = { setDataZoom: (state, dataZoom) => { state.dataZoom = dataZoom; }, - mapRender: (state, devices, type = ParserType.Graph.value) => { + mapRender: (state, { devices, type = ParserType.Graph.value }) => { if (devices && devices.length) { if (state.map) { const parser = parserFactory(type); @@ -1203,7 +1230,7 @@ const map = { }, setOverlapData: ({ commit }, overlapData) => { commit('setOverlapData', overlapData); - commit('mapRender', overlapData); + commit('mapRender', { devices: overlapData }); }, setAutoReentryData: ({ commit }, autoReentryData) => { commit('setAutoReentryData', autoReentryData); @@ -1258,14 +1285,15 @@ const map = { }); const list = Object.values(dict); if (window.location.href.includes('/lineDesign/usermap/map/draw')) { + console.log(state.mapDevice); handleOperation(state, list); } - commit('mapRender', list); + commit('mapRender', { devices: list }); resolve(list); }); }, - updateSystemMapDevices: ({ commit, state }, models) => { + updateNccMapDevices: ({ commit, state }, models) => { return new Promise(resolve => { if (!(models instanceof Array)) { models = [models]; @@ -1283,20 +1311,21 @@ const map = { } }); const list = Object.values(dict); - if (window.location.href.includes('/design/usermap/map/systemDraw')) { + if (window.location.href.includes('/design/usermap/map/nccDraw')) { handleOperation(state, list); } - commit('mapRender', list, ParserType.systemGraph.value); + console.log(ParserType.nccGraph.value, '*********'); + commit('mapRender', {devices: list, type: ParserType.nccGraph.value}); resolve(list); }); }, setRevocation({ state, commit }) { - commit('mapRender', revocation(state, state.stepData.shift() || [])); // 撤销 + commit('mapRender', { devices: revocation(state, state.stepData.shift() || []) }); // 撤销 }, setRecover({ state, commit }) { - commit('mapRender', recover(state, state.recoverStepData.shift() || [])); // 恢复 + commit('mapRender', { devices: recover(state, state.recoverStepData.shift() || []) }); // 恢复 }, saveMapDeviceDefaultRelations({ state }) { @@ -1364,7 +1393,7 @@ const map = { }); } - commit('mapRender', deviceList); + commit('mapRender', { devices: deviceList }); } }, diff --git a/src/store/modules/socket.js b/src/store/modules/socket.js index 4b56cba08..cb0d1c3e7 100644 --- a/src/store/modules/socket.js +++ b/src/store/modules/socket.js @@ -119,7 +119,8 @@ const socket = { simulationWorkParam: {}, conversationMessage: {}, controlTransfer: {}, - operationModeApplyList: [] // 模式转换消息列表 + operationModeApplyList: [], // 模式转换消息列表 + nccRunData: [] // ncc运行数据 }, getters: { }, @@ -406,6 +407,9 @@ const socket = { state.operationModeApplyList.splice(index, 1); } }); + }, + handleNccRun: (state, list) => { + state.nccRunData = list; } }, @@ -644,6 +648,9 @@ const socket = { }, operationModeApply: ({ commit }, message) => { commit('operationModeApply', message); + }, + handleNccRun: ({ commit }, message) => { + commit('handleNccRun', message); } } }; diff --git a/src/utils/stomp.js b/src/utils/stomp.js index abd2af6d2..7bbcdb562 100644 --- a/src/utils/stomp.js +++ b/src/utils/stomp.js @@ -68,6 +68,9 @@ export function getTopic(type, group, param) { case 'JL3D': topic = `/user/queue/simulation/${group}/jl3d`; break; + case 'NCC': + topic = `/user/queue/diagram/simulation/${group}`; + break; } return topic; diff --git a/src/utils/subscribeCallback.js b/src/utils/subscribeCallback.js index 30a61a8ac..087ac9c05 100644 --- a/src/utils/subscribeCallback.js +++ b/src/utils/subscribeCallback.js @@ -197,6 +197,9 @@ 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/stationDiagram/jlmap/index.vue b/src/views/newMap/display/stationDiagram/jlmap/index.vue index a5df3665a..3615596c7 100644 --- a/src/views/newMap/display/stationDiagram/jlmap/index.vue +++ b/src/views/newMap/display/stationDiagram/jlmap/index.vue @@ -112,11 +112,6 @@ export default { $route() { this.mapViewLoaded(true); }, - // '$store.state.socket.simulationReset': function (val) { // 仿真结束标识 - // if (val) { - // this.simulationReset(val); - // } - // }, '$store.state.training.rezoomCount': function () { let code = this.$store.state.training.offsetStationCode; // 偏移集中站坐标 if (code && code.includes('Cycle')) { // 单独处理 自动折返 @@ -329,9 +324,9 @@ export default { }); }, // 设置新的地图数据 - setMap(map) { - this.$jlmap.setMap(map, this.$store.state.map.mapDevice, {routeData:this.$store.state.map.routeData, autoReentryData: this.$store.state.map.autoReentryData}); - }, + // setMap(map) { + // this.$jlmap.setMap(map, this.$store.state.map.mapDevice, {routeData:this.$store.state.map.routeData, autoReentryData: this.$store.state.map.autoReentryData}); + // }, // 刷新地图数据 refresh(map) { }, diff --git a/src/views/newMap/display/terminals/index.vue b/src/views/newMap/display/terminals/index.vue index 76773b573..e839f2319 100644 --- a/src/views/newMap/display/terminals/index.vue +++ b/src/views/newMap/display/terminals/index.vue @@ -2,6 +2,7 @@
+ @@ -85,6 +86,7 @@ import TroWork from './troWork'; import TroDetailWork from './troDetailWork'; import TestRunplan from './testRunplan'; import DriverAtsWork from './driverAtsWork'; +import NccWork from './nccWork'; export default { name: 'Index', @@ -121,7 +123,8 @@ export default { TroDetailWork, Jl3dMaintainerSelect, TestRunplan, - DriverAtsWork + DriverAtsWork, + NccWork }, data() { return { @@ -154,6 +157,7 @@ export default { }, watch: { '$store.state.map.mapViewLoadedCount': function (val) { // 地图视图加载完成标识 开始加载默认状态 + if (this.picture === 'nccWork') { return; } this.subscribe('ATS_STATUS'); if (this.isFirst) { this.$store.dispatch('training/setMapDefaultState'); @@ -224,32 +228,7 @@ export default { }, subscribe(type) { // 根据显示端分别订阅 const header = {group: this.group || '', 'X-Token': getToken()}; - switch (type) { - case 'COMMON': - creatSubscribe(getTopic(type, this.group), header, defaultCallback); - break; - case 'ATS_STATUS': - creatSubscribe(getTopic(type, this.group), header, defaultCallback); - break; - case 'STATE': - creatSubscribe(getTopic(type, this.group), header, stateCallback); - break; - case 'CTC': - creatSubscribe(getTopic(type, this.group), header, defaultCallback); - break; - case 'LPF': - creatSubscribe(getTopic(type, this.group), header, defaultCallback); - break; - case 'YJDDZH': - creatSubscribe(getTopic(type, this.group), header, defaultCallback); - break; - case 'RUNFACT': - creatSubscribe(getTopic(type, this.group), header, defaultCallback); - break; - case 'JL3D': - creatSubscribe(getTopic(type, this.group), header, defaultCallback); - break; - } + creatSubscribe(getTopic(type, this.group), header, type === 'STATE' ? stateCallback : defaultCallback); }, clearSubscribe() { clearSubscribe(getTopic('COMMON', this.group)); @@ -295,6 +274,8 @@ export default { this.mapViewLoaded(true); } else if (val === 'dispatchingCommand') { this.$nextTick(() => { this.subscribe('CTC'); }); + } else if (val === 'nccWork') { + this.$nextTick(() => { this.subscribe('NCC'); }); } this.$nextTick(() => { this.loading = false; }); }, diff --git a/src/views/newMap/display/terminals/nccWork.vue b/src/views/newMap/display/terminals/nccWork.vue new file mode 100644 index 000000000..3e60f96aa --- /dev/null +++ b/src/views/newMap/display/terminals/nccWork.vue @@ -0,0 +1,94 @@ + + + + + diff --git a/src/views/newMap/display/terminals/terminalMenu.vue b/src/views/newMap/display/terminals/terminalMenu.vue index 142a59446..155084a58 100644 --- a/src/views/newMap/display/terminals/terminalMenu.vue +++ b/src/views/newMap/display/terminals/terminalMenu.vue @@ -40,6 +40,13 @@ export default { isShow: () => this.$route.query.lineCode !== '14', click: this.changePictureShow }, + { + name: 'Ncc', + code: 'nccWork', + roleList: ['DISPATCHER'], + isShow: () => this.$route.query.simType === 'METRO', + click: this.changePictureShow + }, { name: '行调台', code: 'dispatcherManage', @@ -305,7 +312,6 @@ export default { } else if (this.roles === 'DRIVER') { // 司机模拟 const trainingDesign = this.$store.state.training.domConfig ? this.$store.state.training.domConfig.trainingDesign : false; - console.log('1111111111111111', trainingDesign); this.changePictureShow(trainingDesign ? 'driverAtsWork' : 'drivingPlan'); } }, diff --git a/src/views/newMap/newDesignUser/demonList.vue b/src/views/newMap/newDesignUser/demonList.vue index eec2aa4ec..c8625dcd5 100644 --- a/src/views/newMap/newDesignUser/demonList.vue +++ b/src/views/newMap/newDesignUser/demonList.vue @@ -139,17 +139,17 @@ export default { lineCode: elem.lineCode }, { - id: '2', - name: '系统配置绘图', - type: 'mapSystem', + id: '3', + name: '画面管理', + type: 'mapPicture', mapId: elem.id, mapName: elem.name, lineCode: elem.lineCode }, { - id: '3', - name: '画面管理', - type: 'mapPicture', + id: '4', + name: 'NCC设计', + type: 'nccDesign', mapId: elem.id, mapName: elem.name, lineCode: elem.lineCode @@ -180,16 +180,6 @@ export default { }); break; } - case 'mapSystem': { - if (this.loadingProjectList.includes(this.project)) { - this.$store.dispatch('app/transitionAnimations'); - } - this.$router.push({ - path: `/design/usermap/map/systemDraw/${obj.mapId}/draft`, - query: { name: obj.mapName, lineCode: obj.lineCode } - }); - break; - } case 'mapPicture': { if (this.loadingProjectList.includes(this.project)) { this.$store.dispatch('app/transitionAnimations'); @@ -200,6 +190,16 @@ export default { }); break; } + case 'nccDesign': { + if (this.loadingProjectList.includes(this.project)) { + this.$store.dispatch('app/transitionAnimations'); + } + this.$router.push({ + path: `/design/usermap/map/nccDraw/${obj.mapId}/draft`, + query: { name: obj.mapName, lineCode: obj.lineCode } + }); + break; + } } }, showContextMenu(e, obj, node, vueElem) { diff --git a/src/views/newMap/newMapdraftSystem/index.vue b/src/views/newMap/newMapdraftSystem/index.vue index 4ae8a1c98..57e3d4ba7 100644 --- a/src/views/newMap/newMapdraftSystem/index.vue +++ b/src/views/newMap/newMapdraftSystem/index.vue @@ -34,9 +34,9 @@ + diff --git a/src/views/newMap/newMapdraftSystem/mapoperate/components/operateProperty.vue b/src/views/newMap/newMapdraftSystem/mapoperate/components/operateProperty.vue index c9fad141e..4bb4b58a4 100644 --- a/src/views/newMap/newMapdraftSystem/mapoperate/components/operateProperty.vue +++ b/src/views/newMap/newMapdraftSystem/mapoperate/components/operateProperty.vue @@ -59,7 +59,7 @@ export default { }, // 删除对象 deleteObj() { - const selected = this.$store.getters['map/getDeviceByCode'](this.editModel.code); + const selected = this.$store.getters['map/getNccDeviceByCode'](this.editModel.code); if (selected && this.isDeleteHide) { this.isDeleteHide = false; this.$confirm(this.$t('tip.confirmDeletion'), this.$t('tip.hint'), { diff --git a/src/views/newMap/newMapdraftSystem/mapoperate/config/list.vue b/src/views/newMap/newMapdraftSystem/mapoperate/config/list.vue index 48f18b520..3cbf20a11 100644 --- a/src/views/newMap/newMapdraftSystem/mapoperate/config/list.vue +++ b/src/views/newMap/newMapdraftSystem/mapoperate/config/list.vue @@ -95,6 +95,11 @@ +