列车连击调整

This commit is contained in:
joylink_fanyuhong 2024-07-19 09:21:32 +08:00
parent 9112a3c73a
commit 9be34a00c7
2 changed files with 10 additions and 14 deletions

View File

@ -442,6 +442,7 @@ export async function updateTrainConn(data: {
id: string;
simulationId: string;
connType: number;
typeName: string;
}) {
return await api.post(`${UriBase}/train/conn`, data);
}
@ -473,9 +474,6 @@ export async function xcjUpdateParams(data: {
}
/** 列车取消连接 */
export async function cancelTrainConn(data: {
trainId: string;
id: string;
}) {
export async function cancelTrainConn(data: { trainId: string; id: string }) {
return await api.delete(`${UriBase}/train/unconn/${data.trainId}/${data.id}`);
}

View File

@ -57,22 +57,19 @@ const connType = ref<number | undefined>();
const connectOptions = ref<{ label: string; value: number }[]>([]);
const showLoadTransData = ref(true);
const connectMap = new Map<number, string>();
onMounted(() => {
connectOptions.value = [];
getCanLinkPlatForm(props.simulationId)
.then((resp) => {
const list: { label: string; value: number }[] = [];
resp.data.forEach((element: { connType: number }) => {
if (element.connType === 1) {
list.push({ label: '半实物', value: 1 });
} else if (element.connType === 3) {
list.push({ label: 'PC仿真A', value: 3 });
// } else if (element.connType === 0) {
// list.push({ label: '', value: 0 });
} else if (element.connType === 4) {
list.push({ label: 'PC仿真B', value: 4 });
}
resp.data.forEach((element: { typeName: string; connType: number }) => {
list.push({
label: element.typeName,
value: element.connType,
});
connectMap.set(element.connType, element.typeName);
});
connectOptions.value = list;
})
@ -88,6 +85,7 @@ function onCreate() {
id: props.trainId + '',
simulationId: props.simulationId,
connType: connType.value as number,
typeName: connectMap.get(connType.value as number) || '',
})
.then(() => {
successNotify('列车连接成功!');