diff --git a/src/views/newMap/newMapdraft/mapoperate/section.vue b/src/views/newMap/newMapdraft/mapoperate/section.vue index 51437383b..83a50d2e6 100644 --- a/src/views/newMap/newMapdraft/mapoperate/section.vue +++ b/src/views/newMap/newMapdraft/mapoperate/section.vue @@ -372,8 +372,8 @@ export default { { prop: 'namePosition.y', firstLevel: 'namePosition', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' } ] }, { prop: 'type', label: this.$t('map.sectionType'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SectionTypeList}, - { prop: 'leftSectionCode', label: this.$t('map.leftAssociatedSection'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', clearable: true, options: this.AssociateSectionList}, - { prop: 'rightSectionCode', label: this.$t('map.rightAssociatedSection'), type: 'select', optionLabel: 'name&&code', optionValue: 'code', clearable: true, options: this.AssociateSectionList}, + { prop: 'leftSectionCode', label: this.$t('map.leftAssociatedSection'), type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', clearable: true, options: this.AssociateSectionList, hover: this.hover, buttonType: 'leftSection', buttonShowType: this.isLeftSectionButtonShow}, + { prop: 'rightSectionCode', label: this.$t('map.rightAssociatedSection'), type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', clearable: true, options: this.AssociateSectionList}, { prop: 'parentCode', label: this.$t('map.associatedSection'), type: 'select', mode: true, optionLabel: 'name&&code', optionValue: 'code', disabled: true, options: this.sectionList, isHidden: !this.isParentCode }, { prop: 'isStandTrack', label: this.$t('map.isStandTrack'), type: 'checkbox', isHidden: !this.isStandTrackShow }, // 1 @@ -445,7 +445,7 @@ export default { rules() { var validateLeftSection = (rule, value, callback) => { const leftSection = value ? this.$store.getters['map/getDeviceByCode'](value) : ''; - if (leftSection && (leftSection.points[1].x !== this.selected.points[0].x || leftSection.points[1].y !== this.selected.points[0].y )) { + if (leftSection && (leftSection.points[1].x !== this.editModel.points[0].x || leftSection.points[1].y !== this.editModel.points[0].y )) { callback(new Error(this.$t('rules.theLeftEndOfTheSelectedAssociatedSectionIsNotAdjacent'))); } else { callback(); @@ -453,7 +453,7 @@ export default { }; var validateRightSection = (rule, value, callback) => { const rightSection = value ? this.$store.getters['map/getDeviceByCode'](value) : ''; - if (rightSection && (rightSection.points[0].x !== this.selected.points[1].x || rightSection.points[0].y !== this.selected.points[1].y )) { + if (rightSection && (rightSection.points[0].x !== this.editModel.points[1].x || rightSection.points[0].y !== this.editModel.points[1].y )) { callback(new Error(this.$t('rules.theRightEndOfTheSelectedAssociatedSectionIsNotAdjacent'))); } else { callback(); @@ -595,6 +595,9 @@ export default { }, isStandTrackShow() { return this.editModel.type !== '04' && this.editModel.type !== '03' && !this.editModel.isSwitchSection; + }, + isLeftSectionButtonShow() { + return this.field === 'leftSection'; } }, watch: { @@ -642,8 +645,21 @@ export default { deviceSelect(selected) { this.AssociateSectionList = this.sectionList.filter(item => { return item.type === '01' && item.code !== selected.code; }); if (!this.fieldS) { // 判断是否激活选择站台 - this.$refs.dataform.resetFields(); if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase()) { + if (this.field === 'leftSection') { + this.editModel.leftSectionCode = selected.code; + this.activeName = 'first'; + this.field = ''; + this.$emit('fieldSelect', ''); + return; + } else if (this.field === 'rightSection') { + this.editModel.rightSectionCode = selected.code; + this.activeName = 'first'; + this.field = ''; + this.$emit('fieldSelect', ''); + return; + } + this.$refs.dataform.resetFields(); this.editModel.points = []; this.activeName = 'first'; this.editModel = deepAssign(this.editModel, selected); diff --git a/src/views/newMap/newMapdraft/mapoperate/station.vue b/src/views/newMap/newMapdraft/mapoperate/station.vue index 426ec651f..286f7c577 100644 --- a/src/views/newMap/newMapdraft/mapoperate/station.vue +++ b/src/views/newMap/newMapdraft/mapoperate/station.vue @@ -18,7 +18,7 @@ - + { if (valid) { - if (this.addModel.sectionCode) { - const uid = getUID('Station'); - const model = { - _type: 'Station', - code: uid, - zcCode: '', - runPlanName: '', - visible: true, - nameFont: '14px consolas', - nameFontColor: '#FFFFFF', - kmPost: '1000km~2000km', - kmPostShow: true, - kmPostFont: '8px consolas', - kmPostFontColor: '#FFFFFF', - centralized: false, - concentrateStationCode: '', - controlled:false, - chargeStationCodeList:[] - }; - this.sectionList.forEach(elem => { - if (elem.code === this.addModel.sectionCode) { - const l = 0; - const r = elem.points.length - 1; - model.name = 'Station_' + elem.name.replace('Station_', ''); - model.position = { - x: elem.points[l].x + (elem.points[r].x - elem.points[l].x) / 2, - y: elem.points[l].y - }; - } + if (this.addModel.sectionCode.length) { + const models = []; + this.addModel.sectionCode.forEach((item) => { + const uid = getUID('Station'); + const model = { + _type: 'Station', + code: uid, + zcCode: '', + runPlanName: '', + visible: true, + nameFont: '14px consolas', + nameFontColor: '#FFFFFF', + kmPost: '1000km~2000km', + kmPostShow: true, + kmPostFont: '8px consolas', + kmPostFontColor: '#FFFFFF', + centralized: false, + concentrateStationCode: '', + controlled:false, + chargeStationCodeList:[] + }; + this.sectionList.forEach(elem => { + if (elem.code === item) { + const l = 0; + const r = elem.points.length - 1; + model.name = 'Station_' + elem.name.replace('Station_', ''); + model.position = { + x: elem.points[l].x + (elem.points[r].x - elem.points[l].x) / 2, + y: elem.points[l].y - 100 + }; + } + }); + models.push(model); }); - - this.$emit('updateMapModel', model); + this.$emit('updateMapModel', models); } } });