选择link:
-
+
{
if (valid) {
const edits = [];
- const model = Object.assign({_type: 'Section'}, this.editModel);
+ const model = Object.assign({_type: 'Section'}, this.editModel); // 修改元素model
model.leftStopPointOffset = Number(model.leftStopPointOffset);
model.rightStopPointOffset = Number(model.rightStopPointOffset);
this.sectionList.forEach(section => {
@@ -874,10 +875,24 @@ export default {
section.trainPosType = model.trainPosType;
edits.push(section);
}
+ if (section.linkCode == model.linkCode && model.code != section.code) {
+ // debugger;
+ const lastIndex = this.oldPoint.length - 1;
+ if (this.oldPoint[0].x == section.points[section.points.length -1].x && this.oldPoint[0].y == section.points[section.points.length -1].y) {
+ section.points[section.points.length -1].x = model.points[0].x;
+ section.points[section.points.length -1].y = model.points[0].y;
+ }
+ if (this.oldPoint[lastIndex].x == section.points[0].x && this.oldPoint[lastIndex].y == section.points[0].y) {
+ section.points[0].x = model.points[model.points.length -1].x;
+ section.points[0].y = model.points[model.points.length -1].y;
+ }
+ edits.push(section);
+ }
});
edits.push(model);
this.fieldS = '';
this.$emit('addOrUpdateMapModel', edits);
+ this.oldPoint = JSON.parse(JSON.stringify(model.points));
}
});
},
@@ -1101,17 +1116,19 @@ export default {
delRelevanceSection() {
const selected = [];
const switchList = [];
- this.sectionList.forEach(section => {
- if (section.linkCode == this.linkCode) {
- const selectedSection = this.$store.getters['map/getDeviceByCode'](section.code);
- selected.push(selectedSection);
- this.switchList.forEach(switchEle => {
- if (section.relSwitchCode == switchEle.code) {
- const selectedSwitch = this.$store.getters['map/getDeviceByCode'](switchEle.code);
- switchList.push(selectedSwitch);
- }
- });
- }
+ this.linkCode.forEach(linkCode => {
+ this.sectionList.forEach(section => {
+ if (section.linkCode == linkCode) {
+ const selectedSection = this.$store.getters['map/getDeviceByCode'](section.code);
+ selected.push(selectedSection);
+ this.switchList.forEach(switchEle => {
+ if (section.relSwitchCode == switchEle.code) {
+ const selectedSwitch = this.$store.getters['map/getDeviceByCode'](switchEle.code);
+ switchList.push(selectedSwitch);
+ }
+ });
+ }
+ });
});
this.$confirm(this.$t('tip.confirmDeletion'), this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'),
@@ -1123,6 +1140,7 @@ export default {
});
await this.$emit('delMapModel', selected);
this.deviceSelect();
+ this.linkCode = '';
}).catch(() => {
this.$message.info(this.$t('tip.cancelledDelete'));
});
diff --git a/src/views/map/mapdraft/mapedit/mapoperate/switch.vue b/src/views/map/mapdraft/mapedit/mapoperate/switch.vue
index 08b6eb31f..979639b0f 100644
--- a/src/views/map/mapdraft/mapedit/mapoperate/switch.vue
+++ b/src/views/map/mapdraft/mapedit/mapoperate/switch.vue
@@ -171,15 +171,15 @@ export default {
create() { // 一键生成道岔
this.questionList = []; // 有问题区段列表
const models = [];
- // const remove = [];
const linkObj = {};
this.linkList.forEach(link => {
if (link && link.leftFdCode && link.leftSdCode) { // 左侧同时都有关联link
linkObj[`${link.code}`] = { name: '', num: 0 };
} else if (link && link.rightFdCode && link.rightSdCode) { // 右侧同时都有关联link
linkObj[`${link.code}`] = { name: '', num: 0 };
+ } else if (link && link.leftFdCode && !link.leftSdCode && link.rightFdCode && !link.rightSdCode) { // 左右正向link关联,侧向link不关联检测
+ linkObj[`${link.code}`] = { name: '', num: 0 };
}
-
});
this.sectionList.forEach(section => {
for (const link in linkObj) {
@@ -227,7 +227,7 @@ export default {
}
};
const swch = this.findSwitchData(model.sectionACode, model.sectionBCode, model.sectionCCode);
- !swch && models.push(model);
+ !swch && models.push(model); // 已有的道岔不在创建
}
}
}
@@ -273,6 +273,16 @@ export default {
}
}
});
+ const createArr = [];
+ models.forEach((item) => {
+ const sectionA = this.$store.getters['map/getDeviceByCode'](item.sectionACode);
+ const sectionB = this.$store.getters['map/getDeviceByCode'](item.sectionBCode);
+ const sectionC = this.$store.getters['map/getDeviceByCode'](item.sectionCCode);
+ if (linkObj[sectionA.linkCode].num != 1 && linkObj[sectionB.linkCode].num != 1 && linkObj[sectionC.linkCode].num != 1 ) {
+ createArr.push(item);
+ }
+ });
+ // console.log(models, createArr, '创建道岔list');
this.$confirm(this.$t('tip.confirmBatchGeneration'), this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'),
cancelButtonText: this.$t('tip.cancel'),
@@ -280,14 +290,11 @@ export default {
}).then(() => {
for (const link in linkObj) {
if (linkObj[link].num == 1) {
- this.questionList.push(`${this.$t('map.section')}${linkObj[link].name}${this.$t('tip.linkNoneSplit')}`);
+ this.questionList.push(`${this.$t('map.section')}${linkObj[link].name}${this.$t('tip.linkNoneSplit')}, ${this.$t('tip.createSwitchPortion')}`);
}
}
- if (!this.questionList.length) { // 没有问题list 再去创建
- // this.$emit('delMapModel', remove);
- this.$emit('addOrUpdateMapModel', models);
- this.createSwitchSection(models);
- }
+ this.$emit('addOrUpdateMapModel', createArr);
+ this.createSwitchSection(createArr);
}).catch(() => {
this.$message({
type: 'info',