代码调整

This commit is contained in:
joylink_cuiweidong 2020-05-09 18:24:21 +08:00
parent 9796280970
commit 13ae9eba9c

View File

@ -374,28 +374,24 @@ export default {
this.addStartSectionData(true);
},
changeStartSection(data) {
this.judgeAllowSelected();
const result = this.addStartSectionData(false);
if (result) {
const section = this.$store.getters['map/getDeviceByCode'](data);
if (section.belongStation) {
this.addModel.startStationCode = section.belongStation;
}
const section = this.$store.getters['map/getDeviceByCode'](data);
if (section.belongStation) {
this.addModel.startStationCode = section.belongStation;
}
this.judgeAllowSelected();
this.addStartSectionData(false);
},
changeEndStation() {
this.judgeAllowSelected();
this.addEndSectionData(true);
},
changeEndSection(data) {
this.judgeAllowSelected();
const result = this.addEndSectionData(false);
if (result) {
const section = this.$store.getters['map/getDeviceByCode'](data);
if (section.belongStation) {
this.addModel.endStationCode = section.belongStation;
}
const section = this.$store.getters['map/getDeviceByCode'](data);
if (section.belongStation) {
this.addModel.endStationCode = section.belongStation;
}
this.judgeAllowSelected();
this.addEndSectionData(false);
},
judgeAllowSelected() {
if (this.addModel.startStationCode != '' && this.addModel.startSectionCode != '' && this.addModel.endStationCode != '' && this.addModel.endSectionCode != '') {
@ -437,25 +433,25 @@ export default {
this.addEndSectionData(true);
} else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'startSectionCode'.toUpperCase()) {
if (selected.standTrack || selected.reentryTrack || selected.transferTrack) {
this.addModel.startSectionCode = selected.code;
this.judgeAllowSelected();
const result = this.addStartSectionData(false);
if (selected.belongStation && result) {
if (selected.belongStation) {
this.addModel.startStationCode = selected.belongStation;
}
this.addModel.startSectionCode = selected.code;
this.judgeAllowSelected();
this.addStartSectionData(false);
} else {
// (//)
this.$message.error('请选择正确的起始区段');
}
} else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'endSectionCode'.toUpperCase()) {
if (selected.standTrack || selected.reentryTrack || selected.transferTrack) {
this.addModel.endSectionCode = selected.code;
this.judgeAllowSelected();
const result = this.addEndSectionData(false);
this.addModel.destinationCode = selected.destinationCode || '';
if (selected.belongStation && result) {
if (selected.belongStation) {
this.addModel.endStationCode = selected.belongStation;
}
this.addModel.endSectionCode = selected.code;
this.judgeAllowSelected();
this.addEndSectionData(false);
this.addModel.destinationCode = selected.destinationCode || '';
} else {
this.$message.error('请选择正确的终到区段');
}
@ -478,44 +474,37 @@ export default {
case 'center': {
if (index < 0) {
list.splice(list.length - 1, 0, data);
return true;
} else {
this.$messageBox('该区段已经在交路区段中存在');
return false;
}
break;
}
case 'top': {
if (isStation) {
list.splice(0, 1, data);
return true;
} else {
if (index < 0) {
list.splice(0, 1, data);
return true;
} else {
if (index == list.length - 1 && list.length >= 2) {
this.$messageBox('起始区段和终到区段不能相同');
this.addModel.startSectionCode = list[0].sectionCode;
return false;
this.addModel.startStationCode = list[0].stationCode;
this.$messageBox('起始区段和终到区段不能相同');
} else if (index != list.length - 1 && index != 0) {
this.$messageBox('该区段已经在交路区段中存在');
return false;
}
return false;
}
}
break;
}
case 'bottom': {
if (isStation) {
if (list.length >= 2) {
list.splice(list.length - 1, 1, data);
return true;
} else {
if (index < 0) {
list.push(data);
return true;
}
return false;
}
} else {
if (index < 0) {
@ -524,28 +513,25 @@ export default {
} else {
list.push(data);
}
return true;
} else {
if (index == 0 && list.length >= 2) {
this.$messageBox('起始区段和终到区段不能相同');
this.addModel.endSectionCode = list[list.length - 1].sectionCode;
return false;
this.addModel.endStationCode = list[list.length - 1].stationCode;
this.$messageBox('起始区段和终到区段不能相同');
} else if (index != list.length - 1 && index != 0) {
this.$messageBox('该区段已经在交路区段中存在');
return false;
}
return false;
}
}
break;
}
default: {
if (index < 0) {
list.splice(list.length - 1, 0, data);
return true;
} else {
this.$messageBox(this.$t('tip.routeSameID'));
return false;
}
break;
}
}
this.sectionCode = '';