diff --git a/src/views/newMap/newMapdraft/mapoperate/section/create.vue b/src/views/newMap/newMapdraft/mapoperate/section/create.vue index 3af9ba21a..559ef5e14 100644 --- a/src/views/newMap/newMapdraft/mapoperate/section/create.vue +++ b/src/views/newMap/newMapdraft/mapoperate/section/create.vue @@ -30,7 +30,17 @@ @click="hover('getSectionStart')" >{{ $t('map.activate') }} - + + + + + {{ $t('map.activate') }} + + @@ -146,15 +156,21 @@ export default { { value: '01', label: this.$t('map.coordinateMode') - }, { + }, + { + value: '05', + label: '向左延伸方式' + }, + { value: '03', - label: this.$t('map.frontSectionMode') + label: '向右延伸方式' + // this.$t('map.frontSectionMode') }, { value: '02', label: this.$t('map.sectionAssociationMode') }, { value: '04', - label: '批量创建' + label: '批量创建(向右)' } ] }; @@ -233,20 +249,39 @@ export default { this.createModel.modelList = []; } }, - extendCreate(model) { // 延伸创建 - const startModel = this.$store.getters['map/getDeviceByCode'](this.createModel.leftSectionCode); - const start_x = startModel.points[startModel.points.length - 1].x; - const start_y = startModel.points[startModel.points.length - 1].y; - model.points = [ - { x: start_x, y: start_y }, - { x: start_x + this.createModel.length, y: start_y } - ]; + extendCreate(model, type) { // 延伸创建 const models = []; - model.leftSectionCode = this.createModel.leftSectionCode; - const leftSection = this.getSectionByCode(this.createModel.leftSectionCode); - leftSection.rightSectionCode = model.code; + let section; + switch (type) { + case 'left': { + const startModel = this.$store.getters['map/getDeviceByCode'](this.createModel.rightSectionCode); + const start_x = startModel.points[0].x; + const start_y = startModel.points[0].y; + model.points = [ + { x: start_x - this.createModel.length, y: start_y }, + { x: start_x, y: start_y } + ]; + model.rightSectionCode = this.createModel.rightSectionCode; + section = this.getSectionByCode(this.createModel.rightSectionCode); + section.leftSectionCode = model.code; + break; + } + case 'right': { + const startModel = this.$store.getters['map/getDeviceByCode'](this.createModel.leftSectionCode); + const start_x = startModel.points[startModel.points.length - 1].x; + const start_y = startModel.points[startModel.points.length - 1].y; + model.points = [ + { x: start_x, y: start_y }, + { x: start_x + this.createModel.length, y: start_y } + ]; + model.leftSectionCode = this.createModel.leftSectionCode; + section = this.getSectionByCode(this.createModel.leftSectionCode); + section.rightSectionCode = model.code; + break; + } + } models.push(model); - models.push(leftSection); + models.push(section); this.$emit('updateMapModel', models); }, associatedCreate(model) { // 区段关联方式 @@ -305,7 +340,9 @@ export default { } else if (this.createModel.type === '02') { this.associatedCreate(model); } else if (this.createModel.type === '03') { - this.createModel.leftSectionCode && this.extendCreate(model); + this.createModel.leftSectionCode && this.extendCreate(model, 'right'); + } else if (this.createModel.type === '05') { + this.createModel.rightSectionCode && this.extendCreate(model, 'left'); } } }