通信链接断开位置调整;线路初始化删除列车

This commit is contained in:
dong 2023-12-20 13:57:39 +08:00
parent c0219744ff
commit c72b11fd81
5 changed files with 50 additions and 2 deletions

View File

@ -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<string> {
return api.get(`${alertUriBase}/reset/${linId}`);
}

View File

@ -1 +1,4 @@
// app global css in SCSS form
.my-notif-class {
margin-top: 50px;
}

View File

@ -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();

View File

@ -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();

View File

@ -30,6 +30,13 @@
class="q-mr-sm"
@click="openSetAlarmTextDialog"
/>
<q-btn
v-if="showSetAlarmTextButton && route.path.includes('line/monitor')"
color="warning"
label="初始化"
class="q-mr-sm"
@click="resetFn"
/>
<div class="q-gutter-sm row items-center no-wrap">
<q-btn
@ -98,10 +105,15 @@ import setAlarmMock from 'src/components/alarm/setAlarmMock.vue';
import NCC from '/logo/NCC_bai.png';
import { getShowSetAlarmTextButton } from 'src/configs/UrlManage';
import { useLineNetStore } from 'src/stores/line-net-store';
import { resetApi } from 'src/api/AlertMock';
import { useLineStore } from 'src/stores/line-store';
import { errorNotify } from 'src/utils/CommonNotify';
import { Train } from 'src/graphics/train/Train';
const leftDrawerOpen = ref(false);
const router = useRouter();
const route = useRoute();
const lineStore = useLineStore();
function toggleLeftDrawer() {
leftDrawerOpen.value = !leftDrawerOpen.value;
onResize();
@ -169,4 +181,27 @@ function logOut() {
function backConfirm() {
router.replace('/monitor');
}
function resetFn() {
Dialog.create({
title: '初始化确认',
message: '确认是否初始化?',
cancel: true,
persistent: true,
}).onOk(() => {
console.log('初始化', lineStore.lineId);
lineStore.lineId &&
resetApi(lineStore.lineId)
.then(() => {
const app = lineStore.getLineApp();
const trainList = app.queryStore.queryByType<Train>(Train.Type);
trainList.forEach((g) => {
app.deleteGraphics(g);
});
})
.catch((err) => {
errorNotify('初始化删除!', err);
});
});
}
</script>