批量添加集中站增加校验
This commit is contained in:
parent
4d4169a6e6
commit
b5794cd854
@ -54,28 +54,38 @@ function addCentralizedStation() {
|
||||
if (device.type === Section.Type) {
|
||||
const data = new SectionData();
|
||||
data.copyFrom(device.saveData());
|
||||
data.centralizedStations.push(stationName.value);
|
||||
device.updateData(data);
|
||||
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());
|
||||
data.centralizedStations.push(stationName.value);
|
||||
device.updateData(data);
|
||||
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());
|
||||
data.centralizedStations.push(stationName.value);
|
||||
device.updateData(data);
|
||||
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());
|
||||
data.centralizedStations.push(stationName.value);
|
||||
device.updateData(data);
|
||||
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());
|
||||
data.centralizedStations.push(stationName.value);
|
||||
device.updateData(data);
|
||||
if (!data.centralizedStations.includes(stationName.value)) {
|
||||
data.centralizedStations.push(stationName.value);
|
||||
device.updateData(data);
|
||||
}
|
||||
}
|
||||
});
|
||||
stationName.value = '';
|
||||
|
Loading…
Reference in New Issue
Block a user