代码调整
This commit is contained in:
parent
3215ac97ab
commit
de024b9a45
@ -374,24 +374,28 @@ export default {
|
||||
this.addStartSectionData(true);
|
||||
},
|
||||
changeStartSection(data) {
|
||||
const section = this.$store.getters['map/getDeviceByCode'](data);
|
||||
if (section.belongStation) {
|
||||
this.addModel.startStationCode = section.belongStation;
|
||||
}
|
||||
this.judgeAllowSelected();
|
||||
this.addStartSectionData(false);
|
||||
const result = this.addStartSectionData(false);
|
||||
if (result) {
|
||||
const section = this.$store.getters['map/getDeviceByCode'](data);
|
||||
if (section.belongStation) {
|
||||
this.addModel.startStationCode = section.belongStation;
|
||||
}
|
||||
}
|
||||
},
|
||||
changeEndStation() {
|
||||
this.judgeAllowSelected();
|
||||
this.addEndSectionData(true);
|
||||
},
|
||||
changeEndSection(data) {
|
||||
const section = this.$store.getters['map/getDeviceByCode'](data);
|
||||
if (section.belongStation) {
|
||||
this.addModel.startStationCode = section.belongStation;
|
||||
}
|
||||
this.judgeAllowSelected();
|
||||
this.addEndSectionData(false);
|
||||
const result = this.addEndSectionData(false);
|
||||
if (result) {
|
||||
const section = this.$store.getters['map/getDeviceByCode'](data);
|
||||
if (section.belongStation) {
|
||||
this.addModel.endStationCode = section.belongStation;
|
||||
}
|
||||
}
|
||||
},
|
||||
judgeAllowSelected() {
|
||||
if (this.addModel.startStationCode != '' && this.addModel.startSectionCode != '' && this.addModel.endStationCode != '' && this.addModel.endSectionCode != '') {
|
||||
@ -403,13 +407,17 @@ export default {
|
||||
addStartSectionData(isStation) {
|
||||
if (this.addModel.startStationCode != '' && this.addModel.startSectionCode != '') {
|
||||
this.isStartSelected = true;
|
||||
this.pushSection({stationCode: this.addModel.startStationCode, sectionCode: this.addModel.startSectionCode}, 'top', isStation);
|
||||
const result = this.pushSection({stationCode: this.addModel.startStationCode, sectionCode: this.addModel.startSectionCode}, 'top', isStation);
|
||||
return result;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
addEndSectionData(isStation) {
|
||||
if (this.addModel.endStationCode != '' && this.addModel.endSectionCode != '') {
|
||||
this.pushSection({stationCode: this.addModel.endStationCode, sectionCode: this.addModel.endSectionCode}, 'bottom', isStation);
|
||||
const result = this.pushSection({stationCode: this.addModel.endStationCode, sectionCode: this.addModel.endSectionCode}, 'bottom', isStation);
|
||||
return result;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
hover(field) {
|
||||
this.field = field === this.field ? '' : field;
|
||||
@ -429,25 +437,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) {
|
||||
if (selected.belongStation) {
|
||||
this.addModel.startStationCode = selected.belongStation;
|
||||
}
|
||||
this.addModel.startSectionCode = selected.code;
|
||||
this.judgeAllowSelected();
|
||||
this.addStartSectionData(false);
|
||||
const result = this.addStartSectionData(false);
|
||||
if (selected.belongStation && result) {
|
||||
this.addModel.startStationCode = selected.belongStation;
|
||||
}
|
||||
} else {
|
||||
// (折返轨/转换轨/站台轨对应的区段)
|
||||
this.$message.error('请选择正确的起始区段');
|
||||
}
|
||||
} else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'endSectionCode'.toUpperCase()) {
|
||||
if (selected.standTrack || selected.reentryTrack || selected.transferTrack) {
|
||||
if (selected.belongStation) {
|
||||
this.addModel.endStationCode = selected.belongStation;
|
||||
}
|
||||
this.addModel.endSectionCode = selected.code;
|
||||
this.judgeAllowSelected();
|
||||
this.addEndSectionData(false);
|
||||
const result = this.addEndSectionData(false);
|
||||
this.addModel.destinationCode = selected.destinationCode || '';
|
||||
if (selected.belongStation && result) {
|
||||
this.addModel.endStationCode = selected.belongStation;
|
||||
}
|
||||
} else {
|
||||
this.$message.error('请选择正确的终到区段');
|
||||
}
|
||||
@ -470,36 +478,44 @@ 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;
|
||||
} 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) {
|
||||
@ -508,24 +524,28 @@ 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;
|
||||
} 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 = '';
|
||||
@ -583,7 +603,7 @@ export default {
|
||||
this.changeSectionSelected(this.addModel.parkSectionCodeList, flag);
|
||||
},
|
||||
changeSectionSelected(selectedList, flag) {
|
||||
if (this.addModel.parkSectionCodeList.length > 0) {
|
||||
if (this.addModel.parkSectionCodeList && this.addModel.parkSectionCodeList.length > 0) {
|
||||
if (flag) {
|
||||
if (this.oldsection.length > 0) {
|
||||
this.oldsection.forEach((section)=>{
|
||||
|
Loading…
Reference in New Issue
Block a user