From b5794cd8546569b8cba8ed3a19f2a76f681cdbaf Mon Sep 17 00:00:00 2001 From: fan Date: Mon, 23 Oct 2023 14:09:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=B9=E9=87=8F=E6=B7=BB=E5=8A=A0=E9=9B=86?= =?UTF-8?q?=E4=B8=AD=E7=AB=99=E5=A2=9E=E5=8A=A0=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../properties/multipleSelectProperty.vue | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/components/draw-app/properties/multipleSelectProperty.vue b/src/components/draw-app/properties/multipleSelectProperty.vue index ce2e95d..9cefd1c 100644 --- a/src/components/draw-app/properties/multipleSelectProperty.vue +++ b/src/components/draw-app/properties/multipleSelectProperty.vue @@ -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 = '';