diff --git a/src/store/modules/map.js b/src/store/modules/map.js index 398f4e513..d1f80c051 100644 --- a/src/store/modules/map.js +++ b/src/store/modules/map.js @@ -1,9 +1,9 @@ -import deviceType from '@/jmapNew/constant/deviceType' +import deviceType from '@/jmapNew/constant/deviceType'; // import { parser, updateMapData } from '@/jmapNew/utils/parser'; -import { parserFactory, ParserType } from '@/jmapNew/parser' -import Vue from 'vue' -import { deepAssign } from '@/utils/index' -import store from '@/store/index' +import { parserFactory, ParserType } from '@/jmapNew/parser'; +import Vue from 'vue'; +import { deepAssign } from '@/utils/index'; +import store from '@/store/index'; /** * 查询受影响的Devices并删除 @@ -12,1274 +12,1274 @@ import store from '@/store/index' * @param {Array} list */ function queryDeleteModels(state, device, dict) { - function setDisPose(model, dict) { - if (!dict[model.code] || !dict[model.code]._dispose) { - dict[model.code] = { ...model, _dispose: true } + function setDisPose(model, dict) { + if (!dict[model.code] || !dict[model.code]._dispose) { + dict[model.code] = { ...model, _dispose: true }; + } } - } - const map = state.map + const map = state.map; - if (device && map) { - setDisPose(device, dict) + if (device && map) { + setDisPose(device, dict); - switch (device._type) { - // 移除区段关联项 - case deviceType.Section: + switch (device._type) { + // 移除区段关联项 + case deviceType.Section: // 删除所属逻辑区段 - if (map.sectionList && map.sectionList.length && device.type == '01') { - map.sectionList.forEach(elem => { - if (elem.type != '01' && elem.parentCode == device.code) { - setDisPose(elem, dict) - } - }) - } - - // 查询区段关联的道岔 - if (map.switchList && map.switchList.length) { - map.switchList.forEach(elem => { - if (elem.sectionACode == device.code || elem.sectionBCode == device.code || elem.sectionCCode == device.code) { - queryDeleteModels(state, elem, dict) - } - }) - } - - break - case deviceType.Switch: - map.sectionList.forEach(elem => { - if (elem.type == '03' && elem.relSwitchCode == device.code) { - if (!dict[elem.code] || !dict[elem.code]._dispose) { - const copyModel = deepAssign({}, elem) - if (copyModel.parentCode) { - const model = dict[copyModel.parentCode] || state.mapDevice[copyModel.parentCode] || {} - if (model.code) { - const setionModel = deepAssign({}, model) - setionModel.relevanceSectionList.forEach((sectionCode, index) => { - if (sectionCode == copyModel.code) { - setionModel.relevanceSectionList.splice(index, 1) - dict[setionModel.code] = setionModel + if (map.sectionList && map.sectionList.length && device.type == '01') { + map.sectionList.forEach(elem => { + if (elem.type != '01' && elem.parentCode == device.code) { + setDisPose(elem, dict); + } + }); + } + + // 查询区段关联的道岔 + if (map.switchList && map.switchList.length) { + map.switchList.forEach(elem => { + if (elem.sectionACode == device.code || elem.sectionBCode == device.code || elem.sectionCCode == device.code) { + queryDeleteModels(state, elem, dict); + } + }); + } + + break; + case deviceType.Switch: + map.sectionList.forEach(elem => { + if (elem.type == '03' && elem.relSwitchCode == device.code) { + if (!dict[elem.code] || !dict[elem.code]._dispose) { + const copyModel = deepAssign({}, elem); + if (copyModel.parentCode) { + const model = dict[copyModel.parentCode] || state.mapDevice[copyModel.parentCode] || {}; + if (model.code) { + const setionModel = deepAssign({}, model); + setionModel.relevanceSectionList.forEach((sectionCode, index) => { + if (sectionCode == copyModel.code) { + setionModel.relevanceSectionList.splice(index, 1); + dict[setionModel.code] = setionModel; + } + }); + } + } + copyModel.relSwitchCode = ''; + // 旧版地图 判断是否道岔区段为isSwitchSection,新版地图已经更换为switchSection + // 此处为了兼容旧版,暂时没有删除isSwitchSection,待旧版地图删除之后需要删除isSwitchSection + copyModel.isSwitchSection = false; + copyModel.switchSection = false; + copyModel.type = '01'; + copyModel.name = copyModel.name.split('-')[0]; + dict[elem.code] = copyModel; } - }) } - } - copyModel.relSwitchCode = '' - // 旧版地图 判断是否道岔区段为isSwitchSection,新版地图已经更换为switchSection - // 此处为了兼容旧版,暂时没有删除isSwitchSection,待旧版地图删除之后需要删除isSwitchSection - copyModel.isSwitchSection = false - copyModel.switchSection = false - copyModel.type = '01' - copyModel.name = copyModel.name.split('-')[0] - dict[elem.code] = copyModel - } - } - if (elem.type == '04') { - if (dict[elem.code] && !dict[elem.code].relevanceSectionList.length) { - setDisPose(elem, dict) - } else if (elem.relevanceSectionList && !elem.relevanceSectionList.length) { - setDisPose(elem, dict) - } - } - }) - break + if (elem.type == '04') { + if (dict[elem.code] && !dict[elem.code].relevanceSectionList.length) { + setDisPose(elem, dict); + } else if (elem.relevanceSectionList && !elem.relevanceSectionList.length) { + setDisPose(elem, dict); + } + } + }); + break; + } } - } } // 保存草稿地图绘制关系检测 function saveMapDeviceDefaultRelations(state) { - if (state && state.map) { - const map = state.map - // 设置图片图层 - if (map.resourceList && map.resourceList.length) { - map.resourceList.forEach(elem => { - if (!elem.zIndex) { - elem.zIndex = 1 + if (state && state.map) { + const map = state.map; + // 设置图片图层 + if (map.resourceList && map.resourceList.length) { + map.resourceList.forEach(elem => { + if (!elem.zIndex) { + elem.zIndex = 1; + } + }); } - }) } - } } function handleOperation(state, models) { - const list = [] - models.forEach(item => { - if (item._dispose) { - list.push({ operation: 'del', data: deepAssign({}, state.mapDevice[item.code]) }) - } else if (state.mapDevice[item.code]) { - list.push({ operation: 'edit', data: deepAssign({}, state.mapDevice[item.code]) }) - } else { - list.push({ operation: 'add', data: deepAssign({}, item) }) - } - }) + const list = []; + models.forEach(item => { + if (item._dispose) { + list.push({ operation: 'del', data: deepAssign({}, state.mapDevice[item.code]) }); + } else if (state.mapDevice[item.code]) { + list.push({ operation: 'edit', data: deepAssign({}, state.mapDevice[item.code]) }); + } else { + list.push({ operation: 'add', data: deepAssign({}, item) }); + } + }); - if (list.length) { - if (state.stepData.length >= 15) { - // 步骤数据最多储存15步 - state.stepData.pop() + if (list.length) { + if (state.stepData.length >= 15) { + // 步骤数据最多储存15步 + state.stepData.pop(); + } + state.stepData.unshift(list); + state.recoverStepData = []; } - state.stepData.unshift(list) - state.recoverStepData = [] - } } // 撤销 function revocation(state, models) { - if (models && models.length) { - const list = [] - const stepList = [] - models.forEach(item => { - switch (item.operation) { - case 'add': { - list.push({ operation: 'del', data: deepAssign({}, state.mapDevice[item.data.code]) }) - stepList.push({ ...item.data, _dispose: true }) - break - } - case 'del': { - list.push({ operation: 'add', data: deepAssign({}, item.data) }) - stepList.push({ ...item.data, _dispose: false }) - break - } - case 'edit': { - list.push({ operation: 'edit', data: deepAssign({}, state.mapDevice[item.data.code] || item.data) }) - stepList.push({ ...item.data, _dispose: false }) - break - } - } - }) - state.recoverStepData.unshift(list) - return stepList - } + if (models && models.length) { + const list = []; + const stepList = []; + models.forEach(item => { + switch (item.operation) { + case 'add': { + list.push({ operation: 'del', data: deepAssign({}, state.mapDevice[item.data.code]) }); + stepList.push({ ...item.data, _dispose: true }); + break; + } + case 'del': { + list.push({ operation: 'add', data: deepAssign({}, item.data) }); + stepList.push({ ...item.data, _dispose: false }); + break; + } + case 'edit': { + list.push({ operation: 'edit', data: deepAssign({}, state.mapDevice[item.data.code] || item.data) }); + stepList.push({ ...item.data, _dispose: false }); + break; + } + } + }); + state.recoverStepData.unshift(list); + return stepList; + } } // 恢复 function recover(state, models) { - if (models && models.length) { - const list = [] - const stepList = [] - models.forEach(item => { - switch (item.operation) { - case 'add': { - list.push({ operation: 'del', data: deepAssign({}, state.mapDevice[item.data.code]) }) - stepList.push({ ...item.data, _dispose: true }) - break - } - case 'del': { - list.push({ operation: 'add', data: deepAssign({}, item.data) }) - stepList.push({ ...item.data, _dispose: false }) - break - } - case 'edit': { - list.push({ operation: 'edit', data: deepAssign({}, state.mapDevice[item.data.code] || item.data) }) - stepList.push({ ...item.data, _dispose: false }) - break - } - } - }) - state.stepData.unshift(list) - return stepList - } + if (models && models.length) { + const list = []; + const stepList = []; + models.forEach(item => { + switch (item.operation) { + case 'add': { + list.push({ operation: 'del', data: deepAssign({}, state.mapDevice[item.data.code]) }); + stepList.push({ ...item.data, _dispose: true }); + break; + } + case 'del': { + list.push({ operation: 'add', data: deepAssign({}, item.data) }); + stepList.push({ ...item.data, _dispose: false }); + break; + } + case 'edit': { + list.push({ operation: 'edit', data: deepAssign({}, state.mapDevice[item.data.code] || item.data) }); + stepList.push({ ...item.data, _dispose: false }); + break; + } + } + }); + state.stepData.unshift(list); + return stepList; + } } // 过滤空值 删除 function filtrationModel(models) { - models.forEach(model => { - for (const key in model) { - if (typeof model[key] == 'string') { - if (!model[key]) { - delete model[key] + models.forEach(model => { + for (const key in model) { + if (typeof model[key] == 'string') { + if (!model[key]) { + delete model[key]; + } + } + if (model[key] == null || model[key] == undefined) { + delete model[key]; + } } - } - if (model[key] == null || model[key] == undefined) { - delete model[key] - } - } - }) - return models + }); + return models; } /** * 实训状态数据 */ const map = { - namespaced: true, + namespaced: true, - state: { - routeData: {}, // 进路数据 - routeList: [], // 进路list - routeStartSignalData: {}, // 进路始端信号机数据 - autoReentryData: {}, // 自动折返数据 - autoReentryList: [], // 自动折返list - signalApproachSectionData: {}, // 信号机接近区段数据 - signalApproachSectionList: [], // 信号机接近区段list - stepData: [], // 缓存数据 - mapName: '', // 地图名称 - mapConfig: [], // 地图所属线路配置 - recoverStepData: [], // 缓存恢复数据 - seclectDeviceList: [], // 包围框选中元素列表 - trainWindowSectionCode: '', // 选择车次窗所属区段code - flankProtectList: [], // 侧防列表 - map: null, // 地图数据 - dataZoom: {}, // 缩放位置 - mapDevice: {}, // 解析后的地图数据 - mapList: {}, // 地图数据列表 - mapViewLoadedCount: 0, // 地图视图加载完成标识 - mapDataLoadedCount: 0, // 地图数据加载完成标识 - mapStateLoadedCount: 0, // 地图状态变化完成标识 - mapDataLoadedScreenCount: 0, // 大屏加载完成 - mapStationStateUpdateCount: 0, // 车站状态刷新 - trainDetails: null, // 地图'列车详情'显示 - deleteCount: 0, // 绘图快捷删除标识 - updateCount: 0, // 绘图快捷修改标识 - mousemove: 0, // 实训战场图移动标识 - version: '', // 地图版本, - activeTrainListUpdate: 0, // 当前按计划行车的列车列表更新标识 - runLineTrainUpdate: 0, // 当前按计划行车列车运行线更新标识 - activeTrainListChange: 0, // 当前按计划行车的列车列表变化标识(只对列车的groupNumber进行了检测) - activeTrainList: [], // 当前按计划行车的列车列表 - showCentralizedStationCode: '', // 现地分集中站显示(集中站code) - showCentralizedStationNum: 0, // 现地分集中站显示判断 - overlapList: [], // 延续保护list - overlapData: {}, // 延续保护数据 - holdStandList: [], // 扣车站台列表 - holdStatus: false, // 是否有扣车状态 - jumpStandList: [], // 跳停站台列表 - jumpStatus: false, // 是否有跳停状态 - // selectDeviceFlag: false, // 设备管理激活判断 - keyboardEnterCount: 0, // 键盘enter键触发 - controlTransfer: [], // 控制权转移消息 - mapDataParseCount: 0, - foldLineMap: {}, // 现地折行线map数据 - clearButtonCount: 0, // 清除操作按钮计数器 - stationControlMap: {} // 站控显示的map { 当前车站:显示车站列表 } - }, - - getters: { - trainWindowSectionCode: state => { - return state.trainWindowSectionCode - }, - mapConfig: state => { - return state.mapConfig - }, - routeList: state => { - return state.routeList - }, - routeData: state => { - return state.routeData - }, - overlapList: state => { - return state.overlapList - }, - overlapData: state => { - return state.overlapData - }, - autoReentryData: state => { - return state.autoReentryData - }, - autoReentryList: state => { - return state.autoReentryList - }, - seclectDeviceList: state => { - return state.seclectDeviceList - }, - stepData: state => { - return state.stepData - }, - recoverStepData: state => { - return state.recoverStepData - }, - map: state => { - return state.map - }, - psdList: state => { - if (state.map) { - return state.map.psdList - } else { - return [] - } - }, - espList: state => { - if (state.map) { - return state.map.espList - } else { - return [] - } - }, - lineCode: state => { - if (state.map && state.map.skinVO) { - return state.map.skinVO.code - } - }, - name: state => { - if (state.map) { - return state.map.name - } else { - return null - } - }, - // version: (state) => { - // if (state.map) { - // return state.version; - // } else { - // return null; - // } - // }, - // linkList: (state) => { - // if (state.map) { - // return state.map.linkList; - // } else { - // return []; - // } - // }, - switchList: state => { - if (state.map) { - return state.map.switchList - } else { - return [] - } - }, - floodGateList: state => { - if (state.map) { - return state.map.floodGateList - } else { - return [] - } - }, - // buttonList: (state) => { - // if (state.map) { - // return state.map.buttonList; - // } else { - // return []; - // } - // }, - signalList: state => { - if (state.map) { - return state.map.signalList - } else { - return [] - } - }, - sectionList: state => { - if (state.map) { - return state.map.sectionList - } else { - return [] - } - }, - zcList: state => { - if (state.map) { - return state.map.zcList - } else { - return [] - } - }, - powerLineList: state => { - if (state.map) { - return state.map.powerLineList || [] - } else { - return [] - } - }, - tempSpeedLimitList: state => { - if (state.map) { - return state.map.tempSpeedLimitList - } else { - return [] - } - }, - lcList: state => { - if (state.map) { - return state.map.lcList - } else { - return [] - } - }, - tbStrategyList: state => { - if (state.map) { - return state.map.tbStrategyList || [] - } else { - return [] - } - }, - axleCounterResetButtonList: state => { - if (state.map) { - return state.map.axleCounterResetButtonList || [] - } else { - return [] - } - }, - totalGuideLockButtonVOList: state => { - if (state.map) { - return state.map.totalGuideLockButtonVOList || [] - } else { - return [] - } - }, - cycleButtonList: state => { - if (state.map) { - return state.map.cycleButtonList || [] - } else { - return [] - } - }, - outerFrameList: state => { - if (state.map) { - return state.map.outerFrameList || [] - } else { - return [] - } - }, - bigScreenConfig: state => { - if (state.map) { - return state.map.bigScreenConfig || {} - } else { - return {} - } - }, - indicatorLightList: state => { - if (state.map) { - return state.map.indicatorLightList || [] - } else { - return [] - } - }, - splitStationList: state => { - if (state.map) { - return state.map.splitStationList || [] - } else { - return [] - } - }, - automaticRouteButtonList: state => { - if (state.map) { - return state.map.automaticRouteButtonList || [] - } else { - return [] - } - }, - resourceList: state => { - if (state.map) { - return state.map.resourceList - } else { - return [] - } - }, - stationList: state => { - if (state.map) { - return state.map.stationList - } else { - return [] - } - }, - stationStandList: state => { - if (state.map) { - return state.map.stationStandList - } else { - return [] - } - }, - stationControlList: state => { - if (state.map) { - return state.map.stationControlList - } else { - return [] - } - }, - counterList: state => { - if (state.map) { - return state.map.counterList - } else { - return [] - } - }, - delayShowList: state => { - if (state.map) { - return state.map.delayShowList - } else { - return [] - } - }, - lineList: state => { - if (state.map) { - return state.map.lineList - } else { - return [] - } - }, - arrowList: state => { - if (state.map) { - return state.map.arrowList || [] - } else { - return [] - } - }, - textList: state => { - if (state.map) { - return state.map.textList - } else { - return [] - } - }, - rectList: state => { - if (state.map) { - return state.map.rectList || [] - } else { - return [] - } - }, - trainWindowList: state => { - if (state.map) { - return state.map.trainWindowList - } else { - return [] - } - }, - trainList: state => { - if (state.map) { - return state.map.trainList - } else { - return [] - } - }, - trainModelList: state => { - if (state.map) { - return state.map.trainModelList - } else { - return [] - } - }, - directionRodList: state => { - if (state.map) { - return state.map.directionRodList - } else { - return [] - } - }, - signalButtonList: state => { - if (state.map) { - return state.map.signalButtonList || [] - } else { - return [] - } - }, - responderList: state => { - if (state.map) { - return state.map.responderList || [] - } else { - return [] - } - }, - // trainDetails: (state) => { - // return state.trainDetails; - // }, - flankProtectList: state => { - return state.flankProtectList - }, - // mapDevice: (state) => { - // return state.mapDevice; - // }, - getDeviceByCode: state => code => { - return state.mapDevice[code] - }, - getApproachSectionByCode: state => code => { - return state.signalApproachSectionData[code] + state: { + routeData: {}, // 进路数据 + routeList: [], // 进路list + routeStartSignalData: {}, // 进路始端信号机数据 + autoReentryData: {}, // 自动折返数据 + autoReentryList: [], // 自动折返list + signalApproachSectionData: {}, // 信号机接近区段数据 + signalApproachSectionList: [], // 信号机接近区段list + stepData: [], // 缓存数据 + mapName: '', // 地图名称 + mapConfig: [], // 地图所属线路配置 + recoverStepData: [], // 缓存恢复数据 + seclectDeviceList: [], // 包围框选中元素列表 + trainWindowSectionCode: '', // 选择车次窗所属区段code + flankProtectList: [], // 侧防列表 + map: null, // 地图数据 + dataZoom: {}, // 缩放位置 + mapDevice: {}, // 解析后的地图数据 + mapList: {}, // 地图数据列表 + mapViewLoadedCount: 0, // 地图视图加载完成标识 + mapDataLoadedCount: 0, // 地图数据加载完成标识 + mapStateLoadedCount: 0, // 地图状态变化完成标识 + mapDataLoadedScreenCount: 0, // 大屏加载完成 + mapStationStateUpdateCount: 0, // 车站状态刷新 + trainDetails: null, // 地图'列车详情'显示 + deleteCount: 0, // 绘图快捷删除标识 + updateCount: 0, // 绘图快捷修改标识 + mousemove: 0, // 实训战场图移动标识 + version: '', // 地图版本, + activeTrainListUpdate: 0, // 当前按计划行车的列车列表更新标识 + runLineTrainUpdate: 0, // 当前按计划行车列车运行线更新标识 + activeTrainListChange: 0, // 当前按计划行车的列车列表变化标识(只对列车的groupNumber进行了检测) + activeTrainList: [], // 当前按计划行车的列车列表 + showCentralizedStationCode: '', // 现地分集中站显示(集中站code) + showCentralizedStationNum: 0, // 现地分集中站显示判断 + overlapList: [], // 延续保护list + overlapData: {}, // 延续保护数据 + holdStandList: [], // 扣车站台列表 + holdStatus: false, // 是否有扣车状态 + jumpStandList: [], // 跳停站台列表 + jumpStatus: false, // 是否有跳停状态 + // selectDeviceFlag: false, // 设备管理激活判断 + keyboardEnterCount: 0, // 键盘enter键触发 + controlTransfer: [], // 控制权转移消息 + mapDataParseCount: 0, + foldLineMap: {}, // 现地折行线map数据 + clearButtonCount: 0, // 清除操作按钮计数器 + stationControlMap: {} // 站控显示的map { 当前车站:显示车站列表 } }, - // 查询区段关联的计数器 - getCounterBySectionCode: state => (code, type) => { - let device = null - var section = state.mapDevice[code] - if (section) { - state.map.counterList.forEach(counter => { - if (counter.stationCode === section.model.stationCode && type == counter.type) { - device = state.mapDevice[counter.code] - return - } - }) - } + getters: { + trainWindowSectionCode: state => { + return state.trainWindowSectionCode; + }, + mapConfig: state => { + return state.mapConfig; + }, + routeList: state => { + return state.routeList; + }, + routeData: state => { + return state.routeData; + }, + overlapList: state => { + return state.overlapList; + }, + overlapData: state => { + return state.overlapData; + }, + autoReentryData: state => { + return state.autoReentryData; + }, + autoReentryList: state => { + return state.autoReentryList; + }, + seclectDeviceList: state => { + return state.seclectDeviceList; + }, + stepData: state => { + return state.stepData; + }, + recoverStepData: state => { + return state.recoverStepData; + }, + map: state => { + return state.map; + }, + psdList: state => { + if (state.map) { + return state.map.psdList; + } else { + return []; + } + }, + espList: state => { + if (state.map) { + return state.map.espList; + } else { + return []; + } + }, + lineCode: state => { + if (state.map && state.map.skinVO) { + return state.map.skinVO.code; + } + }, + name: state => { + if (state.map) { + return state.map.name; + } else { + return null; + } + }, + // version: (state) => { + // if (state.map) { + // return state.version; + // } else { + // return null; + // } + // }, + // linkList: (state) => { + // if (state.map) { + // return state.map.linkList; + // } else { + // return []; + // } + // }, + switchList: state => { + if (state.map) { + return state.map.switchList; + } else { + return []; + } + }, + floodGateList: state => { + if (state.map) { + return state.map.floodGateList; + } else { + return []; + } + }, + // buttonList: (state) => { + // if (state.map) { + // return state.map.buttonList; + // } else { + // return []; + // } + // }, + signalList: state => { + if (state.map) { + return state.map.signalList; + } else { + return []; + } + }, + sectionList: state => { + if (state.map) { + return state.map.sectionList; + } else { + return []; + } + }, + zcList: state => { + if (state.map) { + return state.map.zcList; + } else { + return []; + } + }, + powerLineList: state => { + if (state.map) { + return state.map.powerLineList || []; + } else { + return []; + } + }, + tempSpeedLimitList: state => { + if (state.map) { + return state.map.tempSpeedLimitList; + } else { + return []; + } + }, + lcList: state => { + if (state.map) { + return state.map.lcList; + } else { + return []; + } + }, + tbStrategyList: state => { + if (state.map) { + return state.map.tbStrategyList || []; + } else { + return []; + } + }, + axleCounterResetButtonList: state => { + if (state.map) { + return state.map.axleCounterResetButtonList || []; + } else { + return []; + } + }, + totalGuideLockButtonVOList: state => { + if (state.map) { + return state.map.totalGuideLockButtonVOList || []; + } else { + return []; + } + }, + cycleButtonList: state => { + if (state.map) { + return state.map.cycleButtonList || []; + } else { + return []; + } + }, + outerFrameList: state => { + if (state.map) { + return state.map.outerFrameList || []; + } else { + return []; + } + }, + bigScreenConfig: state => { + if (state.map) { + return state.map.bigScreenConfig || {}; + } else { + return {}; + } + }, + indicatorLightList: state => { + if (state.map) { + return state.map.indicatorLightList || []; + } else { + return []; + } + }, + splitStationList: state => { + if (state.map) { + return state.map.splitStationList || []; + } else { + return []; + } + }, + automaticRouteButtonList: state => { + if (state.map) { + return state.map.automaticRouteButtonList || []; + } else { + return []; + } + }, + resourceList: state => { + if (state.map) { + return state.map.resourceList; + } else { + return []; + } + }, + stationList: state => { + if (state.map) { + return state.map.stationList; + } else { + return []; + } + }, + stationStandList: state => { + if (state.map) { + return state.map.stationStandList; + } else { + return []; + } + }, + stationControlList: state => { + if (state.map) { + return state.map.stationControlList; + } else { + return []; + } + }, + counterList: state => { + if (state.map) { + return state.map.counterList; + } else { + return []; + } + }, + delayShowList: state => { + if (state.map) { + return state.map.delayShowList; + } else { + return []; + } + }, + lineList: state => { + if (state.map) { + return state.map.lineList; + } else { + return []; + } + }, + arrowList: state => { + if (state.map) { + return state.map.arrowList || []; + } else { + return []; + } + }, + textList: state => { + if (state.map) { + return state.map.textList; + } else { + return []; + } + }, + rectList: state => { + if (state.map) { + return state.map.rectList || []; + } else { + return []; + } + }, + trainWindowList: state => { + if (state.map) { + return state.map.trainWindowList; + } else { + return []; + } + }, + trainList: state => { + if (state.map) { + return state.map.trainList; + } else { + return []; + } + }, + trainModelList: state => { + if (state.map) { + return state.map.trainModelList; + } else { + return []; + } + }, + directionRodList: state => { + if (state.map) { + return state.map.directionRodList; + } else { + return []; + } + }, + signalButtonList: state => { + if (state.map) { + return state.map.signalButtonList || []; + } else { + return []; + } + }, + responderList: state => { + if (state.map) { + return state.map.responderList || []; + } else { + return []; + } + }, + // trainDetails: (state) => { + // return state.trainDetails; + // }, + flankProtectList: state => { + return state.flankProtectList; + }, + // mapDevice: (state) => { + // return state.mapDevice; + // }, + getDeviceByCode: state => code => { + return state.mapDevice[code]; + }, + getApproachSectionByCode: state => code => { + return state.signalApproachSectionData[code]; + }, - return device - }, + // 查询区段关联的计数器 + getCounterBySectionCode: state => (code, type) => { + let device = null; + var section = state.mapDevice[code]; + if (section) { + state.map.counterList.forEach(counter => { + if (counter.stationCode === section.model.stationCode && type == counter.type) { + device = state.mapDevice[counter.code]; + return; + } + }); + } - // 查询信号机关联的计数器 - getCounterBySingalCode: state => (code, type) => { - let device = null - var signal = state.mapDevice[code] - if (signal) { - state.map.counterList.forEach(counter => { - if (counter.stationCode === signal.model.stationCode && type == counter.type) { - device = state.mapDevice[counter.code] - return - } - }) - } - return device - }, + return device; + }, - // // 查询所属车站关联的控制模式 - // getStationControlByStationCode: (state) => (code) => { - // let device = null; - // if (code && - // state.map && - // state.map.stationControlList && state.map.stationControlList.length) { - // state.map.stationControlList.forEach(elem => { - // if (elem.stationCode == code) { - // device = state.mapDevice[elem.code]; - // } - // }); - // } + // 查询信号机关联的计数器 + getCounterBySingalCode: state => (code, type) => { + let device = null; + var signal = state.mapDevice[code]; + if (signal) { + state.map.counterList.forEach(counter => { + if (counter.stationCode === signal.model.stationCode && type == counter.type) { + device = state.mapDevice[counter.code]; + return; + } + }); + } + return device; + }, - // return device; - // }, + // // 查询所属车站关联的控制模式 + // getStationControlByStationCode: (state) => (code) => { + // let device = null; + // if (code && + // state.map && + // state.map.stationControlList && state.map.stationControlList.length) { + // state.map.stationControlList.forEach(elem => { + // if (elem.stationCode == code) { + // device = state.mapDevice[elem.code]; + // } + // }); + // } - // 查询所属车站的控制模式 - getDeviceStationCodeByStationCode: state => code => { - let device = null - if (code && state.map && state.map.stationList && state.map.stationList.length) { - state.map.stationList.forEach(elem => { - if (elem.code == code) { - device = state.mapDevice[elem.code] - } - }) - } + // return device; + // }, - return device - }, - getStationCodeByTrain: state => train => { - if (train && train.sectionCode) { - const section = state.mapDevice[train.sectionCode] - if (section && section.stationCode) { - return state.mapDevice[section.stationCode] - } - } - }, - // 通过循环区段来获取控制模式 - getDeviceTrainWindowCodeByStationCode: state => code => { - let device = null - if (code && state.map && state.map.sectionList && state.map.sectionList.length) { - state.map.sectionList.forEach(elem => { - if (elem.trainWindowCode == code) { - state.trainWindowSectionCode = elem.code - device = state.mapDevice[elem.stationCode] - } - }) - } + // 查询所属车站的控制模式 + getDeviceStationCodeByStationCode: state => code => { + let device = null; + if (code && state.map && state.map.stationList && state.map.stationList.length) { + state.map.stationList.forEach(elem => { + if (elem.code == code) { + device = state.mapDevice[elem.code]; + } + }); + } - return device - }, - checkDeviceShow: state => deviceCode => { - if (state.map && state.map.displayList && state.map.displayList.length && store.state.training.prdType) { - let flag = false - const stationCode = state.showCentralizedStationCode - state.map.displayList.forEach(item => { - if ( - store.state.training.prdType === '01' && + return device; + }, + getStationCodeByTrain: state => train => { + if (train && train.sectionCode) { + const section = state.mapDevice[train.sectionCode]; + if (section && section.stationCode) { + return state.mapDevice[section.stationCode]; + } + } + }, + // 通过循环区段来获取控制模式 + getDeviceTrainWindowCodeByStationCode: state => code => { + let device = null; + if (code && state.map && state.map.sectionList && state.map.sectionList.length) { + state.map.sectionList.forEach(elem => { + if (elem.trainWindowCode == code) { + state.trainWindowSectionCode = elem.code; + device = state.mapDevice[elem.stationCode]; + } + }); + } + + return device; + }, + checkDeviceShow: state => deviceCode => { + if (state.map && state.map.displayList && state.map.displayList.length && store.state.training.prdType) { + let flag = false; + const stationCode = state.showCentralizedStationCode; + state.map.displayList.forEach(item => { + if ( + store.state.training.prdType === '01' && item.type === 'LOCAL' && ((item.stationCodeList.includes(stationCode) && item.elementList.includes(deviceCode)) || !stationCode) - ) { - flag = true - } else if (store.state.training.prdType === '02' && item.type === 'CENTER' && item.elementList.includes(deviceCode)) { - flag = true - } else if (store.state.training.prdType === '09' && item.type === 'DEPOT_IL' && item.elementList.includes(deviceCode)) { - flag = true - } - }) - return flag - } else { - return true - } - } - }, + ) { + flag = true; + } else if (store.state.training.prdType === '02' && item.type === 'CENTER' && item.elementList.includes(deviceCode)) { + flag = true; + } else if (store.state.training.prdType === '09' && item.type === 'DEPOT_IL' && item.stationCodeList.includes(stationCode) && item.elementList.includes(deviceCode)) { + flag = true; + } + }); + return flag; + } else { + return true; + } + } + }, - mutations: { + mutations: { // 改变地图数据索引 - flushMapRef: state => { - if (state.map) { - state.map.sectionList = [...(state.map.sectionList || [])] - state.map.switchList = [...(state.map.switchList || [])] - state.map.signalList = [...(state.map.signalList || [])] - state.map.stationList = [...(state.map.stationList || [])] - state.map.standList = [...(state.map.standList || [])] - state.map.stationStandList = [...(state.map.stationStandList || [])] - state.map.trainList = [...(state.map.trainList || [])] - state.map.trainWindowList = [...(state.map.trainWindowList || [])] - } - }, - // 设置地图名称 - setMapName: (state, name) => { - state.mapName = name - }, - // 设置地图数据 - setMapData: (state, map) => { - if (map && map.skinVO) { - state.map = map - let showConfig = {} - if (Vue.prototype.$jlmap && typeof Vue.prototype.$jlmap.getShowConfig === 'function') { - showConfig = Vue.prototype.$jlmap.getShowConfig() - } - const foldLineMap = {} + flushMapRef: state => { + if (state.map) { + state.map.sectionList = [...(state.map.sectionList || [])]; + state.map.switchList = [...(state.map.switchList || [])]; + state.map.signalList = [...(state.map.signalList || [])]; + state.map.stationList = [...(state.map.stationList || [])]; + state.map.standList = [...(state.map.standList || [])]; + state.map.stationStandList = [...(state.map.stationStandList || [])]; + state.map.trainList = [...(state.map.trainList || [])]; + state.map.trainWindowList = [...(state.map.trainWindowList || [])]; + } + }, + // 设置地图名称 + setMapName: (state, name) => { + state.mapName = name; + }, + // 设置地图数据 + setMapData: (state, map) => { + if (map && map.skinVO) { + state.map = map; + let showConfig = {}; + if (Vue.prototype.$jlmap && typeof Vue.prototype.$jlmap.getShowConfig === 'function') { + showConfig = Vue.prototype.$jlmap.getShowConfig(); + } + const foldLineMap = {} ;(map.lineList || []).forEach(item => { - if (item.type === '03' && foldLineMap[item.stationCode]) { - foldLineMap[item.stationCode].push(item) - } else if (item.type === '03') { - foldLineMap[item.stationCode] = [item] - } - }) - state.foldLineMap = foldLineMap - const parser = parserFactory(ParserType.Graph.value) - state.mapDevice = parser.parser(map, map.skinVO.code, showConfig) - state.stationControlMap = {} - map.stationList.forEach(station => { - if (station.ciStation) { - const centrailzedList = [station.code] - state.stationControlMap[station.code] = centrailzedList - station.relStationCodeList.forEach(relStationCode => { - state.stationControlMap[relStationCode] = centrailzedList - if (state.mapDevice[relStationCode].centralized) { - centrailzedList.push(relStationCode) - } - }) - } - }) - Vue.prototype.$jlmap && Vue.prototype.$jlmap.setMapDevice(state.mapDevice) - } else { - state.map = null - state.mapDevice = {} - } - }, - importMapData: (state, data) => { - let showConfig = {} - if (Vue.prototype.$jlmap && typeof Vue.prototype.$jlmap.getShowConfig === 'function') { - showConfig = Vue.prototype.$jlmap.getShowConfig() - } - Object.keys(data).forEach(key => { - state.map[key] = [...state.map[key] , ...data[key]] - }) - const parser = parserFactory(ParserType.Graph.value) - state.mapDevice = parser.parser(state.map, state.map.skinVO.code, showConfig) - Vue.prototype.$jlmap && Vue.prototype.$jlmap.setMapDevice(state.mapDevice) - Vue.prototype.$jlmap && Vue.prototype.$jlmap.$painter.repaint(state.mapDevice) - Vue.prototype.$jlmap && Vue.prototype.$jlmap.setDefaultState() - }, - updateMapDevice: (state, list) => { - list.forEach(elem => { - state.mapDevice[elem.code] = deepAssign(state.mapDevice[elem.code] || {}, elem) - }) - }, - // 设置地图所属线路 - setMapConfig: (state, config) => { - state.mapConfig = config - }, - // 获取包围框选中元素列表 - setSeclectDeviceList: (state, list) => { - state.seclectDeviceList = list - }, - // 设置缩放位置 - setDataZoom: (state, dataZoom) => { - state.dataZoom = dataZoom - }, - mapRender: (state, devices, type = ParserType.Graph.value) => { - if (devices && devices.length) { - if (state.map) { - const parser = parserFactory(type) - devices.forEach(elem => { - parser.updateMapData(state, elem) - }) - } - if (Vue.prototype.$jlmap) { - Vue.prototype.$jlmap.render(devices) - } - } - }, - setTrainDetails: (state, details) => { - state.trainDetails = details - }, - mapViewLoadedCountIncrement: state => { - state.mapViewLoadedCount += 1 - }, - mapDataLoadedCountIncrement: state => { - state.mapDataLoadedCount += 1 - }, - mapStateLoadedCountIncrenment: state => { - state.mapStateLoadedCount += 1 - }, - mapViewLoadedScreenCountIncrement: state => { - state.mapDataLoadedScreenCount += 1 - }, - mapStationStateUpdate: state => { - state.mapStationStateUpdateCount += 1 - }, - operateTrainModel: (state, { model, type }) => { - if (state.map && model) { - const list = state.map.trainModelList || [] - if (type === 'ADD') { - const index = list.indexOf( - list.find(elem => { - return elem.code === model.code - }) - ) - if (index < 0) { - list.push(Object.assign({}, model)) - } - } else if (type === 'UPT') { - const index = list.indexOf( - list.find(elem => { - return elem.code === model.code - }) - ) - if (index >= 0) { - for (var prop in model) { - list[index][prop] = model[prop] + if (item.type === '03' && foldLineMap[item.stationCode]) { + foldLineMap[item.stationCode].push(item); + } else if (item.type === '03') { + foldLineMap[item.stationCode] = [item]; + } + }); + state.foldLineMap = foldLineMap; + const parser = parserFactory(ParserType.Graph.value); + state.mapDevice = parser.parser(map, map.skinVO.code, showConfig); + state.stationControlMap = {}; + map.stationList.forEach(station => { + if (station.ciStation) { + const centrailzedList = [station.code]; + state.stationControlMap[station.code] = centrailzedList; + station.relStationCodeList.forEach(relStationCode => { + state.stationControlMap[relStationCode] = centrailzedList; + if (state.mapDevice[relStationCode].centralized) { + centrailzedList.push(relStationCode); + } + }); + } + }); + Vue.prototype.$jlmap && Vue.prototype.$jlmap.setMapDevice(state.mapDevice); + } else { + state.map = null; + state.mapDevice = {}; } - } - } else if (type === 'DEL') { - const index = list.indexOf( - list.find(elem => { - return elem.code === model.code - }) - ) - if (index >= 0) { - list.splice(index, 1) - } + }, + importMapData: (state, data) => { + let showConfig = {}; + if (Vue.prototype.$jlmap && typeof Vue.prototype.$jlmap.getShowConfig === 'function') { + showConfig = Vue.prototype.$jlmap.getShowConfig(); + } + Object.keys(data).forEach(key => { + state.map[key] = [...state.map[key], ...data[key]]; + }); + const parser = parserFactory(ParserType.Graph.value); + state.mapDevice = parser.parser(state.map, state.map.skinVO.code, showConfig); + Vue.prototype.$jlmap && Vue.prototype.$jlmap.setMapDevice(state.mapDevice); + Vue.prototype.$jlmap && Vue.prototype.$jlmap.$painter.repaint(state.mapDevice); + Vue.prototype.$jlmap && Vue.prototype.$jlmap.setDefaultState(); + }, + updateMapDevice: (state, list) => { + list.forEach(elem => { + state.mapDevice[elem.code] = deepAssign(state.mapDevice[elem.code] || {}, elem); + }); + }, + // 设置地图所属线路 + setMapConfig: (state, config) => { + state.mapConfig = config; + }, + // 获取包围框选中元素列表 + setSeclectDeviceList: (state, list) => { + state.seclectDeviceList = list; + }, + // 设置缩放位置 + setDataZoom: (state, dataZoom) => { + state.dataZoom = dataZoom; + }, + mapRender: (state, devices, type = ParserType.Graph.value) => { + if (devices && devices.length) { + if (state.map) { + const parser = parserFactory(type); + devices.forEach(elem => { + parser.updateMapData(state, elem); + }); + } + if (Vue.prototype.$jlmap) { + Vue.prototype.$jlmap.render(devices); + } + } + }, + setTrainDetails: (state, details) => { + state.trainDetails = details; + }, + mapViewLoadedCountIncrement: state => { + state.mapViewLoadedCount += 1; + }, + mapDataLoadedCountIncrement: state => { + state.mapDataLoadedCount += 1; + }, + mapStateLoadedCountIncrenment: state => { + state.mapStateLoadedCount += 1; + }, + mapViewLoadedScreenCountIncrement: state => { + state.mapDataLoadedScreenCount += 1; + }, + mapStationStateUpdate: state => { + state.mapStationStateUpdateCount += 1; + }, + operateTrainModel: (state, { model, type }) => { + if (state.map && model) { + const list = state.map.trainModelList || []; + if (type === 'ADD') { + const index = list.indexOf( + list.find(elem => { + return elem.code === model.code; + }) + ); + if (index < 0) { + list.push(Object.assign({}, model)); + } + } else if (type === 'UPT') { + const index = list.indexOf( + list.find(elem => { + return elem.code === model.code; + }) + ); + if (index >= 0) { + for (var prop in model) { + list[index][prop] = model[prop]; + } + } + } else if (type === 'DEL') { + const index = list.indexOf( + list.find(elem => { + return elem.code === model.code; + }) + ); + if (index >= 0) { + list.splice(index, 1); + } - const trainList = state.map.trainList - trainList.forEach(elem => { - if (elem.modelCode == model.code) { - elem['_dispose'] = true - } - }) + const trainList = state.map.trainList; + trainList.forEach(elem => { + if (elem.modelCode == model.code) { + elem['_dispose'] = true; + } + }); - if (Vue.prototype.$jlmap) { - Vue.prototype.$jlmap.render(trainList) - } - } - } - }, - mapClear: state => { - state.map = null - state.mapDevice = {} - if (Vue.prototype.$jlmap) { - Vue.prototype.$jlmap.clear() - } - }, - updateMapStandData: (state, { models, type }) => { - models.forEach(item => { - if (!state.mapDevice[item.code]) { - state.mapDevice[item.code] = item - state.map[type].push(item) - } - }) - }, - delMapStandData: (state, { models, type }) => { - models.forEach(item => { - if (state.mapDevice[item.code]) { - delete state.mapDevice[item.code] - state.map[type].forEach((elem, index) => { - if (item.code == elem.code) { - state.map[type].splice(index, 1) + if (Vue.prototype.$jlmap) { + Vue.prototype.$jlmap.render(trainList); + } + } } - }) - } - }) - }, - setActiveTrainList: state => { - state.activeTrainListUpdate++ - }, - setRunLineTrain: state => { - state.runLineTrainUpdate++ - }, - resetActiveTrainList: (state, isBack) => { - state.activeTrainList = [] - if (!isBack) { - state.activeTrainListUpdate = 0 - state.activeTrainListChange = 0 - state.runLineTrainUpdate = 0 - } - }, - setDeleteCount: state => { - state.deleteCount++ - }, - setUpdateCount: state => { - state.updateCount++ - }, - setMousemove: state => { - state.mousemove++ - }, - // 设置进路数据 - setRouteData: (state, routeDataList) => { - state.routeData = {} - state.routeStartSignalData = {} - routeDataList.forEach(data => { - state.routeData[data.code] = data - if (state.routeStartSignalData[data.startSignalCode] && state.routeStartSignalData[data.startSignalCode].length) { - state.routeStartSignalData[data.startSignalCode].push(data) - } else { - state.routeStartSignalData[data.startSignalCode] = [data] - } - }) - state.map && + }, + mapClear: state => { + state.map = null; + state.mapDevice = {}; + if (Vue.prototype.$jlmap) { + Vue.prototype.$jlmap.clear(); + } + }, + updateMapStandData: (state, { models, type }) => { + models.forEach(item => { + if (!state.mapDevice[item.code]) { + state.mapDevice[item.code] = item; + state.map[type].push(item); + } + }); + }, + delMapStandData: (state, { models, type }) => { + models.forEach(item => { + if (state.mapDevice[item.code]) { + delete state.mapDevice[item.code]; + state.map[type].forEach((elem, index) => { + if (item.code == elem.code) { + state.map[type].splice(index, 1); + } + }); + } + }); + }, + setActiveTrainList: state => { + state.activeTrainListUpdate++; + }, + setRunLineTrain: state => { + state.runLineTrainUpdate++; + }, + resetActiveTrainList: (state, isBack) => { + state.activeTrainList = []; + if (!isBack) { + state.activeTrainListUpdate = 0; + state.activeTrainListChange = 0; + state.runLineTrainUpdate = 0; + } + }, + setDeleteCount: state => { + state.deleteCount++; + }, + setUpdateCount: state => { + state.updateCount++; + }, + setMousemove: state => { + state.mousemove++; + }, + // 设置进路数据 + setRouteData: (state, routeDataList) => { + state.routeData = {}; + state.routeStartSignalData = {}; + routeDataList.forEach(data => { + state.routeData[data.code] = data; + if (state.routeStartSignalData[data.startSignalCode] && state.routeStartSignalData[data.startSignalCode].length) { + state.routeStartSignalData[data.startSignalCode].push(data); + } else { + state.routeStartSignalData[data.startSignalCode] = [data]; + } + }); + state.map && state.map.automaticRouteButtonList && state.map.automaticRouteButtonList.forEach(item => { - state.routeData[item.automaticRouteCode].automaticRouteCode = item.code - }) - state.routeList = routeDataList - }, - setOverlapData: (state, overlapList) => { - state.overlapData = {} - overlapList.forEach(data => { - state.overlapData[data.code] = data - }) - state.overlapList = overlapList - }, - setAutoReentryData: (state, autoReentryList) => { - state.autoReentryData = {} - autoReentryList.forEach(data => { - state.autoReentryData[data.code] = data - }) - state.map && + state.routeData[item.automaticRouteCode].automaticRouteCode = item.code; + }); + state.routeList = routeDataList; + }, + setOverlapData: (state, overlapList) => { + state.overlapData = {}; + overlapList.forEach(data => { + state.overlapData[data.code] = data; + }); + state.overlapList = overlapList; + }, + setAutoReentryData: (state, autoReentryList) => { + state.autoReentryData = {}; + autoReentryList.forEach(data => { + state.autoReentryData[data.code] = data; + }); + state.map && state.map.cycleButtonList && state.map.cycleButtonList.forEach(item => { - state.autoReentryData[item.cycleCode].cycleButtonCode = item.code - }) - state.autoReentryList = autoReentryList - }, - setSignalApproachSectionData: (state, signalApproachSectionList) => { - state.signalApproachSectionData = {} - signalApproachSectionList.forEach(data => { - state.signalApproachSectionData[data.signalCode] = data - }) - state.signalApproachSectionList = signalApproachSectionList - }, - updateRouteState: (state, status) => { - state.routeData[status.code] = deepAssign(state.routeData[status.code], status) - }, - updateAutoReentryState: (state, status) => { - state.autoReentryData[status.code] = deepAssign(state.autoReentryData[status.code], status) - }, - updateStationStand: (state, status) => { - const holdIndex = state.holdStandList.indexOf(status.code) - const jumpIndex = state.jumpStandList.indexOf(status.code) - const device = state.mapDevice[status.code] - if ((device.stationHoldTrain || device.centerHoldTrain || device.ibpHoldTrain) && holdIndex < 0) { - state.holdStandList.push(device.code) - } else if (!(device.stationHoldTrain || device.centerHoldTrain || device.ibpHoldTrain) && holdIndex > -1) { - state.holdStandList.splice(holdIndex, 1) - } - state.holdStatus = state.holdStandList.length > 0 - if ((device.assignSkip || device.allSkip) && jumpIndex < 0) { - state.jumpStandList.push(device.code) - } else if (!(device.assignSkip || device.allSkip) && jumpIndex > -1) { - state.jumpStandList.splice(jumpIndex, 1) - } - state.jumpStatus = state.jumpStandList.length > 0 - }, - setMapVersion: (state, version) => { - state.version = version - }, - setShowCentralizedStationCode: (state, stationCode) => { - state.showCentralizedStationCode = stationCode - }, - setShowCentralizedStationNum: state => { - state.showCentralizedStationNum++ - }, - setFlankProtectList: (state, data) => { - state.flankProtectList.push(data) - }, - delFlankProtectList: (state, data) => { - state.flankProtectList.forEach((item, index) => { - if (item.code == data.code) { - state.flankProtectList.splice(index, 1) + state.autoReentryData[item.cycleCode].cycleButtonCode = item.code; + }); + state.autoReentryList = autoReentryList; + }, + setSignalApproachSectionData: (state, signalApproachSectionList) => { + state.signalApproachSectionData = {}; + signalApproachSectionList.forEach(data => { + state.signalApproachSectionData[data.signalCode] = data; + }); + state.signalApproachSectionList = signalApproachSectionList; + }, + updateRouteState: (state, status) => { + state.routeData[status.code] = deepAssign(state.routeData[status.code], status); + }, + updateAutoReentryState: (state, status) => { + state.autoReentryData[status.code] = deepAssign(state.autoReentryData[status.code], status); + }, + updateStationStand: (state, status) => { + const holdIndex = state.holdStandList.indexOf(status.code); + const jumpIndex = state.jumpStandList.indexOf(status.code); + const device = state.mapDevice[status.code]; + if ((device.stationHoldTrain || device.centerHoldTrain || device.ibpHoldTrain) && holdIndex < 0) { + state.holdStandList.push(device.code); + } else if (!(device.stationHoldTrain || device.centerHoldTrain || device.ibpHoldTrain) && holdIndex > -1) { + state.holdStandList.splice(holdIndex, 1); + } + state.holdStatus = state.holdStandList.length > 0; + if ((device.assignSkip || device.allSkip) && jumpIndex < 0) { + state.jumpStandList.push(device.code); + } else if (!(device.assignSkip || device.allSkip) && jumpIndex > -1) { + state.jumpStandList.splice(jumpIndex, 1); + } + state.jumpStatus = state.jumpStandList.length > 0; + }, + setMapVersion: (state, version) => { + state.version = version; + }, + setShowCentralizedStationCode: (state, stationCode) => { + state.showCentralizedStationCode = stationCode; + }, + setShowCentralizedStationNum: state => { + state.showCentralizedStationNum++; + }, + setFlankProtectList: (state, data) => { + state.flankProtectList.push(data); + }, + delFlankProtectList: (state, data) => { + state.flankProtectList.forEach((item, index) => { + if (item.code == data.code) { + state.flankProtectList.splice(index, 1); + } + }); + }, + // 更新激活的列车信息 + updateActiveTrainList: (state, data) => { + let isExist = false; + state.activeTrainList.forEach(elem => { + if (elem == data.code) { + isExist = true; + if (data.dispose) { + state.activeTrainList.splice(state.activeTrainList.indexOf(data.code), 1); + state.activeTrainListChange += 1; + } + } + }); + if (!isExist) { + state.activeTrainList.push(data.code); + state.activeTrainListChange += 1; + } + }, + selectDeviceCode: (state, data) => { + state.selectDevice = { + flag: data.flag, + type: data.type + }; + }, + setKeyboardEnter: state => { + state.keyboardEnterCount++; + }, + setControlTransfer: (state, controlTransfer) => { + state.controlTransfer = controlTransfer; + }, + mapDataParseCountIncrease: state => { + state.mapDataLoadedCount += 1; + }, + initSimulationButton: state => { + state.clearButtonCount += 1; + }, + clearStepData: state => { + state.stepData = []; } - }) }, - // 更新激活的列车信息 - updateActiveTrainList: (state, data) => { - let isExist = false - state.activeTrainList.forEach(elem => { - if (elem == data.code) { - isExist = true - if (data.dispose) { - state.activeTrainList.splice(state.activeTrainList.indexOf(data.code), 1) - state.activeTrainListChange += 1 - } - } - }) - if (!isExist) { - state.activeTrainList.push(data.code) - state.activeTrainListChange += 1 - } - }, - selectDeviceCode: (state, data) => { - state.selectDevice = { - flag: data.flag, - type: data.type - } - }, - setKeyboardEnter: state => { - state.keyboardEnterCount++ - }, - setControlTransfer: (state, controlTransfer) => { - state.controlTransfer = controlTransfer - }, - mapDataParseCountIncrease: state => { - state.mapDataLoadedCount += 1 - }, - initSimulationButton: state => { - state.clearButtonCount += 1 - }, - clearStepData: state => { - state.stepData = [] - } - }, - actions: { - flushMapRef: ({ commit }) => { - commit('flushMapRef') - }, - setMapData: ({ commit }, mapData) => { - commit('setMapData', mapData) - }, - setReleaseMapData: ({ commit }, mapData) => { - mapData.graphDataNew && + actions: { + flushMapRef: ({ commit }) => { + commit('flushMapRef'); + }, + setMapData: ({ commit }, mapData) => { + commit('setMapData', mapData); + }, + setReleaseMapData: ({ commit }, mapData) => { + mapData.graphDataNew && mapData.graphDataNew.trainList && mapData.graphDataNew.trainList.forEach(item => { - item.code = item.groupNumber - }) - mapData.graphDataNew.signalApproachSectionList = mapData.logicDataNew.signalApproachSectionList - const overlapData = mapData.logicDataNew.overlapList - overlapData.forEach(item => { - item._type = 'OverAp' - }) - mapData.graphDataNew.overlapList = overlapData + item.code = item.groupNumber; + }); + mapData.graphDataNew.signalApproachSectionList = mapData.logicDataNew.signalApproachSectionList; + const overlapData = mapData.logicDataNew.overlapList; + overlapData.forEach(item => { + item._type = 'OverAp'; + }); + mapData.graphDataNew.overlapList = overlapData; - commit('setMapName', mapData.name) - commit('setMapData', mapData.graphDataNew) - commit('setRouteData', mapData.logicDataNew.routeList) - commit('setOverlapData', overlapData) - commit('setAutoReentryData', mapData.logicDataNew.autoReentryList) - commit('setSignalApproachSectionData', mapData.logicDataNew.signalApproachSectionList) - commit('setMapConfig', mapData.configVO) - commit('setMapVersion', mapData.version) - if (Vue.prototype.$jlmap) { - Vue.prototype.$jlmap.clearTrainView() - } - store.dispatch('training/setMapDefaultState') - }, - setPreviewMapData: ({ commit }, mapData) => { - commit('setMapData', mapData.graphDataNew) - store.dispatch('training/over') - store.dispatch('training/setMapDefaultState') - if (Vue.prototype.$jlmap) { - Vue.prototype.$jlmap.clearTrainView() - } - }, - mapClear: ({ commit }) => { - commit('mapClear') - }, - setOverlapData: ({ commit }, overlapData) => { - commit('setOverlapData', overlapData) - commit('mapRender', overlapData) - }, - setAutoReentryData: ({ commit }, autoReentryData) => { - commit('setAutoReentryData', autoReentryData) - }, - setSignalApproachSectionData: ({ commit }, signalApproachSectionList) => { - commit('setSignalApproachSectionData', signalApproachSectionList) - }, - updateRouteState: ({ commit }, status) => { - // 设置进路数据状态 - commit('updateRouteState', status) - }, - updateAutoReentryState: ({ commit }, status) => { - commit('updateAutoReentryState', status) - }, - updateStationStand: ({ commit }, status) => { - commit('updateStationStand', status) - }, - getRouteDataListByCode: ({ state, commit }, code) => { - // 获取进路数据 - return new Promise(resolve => { - const list = [] - const routeList = Object.values(state.routeData) - routeList.forEach(route => { - if (route.startSignalCode == code) { - list.push(route) - } - }) - resolve(list) - }) - }, - - setTrainDetails: ({ commit }, message) => { - commit('setTrainDetails', message) - }, - - updateMapDevices: ({ commit, state }, models) => { - return new Promise(resolve => { - if (!(models instanceof Array)) { - models = [models] - } - // 过滤 空/null/undefined value 值 - const dictList = filtrationModel(models) - - // 查找向上关联需要一起删除的设备 - const dict = {} - dictList.forEach(model => { - if (model['_dispose']) { - queryDeleteModels(state, model, dict) - } else { - dict[model.code] = model - } - }) - const list = Object.values(dict) - if (window.location.href.includes('/design/usermap/map/draw')) { - handleOperation(state, list) - } - commit('mapRender', list) - resolve(list) - }) - }, - - updateSystemMapDevices: ({ commit, state }, models) => { - return new Promise(resolve => { - if (!(models instanceof Array)) { - models = [models] - } - // 过滤 空/null/undefined value 值 - const dictList = filtrationModel(models) - - // 查找向上关联需要一起删除的设备 - const dict = {} - dictList.forEach(model => { - if (model['_dispose']) { - dict[model.code] = { ...model, _dispose: true } - } else { - dict[model.code] = model - } - }) - const list = Object.values(dict) - if (window.location.href.includes('/design/usermap/map/systemDraw')) { - handleOperation(state, list) - } - commit('mapRender', list, ParserType.systemGraph.value) - resolve(list) - }) - }, - - setRevocation({ state, commit }) { - commit('mapRender', revocation(state, state.stepData.shift() || [])) // 撤销 - }, - - setRecover({ state, commit }) { - commit('mapRender', recover(state, state.recoverStepData.shift() || [])) // 恢复 - }, - - saveMapDeviceDefaultRelations({ state }) { - saveMapDeviceDefaultRelations(state) - }, - - mapViewLoaded: ({ commit }) => { - commit('mapViewLoadedCountIncrement') - }, - - mapViewScreenLoaded: ({ commit }) => { - commit('mapViewLoadedScreenCountIncrement') - }, - - mapDataLoaded: ({ commit }) => { - commit('mapDataLoadedCountIncrement') - }, - - mapStateLoaded: ({ commit }) => { - commit('mapStateLoadedCountIncrenment') - }, - - clearJlmapTrainView: () => { - if (Vue.prototype.$jlmap) { - Vue.prototype.$jlmap.clearTrainView() - } - }, - - setTrainWindowShow: ({ commit, state }, show) => { - if (state.map) { - var deviceList = [] - var trainWindowList = state.map.trainWindowList - - if (trainWindowList && trainWindowList.length) { - trainWindowList.forEach(elem => { - elem._type = deviceType.TrainWindow - elem.trainWindowShow = show - if (state.mapDevice[elem.code] && state.mapDevice[elem.code].instance) { - elem.isShowShape = state.mapDevice[elem.code].instance.isShowShape - } else { - elem.isShowShape = true + commit('setMapName', mapData.name); + commit('setMapData', mapData.graphDataNew); + commit('setRouteData', mapData.logicDataNew.routeList); + commit('setOverlapData', overlapData); + commit('setAutoReentryData', mapData.logicDataNew.autoReentryList); + commit('setSignalApproachSectionData', mapData.logicDataNew.signalApproachSectionList); + commit('setMapConfig', mapData.configVO); + commit('setMapVersion', mapData.version); + if (Vue.prototype.$jlmap) { + Vue.prototype.$jlmap.clearTrainView(); } - deviceList.push(elem) - }) + store.dispatch('training/setMapDefaultState'); + }, + setPreviewMapData: ({ commit }, mapData) => { + commit('setMapData', mapData.graphDataNew); + store.dispatch('training/over'); + store.dispatch('training/setMapDefaultState'); + if (Vue.prototype.$jlmap) { + Vue.prototype.$jlmap.clearTrainView(); + } + }, + mapClear: ({ commit }) => { + commit('mapClear'); + }, + setOverlapData: ({ commit }, overlapData) => { + commit('setOverlapData', overlapData); + commit('mapRender', overlapData); + }, + setAutoReentryData: ({ commit }, autoReentryData) => { + commit('setAutoReentryData', autoReentryData); + }, + setSignalApproachSectionData: ({ commit }, signalApproachSectionList) => { + commit('setSignalApproachSectionData', signalApproachSectionList); + }, + updateRouteState: ({ commit }, status) => { + // 设置进路数据状态 + commit('updateRouteState', status); + }, + updateAutoReentryState: ({ commit }, status) => { + commit('updateAutoReentryState', status); + }, + updateStationStand: ({ commit }, status) => { + commit('updateStationStand', status); + }, + getRouteDataListByCode: ({ state, commit }, code) => { + // 获取进路数据 + return new Promise(resolve => { + const list = []; + const routeList = Object.values(state.routeData); + routeList.forEach(route => { + if (route.startSignalCode == code) { + list.push(route); + } + }); + resolve(list); + }); + }, + + setTrainDetails: ({ commit }, message) => { + commit('setTrainDetails', message); + }, + + updateMapDevices: ({ commit, state }, models) => { + return new Promise(resolve => { + if (!(models instanceof Array)) { + models = [models]; + } + // 过滤 空/null/undefined value 值 + const dictList = filtrationModel(models); + + // 查找向上关联需要一起删除的设备 + const dict = {}; + dictList.forEach(model => { + if (model['_dispose']) { + queryDeleteModels(state, model, dict); + } else { + dict[model.code] = model; + } + }); + const list = Object.values(dict); + if (window.location.href.includes('/design/usermap/map/draw')) { + handleOperation(state, list); + } + commit('mapRender', list); + resolve(list); + }); + }, + + updateSystemMapDevices: ({ commit, state }, models) => { + return new Promise(resolve => { + if (!(models instanceof Array)) { + models = [models]; + } + // 过滤 空/null/undefined value 值 + const dictList = filtrationModel(models); + + // 查找向上关联需要一起删除的设备 + const dict = {}; + dictList.forEach(model => { + if (model['_dispose']) { + dict[model.code] = { ...model, _dispose: true }; + } else { + dict[model.code] = model; + } + }); + const list = Object.values(dict); + if (window.location.href.includes('/design/usermap/map/systemDraw')) { + handleOperation(state, list); + } + commit('mapRender', list, ParserType.systemGraph.value); + resolve(list); + }); + }, + + setRevocation({ state, commit }) { + commit('mapRender', revocation(state, state.stepData.shift() || [])); // 撤销 + }, + + setRecover({ state, commit }) { + commit('mapRender', recover(state, state.recoverStepData.shift() || [])); // 恢复 + }, + + saveMapDeviceDefaultRelations({ state }) { + saveMapDeviceDefaultRelations(state); + }, + + mapViewLoaded: ({ commit }) => { + commit('mapViewLoadedCountIncrement'); + }, + + mapViewScreenLoaded: ({ commit }) => { + commit('mapViewLoadedScreenCountIncrement'); + }, + + mapDataLoaded: ({ commit }) => { + commit('mapDataLoadedCountIncrement'); + }, + + mapStateLoaded: ({ commit }) => { + commit('mapStateLoadedCountIncrenment'); + }, + + clearJlmapTrainView: () => { + if (Vue.prototype.$jlmap) { + Vue.prototype.$jlmap.clearTrainView(); + } + }, + + setTrainWindowShow: ({ commit, state }, show) => { + if (state.map) { + var deviceList = []; + var trainWindowList = state.map.trainWindowList; + + if (trainWindowList && trainWindowList.length) { + trainWindowList.forEach(elem => { + elem._type = deviceType.TrainWindow; + elem.trainWindowShow = show; + if (state.mapDevice[elem.code] && state.mapDevice[elem.code].instance) { + elem.isShowShape = state.mapDevice[elem.code].instance.isShowShape; + } else { + elem.isShowShape = true; + } + deviceList.push(elem); + }); + } + + commit('mapRender', deviceList); + } + }, + + operateTrainModel: ({ commit }, { model, type }) => { + commit('operateTrainModel', { model, type }); + }, + + updateMapStandData: ({ commit }, { models, type }) => { + commit('updateMapStandData', { models, type }); + }, + + delMapStandData: ({ commit }, { models, type }) => { + commit('delMapStandData', { models, type }); + }, + setDeleteCount: ({ commit }) => { + commit('setDeleteCount'); + }, + setActiveTrainList: ({ commit }) => { + commit('setActiveTrainList'); + }, + setRunLineTrain: ({ commit }) => { + commit('setRunLineTrain'); + }, + resetActiveTrainList: ({ commit }, isBack) => { + commit('resetActiveTrainList', isBack); + }, + setUpdateCount: ({ commit }) => { + commit('setUpdateCount'); + }, + + setMousemove: ({ commit }) => { + commit('setMousemove'); + }, + setMapVersion: ({ commit }, version) => { + commit('setMapVersion', version); + }, + setShowCentralizedStationCode: ({ commit }, stationCode) => { + commit('setShowCentralizedStationCode', stationCode); + }, + setShowCentralizedStationNum: ({ commit }) => { + commit('setShowCentralizedStationNum'); + }, + setFlankProtectList: ({ commit }, data) => { + commit('setFlankProtectList', data); + }, + delFlankProtectList: ({ commit }, data) => { + commit('delFlankProtectList', data); + }, + selectDeviceCode: ({ commit }, data) => { + commit('selectDeviceCode', data); + }, + setKeyboardEnter: ({ commit }) => { + commit('setKeyboardEnter'); + }, + setControlTransfer: ({ commit }, data) => { + commit('setControlTransfer', data); + }, + mapDataParseCountIncrease: ({ commit }) => { + commit('mapDataParseCountIncrease'); + }, + initSimulationButton: ({ commit }) => { + commit('initSimulationButton'); } - - commit('mapRender', deviceList) - } - }, - - operateTrainModel: ({ commit }, { model, type }) => { - commit('operateTrainModel', { model, type }) - }, - - updateMapStandData: ({ commit }, { models, type }) => { - commit('updateMapStandData', { models, type }) - }, - - delMapStandData: ({ commit }, { models, type }) => { - commit('delMapStandData', { models, type }) - }, - setDeleteCount: ({ commit }) => { - commit('setDeleteCount') - }, - setActiveTrainList: ({ commit }) => { - commit('setActiveTrainList') - }, - setRunLineTrain: ({ commit }) => { - commit('setRunLineTrain') - }, - resetActiveTrainList: ({ commit }, isBack) => { - commit('resetActiveTrainList', isBack) - }, - setUpdateCount: ({ commit }) => { - commit('setUpdateCount') - }, - - setMousemove: ({ commit }) => { - commit('setMousemove') - }, - setMapVersion: ({ commit }, version) => { - commit('setMapVersion', version) - }, - setShowCentralizedStationCode: ({ commit }, stationCode) => { - commit('setShowCentralizedStationCode', stationCode) - }, - setShowCentralizedStationNum: ({ commit }) => { - commit('setShowCentralizedStationNum') - }, - setFlankProtectList: ({ commit }, data) => { - commit('setFlankProtectList', data) - }, - delFlankProtectList: ({ commit }, data) => { - commit('delFlankProtectList', data) - }, - selectDeviceCode: ({ commit }, data) => { - commit('selectDeviceCode', data) - }, - setKeyboardEnter: ({ commit }) => { - commit('setKeyboardEnter') - }, - setControlTransfer: ({ commit }, data) => { - commit('setControlTransfer', data) - }, - mapDataParseCountIncrease: ({ commit }) => { - commit('mapDataParseCountIncrease') - }, - initSimulationButton: ({ commit }) => { - commit('initSimulationButton') } - } -} +}; -export default map +export default map; diff --git a/src/utils/baseUrl.js b/src/utils/baseUrl.js index 1818df808..6f00757cf 100644 --- a/src/utils/baseUrl.js +++ b/src/utils/baseUrl.js @@ -2,9 +2,9 @@ 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.152:9000'; // 袁琪 - // BASE_API = 'http://192.168.8.177:9000'; // 旭强 + BASE_API = 'http://192.168.8.177:9000'; // 旭强 // BASE_API = 'http://192.168.2.183:9000'; // 张赛 // BASE_API = 'http://192.168.8.140:9000'; // 杜康 // BASE_API = 'http://b29z135112.zicp.vip'; diff --git a/src/views/demonstration/detail/index.vue b/src/views/demonstration/detail/index.vue index 0d539eabc..c608fb5e6 100644 --- a/src/views/demonstration/detail/index.vue +++ b/src/views/demonstration/detail/index.vue @@ -219,7 +219,7 @@ export default { }); }, async start() { - const jumpFunc = ['jump', 'jump', 'enterIntegratedSimulation', 'jump', 'jumpScheduling', 'enterISCS', 'enterScreen']; + const jumpFunc = ['jump', 'jump', 'enterIntegratedSimulation', 'jump', 'jumpScheduling', 'enterISCS', 'enterScreen', '', 'jump']; this[jumpFunc[parseInt(this.courseModel.prdType) - 1]](); }, jumpSimulation() { diff --git a/src/views/newMap/displayNew/menuSchema.vue b/src/views/newMap/displayNew/menuSchema.vue index e98baf39e..63f99e1fc 100644 --- a/src/views/newMap/displayNew/menuSchema.vue +++ b/src/views/newMap/displayNew/menuSchema.vue @@ -1,7 +1,7 @@