diff --git a/src/jmap/mouseController.js b/src/jmap/mouseController.js index 51c040d00..7cfa6e7ce 100644 --- a/src/jmap/mouseController.js +++ b/src/jmap/mouseController.js @@ -239,7 +239,7 @@ class MouseController extends Eventful { const deviceList = Object.values(this.$jmap.mapDevice); const includeDeviceList = []; deviceList.forEach( item =>{ - if (item.instance._type == deviceType.Section) { + if (item.instance && item.instance._type == deviceType.Section) { let deviceBoundingRect = {}; if (item.type == '03') { deviceBoundingRect = { @@ -260,7 +260,7 @@ class MouseController extends Eventful { includeDeviceList.push(item); } } - if (item.instance._type == deviceType.Switch) { + if (item.instance && item.instance._type == deviceType.Switch) { const deviceBoundingRect = { x1: item.intersection.x, y1: item.intersection.y, diff --git a/src/store/modules/map.js b/src/store/modules/map.js index bcdd27725..13416f734 100644 --- a/src/store/modules/map.js +++ b/src/store/modules/map.js @@ -7,11 +7,18 @@ import { deepAssign } from '@/utils/index'; * 查询向上受影响的Devices * @param {Object} map * @param {Object} device - * @param {Array} effectedDeviceList + * @param {Array} list */ -function queryEffectedModels(map, device, effectedDeviceList) { +function queryDeleteModels(map, device, dict) { + function setDisPose(model, dict) { + if (!dict[model.code] || !dict[model.code]._dispose) { + dict[model.code] = {...model, _dispose: true }; + } + } + if (device && map) { - effectedDeviceList.push(device); + setDisPose(device, dict); + switch (device._type) { // 查询ink关联项 case deviceType.Link: @@ -19,7 +26,7 @@ function queryEffectedModels(map, device, effectedDeviceList) { if (map.sectionList && map.sectionList.length) { map.sectionList.forEach(elem => { if (elem.linkCode === device.code) { - queryEffectedModels(map, elem, effectedDeviceList); + queryDeleteModels(map, elem, dict); } }); } @@ -28,27 +35,18 @@ function queryEffectedModels(map, device, effectedDeviceList) { if (map.signalList && map.signalList.length) { map.signalList.forEach(elem => { if (elem.linkCode === device.code) { - effectedDeviceList.push(elem); + setDisPose(elem, dict); } }); } break; // 移除区段关联项 case deviceType.Section: - // 查询物理区段关联的逻辑区段 - if (map.sectionList && map.sectionList.length && device.type === '01') { + // 删除所属逻辑区段 + if (map.sectionList && map.sectionList.length && device.type == '01') { map.sectionList.forEach(elem => { - if (elem.type !== '01' && elem.parentCode === device.code) { - effectedDeviceList.push(elem); - } - }); - } - - // 查询区段关联车次窗 - if (map.trainWindowList && map.trainWindowList.length) { - map.trainModelList.forEach(elem => { - if (elem.sectionCode == device.code) { - effectedDeviceList.push(elem); + if (elem.type != '01' && elem.parentCode == device.code) { + setDisPose(elem, dict); } }); } @@ -56,22 +54,27 @@ function queryEffectedModels(map, device, effectedDeviceList) { // 查询区段关联的道岔 if (map.switchList && map.switchList.length) { map.switchList.forEach(elem => { - if (elem.sectionACode === device.code || - elem.sectionBCode === device.code || - elem.sectionCCode === device.code) { - effectedDeviceList.push(elem); + if (elem.sectionACode == device.code || elem.sectionBCode == device.code || elem.sectionCCode == device.code) { + queryDeleteModels(map, elem, dict); } }); } - // 查询区段关联的车站 - if (map.stationList && map.stationList.length) { - map.stationList.forEach(elem => { - if (elem.sectionCode === device.code) { - effectedDeviceList.push(elem); + break; + case deviceType.Switch: + map.sectionList.forEach(elem => { + if (elem.type == '03' && elem.relSwitchCode == device.code) { + setDisPose(elem, dict); + } + if (elem.relSwitchCode == device.code && elem.type != '03') { + if (!dict[elem.code] || !dict[elem.code]._dispose) { + const copyModel = deepAssign({}, elem); + copyModel.relSwitchCode = ''; + copyModel.isSwitchSection = false; + dict[elem.code] = copyModel; } - }); - } + } + }); break; } } @@ -315,6 +318,9 @@ const map = { map: (state) => { return state.map; }, + safetyDoorList: (state) => { + return state.map.safetyDoorList || []; + }, lineCode: (state) => { if (state.map && state.map.skinVO) { return state.map.skinVO.code; @@ -601,6 +607,14 @@ const map = { 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); + } + }); } }, @@ -643,19 +657,20 @@ const map = { } // 查找向上关联需要一起删除的设备 - const effectedModelList = []; + const dict = {}; models.forEach((model) => { if (model['_dispose']) { - queryEffectedModels(state.map, model, effectedModelList); + queryDeleteModels(state.map, model, dict); } else { - effectedModelList.push(model); + dict[model.code] = model; } }); - handleOperation(state, effectedModelList); + const list = Object.values(dict); + handleOperation(state, list); - commit('mapRender', effectedModelList); - resolve(effectedModelList); + commit('mapRender', list); + resolve(list); }); }, @@ -704,6 +719,10 @@ const map = { operateTrainModel: ({ commit }, { model, type }) => { commit('operateTrainModel', { model, type }); + }, + + updateMapStandData: ({ commit }, { models, type }) => { + commit('updateMapStandData', { models, type }); } } diff --git a/src/views/display/demon/addQuest.vue b/src/views/display/demon/addQuest.vue index 84ae3bfdb..b34ec5851 100644 --- a/src/views/display/demon/addQuest.vue +++ b/src/views/display/demon/addQuest.vue @@ -178,9 +178,10 @@ export default { confirm() { const roleName = this.memberList.find(elem=>{ return elem.id == this.form.role; }); + this.$emit('selectQuest', this.row, this.form.role, this.mapLocation, roleName.role); this.doClose(); this.roleDoClose(); - this.$emit('selectQuest', this.row, this.form.role, this.mapLocation, roleName.role); + }, roleDoClose() { diff --git a/src/views/display/designIndex.vue b/src/views/display/designIndex.vue index db5ae1d11..3d08a026c 100644 --- a/src/views/display/designIndex.vue +++ b/src/views/display/designIndex.vue @@ -585,11 +585,11 @@ export default { if (this.isDrive) { this.panelShow = false; this.drivingShow = true; - this.$refs.Jl3dDrive.show(this.mapId,this.group); + this.$refs.Jl3dDrive.show(this.mapId, this.group); } else { this.panelShow = false; this.simulationShow = true; - this.$refs.Jl3dSimulation.show(this.mapId,this.group); + this.$refs.Jl3dSimulation.show(this.mapId, this.group); } }, showScheduling() { diff --git a/src/views/mapdraft/dataRelation/parkOperate/index.vue b/src/views/mapdraft/dataRelation/parkOperate/index.vue index bff361fb5..9cb48cc88 100644 --- a/src/views/mapdraft/dataRelation/parkOperate/index.vue +++ b/src/views/mapdraft/dataRelation/parkOperate/index.vue @@ -6,6 +6,7 @@