增加忽略结束时间提示

This commit is contained in:
2025-11-18 13:44:01 +08:00
parent b362b08e6f
commit 1169381f7a
2 changed files with 12 additions and 3 deletions

View File

@@ -397,6 +397,7 @@ export default {
onMounted(() => {
window.addEventListener('storage', handleStorageChange);
window.addEventListener('alarm-updated', fetchUnresolvedAlarmCount);
// 首次加载时获取告警数量
fetchUnresolvedAlarmCount();
// 每60秒刷新一次告警数量
@@ -405,6 +406,7 @@ export default {
onUnmounted(() => {
window.removeEventListener('storage', handleStorageChange);
window.removeEventListener('alarm-updated', fetchUnresolvedAlarmCount);
// 清除定时器
if (alarmFetchInterval) {
clearInterval(alarmFetchInterval);

View File

@@ -57,9 +57,15 @@
</el-table-column>
<el-table-column v-if="activeTab === 'unresolved'" label="操作" min-width="100" align="center">
<template #default="scope">
<el-button size="small" @click="handleIgnore(scope.row)" :disabled="scope.row.is_ignored">
{{ scope.row.is_ignored ? '已忽略' : '忽略' }}
</el-button>
<el-tooltip
:content="'忽略至:' + formatTime(scope.row.ignored_until)"
:disabled="!scope.row.is_ignored"
placement="top"
>
<el-button size="small" @click="handleIgnore(scope.row)" :disabled="scope.row.is_ignored">
{{ scope.row.is_ignored ? '已忽略' : '忽略' }}
</el-button>
</el-tooltip>
</template>
</el-table-column>
</el-table>
@@ -168,6 +174,7 @@ export default {
const duration = parseInt(value, 10);
await AlarmApi.snoozeAlarm(alarm.id, { duration_minutes: duration });
this.$message.success('告警已忽略');
window.dispatchEvent(new CustomEvent('alarm-updated'));
await this.loadAlarms();
} catch (err) {
if (err !== 'cancel') {