diff --git a/src/components/alarm/setAlarmMock.vue b/src/components/alarm/setAlarmMock.vue new file mode 100644 index 0000000..b79a76e --- /dev/null +++ b/src/components/alarm/setAlarmMock.vue @@ -0,0 +1,215 @@ + + + diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index 0f95523..0936e65 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -17,11 +17,11 @@ 西安NCC调度辅助决策系统 { + if (getShowSetAlarmTextButton()) { + showSetAlarmTextButton.value = true; + } +}); + +//模拟报警 +const $q = useQuasar(); +function openSetAlarmMockDialog() { + $q.dialog({ + component: setAlarmMock, + }); +} + +const showSetAlarmTextButton = ref(false); +function openSetAlarmTextDialog() { + $q.dialog({ + component: setAlarmText, + }); +} + function logOut() { Dialog.create({ title: '登出确认', @@ -183,76 +196,7 @@ function logOut() { }); } -onMounted(() => { - if (getShowSetAlarmTextButton()) { - showSetAlarmTextButton.value = true; - } -}); - -//模拟报警 -const $q = useQuasar(); -const alertSetShow = ref(false); -const alertType = ref(''); -const lineId = ref(); -const optionsAlertType = [ - '蓝显', - '全线蓝显', - '整侧站台门无法打开', - '整侧站台门无法关闭', - '道岔失表', - '道岔大面积失表', - '计轴红光带', - '计轴大面积红光带', - '计轴橙光带', - '计轴大面积橙光带', - '列车信号故障', - '联锁区红光带', - '联锁区橙光带', -]; -let optionsAlertDevice = ref([]); -const alertDevice = ref([]); -let alertDeviceList: DeviceConfigItem[] = []; - -async function searchAlertDevice() { - try { - optionsAlertDevice.value = []; - alertDevice.value = []; - const type = (saveAlertTypeData as never)[alertType.value]; - alertDeviceList = await getDeviceByAlarmType(3, type); - optionsAlertDevice.value = alertDeviceList.map((item) => item.name); - } catch (err) { - $q.notify({ - type: 'negative', - message: '无法获取指定故障的设备列表', - }); - } -} - -async function alarmMockSet() { - try { - const type = (saveAlertTypeData as never)[alertType.value]; - const Id = lineId.value; - let deviceCodes: string[] = []; - for (let i = 0; i < alertDevice.value.length; i++) { - const index = alertDeviceList.findIndex( - (item) => item.name == alertDevice.value[i] - ); - deviceCodes.push(alertDeviceList[index].code); - } - await mockAlertSet({ lineId: Id, alertType: type, deviceCodes }); - alertSetShow.value = false; - } catch (err) { - $q.notify({ - type: 'negative', - message: '无法设置模拟故障', - }); - } -} - -const showSetAlarmTextButton = ref(false); -function openSetAlarmTextDialog() { - $q.dialog({ - component: setAlarmText, - }); +function backConfirm() { + router.replace('/monitor'); }