调整批量创建区段 逻辑

This commit is contained in:
zyy 2019-12-10 10:12:46 +08:00
parent 4385e64b03
commit 18ebc91da2

View File

@ -803,15 +803,16 @@ export default {
const models = [];
let flag = true;
let leftPointX = 0; let rightPointX = 0;
const startModel = this.getSectionByCode(this.createModel.leftSectionCode);
this.createModel.modelList.forEach((item, index) => {
if (item.length && item.sectionName) {
let param = {};
const uid = getUID('T', [...this.sectionList, ...models]);
const startModel = this.getSectionByCode(this.createModel.leftSectionCode);
rightPointX += item.length;
if (index != 0) {
leftPointX += this.createModel.modelList[index - 1].length;
}
const param = this.createModelParam(uid, item.sectionName);
param = this.createModelParam(uid, item.sectionName);
param.points = [
{ x: startModel.points[startModel.points.length - 1].x + leftPointX, y: startModel.points[startModel.points.length - 1].y },
{ x: startModel.points[startModel.points.length - 1].x + rightPointX, y: startModel.points[startModel.points.length - 1].y }
@ -819,7 +820,6 @@ export default {
if (index == 0) {
param.leftSectionCode = this.createModel.leftSectionCode;
startModel.rightSectionCode = param.code;
models.push(startModel);
} else {
param.leftSectionCode = models[index - 1].code;
models[index - 1].rightSectionCode = param.code;
@ -832,6 +832,7 @@ export default {
}
});
if (flag) {
models.push(startModel);
this.$emit('updateMapModel', models);
this.createModel.modelList = [];
}