This commit is contained in:
fan 2024-01-19 13:42:36 +08:00
commit 288784c4bf
6 changed files with 25 additions and 25 deletions

View File

@ -56,7 +56,7 @@ import DraggableDialog from 'src/components/common/DraggableDialog.vue';
import { request } from 'src/protos/request';
import { useLineStore } from 'src/stores/line-store';
import { errorNotify } from 'src/utils/CommonNotify';
import { onMounted, ref } from 'vue';
import { onMounted, onUnmounted, ref } from 'vue';
const props = defineProps({
id: {
@ -116,5 +116,9 @@ function onCreate() {
}
});
}
onUnmounted(() => {
lineStore.deviceOpreratDialogInstance = null;
});
</script>
<style scoped></style>

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, DialogChainObject } from 'quasar';
import { Dialog } from 'quasar';
import { TurnoutStates } from 'src/drawApp/graphics/TurnoutInteraction';
import TurnoutOperation from 'src/components/draw-app/dialogs/TurnoutOperation.vue';
import { JlGraphic } from 'jl-graphic';
@ -218,19 +218,14 @@ onMounted(() => {
setTurnoutState(lineStore.selectedGraphics[0] as Turnout);
}
});
onUnmounted(() => {
if (graphic.value) {
unSubscribeState(graphic.value as JlGraphic);
}
});
const options = [{ label: '设置参数' }];
let turnoutOpreratDialogInstance: DialogChainObject | null = null;
function doTurnoutOperation(item: { label: string }) {
if (!lineStore.simulationId) return;
if (item.label == '设置参数') {
if (turnoutOpreratDialogInstance) return;
turnoutOpreratDialogInstance = Dialog.create({
if (lineStore.deviceOpreratDialogInstance) return;
lineStore.deviceOpreratDialogInstance = Dialog.create({
title: '道岔设置参数',
message: '',
component: TurnoutOperation,
@ -242,7 +237,7 @@ function doTurnoutOperation(item: { label: string }) {
cancel: true,
persistent: true,
}).onCancel(() => {
turnoutOpreratDialogInstance = null;
lineStore.deviceOpreratDialogInstance = null;
});
}
}
@ -263,8 +258,8 @@ function updateState(newVal: TurnoutStates) {
}
onUnmounted(() => {
if (turnoutOpreratDialogInstance) {
turnoutOpreratDialogInstance?.hide();
if (graphic.value) {
unSubscribeState(graphic.value as JlGraphic);
}
});
</script>

View File

@ -93,11 +93,13 @@ export class TurnoutOperationPlugin extends GraphicInteractionPlugin<Turnout> {
const target = e.target as DisplayObject;
const turnout = target.getGraphic<Turnout>();
if (!turnout) return;
const lineStore = useLineStore();
this.app.updateSelected(turnout);
const simulationId = useLineStore().simulationId || '';
const mapId = useLineStore().mapId as number;
const simulationId = lineStore.simulationId || '';
const mapId = lineStore.mapId as number;
setTurnoutParam.handler = async () => {
Dialog.create({
if (lineStore.deviceOpreratDialogInstance) return;
lineStore.deviceOpreratDialogInstance = Dialog.create({
title: '道岔设置参数',
message: '',
component: TurnoutOperation,
@ -112,7 +114,7 @@ export class TurnoutOperationPlugin extends GraphicInteractionPlugin<Turnout> {
};
const port = (target as TurnoutSection).port;
addTrainConfig.disabled = !port || !useLineStore().trainConfigList;
addTrainConfig.disabled = !port || !lineStore.trainConfigList;
addTrainConfig.handler = () => {
const relations =
turnout.relationManage.getRelationsOfGraphicAndOtherType(

View File

@ -209,6 +209,7 @@ onMounted(async () => {
// drawerRight.value = false;
});
onUnmounted(() => {
lineStore.deviceOpreratDialogInstance?.hide();
if (dialogInstance.value && lineStore.showLayerDialog) {
dialogInstance.value.hide();
}
@ -343,6 +344,8 @@ function destroySimAndBack() {
function switchScene(val: MapInfo) {
if (val.id == lineStore.mapId) return;
lineStore.selectedGraphics = null;
lineApp.getScene(lineStore.sceneName).updateSelected();
lineStore.deviceOpreratDialogInstance?.hide();
lineStore.setMapId(val.id);
sceneName = getSceneNameFn(val);
lineStore.setSceneName(sceneName);

View File

@ -6,14 +6,8 @@ export const user = '2'; // 普通用户
export const routes: RouteRecordRaw[] = [
{
path: '/',
component: () => import('layouts/MainLayout.vue'),
children: [
{
path: '',
name: 'home',
component: () => import('pages/IndexPage.vue'),
},
],
name: 'home',
redirect: '/testManage/test',
},
{

View File

@ -15,6 +15,7 @@ import { TrainState } from 'src/drawApp/graphics/TrainInteraction';
import { esbButtonOperation } from 'src/api/Simulation';
import { TrainConfigItem, getAllTrainList } from 'src/api/TrainModelApi';
import { graphicData } from 'src/protos/stationLayoutGraphics';
import { DialogChainObject } from 'quasar';
export const useLineStore = defineStore('line', {
state: () => ({
@ -34,6 +35,7 @@ export const useLineStore = defineStore('line', {
trainStateMap: new Map() as Map<Date, TrainState[]>,
trainConfigList: null as TrainConfigItem[] | null,
screenDoorGroupList: [] as graphicData.ScreenDoorGroup[],
deviceOpreratDialogInstance: null as DialogChainObject | null,
}),
getters: {
selectedGraphicType: (state) => {