diff --git a/src/views/newMap/newMapdraft/mapoperate/station.vue b/src/views/newMap/newMapdraft/mapoperate/station.vue index 959d44e57..56241251a 100644 --- a/src/views/newMap/newMapdraft/mapoperate/station.vue +++ b/src/views/newMap/newMapdraft/mapoperate/station.vue @@ -107,7 +107,8 @@ export default { 'stationList', 'sectionList', 'zcList', - 'lineCode' + 'lineCode', + 'stationStandList' ]), form() { return { @@ -198,6 +199,7 @@ export default { this.activeName = 'first'; this.editModel = deepAssign(this.editModel, selected); this.editModel.runPlanName = selected.runPlanName || ''; + // 筛选数据 去掉已经是集中站的数据,去掉自己本身,去掉被别的集中站选中的数据 this.chargeStation = this.stationList.filter(data=>{ return !data.centralized && data.code != this.editModel.code && !(data.controlled && data.concentrateStationCode != this.editModel.code); }); @@ -209,17 +211,20 @@ export default { this.$emit('stationSectionCode', ''); } }, + // 选择管理车站 changeChargeStation(data) { if (data.length > 0) { this.chargeStation.forEach(station=>{ const newModal = Object.assign({}, station); newModal.controlled = false; newModal.concentrateStationCode = ''; + this.setStationStand(station,""); data.forEach(each=>{ switch (each) { case station.code: { newModal.controlled = true; newModal.concentrateStationCode = this.editModel.code; + this.setStationStand(station,this.editModel.code); break; } } @@ -227,27 +232,44 @@ export default { this.$emit('updateMapModel', newModal); }); } else { - this.chargeStation.forEach(station=>{ - const newModal = Object.assign({}, station); - newModal.controlled = false; - newModal.concentrateStationCode = ''; - this.$emit('updateMapModel', newModal); - }); + //没有选中数据,直接将其他车站设置为非控制 + this.modifyChargeStation(); } this.edit(); }, changeCentralized(data) { if (!data) { + // 将当前车站选为非集中站 this.editModel.chargeStationCodeList = []; this.edit(); - this.chargeStation.forEach(station=>{ - const newModal = Object.assign({}, station); - newModal.controlled = false; - newModal.concentrateStationCode = ''; - this.$emit('updateMapModel', newModal); - }); + this.modifyChargeStation(); + this.setStationStand(this.editModel,''); + }else{ + this.setStationStand(this.editModel,this.editModel.code); } }, + modifyChargeStation(){ + this.chargeStation.forEach(station=>{ + const newModal = Object.assign({}, station); + newModal.controlled = false; + newModal.concentrateStationCode = ''; + + // 将原来被控制的车站下的站台,属性{所属设备集中站}设置为空 + this.setStationStand(station,""); + + this.$emit('updateMapModel', newModal); + }); + }, + // 设置属性{所属设备集中站} + setStationStand(station,code){ + this.stationStandList.forEach(elem=>{ + if(elem.stationCode==station.code){ + const stationStand = Object.assign({}, elem); + stationStand.deviceStationCode=code; + this.$emit('updateMapModel', stationStand); + } + }); + }, hover(field) { this.field = field === this.field ? '' : field; this.$emit('stationSectionCode', this.field); diff --git a/src/views/newMap/newMapdraft/mapoperate/stationcontrol.vue b/src/views/newMap/newMapdraft/mapoperate/stationcontrol.vue index 65d39aad2..c14321a6f 100644 --- a/src/views/newMap/newMapdraft/mapoperate/stationcontrol.vue +++ b/src/views/newMap/newMapdraft/mapoperate/stationcontrol.vue @@ -18,7 +18,7 @@ - + { if (valid) { - if (this.addModel.stationCode) { - const uid = getUID('StationControl'); - const model = { - _type: 'StationControl', - code: uid - // zokContent: '中控', - // zbjkContent: '总报警', - // zakContent: '站控', - // jjzkContent: '紧急站控', - // zzkContent: '站中控按钮', - // lskContent: '连锁控' - }; - this.stationList.forEach(elem => { - if (elem.code === this.addModel.stationCode) { - model.name = 'StationControl_' + elem.name.replace('Station_', ''); - model.position = { x: elem.position.x, y: elem.position.y }; - model.stationCode = elem.code; - } + if (this.addModel.stationCode.length) { + const models = []; + this.addModel.stationCode.forEach(item => { + const uid = getUID('StationControl'); + const model = { + _type: 'StationControl', + code: uid + // zokContent: '中控', + // zbjkContent: '总报警', + // zakContent: '站控', + // jjzkContent: '紧急站控', + // zzkContent: '站中控按钮', + // lskContent: '连锁控' + }; + this.stationList.forEach(elem => { + if (elem.code === item) { + model.name = 'StationControl_' + elem.name.replace('Station_', ''); + model.position = { x: elem.position.x, y: elem.position.y + 30 }; + model.stationCode = elem.code; + } + }); + models.push(model); }); - - this.$emit('updateMapModel', model); + this.$emit('updateMapModel', models); } else { this.$messageBox(this.$t('tip.selectedStationEmpty')); }