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