|
|
@@ -128,7 +128,6 @@ interface WarnResult {
|
|
|
// 处理预警指标展示数据格式
|
|
|
function groupWarnByType(data: any) {
|
|
|
const result: WarnResult[] = [];
|
|
|
-
|
|
|
// 遍历 102、103、104...
|
|
|
Object.keys(data).forEach((warnKey) => {
|
|
|
const list = data[warnKey] || [];
|
|
|
@@ -151,7 +150,7 @@ function groupWarnByType(data: any) {
|
|
|
} else if (fmin != null && fmax == null) {
|
|
|
warnObj.coRange = `> ${fmin}`;
|
|
|
}
|
|
|
- // 处理变化率(原来的逻辑不动)
|
|
|
+ // 处理变化率
|
|
|
else if (trendMin != null && trendMax != null) {
|
|
|
if (warnName === '黄色预警(较大风险)') {
|
|
|
warnObj.coTrend = `加速上升(${trendMin} - ${trendMax})`;
|
|
|
@@ -316,75 +315,27 @@ watch(
|
|
|
if (newQueryType) {
|
|
|
changePage(newQueryType as string);
|
|
|
}
|
|
|
- modalMonitorData.value = modalRes;
|
|
|
- }
|
|
|
+ },
|
|
|
+ { immediate: true } // 初始化立刻执行
|
|
|
+);
|
|
|
|
|
|
- // // 定时刷新
|
|
|
- function initInterval() {
|
|
|
- if (timer) clearInterval(timer);
|
|
|
- timer = setInterval(() => {
|
|
|
- refresh();
|
|
|
- }, 60000);
|
|
|
- }
|
|
|
-
|
|
|
- async function changePage(pageTypeStr) {
|
|
|
- const target = pageTypeStr || route.query.pageType || 'fire_risk_warn';
|
|
|
- if (pageType.value === target) return;
|
|
|
- pageType.value = target;
|
|
|
- configs.value = pageCache.value[target]?.configs || testBeltNew;
|
|
|
- await nextTick();
|
|
|
- await refresh();
|
|
|
- }
|
|
|
-
|
|
|
- // watch(
|
|
|
- // // 监听动态路由参数 :type
|
|
|
- // () => route.params.type,
|
|
|
- // (newVal) => {
|
|
|
- // if (newVal) {
|
|
|
- // console.log('切换页面类型:', newVal);
|
|
|
- // refresh(); // 切换路由自动刷新
|
|
|
- // }
|
|
|
- // }
|
|
|
- // );
|
|
|
-
|
|
|
- function initModalAnimate(modal) {
|
|
|
- console.log('初始化模型', modal);
|
|
|
- modal.isRender = true;
|
|
|
- modalAnimate(modal, modalMonitorData);
|
|
|
- }
|
|
|
- function clearTimer() {
|
|
|
- if (timer) {
|
|
|
- clearInterval(timer);
|
|
|
- timer = null;
|
|
|
+watch(
|
|
|
+ () => modalMonitorData.value,
|
|
|
+ (newData, oldData) => {
|
|
|
+ if (newData && !Object.keys(oldData).length) {
|
|
|
+ isInitModal.value = true;
|
|
|
}
|
|
|
}
|
|
|
- watch(
|
|
|
- () => route.query.pageType,
|
|
|
- (newQueryType) => {
|
|
|
- if (newQueryType) {
|
|
|
- changePage(newQueryType as string);
|
|
|
- }
|
|
|
- },
|
|
|
- { immediate: true } // 初始化立刻执行
|
|
|
- );
|
|
|
+);
|
|
|
|
|
|
- watch(
|
|
|
- () => modalMonitorData.value,
|
|
|
- (newData, oldData) => {
|
|
|
- if (newData && !Object.keys(oldData).length) {
|
|
|
- isInitModal.value = true;
|
|
|
- }
|
|
|
- }
|
|
|
- );
|
|
|
-
|
|
|
- onMounted(async () => {
|
|
|
- await getSysDataSource();
|
|
|
- await refresh();
|
|
|
- initInterval();
|
|
|
- });
|
|
|
- onUnmounted(() => {
|
|
|
- clearTimer();
|
|
|
- });
|
|
|
+onMounted(async () => {
|
|
|
+ await getSysDataSource();
|
|
|
+ await refresh();
|
|
|
+ initInterval();
|
|
|
+});
|
|
|
+onUnmounted(() => {
|
|
|
+ clearTimer();
|
|
|
+});
|
|
|
</script>
|
|
|
<style lang="less" scoped>
|
|
|
.company-home {
|