操作弹框自动关闭

This commit is contained in:
joylink_zhaoerwei 2024-01-19 10:52:10 +08:00
parent fe46019070
commit e9ddf033a3
2 changed files with 13 additions and 4 deletions

View File

@ -159,7 +159,7 @@
import { Turnout } from 'src/graphics/turnout/Turnout';
import { useLineStore } from 'src/stores/line-store';
import { ref, watch, onMounted, onUnmounted } from 'vue';
import { Dialog } from 'quasar';
import { Dialog, DialogChainObject } from 'quasar';
import { TurnoutStates } from 'src/drawApp/graphics/TurnoutInteraction';
import TurnoutOperation from 'src/components/draw-app/dialogs/TurnoutOperation.vue';
import { JlGraphic } from 'jl-graphic';
@ -225,10 +225,12 @@ onUnmounted(() => {
});
const options = [{ label: '设置参数' }];
let turnoutOpreratDialogInstance: DialogChainObject | null = null;
function doTurnoutOperation(item: { label: string }) {
if (!lineStore.simulationId) return;
if (item.label == '设置参数') {
Dialog.create({
if (turnoutOpreratDialogInstance) return;
turnoutOpreratDialogInstance = Dialog.create({
title: '道岔设置参数',
message: '',
component: TurnoutOperation,
@ -239,6 +241,8 @@ function doTurnoutOperation(item: { label: string }) {
},
cancel: true,
persistent: true,
}).onCancel(() => {
turnoutOpreratDialogInstance = null;
});
}
}
@ -257,4 +261,10 @@ function updateState(newVal: TurnoutStates) {
turnoutState.value = newVal.clone() as TurnoutStates;
forcePosition.value = turnoutState.value.param.forcePosition;
}
onUnmounted(() => {
if (turnoutOpreratDialogInstance) {
turnoutOpreratDialogInstance?.hide();
}
});
</script>

View File

@ -22,11 +22,10 @@ import {
TurnoutSectionHitArea,
} from 'src/graphics/turnout/TurnoutDrawAssistant';
import { useLineStore } from 'src/stores/line-store';
import { SetSwitchParams, setSwitchPosition } from 'src/api/Simulation';
import { Dialog, Notify } from 'quasar';
import AddTrainDialog from '../../components/draw-app/dialogs/AddTrainDialog.vue';
import { addTrain } from 'src/api/Simulation';
import { errorNotify, successNotify } from 'src/utils/CommonNotify';
import { successNotify } from 'src/utils/CommonNotify';
import { AxleCounting } from 'src/graphics/axleCounting/AxleCounting';
import TurnoutOperation from 'src/components/draw-app/dialogs/TurnoutOperation.vue';
import { ApiError } from 'src/boot/axios';