一键生成所有紧急停车按钮组合数据
This commit is contained in:
parent
7eda7c0271
commit
a341a2873c
@ -20,7 +20,6 @@
|
|||||||
label="设备编号"
|
label="设备编号"
|
||||||
v-model="relateDeviceConfig.code"
|
v-model="relateDeviceConfig.code"
|
||||||
:rules="[(val) => val.trim() != '' || '名称不能为空']"
|
:rules="[(val) => val.trim() != '' || '名称不能为空']"
|
||||||
@blur="onSelectDeviceType"
|
|
||||||
/>
|
/>
|
||||||
<selectConfig-utils
|
<selectConfig-utils
|
||||||
ref="selectConfigUtils"
|
ref="selectConfigUtils"
|
||||||
@ -50,8 +49,6 @@ import {
|
|||||||
} from 'src/drawApp/commonApp';
|
} from 'src/drawApp/commonApp';
|
||||||
import { graphicData } from 'src/protos/stationLayoutGraphics';
|
import { graphicData } from 'src/protos/stationLayoutGraphics';
|
||||||
import SelectConfigUtils from 'src/components/common/SelectConfigUtils.vue';
|
import SelectConfigUtils from 'src/components/common/SelectConfigUtils.vue';
|
||||||
import { Station } from 'src/graphics/station/Station';
|
|
||||||
import { Platform } from 'src/graphics/platform/Platform';
|
|
||||||
|
|
||||||
const filterSelect = (g: JlGraphic) => g.type == EsbButton.Type;
|
const filterSelect = (g: JlGraphic) => g.type == EsbButton.Type;
|
||||||
const selectConfigUtils = ref<InstanceType<typeof SelectConfigUtils> | null>(
|
const selectConfigUtils = ref<InstanceType<typeof SelectConfigUtils> | 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>(Station.Type)
|
|
||||||
.find((g) => g.datas.stationName == relateDeviceConfig.value.code);
|
|
||||||
const platforms = drawStore
|
|
||||||
.getDrawApp()
|
|
||||||
.queryStore.queryByType<Platform>(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() {
|
function onReset() {
|
||||||
handleState.value = '新建车站关联设备';
|
handleState.value = '新建车站关联设备';
|
||||||
relateDeviceConfig.value = {
|
relateDeviceConfig.value = {
|
||||||
|
@ -196,6 +196,7 @@ import {
|
|||||||
checkDataToServer,
|
checkDataToServer,
|
||||||
loadUniqueIdPrefix,
|
loadUniqueIdPrefix,
|
||||||
setUniqueIdPrefix,
|
setUniqueIdPrefix,
|
||||||
|
creatStationRelateDevice,
|
||||||
} from 'src/drawApp/commonApp';
|
} from 'src/drawApp/commonApp';
|
||||||
import { saveJkDrawDatas, loadLinkDatas } from 'src/drawApp/jkApp';
|
import { saveJkDrawDatas, loadLinkDatas } from 'src/drawApp/jkApp';
|
||||||
import { RelateDevicelistItem, saveThDrawDatas } from 'src/drawApp/thApp';
|
import { RelateDevicelistItem, saveThDrawDatas } from 'src/drawApp/thApp';
|
||||||
@ -364,6 +365,10 @@ const leftMenuConfig = [
|
|||||||
label: '一键生成所有紧急停车继电器的编号',
|
label: '一键生成所有紧急停车继电器的编号',
|
||||||
click: oneClickGenerateEsbRelayCode,
|
click: oneClickGenerateEsbRelayCode,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: '一键生成所有紧急停车按钮组合数据',
|
||||||
|
click: oneClickGenerateEsbCombinationData,
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
//数据管理下拉按钮
|
//数据管理下拉按钮
|
||||||
@ -894,6 +899,56 @@ function oneClickGenerateEsbRelayCode() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function oneClickGenerateEsbCombinationData() {
|
||||||
|
const stations = drawStore
|
||||||
|
.getDrawApp()
|
||||||
|
.queryStore.queryByType<Station>(Station.Type);
|
||||||
|
stations.forEach((station) => {
|
||||||
|
const platforms = drawStore
|
||||||
|
.getDrawApp()
|
||||||
|
.queryStore.queryByType<Platform>(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>(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() {
|
function backConfirm() {
|
||||||
router.go(-1);
|
router.go(-1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user