| | |
| | | <div class="timeline-container"> |
| | | <div class="controls"> |
| | | <div class="control-btn" @click="skipBackward"> |
| | | <img src="@/assets/img/timeline/left.png" class="fas fa-step-backward" /> |
| | | <img |
| | | src="@/assets/img/timeline/left.png" |
| | | class="fas fa-step-backward" |
| | | /> |
| | | </div> |
| | | <div class="control-btn play-btn" @click="togglePlay"> |
| | | <img v-show="isPlaying" src="@/assets/img/timeline/stop.png" /> |
| | | <img v-show="!isPlaying" src="@/assets/img/timeline/start.png" /> |
| | | </div> |
| | | <div class="control-btn" @click="skipForward"> |
| | | <img src="@/assets/img/timeline/right.png" class="fas fa-step-forward" /> |
| | | <img |
| | | src="@/assets/img/timeline/right.png" |
| | | class="fas fa-step-forward" |
| | | /> |
| | | </div> |
| | | <div class="speed-control" v-show="speedShow"> |
| | | <div @click="toggleSpeedMenu">{{ playbackRate }}X</div> |
| | | <div class="speed-menu" v-show="showSpeedMenu"> |
| | | <div v-for="rate in playbackRates" :key="rate" @click.capture="setPlaybackRate(rate)" |
| | | :class="{ active: playbackRate === rate }"> |
| | | <div |
| | | v-for="rate in playbackRates" |
| | | :key="rate" |
| | | @click.capture="setPlaybackRate(rate)" |
| | | :class="{ active: playbackRate === rate }" |
| | | > |
| | | {{ rate }}X |
| | | </div> |
| | | </div> |
| | |
| | | <div class="timeline"> |
| | | <div class="dates"> |
| | | <div class="current-date">当前播放时间:{{ currentPlayingTime }}</div> |
| | | <div v-for="(date, index) in visibleDates" :key="index" class="date-label"> |
| | | <div |
| | | v-for="(date, index) in visibleDates" |
| | | :key="index" |
| | | class="date-label" |
| | | > |
| | | <!-- {{ formatDate(date) }} --> |
| | | </div> |
| | | <div> |
| | | 专题渲染: |
| | | <el-switch v-model="isColorRenderEnabled" @change="handleColorRenderChange" style="margin-top: -3px" |
| | | :disabled="!isPlaying || !isWaterPrimitiveCreated" /> |
| | | <el-switch |
| | | v-model="isColorRenderEnabled" |
| | | @change="handleColorRenderChange" |
| | | style="margin-top: -3px" |
| | | :disabled="!isPlaying || !isWaterPrimitiveCreated" |
| | | /> |
| | | <!-- active-text="开" inactive-text="关" --> |
| | | </div> |
| | | </div> |
| | | <div class="timeline-track" ref="timelineTrack" @click="seekToPosition"> |
| | | <div class="timeline-progress" :style="{ width: progressPercentage + '%' }"></div> |
| | | <div class="timeline-cursor" :style="{ left: progressPercentage + '%' }"></div> |
| | | <div |
| | | class="timeline-progress" |
| | | :style="{ width: progressPercentage + '%' }" |
| | | ></div> |
| | | <div |
| | | class="timeline-cursor" |
| | | :style="{ left: progressPercentage + '%' }" |
| | | ></div> |
| | | <div class="scale-markers"> |
| | | <div class="scale-marker" style="left: 0%"></div> |
| | | <div class="scale-marker" style="left: 25%"></div> |
| | |
| | | <div class="scale-marker" style="left: 100%"></div> |
| | | </div> |
| | | <div class="time-markers"> |
| | | <div v-for="(time, index) in timeMarkers" :key="index" class="time-marker" |
| | | :style="{ left: `${index * 25}%`, transform: 'translateX(-50%)' }"> |
| | | <div |
| | | v-for="(time, index) in timeMarkers" |
| | | :key="index" |
| | | class="time-marker" |
| | | :style="{ left: `${index * 25}%`, transform: 'translateX(-50%)' }" |
| | | > |
| | | <div class="date-part">{{ time.split(" ")[0] }}</div> |
| | | <div class="time-part">{{ time.split(" ")[1] }}</div> |
| | | </div> |
| | |
| | | </div> |
| | | <div> |
| | | <div style="display: flex"> |
| | | <ratelevel ref="ratelevelRef" :playing-time="sendCurrentPlayingTime" |
| | | @finish-calculation="handleFinishCalculation" style=" |
| | | <ratelevel |
| | | ref="ratelevelRef" |
| | | :playing-time="sendCurrentPlayingTime" |
| | | @finish-calculation="handleFinishCalculation" |
| | | style=" |
| | | margin-top: 12px; |
| | | margin-left: 28px; |
| | | margin-right: 10px; |
| | | justify-content: flex-end; |
| | | " /> |
| | | <crossanalysis ref="crossRef" style=" |
| | | " |
| | | /> |
| | | <crossanalysis |
| | | ref="crossRef" |
| | | style=" |
| | | margin-top: 12px; |
| | | margin-left: 16px; |
| | | margin-right: 20px; |
| | | justify-content: flex-end; |
| | | " /> |
| | | " |
| | | /> |
| | | </div> |
| | | <el-button @click="handleBack" style=" |
| | | <el-button |
| | | @click="handleBack" |
| | | style=" |
| | | margin-top: 3px; |
| | | margin-left: 28px; |
| | | margin-right: 10px; |
| | | width: 75%; |
| | | height: 30%; |
| | | ">结束模拟</el-button> |
| | | " |
| | | >结束模拟</el-button |
| | | > |
| | | </div> |
| | | </div> |
| | | </template> |
| | |
| | | import { useSimStore } from "@/store/simulation"; |
| | | import { storeToRefs } from "pinia"; |
| | | const simStore = useSimStore(); |
| | | const { selectedScheme, frameNum, layerDate, schemWaterInfo } = storeToRefs(simStore); |
| | | const { selectedScheme, frameNum, layerDate, schemWaterInfo } = |
| | | storeToRefs(simStore); |
| | | import { clearAllPoints } from "@/utils/map"; |
| | | |
| | | const emit = defineEmits([ |
| | | "timeUpdate", |
| | |
| | | } |
| | | |
| | | // 触发进度更新 |
| | | const progress = currentTime.value / totalDuration; |
| | | emit("timeUpdate", progress * 100); |
| | | // const progress = currentTime.value / totalDuration; |
| | | // 实时模拟应该不用显示弹窗吧 |
| | | // emit("timeUpdate", progress * 100); |
| | | |
| | | // 如果需要触发某些更新函数,也可以保留 |
| | | updateWaterColorByTime(); |
| | |
| | | // 降雨数据相关变量 |
| | | let rainFallValues = ref([]); // 存储原始降雨量数据 |
| | | let minRainValue = ref(Infinity); |
| | | let averageRainIntensity = ref() |
| | | let averageRainIntensity = ref(); |
| | | let maxRainValue = ref(-Infinity); |
| | | // 获取降雨数据 |
| | | function getRainfallData() { |
| | |
| | | rainFallValues.value = hourlyRainfallList.map((r) => r.intensity); |
| | | // 计算平均雨强 |
| | | if (rainFallValues.value.length > 0) { |
| | | const sumIntensity = rainFallValues.value.reduce((sum, val) => sum + val, 0); |
| | | const sumIntensity = rainFallValues.value.reduce( |
| | | (sum, val) => sum + val, |
| | | 0 |
| | | ); |
| | | averageRainIntensity.value = sumIntensity / rainFallValues.value.length; |
| | | } else { |
| | | averageRainIntensity.value = 0; // 或者 null 表示无数据 |
| | |
| | | minRainValue.value, |
| | | maxRainValue.value |
| | | ); |
| | | |
| | | } |
| | | // 定义降雨等级及其对应的视觉参数 |
| | | const rainLevels = [ |
| | |
| | | // console.log("========================================"); |
| | | // console.log(`【时间戳】: ${new Date(currentTimeMs).toLocaleString()}`); |
| | | console.log( |
| | | `【累计降雨量 R】: ${currentTotal !== null ? currentTotal.toFixed(2) : "未知" |
| | | `【累计降雨量 R】: ${ |
| | | currentTotal !== null ? currentTotal.toFixed(2) : "未知" |
| | | } mm` |
| | | ); |
| | | // console.log(`【当前阶段】: 第 ${currentStage} 阶段`); |
| | |
| | | watersMaxHeight, |
| | | watersMinHeight |
| | | ); |
| | | const waterInfoArr = [watersMaxHeight, maxRainValue.value,averageRainIntensity.value] |
| | | schemWaterInfo.value = waterInfoArr |
| | | const waterInfoArr = [ |
| | | watersMaxHeight, |
| | | maxRainValue.value, |
| | | averageRainIntensity.value, |
| | | ]; |
| | | schemWaterInfo.value = waterInfoArr; |
| | | // 更新时间轴相关数据 |
| | | if (timestamps) { |
| | | frameNum.value = timestamps.length; |
| | |
| | | watch( |
| | | () => finishPlay.value, |
| | | (newVal) => { |
| | | if (newVal && selectedScheme.value.type === 2) { |
| | | if ( |
| | | newVal && |
| | | selectedScheme.value.type === 2 && |
| | | simStore.rePlayList.length > 0 |
| | | ) { |
| | | handlePlayFinished(); |
| | | } |
| | | } |
| | |
| | | if (selectedScheme.value.type === 2) { |
| | | try { |
| | | await ElMessageBox.confirm("方案未停止时结束模拟后,后台将停止计算", { |
| | | confirmButtonText: "返回列表", |
| | | cancelButtonText: "结束模拟", |
| | | confirmButtonText: "结束模拟", |
| | | cancelButtonText: "返回列表", |
| | | type: "warning", |
| | | }); |
| | | // 用户点击了确认,这里不执行任何操作,仅关闭对话框 |
| | | |
| | | const res = await stopSim(selectedScheme.value.id); |
| | | if (res.code == 404) { |
| | | ElMessage.warning("该服务已停止"); |
| | | } else { |
| | | ElMessage.success("服务正在停止中"); |
| | | } |
| | | } catch (error) { |
| | | stopSim(selectedScheme.value.id).then((res) => { |
| | | if (res.code == 404) { |
| | | ElMessage.warning("该服务已停止"); |
| | | } else { |
| | | ElMessage.success("服务正在停止中"); |
| | | } |
| | | }); |
| | | // return; |
| | | // 用户点击了【返回列表】或者出现错误 |
| | | return; |
| | | } |
| | | } |
| | | // 不管type是不是2,最终都执行结束模拟的操作 |
| | | |
| | | // 不管 type 是不是 2,最终都执行结束模拟操作 |
| | | endSimulation(); |
| | | } |
| | | |
| | | async function endSimulation() { |
| | | clearAllPoints(); |
| | | simStore.openDia = true; |
| | | simStore.crossSection = []; |
| | | // 结束模拟之后清除layer列表 |
| | | simStore.rePlayList = []; |
| | | console.log(simStore.rePlayList, "结束模拟清除rePlayListrePlayList列表"); |
| | | EventBus.emit("close-time"); |
| | | endSimulate(); |
| | | isWaterPrimitiveCreated.value = false; |