From a341a2873c083404b27b217879148627f8ffb57f Mon Sep 17 00:00:00 2001 From: joylink_zhaoerwei Date: Wed, 6 Dec 2023 15:15:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=80=E9=94=AE=E7=94=9F=E6=88=90=E6=89=80?= =?UTF-8?q?=E6=9C=89=E7=B4=A7=E6=80=A5=E5=81=9C=E8=BD=A6=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E7=BB=84=E5=90=88=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../properties/StationRelateDeviceConfig.vue | 30 ---------- src/layouts/DrawLayout.vue | 55 +++++++++++++++++++ 2 files changed, 55 insertions(+), 30 deletions(-) diff --git a/src/components/draw-app/properties/StationRelateDeviceConfig.vue b/src/components/draw-app/properties/StationRelateDeviceConfig.vue index adcd20d..92ae536 100644 --- a/src/components/draw-app/properties/StationRelateDeviceConfig.vue +++ b/src/components/draw-app/properties/StationRelateDeviceConfig.vue @@ -20,7 +20,6 @@ label="设备编号" v-model="relateDeviceConfig.code" :rules="[(val) => val.trim() != '' || '名称不能为空']" - @blur="onSelectDeviceType" /> g.type == EsbButton.Type; const selectConfigUtils = ref | null>( @@ -170,33 +167,6 @@ async function editRelateDevices(row: RelateDevicelistItem) { } } -function onSelectDeviceType() { - if ( - relateDeviceConfig.value.deviceType == - graphicData.RelatedRef.DeviceType.station - ) { - const targetStation = drawStore - .getDrawApp() - .queryStore.queryByType(Station.Type) - .find((g) => g.datas.stationName == relateDeviceConfig.value.code); - const platforms = drawStore - .getDrawApp() - .queryStore.queryByType(Platform.Type) - .filter((g) => g.datas.refStation == targetStation?.id); - selectConfigUtils.value.selectConfig = []; - let refEsbRelayCodes = platforms.map((g) => g.datas.refEsbRelayCode); - refEsbRelayCodes = Array.from(new Set(refEsbRelayCodes)); - refEsbRelayCodes.forEach((relayCode) => { - selectConfigUtils.value.selectConfig.push({ - code: relayCode, - refDevices: [], - refDevicesCode: [], - expanded: false, - }); - }); - } -} - function onReset() { handleState.value = '新建车站关联设备'; relateDeviceConfig.value = { diff --git a/src/layouts/DrawLayout.vue b/src/layouts/DrawLayout.vue index 650c121..622fef1 100644 --- a/src/layouts/DrawLayout.vue +++ b/src/layouts/DrawLayout.vue @@ -196,6 +196,7 @@ import { checkDataToServer, loadUniqueIdPrefix, setUniqueIdPrefix, + creatStationRelateDevice, } from 'src/drawApp/commonApp'; import { saveJkDrawDatas, loadLinkDatas } from 'src/drawApp/jkApp'; import { RelateDevicelistItem, saveThDrawDatas } from 'src/drawApp/thApp'; @@ -364,6 +365,10 @@ const leftMenuConfig = [ label: '一键生成所有紧急停车继电器的编号', click: oneClickGenerateEsbRelayCode, }, + { + label: '一键生成所有紧急停车按钮组合数据', + click: oneClickGenerateEsbCombinationData, + }, ]; //数据管理下拉按钮 @@ -894,6 +899,56 @@ function oneClickGenerateEsbRelayCode() { }); } +function oneClickGenerateEsbCombinationData() { + const stations = drawStore + .getDrawApp() + .queryStore.queryByType(Station.Type); + stations.forEach((station) => { + const platforms = drawStore + .getDrawApp() + .queryStore.queryByType(Platform.Type) + .filter((g) => g.datas.refStation == station?.id); + let refEsbRelayCodes = platforms.map((g) => g.datas.refEsbRelayCode); + refEsbRelayCodes = Array.from(new Set(refEsbRelayCodes)); + const combinationtypes: graphicData.DeviceCombinationtype[] = []; + const esbButtons = drawStore + .getDrawApp() + .queryStore.queryByType(EsbButton.Type); + if (refEsbRelayCodes.length == 1) { + const platformIds = platforms.map((g) => g.id); + const esbButtonIds = esbButtons + .filter((g) => platformIds.includes(g.datas.refStand)) + .map((g) => g.id); + + combinationtypes.push( + new graphicData.DeviceCombinationtype({ + code: refEsbRelayCodes[0], + refDevices: esbButtonIds, + }) + ); + } else { + platforms.forEach((platform) => { + const esbButtonIds = esbButtons + .filter((g) => g.datas.refStand == platform.id) + .map((g) => g.id); + combinationtypes.push( + new graphicData.DeviceCombinationtype({ + code: platform.datas.refEsbRelayCode, + refDevices: esbButtonIds, + }) + ); + }); + } + + const stationRelateDevice = new graphicData.StationRelateDevice({ + deviceType: graphicData.RelatedRef.DeviceType.station, + code: station.datas.stationName, + combinationtypes: combinationtypes, + }); + creatStationRelateDevice(stationRelateDevice); + }); +} + function backConfirm() { router.go(-1); }