From d02295b206c7256014a4decdfdc9e9f694047cef Mon Sep 17 00:00:00 2001 From: joylink_fanyuhong <18706759286@163.com> Date: Wed, 20 Nov 2024 10:17:32 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B7=B3=E8=BD=ACats=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/drawApp/graphics/RunLineInteraction.ts | 14 +++++++++++++- src/pages/MonitorPage.vue | 9 +++------ src/stores/line-net-store.ts | 2 ++ 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/drawApp/graphics/RunLineInteraction.ts b/src/drawApp/graphics/RunLineInteraction.ts index afd4138..518122d 100644 --- a/src/drawApp/graphics/RunLineInteraction.ts +++ b/src/drawApp/graphics/RunLineInteraction.ts @@ -23,6 +23,7 @@ import { RunLineGraphicHitArea } from 'src/graphics/runLine/RunLineDrawAssistant import { Dialog } from 'quasar'; import SetDashLineDialog from '../../components/draw-app/dialogs/SetDashLineDialog.vue'; import SetGaryLineDialog from '../../components/draw-app/dialogs/SetGaryLineDialog.vue'; +import { useLineNetStore } from 'src/stores/line-net-store'; export class RunLineData extends GraphicDataBase implements IRunLineData { constructor(data?: graphicData.RunLine) { @@ -235,7 +236,6 @@ export class DrawRunLinePlugin extends GraphicInteractionPlugin { }); }; setGrayLineConfig.handler = () => { - console.log(runLine.datas, '11111'); Dialog.create({ title: '设置灰线段', message: '', @@ -280,10 +280,22 @@ export class RunLineOperateInteraction extends GraphicInteractionPlugin g.cursor = 'pointer'; g.lineBody.hitArea = new RunLineGraphicHitArea(g); g.selectable = true; + g.on('_leftclick', this.leftClick, this); } unbind(g: RunLine): void { g.selectable = false; g.eventMode = 'none'; + g.off('_leftclick', this.leftClick, this); + } + + leftClick(e: FederatedMouseEvent) { + const target = e.target as DisplayObject; + const runLine = target.getGraphic() as RunLine; + const lineId = runLine.datas.lineId; + if (lineId) { + useLineNetStore().jumpLineCount++; + useLineNetStore().jumpLineId = lineId; + } } } diff --git a/src/pages/MonitorPage.vue b/src/pages/MonitorPage.vue index 71af585..906b97b 100644 --- a/src/pages/MonitorPage.vue +++ b/src/pages/MonitorPage.vue @@ -35,13 +35,10 @@ watch( } ); watch( - () => lineNetStore.selectedGraphic, + () => lineNetStore.jumpLineCount, (val) => { - if (val && lineNetStore.selectedGraphicType == RunLine.Type) { - const lineId = (val as RunLine)?.datas.lineId; - if (lineId) { - router.replace(`/line/monitor/${lineId}`); - } + if (val) { + router.replace(`/line/monitor/${lineNetStore.jumpLineId}`); } } ); diff --git a/src/stores/line-net-store.ts b/src/stores/line-net-store.ts index 4db806c..ec2fbaa 100644 --- a/src/stores/line-net-store.ts +++ b/src/stores/line-net-store.ts @@ -38,6 +38,8 @@ export const useLineNetStore = defineStore('lineNet', { closeAllAlarmInfoDialog: false, connectButtonColor: 'green', connectInfo: null as state.WarnLineMessage | null, + jumpLineCount: 0, + jumpLineId: '', }), getters: { untreatedNum: (state) => {