Compare commits
2 Commits
c2e79a73f7
...
34af6397ae
Author | SHA1 | Date | |
---|---|---|---|
|
34af6397ae | ||
|
5aaec3388f |
@ -191,7 +191,7 @@ 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 { removeTrain, cancelTrainConn } from 'src/api/Simulation';
|
||||
import { errorNotify, successNotify } from 'src/utils/CommonNotify';
|
||||
|
||||
interface KeyType {
|
||||
@ -634,6 +634,10 @@ const options = [
|
||||
label: '取消连接',
|
||||
value: 4,
|
||||
},
|
||||
{
|
||||
label: '清除列车',
|
||||
value: 5,
|
||||
},
|
||||
];
|
||||
|
||||
function doTrainOperation(option: { label: string; value: number }) {
|
||||
@ -645,6 +649,8 @@ function doTrainOperation(option: { label: string; value: number }) {
|
||||
openTccDialog();
|
||||
} else if (option.value == 4) {
|
||||
cancelTrainLink();
|
||||
} else if (option.value == 5) {
|
||||
clearTrain();
|
||||
}
|
||||
}
|
||||
|
||||
@ -708,6 +714,28 @@ function openTccDialog() {
|
||||
trainInfo.value?.trainControlMapId as number
|
||||
);
|
||||
}
|
||||
|
||||
function clearTrain() {
|
||||
if (!lineStore.selectedGraphics) return;
|
||||
const train = lineStore.selectedGraphics[0] as Train;
|
||||
Dialog.create({
|
||||
title: '确认',
|
||||
message: `确认清除【${trainInfo.value?.id}】列车吗?`,
|
||||
cancel: true,
|
||||
}).onOk(async () => {
|
||||
removeTrain({
|
||||
simulationId: lineStore.simulationId as string,
|
||||
mapId: lineStore.mapId as number,
|
||||
trainId: train.code,
|
||||
})
|
||||
.then(() => {
|
||||
successNotify('移除列车成功!');
|
||||
})
|
||||
.catch((err) => {
|
||||
errorNotify('移除列车失败!', err);
|
||||
});
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.q-item {
|
||||
|
@ -16,6 +16,7 @@ import { successNotify, errorNotify } from '../../utils/CommonNotify';
|
||||
import { Dialog } from 'quasar';
|
||||
import SetTrainParam from 'src/components/draw-app/dialogs/SetTrainParam.vue';
|
||||
import SetTrainLink from 'src/components/draw-app/dialogs/SetTrainLink.vue';
|
||||
import { useTccStore } from 'src/stores/tcc-store';
|
||||
export class TrainState extends GraphicStateBase implements ITrainState {
|
||||
constructor(proto?: state.TrainMapState) {
|
||||
let states;
|
||||
@ -708,11 +709,20 @@ const CancelLink: MenuItemOptions = {
|
||||
const removeTrainConfig: MenuItemOptions = {
|
||||
name: '清除列车',
|
||||
};
|
||||
const DrivingCabConfig: MenuItemOptions = {
|
||||
name: '列车驾驶台',
|
||||
};
|
||||
const TrainOperateMenu: ContextMenu = ContextMenu.init({
|
||||
name: '列车操作菜单',
|
||||
groups: [
|
||||
{
|
||||
items: [TrainParam, TrainLink, CancelLink, removeTrainConfig],
|
||||
items: [
|
||||
TrainParam,
|
||||
TrainLink,
|
||||
CancelLink,
|
||||
DrivingCabConfig,
|
||||
removeTrainConfig,
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
@ -817,6 +827,12 @@ export class TrainOperateInteraction extends GraphicInteractionPlugin<Train> {
|
||||
});
|
||||
});
|
||||
};
|
||||
DrivingCabConfig.handler = () => {
|
||||
useTccStore().setTccParam(
|
||||
parseInt(train.states.id),
|
||||
train.states.trainControlMapId
|
||||
);
|
||||
};
|
||||
|
||||
TrainOperateMenu.open(e.global);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user