增加忽略结束时间提示
This commit is contained in:
@@ -397,6 +397,7 @@ export default {
|
|||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
window.addEventListener('storage', handleStorageChange);
|
window.addEventListener('storage', handleStorageChange);
|
||||||
|
window.addEventListener('alarm-updated', fetchUnresolvedAlarmCount);
|
||||||
// 首次加载时获取告警数量
|
// 首次加载时获取告警数量
|
||||||
fetchUnresolvedAlarmCount();
|
fetchUnresolvedAlarmCount();
|
||||||
// 每60秒刷新一次告警数量
|
// 每60秒刷新一次告警数量
|
||||||
@@ -405,6 +406,7 @@ export default {
|
|||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
window.removeEventListener('storage', handleStorageChange);
|
window.removeEventListener('storage', handleStorageChange);
|
||||||
|
window.removeEventListener('alarm-updated', fetchUnresolvedAlarmCount);
|
||||||
// 清除定时器
|
// 清除定时器
|
||||||
if (alarmFetchInterval) {
|
if (alarmFetchInterval) {
|
||||||
clearInterval(alarmFetchInterval);
|
clearInterval(alarmFetchInterval);
|
||||||
|
|||||||
@@ -57,9 +57,15 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column v-if="activeTab === 'unresolved'" label="操作" min-width="100" align="center">
|
<el-table-column v-if="activeTab === 'unresolved'" label="操作" min-width="100" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button size="small" @click="handleIgnore(scope.row)" :disabled="scope.row.is_ignored">
|
<el-tooltip
|
||||||
{{ scope.row.is_ignored ? '已忽略' : '忽略' }}
|
:content="'忽略至:' + formatTime(scope.row.ignored_until)"
|
||||||
</el-button>
|
: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>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@@ -168,6 +174,7 @@ export default {
|
|||||||
const duration = parseInt(value, 10);
|
const duration = parseInt(value, 10);
|
||||||
await AlarmApi.snoozeAlarm(alarm.id, { duration_minutes: duration });
|
await AlarmApi.snoozeAlarm(alarm.id, { duration_minutes: duration });
|
||||||
this.$message.success('告警已忽略');
|
this.$message.success('告警已忽略');
|
||||||
|
window.dispatchEvent(new CustomEvent('alarm-updated'));
|
||||||
await this.loadAlarms();
|
await this.loadAlarms();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err !== 'cancel') {
|
if (err !== 'cancel') {
|
||||||
|
|||||||
Reference in New Issue
Block a user