1
wangjuncheng
2025-07-01 ed436f333286d28af77d712ba7c26c61a0fe9fb5
1
已修改3个文件
41 ■■■■■ 文件已修改
src/components/menu/TimeLine.vue 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/monifangzhen/echartInfo.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/water.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/menu/TimeLine.vue
@@ -668,24 +668,24 @@
  colorState.lastTime = currentTime.value;
  // ====== 新增:在 updateWaterColor 前打印当前信息 ======
  // // 获取当前累计降雨量
  // let currentTotal = null;
  // const baseTimestamp = new Date(rainTotalInfo.value[0].time).getTime();
  // const currentTimeMs = baseTimestamp + currentTime.value * 1000;
  let currentTotal = null;
  const baseTimestamp = new Date(rainTotalInfo.value[0].time).getTime();
  const currentTimeMs = baseTimestamp + currentTime.value * 1000;
  // // 找到最接近的降雨数据点
  // for (let i = rainTotalInfo.value.length - 1; i >= 0; i--) {
  //   const dataTimeMs = new Date(rainTotalInfo.value[i].time).getTime();
  //   if (dataTimeMs <= currentTimeMs) {
  //     currentTotal = rainTotalInfo.value[i].total;
  //     break;
  //   }
  // }
  // 找到最接近的降雨数据点
  for (let i = rainTotalInfo.value.length - 1; i >= 0; i--) {
    const dataTimeMs = new Date(rainTotalInfo.value[i].time).getTime();
    if (dataTimeMs <= currentTimeMs) {
      currentTotal = rainTotalInfo.value[i].total;
      break;
    }
  }
  // // 打印信息
  // 打印信息
  // console.log("========================================");
  // console.log(`【时间戳】: ${new Date(currentTimeMs).toLocaleString()}`);
  // console.log(`【累计降雨量 R】: ${currentTotal !== null ? currentTotal.toFixed(2) : '未知'} mm`);
  // console.log(`【当前阶段】: 第 ${currentStage} 阶段`);
  console.log(`【时间戳】: ${new Date(currentTimeMs).toLocaleString()}`);
  console.log(`【累计降雨量 R】: ${currentTotal !== null ? currentTotal.toFixed(2) : '未知'} mm`);
  console.log(`【当前阶段】: 第 ${currentStage} 阶段`);
  // console.log(`【颜色 HEX】: ${colorState.colorStages[currentStage]?.color || '未定义'}`);
  // console.log(`【透明度 Alpha】: ${colorState.colorStages[currentStage]?.alpha || '未定义'}`);
  // console.log("========================================");
@@ -931,7 +931,6 @@
    }
    // console.log('获取到的 serviceName:', serviceInfo);
    // 根据 layer.json 获取时间轴信息
    const {
      waterTimestamps: timestamps,
@@ -956,7 +955,6 @@
        "YYYY-MM-DD HH:mm:ss"
      );
    }
    minFlowRate = watersMinHeight;
    maxFlowRate = watersMaxHeight;
  } catch (error) {
@@ -973,9 +971,7 @@
  // 因为这个函数实时模拟监听也需要使用,所以封装了一个函数
  await initializeSimulationData();
});
const shouldAutoPlay = ref(false);
// 监听 layerDate 变化后标记准备播放
watch(
  () => layerDate.value,
@@ -986,7 +982,6 @@
  },
  { deep: true }
);
// 等待 finishPlay 成功后再播放
watchEffect(() => {
  if (shouldAutoPlay.value && finishPlay.value && !isPlaying.value) {
@@ -995,7 +990,6 @@
    shouldAutoPlay.value = false;
  }
});
// 根据返回数据的个数去渲染时间轴
function updateTimelineRange() {
  if (waterTimestamps.value.length > 0) {
@@ -1006,7 +1000,6 @@
    duration.value = (last - first) / 1000; // 毫秒转秒
  }
}
onBeforeUnmount(() => {
  stopPlayback();
  destoryWaterPrimitive();
src/components/monifangzhen/echartInfo.vue
@@ -456,7 +456,7 @@
  const startUpdating = () => {
    if (updateInterval || dataIndex.value >= rainfallData.value.length) {
      console.log("Animation already running or completed");
      // console.log("Animation already running or completed");
      return;
    }
src/utils/water.js
@@ -47,7 +47,7 @@
  ];
  const levelCount = colorStops.length;
  const minAllowed = 0.005; // 最小允许值
  const minAllowed = 0.05; // 最小允许值
  const threshold = 1; // 小值与大值分界点
  let effectiveMin = Math.max(minFlowRate, minAllowed); // 最小不能小于 0.01