diff --git a/src/views/newMap/newMapdraft/mapoperate/stationcontrol.vue b/src/views/newMap/newMapdraft/mapoperate/stationcontrol.vue index 65d39aad2..1c1cdc449 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; + } + }); + console.log(model); + models.push(model); }); - - this.$emit('updateMapModel', model); + this.$emit('updateMapModel', models); } else { this.$messageBox(this.$t('tip.selectedStationEmpty')); }