From b5795f19e0e1b0fde1f3209a308162e3a5bcff2b Mon Sep 17 00:00:00 2001 From: Yuan Date: Fri, 25 Aug 2023 17:27:25 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8C=83=E5=9B=B4=E7=AE=A1=E7=90=86=E6=8B=86?= =?UTF-8?q?=E5=88=86App?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RangeConfig.vue} | 24 +-- .../{ => rangeConfigApp}/RangeList.vue | 2 +- src/drawApp/rangeConfigApp.ts | 139 ++++++++++++++++++ src/graphics/train/Train.ts | 1 + src/layouts/LineLayout.vue | 33 ++--- src/layouts/RangeConfigLayout.vue | 74 ++++++++++ src/pages/PublishManage.vue | 8 +- src/router/routes.ts | 5 + src/stores/range-config-store.ts | 27 ++++ 9 files changed, 278 insertions(+), 35 deletions(-) rename src/components/{rangeConfig.vue => rangeConfigApp/RangeConfig.vue} (90%) rename src/components/{ => rangeConfigApp}/RangeList.vue (98%) create mode 100644 src/drawApp/rangeConfigApp.ts create mode 100644 src/layouts/RangeConfigLayout.vue create mode 100644 src/stores/range-config-store.ts diff --git a/src/components/rangeConfig.vue b/src/components/rangeConfigApp/RangeConfig.vue similarity index 90% rename from src/components/rangeConfig.vue rename to src/components/rangeConfigApp/RangeConfig.vue index dbf651a..01a351b 100644 --- a/src/components/rangeConfig.vue +++ b/src/components/rangeConfigApp/RangeConfig.vue @@ -1,5 +1,5 @@ diff --git a/src/layouts/RangeConfigLayout.vue b/src/layouts/RangeConfigLayout.vue new file mode 100644 index 0000000..1d0ef67 --- /dev/null +++ b/src/layouts/RangeConfigLayout.vue @@ -0,0 +1,74 @@ + + + diff --git a/src/pages/PublishManage.vue b/src/pages/PublishManage.vue index 06c38c5..af92d1a 100644 --- a/src/pages/PublishManage.vue +++ b/src/pages/PublishManage.vue @@ -30,9 +30,15 @@ + import('layouts/LineLayout.vue'), }, + { + path: '/rangeConfig/:id', + name: 'rangeConfig', + component: () => import('layouts/RangeConfigLayout.vue'), + }, // { // path: '/line/monitor/:lineId', // name: 'linemonitor', diff --git a/src/stores/range-config-store.ts b/src/stores/range-config-store.ts new file mode 100644 index 0000000..b632774 --- /dev/null +++ b/src/stores/range-config-store.ts @@ -0,0 +1,27 @@ +import { defineStore } from 'pinia'; +import { initRangeConfigApp } from 'src/drawApp/rangeConfigApp'; +import { JlGraphic } from 'src/jl-graphic'; + +export const useRangeConfigStore = defineStore('rangeConfig', { + state: () => ({ + lineName: '', + lineId: NaN, + selectedGraphics: [] as JlGraphic[], + }), + actions: { + initRangeConfigApp(dom: HTMLElement) { + const app = initRangeConfigApp(dom); + app.on('graphicselectedchange', () => { + this.selectedGraphics = app.selectedGraphics; + }); + this.selectedGraphics = []; + return app; + }, + setLineId(id: number) { + this.lineId = id; + }, + setLineName(name: string) { + this.lineName = name; + }, + }, +});