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); + }); + }); +}