批量添加集中站增加校验

This commit is contained in:
fan 2023-10-23 14:09:15 +08:00
parent 4d4169a6e6
commit b5794cd854

View File

@ -54,29 +54,39 @@ function addCentralizedStation() {
if (device.type === Section.Type) {
const data = new SectionData();
data.copyFrom(device.saveData());
if (!data.centralizedStations.includes(stationName.value)) {
data.centralizedStations.push(stationName.value);
device.updateData(data);
}
} else if (device.type === Signal.Type) {
const data = new SignalData();
data.copyFrom(device.saveData());
if (!data.centralizedStations.includes(stationName.value)) {
data.centralizedStations.push(stationName.value);
device.updateData(data);
}
} else if (device.type === Turnout.Type) {
const data = new TurnoutData();
data.copyFrom(device.saveData());
if (!data.centralizedStations.includes(stationName.value)) {
data.centralizedStations.push(stationName.value);
device.updateData(data);
}
} else if (device.type === AxleCounting.Type) {
const data = new AxleCountingData();
data.copyFrom(device.saveData());
if (!data.centralizedStations.includes(stationName.value)) {
data.centralizedStations.push(stationName.value);
device.updateData(data);
}
} else if (device.type === Transponder.Type) {
const data = new TransponderData();
data.copyFrom(device.saveData());
if (!data.centralizedStations.includes(stationName.value)) {
data.centralizedStations.push(stationName.value);
device.updateData(data);
}
}
});
stationName.value = '';
});