From c72b11fd813d6122d400e370dd9cb8bb85eb6259 Mon Sep 17 00:00:00 2001 From: dong <58670809@qq.com> Date: Wed, 20 Dec 2023 13:57:39 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E4=BF=A1=E9=93=BE=E6=8E=A5=E6=96=AD?= =?UTF-8?q?=E5=BC=80=E4=BD=8D=E7=BD=AE=E8=B0=83=E6=95=B4=EF=BC=9B=E7=BA=BF?= =?UTF-8?q?=E8=B7=AF=E5=88=9D=E5=A7=8B=E5=8C=96=E5=88=A0=E9=99=A4=E5=88=97?= =?UTF-8?q?=E8=BD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/AlertMock.ts | 8 ++++++++ src/css/app.scss | 3 +++ src/drawApp/lineApp.ts | 3 ++- src/drawApp/lineNetApp.ts | 3 ++- src/layouts/MainLayout.vue | 35 +++++++++++++++++++++++++++++++++++ 5 files changed, 50 insertions(+), 2 deletions(-) diff --git a/src/api/AlertMock.ts b/src/api/AlertMock.ts index 8dca82a..9e31f90 100644 --- a/src/api/AlertMock.ts +++ b/src/api/AlertMock.ts @@ -130,3 +130,11 @@ export async function recordAlarmReport( const response = await api.post(`/api/alertRecord/report/${lineId}`, data); return response.data; } + +/** + * 初始化 + * @param linId 线路的id + */ +export function resetApi(linId: number): Promise { + return api.get(`${alertUriBase}/reset/${linId}`); +} diff --git a/src/css/app.scss b/src/css/app.scss index ecac98f..2157cc3 100644 --- a/src/css/app.scss +++ b/src/css/app.scss @@ -1 +1,4 @@ // app global css in SCSS form +.my-notif-class { + margin-top: 50px; +} diff --git a/src/drawApp/lineApp.ts b/src/drawApp/lineApp.ts index 90aa484..4202d02 100644 --- a/src/drawApp/lineApp.ts +++ b/src/drawApp/lineApp.ts @@ -143,7 +143,8 @@ export function initLineApp(): IGraphicApp { type: 'negative', timeout: 0, position: 'top-right', - message: '通信链接已断开!', + message: '与WebSocket服务连接断开!', + classes: 'my-notif-class', }); } else if (msgNotify && connected) { msgNotify(); diff --git a/src/drawApp/lineNetApp.ts b/src/drawApp/lineNetApp.ts index fb6f1ae..1f00a57 100644 --- a/src/drawApp/lineNetApp.ts +++ b/src/drawApp/lineNetApp.ts @@ -91,7 +91,8 @@ export function initLineNetApp(): IGraphicApp { type: 'negative', timeout: 0, position: 'top-right', - message: '通信链接已断开!', + message: '与WebSocket服务连接断开!', + classes: 'my-notif-class', }); } else if (msgNotify && connected) { msgNotify(); diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index 3ef22a0..2dd13f7 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -30,6 +30,13 @@ class="q-mr-sm" @click="openSetAlarmTextDialog" /> +
{ + console.log('初始化', lineStore.lineId); + lineStore.lineId && + resetApi(lineStore.lineId) + .then(() => { + const app = lineStore.getLineApp(); + const trainList = app.queryStore.queryByType(Train.Type); + trainList.forEach((g) => { + app.deleteGraphics(g); + }); + }) + .catch((err) => { + errorNotify('初始化删除!', err); + }); + }); +}