feat: 添加活动告警自动刷新功能
This commit is contained in:
@@ -208,6 +208,7 @@ let serverTime = reactive({
|
|||||||
zone: 'UTC', // 时区 UTC
|
zone: 'UTC', // 时区 UTC
|
||||||
interval: null as any, // 定时器
|
interval: null as any, // 定时器
|
||||||
});
|
});
|
||||||
|
let activeAlarmRefresh = 0;
|
||||||
|
|
||||||
// 获取服务器时间
|
// 获取服务器时间
|
||||||
function fnGetServerTime() {
|
function fnGetServerTime() {
|
||||||
@@ -221,6 +222,7 @@ function fnGetServerTime() {
|
|||||||
serverTime.timestamp = parseInt(res.data.timestamp);
|
serverTime.timestamp = parseInt(res.data.timestamp);
|
||||||
serverTime.interval = setInterval(() => {
|
serverTime.interval = setInterval(() => {
|
||||||
serverTime.timestamp += 1000;
|
serverTime.timestamp += 1000;
|
||||||
|
activeAlarmRefresh += 1;
|
||||||
// serverTimeStr.value = parseDateToStr(serverTime.timestamp);
|
// serverTimeStr.value = parseDateToStr(serverTime.timestamp);
|
||||||
// 用DOM直接修改
|
// 用DOM直接修改
|
||||||
if (serverTimeDom) {
|
if (serverTimeDom) {
|
||||||
@@ -229,6 +231,10 @@ function fnGetServerTime() {
|
|||||||
YYYY_MM_DD_HH_MM_SSZ
|
YYYY_MM_DD_HH_MM_SSZ
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if (activeAlarmRefresh === 5) {
|
||||||
|
useAlarmStore().fnGetActiveAlarmInfo();
|
||||||
|
activeAlarmRefresh = 0;
|
||||||
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { reactive, ref, onMounted, toRaw } from 'vue';
|
import { reactive, ref, onMounted, toRaw, onUnmounted } from 'vue';
|
||||||
import { PageContainer } from 'antdv-pro-layout';
|
import { PageContainer } from 'antdv-pro-layout';
|
||||||
import { ProModal } from 'antdv-pro-modal';
|
import { ProModal } from 'antdv-pro-modal';
|
||||||
import { message, Modal } from 'ant-design-vue/es';
|
import { message, Modal } from 'ant-design-vue/es';
|
||||||
@@ -748,6 +748,22 @@ function fnGetList(pageNum?: number) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let interval: any = null;
|
||||||
|
/**自动刷新 */
|
||||||
|
function AutoRefresh() {
|
||||||
|
interval = setInterval(() => {
|
||||||
|
listAct(toRaw(queryParams), '').then((res: any) => {
|
||||||
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
|
tablePagination.total = res.total;
|
||||||
|
tableState.data = res.rows;
|
||||||
|
} else {
|
||||||
|
tablePagination.total = 0;
|
||||||
|
tableState.data = [];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, 5_000);
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// 初始字典数据
|
// 初始字典数据
|
||||||
Promise.allSettled([
|
Promise.allSettled([
|
||||||
@@ -769,9 +785,12 @@ onMounted(() => {
|
|||||||
dict.activeAlarmSeverity = resArr[3].value;
|
dict.activeAlarmSeverity = resArr[3].value;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// 获取网元网元列表
|
|
||||||
useNeInfoStore().fnNelist();
|
|
||||||
fnGetList();
|
fnGetList();
|
||||||
|
// 自动刷新
|
||||||
|
AutoRefresh();
|
||||||
|
});
|
||||||
|
onUnmounted(() => {
|
||||||
|
clearInterval(interval);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -1261,7 +1280,10 @@ onMounted(() => {
|
|||||||
:label="t('views.faultManage.activeAlarm.ackState')"
|
:label="t('views.faultManage.activeAlarm.ackState')"
|
||||||
name="ackState"
|
name="ackState"
|
||||||
>
|
>
|
||||||
<DictTag :options="dict.activeAckState" :value="modalState.from.ackState" />
|
<DictTag
|
||||||
|
:options="dict.activeAckState"
|
||||||
|
:value="modalState.from.ackState"
|
||||||
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
|
|||||||
Reference in New Issue
Block a user