1
wangjuncheng
2025-06-10 6d989ac3e9902f7dfbc1d8472270929a04ddb517
src/components/menu/TimeLine.vue
@@ -59,7 +59,7 @@
          @finish-calculation="handleFinishCalculation"
          style="margin-top: 12px; margin-left: 28px; margin-right: 10px;justify-content: flex-end;" />
        <crossanalysis ref="crossRef" style="margin-top: 12px; margin-left: 16px; margin-right: 20px;justify-content: flex-end;" />
      </div>
      <el-button @click="handleBack" style="margin-top: 3px; margin-left: 28px; margin-right: 10px;width: 75%;height: 30%;">结束模拟</el-button>
    </div>
@@ -136,6 +136,8 @@
  rainColor: "#99B3CC",
  rainDensity: 30 // 雨的密度
});
let minFlowRate =ref()
let maxFlowRate =ref()
// 计算属性
const progressPercentage = computed(
  () => (currentTime.value / duration.value) * 100
@@ -164,7 +166,9 @@
        baseUrl: `/simu/${serviceInfo}`,
        // baseUrl: `/simu/c2h1dc`,
        interval: intervalMap[playbackRate.value],
        colorRender: isColorRenderEnabled.value
        colorRender: isColorRenderEnabled.value,
        minFlowRate:0.1,
        maxFlowRate:10,
      });
      isWaterPrimitiveCreated.value = true;
    } else {
@@ -300,8 +304,8 @@
    min: 10,
    max: 24.9,
    size: 0.7,
    speed: 40,
    density: 35,
    speed: 28,
    density: 23,
    color: '#ADD8E6'
  },
  {
@@ -309,8 +313,8 @@
    min: 25,
    max: 49.9,
    size: 1.0,
    speed: 70,
    density: 60,
    speed: 36,
    density: 31,
    color: '#ADD8E6'
  },
  {
@@ -318,16 +322,16 @@
    min: 50,
    max: 99.9,
    size: 1.3,
    speed: 90,
    density: 80,
    speed: 42,
    density: 39,
    color: '#ADD8E6'
  },
  {
    name: '大暴雨',
    min: 100,
    size: 1.6,
    speed: 110,
    density: 100,
    speed: 50,
    density: 47,
    color: '#ADD8E6'
  }
];
@@ -339,7 +343,7 @@
    }
  }
  // 默认无雨状态
  return { name: '无雨', size: 0.5, speed: 30, density: 20, color: '#F0F8FF' };
  return { name: '无雨', size: 0.3, speed: 10, density: 10, color: '#F0F8FF' };
}
// 根据播放进度更新天气效果(已优化)
let lastUsedIndex = -1; // 缓存上一次使用的索引,防止重复更新
@@ -355,7 +359,8 @@
  const nextRain = rainFallValues.value[nextIndex];
  // 启用插值(alpha 平滑过渡)
  const alpha = floatIndex - index;
  const rainValue = currentRain + (nextRain - currentRain) * alpha;
  // const rainValue = currentRain + (nextRain - currentRain) * alpha;
  const rainValue = currentRain + (nextRain - currentRain)
  // 打印当前处理的雨量数据
  // console.log(`正在处理的雨量数据点: 当前=${currentRain}, 下一个=${nextRain}, 插值后=${rainValue.toFixed(2)}, 索引=${index}`);
  // 如果当前索引未变化且插值差异不大,跳过重复更新
@@ -370,12 +375,12 @@
  // 获取对应的雨形配置
  const rainLevel = getRainLevel(rainValue);
  if (rainLevel.name === '无雨') {
    // 无雨状态:清除雨效
    mapUtils.delRain();
    console.log('执行了无雨状态,清除了雨效');
    return;
  }
  // if (rainLevel.name === '无雨') {
  //   // 无雨状态:清除雨效
  //   mapUtils.delRain();
  //   console.log('执行了无雨状态,清除了雨效');
  //   return;
  // }
  // 非无雨状态:构建雨滴参数并更新雨效
  const rainParams = {
@@ -384,7 +389,7 @@
    rainDensity: rainLevel.density,
    rainColor: rainLevel.color
  };
  // console.log('当前雨量数据:', rainValue, '当前雨形:', rainLevel);
  console.log('当前雨量数据:', rainValue, '当前雨形:', rainLevel);
  // 调用工具方法更新雨效
  mapUtils.toggleRain(rainParams, true);
}
@@ -540,6 +545,8 @@
    // 当前方案的所有信息
    const schemeInfo = selectedScheme.value;
    serviceInfo = schemeInfo.serviceName;
    // minFlowRate = schemeInfo.最小水深
    // maxFlowRate = schemeInfo.最大水深
    // console.log('获取到的 serviceName:', serviceInfo);
    getRainfallData()
    // 根据layer.json去获取时间轴信息
@@ -588,6 +595,8 @@
  }
  if (crossRef.value) {
    crossRef.value.clearPoints();
    console.log('执行删除点功能');
  }
  emit("isColorRender", false);
  setTimeout(() => {