列车连接调整
This commit is contained in:
parent
a4c4ae1ab3
commit
e379b58871
@ -471,3 +471,11 @@ export async function xcjUpdateParams(data: {
|
||||
}) {
|
||||
return await api.put(`${UriBase}/xcj/operation`, data);
|
||||
}
|
||||
|
||||
/** 列车取消连接 */
|
||||
export async function cancelTrainConn(data: {
|
||||
trainId: string;
|
||||
id: string;
|
||||
}) {
|
||||
return await api.delete(`${UriBase}/train/unconn/${data.trainId}/${data.id}`);
|
||||
}
|
||||
|
@ -68,8 +68,8 @@ onMounted(() => {
|
||||
list.push({ label: '半实物', value: 1 });
|
||||
} else if (element.connType === 2) {
|
||||
list.push({ label: 'PC仿真', value: 2 });
|
||||
} else if (element.connType === 0) {
|
||||
list.push({ label: '取消连接', value: 0 });
|
||||
// } else if (element.connType === 0) {
|
||||
// list.push({ label: '取消连接', value: 0 });
|
||||
}
|
||||
});
|
||||
connectOptions.value = list;
|
||||
|
@ -191,6 +191,8 @@ import { Dialog } from 'quasar';
|
||||
import { state } from 'src/protos/device_state';
|
||||
import SetTrainLink from 'src/components/draw-app/dialogs/SetTrainLink.vue';
|
||||
import { useTccStore } from 'src/stores/tcc-store';
|
||||
import { cancelTrainConn } from 'src/api/Simulation';
|
||||
import { errorNotify, successNotify } from 'src/utils/CommonNotify';
|
||||
|
||||
interface KeyType {
|
||||
label: string;
|
||||
@ -612,6 +614,10 @@ const options = [
|
||||
label: '列车驾驶台',
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
label: '取消连接',
|
||||
value: 4,
|
||||
},
|
||||
];
|
||||
|
||||
function doTrainOperation(option: { label: string; value: number }) {
|
||||
@ -621,9 +627,31 @@ function doTrainOperation(option: { label: string; value: number }) {
|
||||
linkTrain();
|
||||
} else if (option.value == 3) {
|
||||
openTccDialog();
|
||||
} else if (option.value == 4) {
|
||||
cancelTrainLink();
|
||||
}
|
||||
}
|
||||
|
||||
function cancelTrainLink() {
|
||||
if (!lineStore.selectedGraphics) return;
|
||||
const train = lineStore.selectedGraphics[0] as Train;
|
||||
Dialog.create({
|
||||
title: '确认',
|
||||
message: `确认取消【${train.states.id}】列车的连接吗?`,
|
||||
cancel: true,
|
||||
}).onOk(async () => {
|
||||
cancelTrainConn({
|
||||
id: lineStore.simulationId || '',
|
||||
trainId: train.code,
|
||||
})
|
||||
.then(() => {
|
||||
successNotify('列车取消连接成功!');
|
||||
})
|
||||
.catch((err) => {
|
||||
errorNotify('列车取消连接失败!', err);
|
||||
});
|
||||
});
|
||||
}
|
||||
function linkTrain() {
|
||||
if (!lineStore.selectedGraphics) return;
|
||||
if (lineStore.deviceOpreratDialogInstance) return;
|
||||
|
@ -10,7 +10,7 @@ import {
|
||||
ContextMenu,
|
||||
} from 'jl-graphic';
|
||||
import { DisplayObject, FederatedMouseEvent } from 'pixi.js';
|
||||
import { removeTrain } from 'src/api/Simulation';
|
||||
import { removeTrain, cancelTrainConn } from 'src/api/Simulation';
|
||||
import { useLineStore } from 'src/stores/line-store';
|
||||
import { successNotify, errorNotify } from '../../utils/CommonNotify';
|
||||
import { Dialog } from 'quasar';
|
||||
@ -696,6 +696,9 @@ const TrainParam: MenuItemOptions = {
|
||||
const TrainLink: MenuItemOptions = {
|
||||
name: '列车连接',
|
||||
};
|
||||
const CancelLink: MenuItemOptions = {
|
||||
name: '取消连接',
|
||||
};
|
||||
const removeTrainConfig: MenuItemOptions = {
|
||||
name: '清除列车',
|
||||
};
|
||||
@ -703,7 +706,7 @@ const TrainOperateMenu: ContextMenu = ContextMenu.init({
|
||||
name: '列车操作菜单',
|
||||
groups: [
|
||||
{
|
||||
items: [TrainParam, TrainLink, removeTrainConfig],
|
||||
items: [TrainParam, TrainLink, CancelLink, removeTrainConfig],
|
||||
},
|
||||
],
|
||||
});
|
||||
@ -771,6 +774,24 @@ export class TrainOperateInteraction extends GraphicInteractionPlugin<Train> {
|
||||
persistent: true,
|
||||
});
|
||||
};
|
||||
CancelLink.handler = () => {
|
||||
Dialog.create({
|
||||
title: '确认',
|
||||
message: `确认取消【${train.states.id}】列车的连接吗?`,
|
||||
cancel: true,
|
||||
}).onOk(async () => {
|
||||
cancelTrainConn({
|
||||
id: simulationId,
|
||||
trainId: train.code,
|
||||
})
|
||||
.then(() => {
|
||||
successNotify('列车取消连接成功!');
|
||||
})
|
||||
.catch((err) => {
|
||||
errorNotify('列车取消连接失败!', err);
|
||||
});
|
||||
});
|
||||
};
|
||||
removeTrainConfig.handler = () => {
|
||||
Dialog.create({
|
||||
title: '确认',
|
||||
|
Loading…
Reference in New Issue
Block a user