This commit is contained in:
fan 2021-09-02 16:48:02 +08:00
commit b9c03b591d

View File

@ -30,7 +30,17 @@
@click="hover('getSectionStart')" @click="hover('getSectionStart')"
>{{ $t('map.activate') }}</el-button> >{{ $t('map.activate') }}</el-button>
</el-form-item> </el-form-item>
<el-form-item v-if="createModel.type == '03' || createModel.type == '01'" label="距离长度:" prop="length"> <el-form-item v-if="createModel.type == '05'" label="右关联区段" prop="rightSectionCode">
<el-select v-model="createModel.rightSectionCode" filterable>
<el-option v-for="item in switchAndPhySicalSectionList" :key="item.code" :label="item.name" :value="item.code" />
</el-select>
<el-button
:type="field == 'getSectionEnd' ? 'danger' : 'primary'"
size="small"
@click="hover('getSectionEnd')"
>{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-form-item v-if="createModel.type == '03' || createModel.type == '01'|| createModel.type == '05'" label="距离长度:" prop="length">
<el-input-number v-model="createModel.length" :min="0" /> <el-input-number v-model="createModel.length" :min="0" />
</el-form-item> </el-form-item>
<el-form-item v-if="createModel.type == '02' || createModel.type == '04'" label="起始区段:" prop="leftSectionCode"> <el-form-item v-if="createModel.type == '02' || createModel.type == '04'" label="起始区段:" prop="leftSectionCode">
@ -146,15 +156,21 @@ export default {
{ {
value: '01', value: '01',
label: this.$t('map.coordinateMode') label: this.$t('map.coordinateMode')
}, { },
{
value: '05',
label: '向左延伸方式'
},
{
value: '03', value: '03',
label: this.$t('map.frontSectionMode') label: '向右延伸方式'
// this.$t('map.frontSectionMode')
}, { }, {
value: '02', value: '02',
label: this.$t('map.sectionAssociationMode') label: this.$t('map.sectionAssociationMode')
}, { }, {
value: '04', value: '04',
label: '批量创建' label: '批量创建(向右)'
} }
] ]
}; };
@ -233,7 +249,24 @@ export default {
this.createModel.modelList = []; this.createModel.modelList = [];
} }
}, },
extendCreate(model) { // extendCreate(model, type) { //
const models = [];
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 startModel = this.$store.getters['map/getDeviceByCode'](this.createModel.leftSectionCode);
const start_x = startModel.points[startModel.points.length - 1].x; const start_x = startModel.points[startModel.points.length - 1].x;
const start_y = startModel.points[startModel.points.length - 1].y; const start_y = startModel.points[startModel.points.length - 1].y;
@ -241,12 +274,14 @@ export default {
{ x: start_x, y: start_y }, { x: start_x, y: start_y },
{ x: start_x + this.createModel.length, y: start_y } { x: start_x + this.createModel.length, y: start_y }
]; ];
const models = [];
model.leftSectionCode = this.createModel.leftSectionCode; model.leftSectionCode = this.createModel.leftSectionCode;
const leftSection = this.getSectionByCode(this.createModel.leftSectionCode); section = this.getSectionByCode(this.createModel.leftSectionCode);
leftSection.rightSectionCode = model.code; section.rightSectionCode = model.code;
break;
}
}
models.push(model); models.push(model);
models.push(leftSection); models.push(section);
this.$emit('updateMapModel', models); this.$emit('updateMapModel', models);
}, },
associatedCreate(model) { // associatedCreate(model) { //
@ -305,7 +340,9 @@ export default {
} else if (this.createModel.type === '02') { } else if (this.createModel.type === '02') {
this.associatedCreate(model); this.associatedCreate(model);
} else if (this.createModel.type === '03') { } 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');
} }
} }
} }