吉安感知网项目-前端
shuishen
2026-02-09 23545fcd763ae8bc87072df7001ccd2682b82cce
applications/drone-command/src/views/dataCockpit/index.vue
@@ -57,8 +57,8 @@
  const rightCollapsed = ref(false);
  const allDevices = ref([]);
  const realWarningData = ref([]);
  const realWarningLoading = ref(true);
  const minLoadingMs = 400;
  const realWarningLoading = ref(false);
  const loadingTimer = ref(null);
  const onSelectWarning = (type) => {
    leftActiveId.value = type;
@@ -131,8 +131,11 @@
  };
  const fetchRealWarning = async () => {
    const startAt = Date.now();
    realWarningLoading.value = true;
    // 只有超过200ms才显示loading,避免闪烁
    loadingTimer.value = setTimeout(() => {
      realWarningLoading.value = true;
    }, 200);
    try {
      const params = { current: 1, size: 9999, alarmType: '1' };
      const res = await alarmLogApi(params);
@@ -144,10 +147,7 @@
          (record?.favorited === 1 || record?.favorited === '1')
      }));
    } finally {
      const elapsed = Date.now() - startAt;
      if (elapsed < minLoadingMs) {
        await new Promise((resolve) => setTimeout(resolve, minLoadingMs - elapsed));
      }
      if (loadingTimer.value) clearTimeout(loadingTimer.value);
      realWarningLoading.value = false;
    }
  };