链接key值调整

This commit is contained in:
joylink_fanyuhong 2024-07-19 10:21:59 +08:00
parent 9be34a00c7
commit f6ba3de79d

View File

@ -53,23 +53,23 @@ const props = defineProps({
required: true,
},
});
const connType = ref<number | undefined>();
const connectOptions = ref<{ label: string; value: number }[]>([]);
const connType = ref<string | undefined>();
const connectOptions = ref<{ label: string; value: string }[]>([]);
const showLoadTransData = ref(true);
const connectMap = new Map<number, string>();
const connectMap = new Map<string, number>();
onMounted(() => {
connectOptions.value = [];
getCanLinkPlatForm(props.simulationId)
.then((resp) => {
const list: { label: string; value: number }[] = [];
const list: { label: string; value: string }[] = [];
resp.data.forEach((element: { typeName: string; connType: number }) => {
list.push({
label: element.typeName,
value: element.connType,
value: element.typeName,
});
connectMap.set(element.connType, element.typeName);
connectMap.set(element.typeName, element.connType);
});
connectOptions.value = list;
})
@ -84,8 +84,8 @@ function onCreate() {
updateTrainConn({
id: props.trainId + '',
simulationId: props.simulationId,
connType: connType.value as number,
typeName: connectMap.get(connType.value as number) || '',
connType: connectMap.get(connType.value as string) || 0,
typeName: connType.value as string,
})
.then(() => {
successNotify('列车连接成功!');