From 94dc999e2107401cb9e6c65dd67bc17eecc5e548 Mon Sep 17 00:00:00 2001 From: guonan <guonan201020@163.com> Date: 星期一, 28 四月 2025 11:40:02 +0800 Subject: [PATCH] 修改图表时间以及将避险点修改为避险场所 --- src/components/tools/LayerTree.vue | 14 src/api/hpApi.js | 5 src/store/simAPI.js | 4 src/components/menu/Function.vue | 4 src/components/monifangzhen/echartInfo.vue | 1665 ++-------------------------------------------- src/views/left/KGSimOption/PredictiveSimulation.vue | 210 ++--- src/components/menu/TimeLine.vue | 145 +++- src/views/mnfz.vue | 18 8 files changed, 332 insertions(+), 1,733 deletions(-) diff --git a/src/api/hpApi.js b/src/api/hpApi.js index 1075faf..fa674f7 100644 --- a/src/api/hpApi.js +++ b/src/api/hpApi.js @@ -72,9 +72,8 @@ // 鑾峰彇闆ㄩ噺鏁版嵁 export async function getRainfallData(data) { const response = await axios.post("/hp/rainfallCountyCity/getData", { - filterObject: { - year: 2024, // 鍔ㄦ�佷紶鍏ョ殑骞翠唤鍙傛暟 - }, + filterObject: {}, + "pageSize": 1000 }); console.log("getRainfallData:", response); return response.data; diff --git a/src/components/menu/Function.vue b/src/components/menu/Function.vue index e0eb9e6..b34b83c 100644 --- a/src/components/menu/Function.vue +++ b/src/components/menu/Function.vue @@ -29,7 +29,7 @@ }, { icon: require("@/assets/img/menu/bns.png"), - name: "閬块櫓鐐�", + name: "閬块櫓鍦烘墍", Visible: false, }, { @@ -62,7 +62,7 @@ desc = { Simulation: true, type: "POI", tag: "POI-Sound", Visible: item.Visible } ps.emitMessage(desc) break - case "閬块櫓鐐�": + case "閬块櫓鍦烘墍": if (item.Visible) { loadAreaPolygon("/json/emergency_area.geojson") } else { diff --git a/src/components/menu/TimeLine.vue b/src/components/menu/TimeLine.vue index dd4acc6..438e694 100644 --- a/src/components/menu/TimeLine.vue +++ b/src/components/menu/TimeLine.vue @@ -2,20 +2,30 @@ <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"> <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> @@ -24,24 +34,40 @@ <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 class="current-date">褰撳墠鎾斁鏃堕棿锛歿{ currentPlayingTime }}</div> + <div + v-for="(date, index) in visibleDates" + :key="index" + class="date-label" + > <!-- {{ formatDate(date) }} --> </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="time-markers"> - <div v-for="(time, index) in timeMarkers" :key="index" class="time-marker"> + <div + v-for="(time, index) in timeMarkers" + :key="index" + class="time-marker" + > {{ time }} </div> </div> </div> </div> - <el-button @click="handleBack" style="margin-top: 26px;margin-left: 30px;margin-right: 10px;">缁撴潫妯℃嫙</el-button> + <el-button + @click="handleBack" + style="margin-top: 26px; margin-left: 30px; margin-right: 10px" + >缁撴潫妯℃嫙</el-button + > </div> </template> @@ -59,7 +85,7 @@ import { createWaterPrimitive, destoryWaterPrimitive } from "@/utils/water"; import { fetchWaterSimulationData } from "@/api/trApi.js"; import { EventBus } from "@/eventBus"; -import { ElMessage } from 'element-plus'; +import { ElMessage } from "element-plus"; const emit = defineEmits(["timeUpdate", "isPlaying", "playbackFinished"]); @@ -91,7 +117,9 @@ // 璁$畻灞炴�� const startDate = computed(() => dayjs(props.waterSimulateParams.date[0])); const endDate = computed(() => dayjs(props.waterSimulateParams.date[1])); -const progressPercentage = computed(() => (currentTime.value / duration.value) * 100); +const progressPercentage = computed( + () => (currentTime.value / duration.value) * 100 +); const visibleDates = computed(() => Array.from( new Set(waterTimestamps.value.map((ts) => dayjs(ts).format("YYYY-MM-DD"))) @@ -102,7 +130,8 @@ // 鎾斁鎺у埗 const togglePlay = () => { // 濡傛灉褰撳墠鏄仠姝㈢姸鎬佷笖宸茬粡鎾斁瀹屾瘯锛岀偣鍑绘椂閲嶇疆鏃堕棿 - if (!isPlaying.value && currentTime.value >= duration.value) currentTime.value = 0; + if (!isPlaying.value && currentTime.value >= duration.value) + currentTime.value = 0; isPlaying.value = !isPlaying.value; emit("isPlaying", isPlaying.value); if (isPlaying.value) { @@ -113,9 +142,9 @@ }; const intervalMap = { 1: 1000, // 1鍊嶉�� - 2: 500, // 2鍊嶉�� - 4: 250, // 4鍊嶉�� - 8: 125, // 8鍊嶉�� + 2: 500, // 2鍊嶉�� + 4: 250, // 4鍊嶉�� + 8: 125, // 8鍊嶉�� }; const startPlayback = () => { // 鏍规嵁褰撳墠鍊嶉�熻幏鍙栧搴旂殑 interval @@ -141,8 +170,10 @@ }; const stopPlayback = () => clearInterval(playInterval); -const skipForward = () => (currentTime.value = Math.min(currentTime.value + 1, duration.value)); // 鍚戝墠璺宠浆1绉� -const skipBackward = () => (currentTime.value = Math.max(currentTime.value - 1, 0)); // 鍚戝悗璺宠浆1绉� +const skipForward = () => + (currentTime.value = Math.min(currentTime.value + 1, duration.value)); // 鍚戝墠璺宠浆1绉� +const skipBackward = () => + (currentTime.value = Math.max(currentTime.value - 1, 0)); // 鍚戝悗璺宠浆1绉� const toggleSpeedMenu = () => (showSpeedMenu.value = !showSpeedMenu.value); const setPlaybackRate = (rate) => { playbackRate.value = rate; @@ -155,27 +186,50 @@ currentTime.value = Math.round(percentage * duration.value); emit("timeUpdate", progressPercentage.value); if (waterTimestamps.value.length > 0) { - const clickedTimestamp = dayjs(waterTimestamps.value[0]).add(currentTime.value, "second"); - console.log("Clicked timestamp:", clickedTimestamp.valueOf(), clickedTimestamp.format("YYYY-MM-DD HH:mm:ss")); + const clickedTimestamp = dayjs(waterTimestamps.value[0]).add( + currentTime.value, + "second" + ); + console.log( + "Clicked timestamp:", + clickedTimestamp.valueOf(), + clickedTimestamp.format("YYYY-MM-DD HH:mm:ss") + ); } }; -watch(() => currentTime.value, () => { - if (waterTimestamps.value.length > 0) { - currentPlayingTime.value = dayjs(waterTimestamps.value[0]) - .add(currentTime.value, "second") - .format("YYYY-MM-DD mm:ss"); +watch( + () => currentTime.value, + () => { + if (waterTimestamps.value.length > 0) { + currentPlayingTime.value = dayjs(waterTimestamps.value[0]) + .add(currentTime.value, "second") + .format("YYYY-MM-DD mm:ss"); + + EventBus.emit("time-update", currentPlayingTime.value); + } } -}); +); // 鏃堕棿鏍囪鐢熸垚 function generateTimeMarkers(timestamps) { if (!timestamps || timestamps.length === 0) return []; const sorted = [...timestamps].sort((a, b) => dayjs(a).diff(dayjs(b))); - const interval = Math.floor(dayjs(sorted.at(-1)).diff(dayjs(sorted[0]), "second") / 7); - return Array.from({ length: 8 }, (_, i) => dayjs(sorted[0]).add(i * interval, "second").format("mm:ss")); + const interval = Math.floor( + dayjs(sorted.at(-1)).diff(dayjs(sorted[0]), "second") / 7 + ); + return Array.from({ length: 8 }, (_, i) => + dayjs(sorted[0]) + .add(i * interval, "second") + .format("mm:ss") + ); } -watch(() => waterTimestamps.value, (newTimestamps) => { - if (newTimestamps.length > 0) timeMarkers.value = generateTimeMarkers(newTimestamps); -}, { immediate: true }); +watch( + () => waterTimestamps.value, + (newTimestamps) => { + if (newTimestamps.length > 0) + timeMarkers.value = generateTimeMarkers(newTimestamps); + }, + { immediate: true } +); onMounted(async () => { try { @@ -184,7 +238,9 @@ waterTimestamps.value = timestamps; updateTimelineRange(); timeMarkers.value = generateTimeMarkers(timestamps); - currentPlayingTime.value = dayjs(timestamps[0]).format("YYYY-MM-DD HH:mm:ss"); + currentPlayingTime.value = dayjs(timestamps[0]).format( + "YYYY-MM-DD HH:mm:ss" + ); } } catch (error) { console.error("Error loading water simulation data:", error); @@ -193,21 +249,30 @@ function updateTimelineRange() { if (waterTimestamps.value.length > 0) { - const [first, last] = [waterTimestamps.value[0], waterTimestamps.value.at(-1)]; - props.waterSimulateParams.date = [dayjs(first).toISOString(), dayjs(last).toISOString()]; + const [first, last] = [ + waterTimestamps.value[0], + waterTimestamps.value.at(-1), + ]; + props.waterSimulateParams.date = [ + dayjs(first).toISOString(), + dayjs(last).toISOString(), + ]; duration.value = dayjs(last).diff(dayjs(first), "second"); - console.log("Updated timeline range:", { ...props.waterSimulateParams, duration: duration.value }); + console.log("Updated timeline range:", { + ...props.waterSimulateParams, + duration: duration.value, + }); } } onBeforeUnmount(() => { stopPlayback(); - destoryWaterPrimitive(); + // destoryWaterPrimitive(); }); const { endSimulate } = inject("simulateActions"); function handleBack() { - ElMessage({ message: '妯℃嫙杩涚▼姝e湪鍏抽棴涓�...', type: 'success' }); // 鏄剧ず娑堟伅閫氱煡鐢ㄦ埛妯℃嫙杩涚▼姝e湪鍏抽棴 + ElMessage({ message: "妯℃嫙杩涚▼姝e湪鍏抽棴涓�...", type: "success" }); // 鏄剧ず娑堟伅閫氱煡鐢ㄦ埛妯℃嫙杩涚▼姝e湪鍏抽棴 endSimulate(); - destoryWaterPrimitive(); + // destoryWaterPrimitive(); EventBus.emit("hide-schemeInfo"); } </script> diff --git a/src/components/monifangzhen/echartInfo.vue b/src/components/monifangzhen/echartInfo.vue index 9ea190d..ce0892d 100644 --- a/src/components/monifangzhen/echartInfo.vue +++ b/src/components/monifangzhen/echartInfo.vue @@ -25,21 +25,71 @@ <p style="cursor: pointer" @click="debuffClick">濞佽儊瀵硅薄</p> <div class="echartBox"> <div class="table-container" ref="tableContainer"> - <el-table :data="tableData" style="width: 100%; font-size: 10px" height="100%" @row-click="handleRowClick"> + <el-table + :data="tableData" + style="width: 100%; font-size: 10px" + height="100%" + @row-click="handleRowClick" + > <el-table-column label="褰卞搷鍖哄悕绉�" width="30" align="center"> <template #default="scope"> 褰卞搷鍖簕{ scope.row.zoneId }} </template> </el-table-column> - <el-table-column prop="time" label="褰卞搷鏃堕棿" width="50" align="center"></el-table-column> - <el-table-column prop="population" label="浜哄憳(浜�)" width="23" align="center"></el-table-column> - <el-table-column prop="room" label="鎴垮眿(闂�)" width="23" align="center"></el-table-column> - <el-table-column prop="households" label="鎴锋暟(鎴�)" width="23" align="center"></el-table-column> - <el-table-column prop="property" label="璐骇(涓囧厓)" width="23" align="center"></el-table-column> - <el-table-column prop="maxDepth" label="鏈�澶ф按娣�(绫�)" width="28" align="center"></el-table-column> - <el-table-column prop="maxVelocity" label="鏈�澶ф祦閫�(m/s)" width="35" align="center"></el-table-column> - <el-table-column prop="raininess" label="闆ㄥ己(mm/h)" width="28" align="center"></el-table-column> - <el-table-column prop="warningLevel" label="棰勮绛夌骇" width="28" align="center"></el-table-column> + <el-table-column + prop="time" + label="褰卞搷鏃堕棿" + width="50" + align="center" + ></el-table-column> + <el-table-column + prop="population" + label="浜哄憳(浜�)" + width="23" + align="center" + ></el-table-column> + <el-table-column + prop="room" + label="鎴垮眿(闂�)" + width="23" + align="center" + ></el-table-column> + <el-table-column + prop="households" + label="鎴锋暟(鎴�)" + width="23" + align="center" + ></el-table-column> + <el-table-column + prop="property" + label="璐骇(涓囧厓)" + width="23" + align="center" + ></el-table-column> + <el-table-column + prop="maxDepth" + label="鏈�澶ф按娣�(绫�)" + width="28" + align="center" + ></el-table-column> + <el-table-column + prop="maxVelocity" + label="鏈�澶ф祦閫�(m/s)" + width="35" + align="center" + ></el-table-column> + <el-table-column + prop="raininess" + label="闆ㄥ己(mm/h)" + width="28" + align="center" + ></el-table-column> + <el-table-column + prop="warningLevel" + label="棰勮绛夌骇" + width="28" + align="center" + ></el-table-column> </el-table> </div> </div> @@ -51,7 +101,14 @@ <script setup> import * as echarts from "echarts"; import { EventBus } from "@/eventBus"; // 寮曞叆浜嬩欢鎬荤嚎 -import { ref, onMounted, onBeforeUnmount, nextTick, watch, onUnmounted } from "vue"; +import { + ref, + onMounted, + onBeforeUnmount, + nextTick, + watch, + onUnmounted, +} from "vue"; import dayjs from "dayjs"; import { getRainfall } from "@/api"; @@ -64,6 +121,8 @@ const chart2Data = ref(null); let intervalId1 = null; let intervalId2 = null; + +const nowTime = ref(null); const isFinished = ref(true); @@ -188,1508 +247,6 @@ ]); const rainChangeShow = ref(false); const tableContainer = ref(null); -const rainfallData = ref([ - { - time: "2023-07-30 00:00:00", - total: 0.2, - value: 0.2, - }, - { - time: "2023-07-30 00:10:00", - total: 0.5, - value: 0.3, - }, - { - time: "2023-07-30 00:20:00", - total: 0.6, - value: 0.1, - }, - { - time: "2023-07-30 00:30:00", - total: 0.7, - value: 0.1, - }, - { - time: "2023-07-30 00:40:00", - total: 0.8, - value: 0.1, - }, - { - time: "2023-07-30 00:50:00", - total: 2.2, - value: 1.4, - }, - { - time: "2023-07-30 01:00:00", - total: 9.4, - value: 7.2, - }, - { - time: "2023-07-30 01:10:00", - total: 9.5, - value: 0.1, - }, - { - time: "2023-07-30 01:20:00", - total: 9.6, - value: 0.1, - }, - { - time: "2023-07-30 01:30:00", - total: 9.7, - value: 0.1, - }, - { - time: "2023-07-30 01:40:00", - total: 9.8, - value: 0.1, - }, - { - time: "2023-07-30 01:50:00", - total: 9.9, - value: 0.1, - }, - { - time: "2023-07-30 02:00:00", - total: 19.5, - value: 9.6, - }, - { - time: "2023-07-30 02:10:00", - total: 19.7, - value: 0.2, - }, - { - time: "2023-07-30 02:20:00", - total: 20.5, - value: 0.8, - }, - { - time: "2023-07-30 02:30:00", - total: 20.9, - value: 0.4, - }, - { - time: "2023-07-30 02:40:00", - total: 21.3, - value: 0.4, - }, - { - time: "2023-07-30 02:50:00", - total: 21.8, - value: 0.5, - }, - { - time: "2023-07-30 03:00:00", - total: 21.9, - value: 0.1, - }, - { - time: "2023-07-30 03:10:00", - total: 22.1, - value: 0.2, - }, - { - time: "2023-07-30 03:20:00", - total: 22.4, - value: 0.3, - }, - { - time: "2023-07-30 03:30:00", - total: 22.5, - value: 0.1, - }, - { - time: "2023-07-30 03:40:00", - total: 23.1, - value: 0.6, - }, - { - time: "2023-07-30 03:50:00", - total: 25.1, - value: 2.0, - }, - { - time: "2023-07-30 04:00:00", - total: 27.7, - value: 2.6, - }, - { - time: "2023-07-30 04:10:00", - total: 28.1, - value: 0.4, - }, - { - time: "2023-07-30 04:20:00", - total: 29.0, - value: 0.9, - }, - { - time: "2023-07-30 04:30:00", - total: 30.5, - value: 1.5, - }, - { - time: "2023-07-30 04:40:00", - total: 31.3, - value: 0.8, - }, - { - time: "2023-07-30 04:50:00", - total: 32.1, - value: 0.8, - }, - { - time: "2023-07-30 05:00:00", - total: 33.1, - value: 1.0, - }, - { - time: "2023-07-30 05:10:00", - total: 43.5, - value: 10.4, - }, - { - time: "2023-07-30 05:20:00", - total: 45.9, - value: 2.4, - }, - { - time: "2023-07-30 05:30:00", - total: 47.3, - value: 1.4, - }, - { - time: "2023-07-30 05:40:00", - total: 48.5, - value: 1.2, - }, - { - time: "2023-07-30 05:50:00", - total: 49.3, - value: 0.8, - }, - { - time: "2023-07-30 06:00:00", - total: 50.1, - value: 0.8, - }, - { - time: "2023-07-30 06:10:00", - total: 51.1, - value: 1.0, - }, - { - time: "2023-07-30 06:20:00", - total: 52.1, - value: 1.0, - }, - { - time: "2023-07-30 06:30:00", - total: 52.7, - value: 0.6, - }, - { - time: "2023-07-30 06:40:00", - total: 52.9, - value: 0.2, - }, - { - time: "2023-07-30 06:50:00", - total: 53.3, - value: 0.4, - }, - { - time: "2023-07-30 07:00:00", - total: 53.7, - value: 0.4, - }, - { - time: "2023-07-30 07:10:00", - total: 60.3, - value: 6.6, - }, - { - time: "2023-07-30 07:20:00", - total: 60.9, - value: 0.6, - }, - { - time: "2023-07-30 07:30:00", - total: 61.5, - value: 0.6, - }, - { - time: "2023-07-30 07:40:00", - total: 62.7, - value: 1.2, - }, - { - time: "2023-07-30 07:50:00", - total: 63.3, - value: 0.6, - }, - { - time: "2023-07-30 08:00:00", - total: 63.9, - value: 0.6, - }, - { - time: "2023-07-30 08:10:00", - total: 65.3, - value: 1.4, - }, - { - time: "2023-07-30 08:20:00", - total: 67.7, - value: 2.4, - }, - { - time: "2023-07-30 08:30:00", - total: 68.9, - value: 1.2, - }, - { - time: "2023-07-30 08:40:00", - total: 70.1, - value: 1.2, - }, - { - time: "2023-07-30 08:50:00", - total: 71.7, - value: 1.6, - }, - { - time: "2023-07-30 09:00:00", - total: 75.1, - value: 3.4, - }, - { - time: "2023-07-30 09:10:00", - total: 85.9, - value: 10.8, - }, - { - time: "2023-07-30 09:20:00", - total: 87.9, - value: 2.0, - }, - { - time: "2023-07-30 09:30:00", - total: 89.3, - value: 1.4, - }, - { - time: "2023-07-30 09:40:00", - total: 90.1, - value: 0.8, - }, - { - time: "2023-07-30 09:50:00", - total: 92.7, - value: 2.6, - }, - { - time: "2023-07-30 10:00:00", - total: 95.3, - value: 2.6, - }, - { - time: "2023-07-30 10:10:00", - total: 98.1, - value: 2.8, - }, - { - time: "2023-07-30 10:20:00", - total: 100.5, - value: 2.4, - }, - { - time: "2023-07-30 10:30:00", - total: 102.9, - value: 2.4, - }, - { - time: "2023-07-30 10:40:00", - total: 106.9, - value: 4.0, - }, - { - time: "2023-07-30 10:50:00", - total: 109.5, - value: 2.6, - }, - { - time: "2023-07-30 11:00:00", - total: 110.5, - value: 1.0, - }, - { - time: "2023-07-30 11:10:00", - total: 118.9, - value: 8.4, - }, - { - time: "2023-07-30 11:20:00", - total: 121.3, - value: 2.4, - }, - { - time: "2023-07-30 11:30:00", - total: 123.5, - value: 2.2, - }, - { - time: "2023-07-30 11:40:00", - total: 126.3, - value: 2.8, - }, - { - time: "2023-07-30 11:50:00", - total: 128.7, - value: 2.4, - }, - { - time: "2023-07-30 12:00:00", - total: 129.7, - value: 1.0, - }, - { - time: "2023-07-30 12:10:00", - total: 130.5, - value: 0.8, - }, - { - time: "2023-07-30 12:20:00", - total: 131.7, - value: 1.2, - }, - { - time: "2023-07-30 12:30:00", - total: 133.3, - value: 1.6, - }, - { - time: "2023-07-30 12:40:00", - total: 136.3, - value: 3.0, - }, - { - time: "2023-07-30 12:50:00", - total: 139.5, - value: 3.2, - }, - { - time: "2023-07-30 13:00:00", - total: 141.9, - value: 2.4, - }, - { - time: "2023-07-30 13:10:00", - total: 144.5, - value: 2.6, - }, - { - time: "2023-07-30 13:20:00", - total: 154.1, - value: 9.6, - }, - { - time: "2023-07-30 13:30:00", - total: 155.9, - value: 1.8, - }, - { - time: "2023-07-30 13:40:00", - total: 157.7, - value: 1.8, - }, - { - time: "2023-07-30 13:50:00", - total: 160.1, - value: 2.4, - }, - { - time: "2023-07-30 14:00:00", - total: 163.1, - value: 3.0, - }, - { - time: "2023-07-30 14:10:00", - total: 165.1, - value: 2.0, - }, - { - time: "2023-07-30 14:20:00", - total: 167.1, - value: 2.0, - }, - { - time: "2023-07-30 14:30:00", - total: 168.9, - value: 1.8, - }, - { - time: "2023-07-30 14:40:00", - total: 170.7, - value: 1.8, - }, - { - time: "2023-07-30 14:50:00", - total: 172.1, - value: 1.4, - }, - { - time: "2023-07-30 15:00:00", - total: 173.9, - value: 1.8, - }, - { - time: "2023-07-30 15:10:00", - total: 177.9, - value: 4.0, - }, - { - time: "2023-07-30 15:20:00", - total: 179.9, - value: 2.0, - }, - { - time: "2023-07-30 15:30:00", - total: 186.1, - value: 6.2, - }, - { - time: "2023-07-30 15:40:00", - total: 188.9, - value: 2.8, - }, - { - time: "2023-07-30 15:50:00", - total: 192.1, - value: 3.2, - }, - { - time: "2023-07-30 16:00:00", - total: 194.1, - value: 2.0, - }, - { - time: "2023-07-30 16:10:00", - total: 196.9, - value: 2.8, - }, - { - time: "2023-07-30 16:20:00", - total: 208.9, - value: 12.0, - }, - { - time: "2023-07-30 16:30:00", - total: 211.9, - value: 3.0, - }, - { - time: "2023-07-30 16:40:00", - total: 216.7, - value: 4.8, - }, - { - time: "2023-07-30 16:50:00", - total: 223.5, - value: 6.8, - }, - { - time: "2023-07-30 17:00:00", - total: 228.1, - value: 4.6, - }, - { - time: "2023-07-30 17:10:00", - total: 232.3, - value: 4.2, - }, - { - time: "2023-07-30 17:20:00", - total: 234.7, - value: 2.4, - }, - { - time: "2023-07-30 17:30:00", - total: 237.7, - value: 3.0, - }, - { - time: "2023-07-30 17:40:00", - total: 241.3, - value: 3.6, - }, - { - time: "2023-07-30 17:50:00", - total: 245.1, - value: 3.8, - }, - { - time: "2023-07-30 18:00:00", - total: 250.3, - value: 5.2, - }, - { - time: "2023-07-30 18:10:00", - total: 258.1, - value: 7.8, - }, - { - time: "2023-07-30 18:20:00", - total: 265.1, - value: 7.0, - }, - { - time: "2023-07-30 18:30:00", - total: 268.3, - value: 3.2, - }, - { - time: "2023-07-30 18:40:00", - total: 271.9, - value: 3.6, - }, - { - time: "2023-07-30 18:50:00", - total: 283.7, - value: 11.8, - }, - { - time: "2023-07-30 19:00:00", - total: 287.9, - value: 4.2, - }, - { - time: "2023-07-30 19:10:00", - total: 291.3, - value: 3.4, - }, - { - time: "2023-07-30 19:20:00", - total: 295.1, - value: 3.8, - }, - { - time: "2023-07-30 19:30:00", - total: 300.7, - value: 5.6, - }, - { - time: "2023-07-30 19:40:00", - total: 306.3, - value: 5.6, - }, - { - time: "2023-07-30 19:50:00", - total: 312.1, - value: 5.8, - }, - { - time: "2023-07-30 20:00:00", - total: 317.7, - value: 5.6, - }, - { - time: "2023-07-30 20:10:00", - total: 325.9, - value: 8.2, - }, - { - time: "2023-07-30 20:20:00", - total: 343.3, - value: 17.4, - }, - { - time: "2023-07-30 20:30:00", - total: 353.7, - value: 10.4, - }, - { - time: "2023-07-30 20:40:00", - total: 361.7, - value: 8.0, - }, - { - time: "2023-07-30 20:50:00", - total: 366.7, - value: 5.0, - }, - { - time: "2023-07-30 21:00:00", - total: 369.9, - value: 3.2, - }, - { - time: "2023-07-30 21:10:00", - total: 372.9, - value: 3.0, - }, - { - time: "2023-07-30 21:20:00", - total: 374.3, - value: 1.4, - }, - { - time: "2023-07-30 21:30:00", - total: 376.7, - value: 2.4, - }, - { - time: "2023-07-30 21:40:00", - total: 379.5, - value: 2.8, - }, - { - time: "2023-07-30 21:50:00", - total: 384.5, - value: 5.0, - }, - { - time: "2023-07-30 22:00:00", - total: 387.1, - value: 2.6, - }, - { - time: "2023-07-30 22:10:00", - total: 387.5, - value: 0.4, - }, - { - time: "2023-07-30 22:20:00", - total: 388.9, - value: 1.4, - }, - { - time: "2023-07-30 22:30:00", - total: 398.5, - value: 9.6, - }, - { - time: "2023-07-30 22:40:00", - total: 400.1, - value: 1.6, - }, - { - time: "2023-07-30 22:50:00", - total: 401.7, - value: 1.6, - }, - { - time: "2023-07-30 23:00:00", - total: 403.1, - value: 1.4, - }, - { - time: "2023-07-30 23:10:00", - total: 404.7, - value: 1.6, - }, - { - time: "2023-07-30 23:20:00", - total: 406.5, - value: 1.8, - }, - { - time: "2023-07-30 23:30:00", - total: 412.3, - value: 5.8, - }, - { - time: "2023-07-30 23:40:00", - total: 417.5, - value: 5.2, - }, - { - time: "2023-07-30 23:50:00", - total: 420.1, - value: 2.6, - }, - { - time: "2023-07-31 00:00:00", - total: 422.3, - value: 2.2, - }, - { - time: "2023-07-31 00:10:00", - total: 425.5, - value: 3.2, - }, - { - time: "2023-07-31 00:20:00", - total: 426.3, - value: 0.8, - }, - { - time: "2023-07-31 00:30:00", - total: 427.7, - value: 1.4, - }, - { - time: "2023-07-31 00:40:00", - total: 428.5, - value: 0.8, - }, - { - time: "2023-07-31 00:50:00", - total: 429.3, - value: 0.8, - }, - { - time: "2023-07-31 01:00:00", - total: 434.9, - value: 5.6, - }, - { - time: "2023-07-31 01:10:00", - total: 437.5, - value: 2.6, - }, - { - time: "2023-07-31 01:20:00", - total: 438.3, - value: 0.8, - }, - { - time: "2023-07-31 01:30:00", - total: 439.9, - value: 1.6, - }, - { - time: "2023-07-31 01:40:00", - total: 442.5, - value: 2.6, - }, - { - time: "2023-07-31 01:50:00", - total: 446.9, - value: 4.4, - }, - { - time: "2023-07-31 02:00:00", - total: 449.9, - value: 3.0, - }, - { - time: "2023-07-31 02:10:00", - total: 450.9, - value: 1.0, - }, - { - time: "2023-07-31 02:20:00", - total: 451.9, - value: 1.0, - }, - { - time: "2023-07-31 02:30:00", - total: 452.7, - value: 0.8, - }, - { - time: "2023-07-31 02:40:00", - total: 453.9, - value: 1.2, - }, - { - time: "2023-07-31 02:50:00", - total: 454.3, - value: 0.4, - }, - { - time: "2023-07-31 03:00:00", - total: 455.3, - value: 1.0, - }, - { - time: "2023-07-31 03:10:00", - total: 455.9, - value: 0.6, - }, - { - time: "2023-07-31 03:20:00", - total: 458.7, - value: 2.8, - }, - { - time: "2023-07-31 03:30:00", - total: 459.4, - value: 0.7, - }, - { - time: "2023-07-31 03:40:00", - total: 461.5, - value: 2.1, - }, - { - time: "2023-07-31 03:50:00", - total: 466.9, - value: 5.4, - }, - { - time: "2023-07-31 04:00:00", - total: 467.3, - value: 0.4, - }, - { - time: "2023-07-31 04:10:00", - total: 467.9, - value: 0.6, - }, - { - time: "2023-07-31 04:20:00", - total: 469.1, - value: 1.2, - }, - { - time: "2023-07-31 04:30:00", - total: 472.5, - value: 3.4, - }, - { - time: "2023-07-31 04:40:00", - total: 473.4, - value: 0.9, - }, - { - time: "2023-07-31 04:50:00", - total: 473.8, - value: 0.4, - }, - { - time: "2023-07-31 05:00:00", - total: 474.5, - value: 0.7, - }, - { - time: "2023-07-31 05:10:00", - total: 477.3, - value: 2.8, - }, - { - time: "2023-07-31 05:20:00", - total: 489.5, - value: 12.2, - }, - { - time: "2023-07-31 05:30:00", - total: 495.9, - value: 6.4, - }, - { - time: "2023-07-31 05:40:00", - total: 503.9, - value: 8.0, - }, - { - time: "2023-07-31 05:50:00", - total: 505.5, - value: 1.6, - }, - { - time: "2023-07-31 06:00:00", - total: 506.7, - value: 1.2, - }, - { - time: "2023-07-31 06:10:00", - total: 509.7, - value: 3.0, - }, - { - time: "2023-07-31 06:20:00", - total: 513.9, - value: 4.2, - }, - { - time: "2023-07-31 06:30:00", - total: 515.3, - value: 1.4, - }, - { - time: "2023-07-31 06:40:00", - total: 517.3, - value: 2.0, - }, - { - time: "2023-07-31 06:50:00", - total: 519.3, - value: 2.0, - }, - { - time: "2023-07-31 07:00:00", - total: 523.7, - value: 4.4, - }, - { - time: "2023-07-31 07:10:00", - total: 526.3, - value: 2.6, - }, - { - time: "2023-07-31 07:20:00", - total: 528.9, - value: 2.6, - }, - { - time: "2023-07-31 07:30:00", - total: 535.5, - value: 6.6, - }, - { - time: "2023-07-31 07:40:00", - total: 541.1, - value: 5.6, - }, - { - time: "2023-07-31 07:50:00", - total: 544.3, - value: 3.2, - }, - { - time: "2023-07-31 08:00:00", - total: 550.1, - value: 5.8, - }, - { - time: "2023-07-31 08:10:00", - total: 553.9, - value: 3.8, - }, - { - time: "2023-07-31 08:20:00", - total: 559.7, - value: 5.8, - }, - { - time: "2023-07-31 08:30:00", - total: 562.9, - value: 3.2, - }, - { - time: "2023-07-31 08:40:00", - total: 572.1, - value: 9.2, - }, - { - time: "2023-07-31 08:50:00", - total: 585.3, - value: 13.2, - }, - { - time: "2023-07-31 09:00:00", - total: 596.9, - value: 11.6, - }, - { - time: "2023-07-31 09:10:00", - total: 610.1, - value: 13.2, - }, - { - time: "2023-07-31 09:20:00", - total: 621.5, - value: 11.4, - }, - { - time: "2023-07-31 09:30:00", - total: 628.1, - value: 6.6, - }, - { - time: "2023-07-31 09:40:00", - total: 633.3, - value: 5.2, - }, - { - time: "2023-07-31 09:50:00", - total: 636.5, - value: 3.2, - }, - { - time: "2023-07-31 10:00:00", - total: 642.6, - value: 6.1, - }, - { - time: "2023-07-31 10:10:00", - total: 647.9, - value: 5.3, - }, - { - time: "2023-07-31 10:20:00", - total: 655.3, - value: 7.4, - }, - { - time: "2023-07-31 10:30:00", - total: 668.5, - value: 13.2, - }, - { - time: "2023-07-31 10:40:00", - total: 675.3, - value: 6.8, - }, - { - time: "2023-07-31 10:50:00", - total: 681.1, - value: 5.8, - }, - { - time: "2023-07-31 11:00:00", - total: 682.1, - value: 1.0, - }, - { - time: "2023-07-31 11:10:00", - total: 684.1, - value: 2.0, - }, - { - time: "2023-07-31 11:20:00", - total: 688.3, - value: 4.2, - }, - { - time: "2023-07-31 11:30:00", - total: 690.7, - value: 2.4, - }, - { - time: "2023-07-31 11:40:00", - total: 694.5, - value: 3.8, - }, - { - time: "2023-07-31 11:50:00", - total: 704.1, - value: 9.6, - }, - { - time: "2023-07-31 12:00:00", - total: 711.3, - value: 7.2, - }, - { - time: "2023-07-31 12:10:00", - total: 715.9, - value: 4.6, - }, - { - time: "2023-07-31 12:20:00", - total: 717.5, - value: 1.6, - }, - { - time: "2023-07-31 12:30:00", - total: 724.3, - value: 6.8, - }, - { - time: "2023-07-31 12:40:00", - total: 724.4, - value: 0.1, - }, - { - time: "2023-07-31 12:50:00", - total: 724.7, - value: 0.3, - }, - { - time: "2023-07-31 13:00:00", - total: 725.1, - value: 0.4, - }, - { - time: "2023-07-31 13:10:00", - total: 726.7, - value: 1.6, - }, - { - time: "2023-07-31 13:20:00", - total: 726.8, - value: 0.1, - }, - { - time: "2023-07-31 13:30:00", - total: 726.9, - value: 0.1, - }, - { - time: "2023-07-31 13:40:00", - total: 726.9, - value: 0.0, - }, - { - time: "2023-07-31 13:50:00", - total: 726.9, - value: 0.0, - }, - { - time: "2023-07-31 14:00:00", - total: 726.9, - value: 0.0, - }, - { - time: "2023-07-31 14:10:00", - total: 727.0, - value: 0.1, - }, - { - time: "2023-07-31 14:20:00", - total: 727.5, - value: 0.5, - }, - { - time: "2023-07-31 14:30:00", - total: 736.3, - value: 8.8, - }, - { - time: "2023-07-31 14:40:00", - total: 737.3, - value: 1.0, - }, - { - time: "2023-07-31 14:50:00", - total: 737.9, - value: 0.6, - }, - { - time: "2023-07-31 15:00:00", - total: 738.1, - value: 0.2, - }, - { - time: "2023-07-31 15:10:00", - total: 738.9, - value: 0.8, - }, - { - time: "2023-07-31 15:20:00", - total: 741.3, - value: 2.4, - }, - { - time: "2023-07-31 15:30:00", - total: 742.5, - value: 1.2, - }, - { - time: "2023-07-31 15:40:00", - total: 743.7, - value: 1.2, - }, - { - time: "2023-07-31 15:50:00", - total: 744.9, - value: 1.2, - }, - { - time: "2023-07-31 16:00:00", - total: 746.5, - value: 1.6, - }, - { - time: "2023-07-31 16:10:00", - total: 753.5, - value: 7.0, - }, - { - time: "2023-07-31 16:20:00", - total: 753.9, - value: 0.4, - }, - { - time: "2023-07-31 16:30:00", - total: 754.3, - value: 0.4, - }, - { - time: "2023-07-31 16:40:00", - total: 763.7, - value: 9.4, - }, - { - time: "2023-07-31 16:50:00", - total: 765.7, - value: 2.0, - }, - { - time: "2023-07-31 17:00:00", - total: 766.1, - value: 0.4, - }, - { - time: "2023-07-31 17:10:00", - total: 766.2, - value: 0.1, - }, - { - time: "2023-07-31 17:20:00", - total: 766.3, - value: 0.1, - }, - { - time: "2023-07-31 17:30:00", - total: 766.4, - value: 0.1, - }, - { - time: "2023-07-31 17:40:00", - total: 766.5, - value: 0.1, - }, - { - time: "2023-07-31 17:50:00", - total: 766.6, - value: 0.1, - }, - { - time: "2023-07-31 18:00:00", - total: 767.0, - value: 0.4, - }, - { - time: "2023-07-31 18:10:00", - total: 769.2, - value: 2.2, - }, - { - time: "2023-07-31 18:20:00", - total: 771.6, - value: 2.4, - }, - { - time: "2023-07-31 18:30:00", - total: 773.2, - value: 1.6, - }, - { - time: "2023-07-31 18:40:00", - total: 782.0, - value: 8.8, - }, - { - time: "2023-07-31 18:50:00", - total: 783.2, - value: 1.2, - }, - { - time: "2023-07-31 19:00:00", - total: 783.6, - value: 0.4, - }, - { - time: "2023-07-31 19:10:00", - total: 784.2, - value: 0.6, - }, - { - time: "2023-07-31 19:20:00", - total: 784.5, - value: 0.3, - }, - { - time: "2023-07-31 19:30:00", - total: 784.6, - value: 0.1, - }, - { - time: "2023-07-31 19:40:00", - total: 785.0, - value: 0.4, - }, - { - time: "2023-07-31 19:50:00", - total: 786.0, - value: 1.0, - }, - { - time: "2023-07-31 20:00:00", - total: 790.0, - value: 4.0, - }, - { - time: "2023-07-31 20:10:00", - total: 790.4, - value: 0.4, - }, - { - time: "2023-07-31 20:20:00", - total: 790.8, - value: 0.4, - }, - { - time: "2023-07-31 20:30:00", - total: 791.4, - value: 0.6, - }, - { - time: "2023-07-31 20:40:00", - total: 806.0, - value: 14.6, - }, - { - time: "2023-07-31 20:50:00", - total: 811.6, - value: 5.6, - }, - { - time: "2023-07-31 21:00:00", - total: 816.4, - value: 4.8, - }, - { - time: "2023-07-31 21:10:00", - total: 818.6, - value: 2.2, - }, - { - time: "2023-07-31 21:20:00", - total: 824.6, - value: 6.0, - }, - { - time: "2023-07-31 21:30:00", - total: 825.4, - value: 0.8, - }, - { - time: "2023-07-31 21:40:00", - total: 827.6, - value: 2.2, - }, - { - time: "2023-07-31 21:50:00", - total: 833.2, - value: 5.6, - }, - { - time: "2023-07-31 22:00:00", - total: 836.8, - value: 3.6, - }, - { - time: "2023-07-31 22:10:00", - total: 840.4, - value: 3.6, - }, - { - time: "2023-07-31 22:20:00", - total: 843.4, - value: 3.0, - }, - { - time: "2023-07-31 22:30:00", - total: 845.2, - value: 1.8, - }, - { - time: "2023-07-31 22:40:00", - total: 850.0, - value: 4.8, - }, - { - time: "2023-07-31 22:50:00", - total: 861.6, - value: 11.6, - }, - { - time: "2023-07-31 23:00:00", - total: 864.2, - value: 2.6, - }, - { - time: "2023-07-31 23:10:00", - total: 865.8, - value: 1.6, - }, - { - time: "2023-07-31 23:20:00", - total: 868.4, - value: 2.6, - }, - { - time: "2023-07-31 23:30:00", - total: 871.2, - value: 2.8, - }, - { - time: "2023-07-31 23:40:00", - total: 878.4, - value: 7.2, - }, - { - time: "2023-07-31 23:50:00", - total: 883.0, - value: 4.6, - }, - { - time: "2023-08-01 00:00:00", - total: 883.6, - value: 0.6, - }, - { - time: "2023-08-01 00:10:00", - total: 883.6, - value: 0.0, - }, - { - time: "2023-08-01 00:20:00", - total: 883.6, - value: 0.0, - }, - { - time: "2023-08-01 00:30:00", - total: 883.6, - value: 0.0, - }, - { - time: "2023-08-01 00:40:00", - total: 883.6, - value: 0.0, - }, - { - time: "2023-08-01 00:50:00", - total: 883.6, - value: 0.0, - }, - { - time: "2023-08-01 01:00:00", - total: 883.6, - value: 0.0, - }, - { - time: "2023-08-01 01:10:00", - total: 883.6, - value: 0.0, - }, - { - time: "2023-08-01 01:20:00", - total: 883.6, - value: 0.0, - }, - { - time: "2023-08-01 01:30:00", - total: 883.6, - value: 0.0, - }, - { - time: "2023-08-01 01:40:00", - total: 883.6, - value: 0.0, - }, - { - time: "2023-08-01 01:59:00", - total: 883.6, - value: 0.0, - }, -]); let myChart1 = null; let myChart2 = null; @@ -1701,7 +258,9 @@ }; const getDangerInfo = async () => { try { - const response = await fetch("/json/listMaxInfluenceArea_wgs84_output.json"); + const response = await fetch( + "/json/listMaxInfluenceArea_wgs84_output.json" + ); const result = await response.json(); console.log("Loaded JSON data:", result); if (result && result.data && Array.isArray(result.data.items)) { @@ -1778,6 +337,14 @@ charts.style.height = style.height; }; +const syncTimeWithTimeline = () => { + // 2025-05-24 00:25 + // // 灏嗘椂闂村瓧绗︿覆杞崲涓哄垎閽熸暟 (鏍煎紡: "YYYY-MM-DD mm:ss") + const timeParts = nowTime.value.split(" "); + const timeOnly = timeParts[1]; // 鑾峰彇 "mm:ss" 閮ㄥ垎 + return timeOnly; +}; + const setEcharts1 = () => { const chartDom = document.getElementById("echarts1"); myChart1 = echarts.init(chartDom); @@ -1794,14 +361,16 @@ try { const response = await fetch("/json/rainfall.json"); const result = await response.json(); - console.log("Loaded JSON data:", result); if (result && result.data && Array.isArray(result.data)) { rainfallData.value = result.data; - console.log("rainfallData is an array with length:", rainfallData.value.length); // 璁$畻 value 鍜� total 鐨勬渶澶у�� - const maxValue = Math.max(...rainfallData.value.map((item) => item.value)); - const maxTotal = Math.max(...rainfallData.value.map((item) => item.total)); + const maxValue = Math.max( + ...rainfallData.value.map((item) => item.value) + ); + const maxTotal = Math.max( + ...rainfallData.value.map((item) => item.total) + ); // 鍒濆鍖栨椂闂磋酱锛堜粠00:00寮�濮嬶級 xAxisData.value = ["00:00"]; // 鍒濆鏃堕棿鐐� @@ -1817,28 +386,13 @@ const yAxis2Params = calculateYAxisParams(maxTotal); updateChart(yAxis1Params, yAxis2Params); } else { - console.error("Invalid JSON format: 'data' is missing or not an array!"); + console.error( + "Invalid JSON format: 'data' is missing or not an array!" + ); } } catch (error) { console.error("Error fetching data:", error); } - }; - - // 璁$畻涓嬩竴涓椂闂寸偣锛堝鍔�10鍒嗛挓锛� - const getNextTime = (currentTime) => { - const [hours, mins] = currentTime.split(':').map(Number); - let newHours = hours; - let newMins = mins + 10; - - if (newMins >= 60) { - newMins = 0; - newHours += 1; - } - if (newHours >= 24) { - newHours = 0; - } - - return `${String(newHours).padStart(2, "0")}:${String(newMins).padStart(2, "0")}`; }; // 璁$畻 y 杞村弬鏁帮紙鏈�澶氭湁 4 涓偣锛� @@ -1979,9 +533,7 @@ data1.value.push(newItem.value); // 娣诲姞闄嶉洦鏁版嵁 data2.value.push(newItem.total); // 娣诲姞绱闆ㄩ噺 - // 璁$畻骞舵坊鍔犳柊鐨勬椂闂寸偣锛堝墠涓�涓椂闂寸偣+10鍒嗛挓锛� - const lastTime = xAxisData.value[xAxisData.value.length - 1] || "00:00"; - const nextTime = getNextTime(lastTime); + const nextTime = syncTimeWithTimeline(); xAxisData.value.push(nextTime); // 鏇存柊褰撳墠绱㈠紩 @@ -2077,17 +629,15 @@ try { const response = await fetch("/json/浜庡瑗挎矡鏂潰涓嬫暟鎹�.json"); const result = await response.json(); - console.log("Loaded JSON data:", result); if (result && result.data && Array.isArray(result.data)) { jsonData.value = result.data; - console.log("jsonData is an array with length:", jsonData.value.length); // 璁$畻 value 鍜� total 鐨勬渶澶у�� const maxValue = Math.max(...jsonData.value.map((item) => item.value)); const maxTotal = Math.max(...jsonData.value.map((item) => item.total)); // 鍒濆鍖栨椂闂磋酱锛堜粠00:00寮�濮嬶級 - xAxisData.value = ["00:00"]; // 鍒濆鏃堕棿鐐� + xAxisData.value = ["00:00"] || syncTimeWithTimeline(); // 鍒濆鏃堕棿鐐� // 鍒濆鍖栧浘琛紙浠呭姞杞界涓�涓暟鎹偣锛� if (jsonData.value.length > 0) { @@ -2100,29 +650,15 @@ const yAxis2Params = calculateYAxisParams(maxTotal); updateChart(yAxis1Params, yAxis2Params); } else { - console.error("Invalid JSON format: 'data' is missing or not an array!"); + console.error( + "Invalid JSON format: 'data' is missing or not an array!" + ); } } catch (error) { console.error("Error fetching data:", error); } }; - // 璁$畻涓嬩竴涓椂闂寸偣锛堝鍔�10鍒嗛挓锛� - const getNextTime = (currentTime) => { - const [hours, mins] = currentTime.split(':').map(Number); - let newHours = hours; - let newMins = mins + 10; - - if (newMins >= 60) { - newMins = 0; - newHours += 1; - } - if (newHours >= 24) { - newHours = 0; - } - - return `${String(newHours).padStart(2, "0")}:${String(newMins).padStart(2, "0")}`; - }; // 璁$畻 y 杞村弬鏁帮紙鏈�澶氭湁 4 涓偣锛� const calculateYAxisParams = (max) => { @@ -2262,9 +798,7 @@ data1.value.push(newItem.value); // 娣诲姞瀹炴椂娴侀噺 data2.value.push(newItem.total); // 娣诲姞绱娴侀噺 - // 璁$畻骞舵坊鍔犳柊鐨勬椂闂寸偣锛堝墠涓�涓椂闂寸偣+10鍒嗛挓锛� - const lastTime = xAxisData.value[xAxisData.value.length - 1] || "00:00"; - const nextTime = getNextTime(lastTime); + const nextTime = syncTimeWithTimeline(); xAxisData.value.push(nextTime); // 鏇存柊褰撳墠绱㈠紩 @@ -2352,7 +886,10 @@ }; onMounted(() => { - getRainfallData(); + // getRainfallData(); + EventBus.on("time-update", (time) => { + nowTime.value = time; + }); chart1Data.value = setEcharts1(); chart2Data.value = setEcharts2(); myChart1 = chart1Data.value.myChart1; @@ -2361,6 +898,8 @@ }); onBeforeUnmount(() => { + EventBus.off("time-update"); // 娓呯悊浜嬩欢鐩戝惉 + nowTime.value = null; if (intervalId1) clearInterval(intervalId1); if (intervalId2) clearInterval(intervalId2); if (dataIntervalId) clearInterval(dataIntervalId); diff --git a/src/components/tools/LayerTree.vue b/src/components/tools/LayerTree.vue index 86e3cd8..6204585 100644 --- a/src/components/tools/LayerTree.vue +++ b/src/components/tools/LayerTree.vue @@ -45,7 +45,7 @@ { label: "瀛欒儭娌熼殣鎮g偣" }, { label: "缁煎悎鐩戞祴璁惧淇℃伅" }, { label: "瀛欒儭娌熸柇闈�" }, - { label: "閬块櫓鐐�" }, + { label: "閬块櫓鍦烘墍" }, ], }, ]); @@ -193,7 +193,7 @@ case "娉ョ煶娴侀殣鎮g偣闈㈡暟鎹�": case "缁煎悎鐩戞祴璁惧淇℃伅": case "瀛欒儭娌熸柇闈�": - case "閬块櫓鐐�": + case "閬块櫓鍦烘墍": console.log(label, checked, indeterminate); break; } @@ -297,21 +297,21 @@ } /** - * 娣诲姞閬块櫓鐐� + * 娣诲姞閬块櫓鍦烘墍 */ function addTetrahedron(visible) { const emergencyAreaList = []; - // 鍔犺浇閬块櫓鐐瑰簳灞傞潰鐗� + // 鍔犺浇閬块櫓鍦烘墍搴曞眰闈㈢墖 loadAreaPolygon("/json/emergency_area.geojson", true).then((entities) => { emergencyAreaList.push(...entities); - // 榛樿闅愯棌閬块櫓鐐� + // 榛樿闅愯棌閬块櫓鍦烘墍 entities.forEach((entity) => { entity.show = false; }); - // 灏嗛伩闄╃偣瀹炰綋瀛樺偍鍒� treeMap - treeMap.set("閬块櫓鐐�", entities); + // 灏嗛伩闄╁満鎵�瀹炰綋瀛樺偍鍒� treeMap + treeMap.set("閬块櫓鍦烘墍", entities); }); } diff --git a/src/store/simAPI.js b/src/store/simAPI.js index 648747e..ac9de3c 100644 --- a/src/store/simAPI.js +++ b/src/store/simAPI.js @@ -1,7 +1,8 @@ import { defineStore } from 'pinia' import { ref } from 'vue' -import { ElMessage, ElMessageBox, formMetaProps } from 'element-plus' +import { ElMessage, ElMessageBox } from 'element-plus' import { createSimData } from '@/api/trApi'; +import dayjs from 'dayjs' export const SimAPIStore = defineStore('SimAPI', () => { const selectTab = ref("琛屾斂鍖哄垝浠跨湡") @@ -62,6 +63,7 @@ type: forms.type, status: 0, data: JSON.stringify({ + startTime: dayjs().format('YYYY-MM-DD HH:mm:ss'), type: forms.type, total: forms.rainfall, duration: forms.duration, diff --git a/src/views/left/KGSimOption/PredictiveSimulation.vue b/src/views/left/KGSimOption/PredictiveSimulation.vue index adf5c24..379702b 100644 --- a/src/views/left/KGSimOption/PredictiveSimulation.vue +++ b/src/views/left/KGSimOption/PredictiveSimulation.vue @@ -6,11 +6,16 @@ isCollapsed ? "灞曞紑" : "鏀惰捣" }}</span> </div> - <div class="details" :class="{ hidden: isCollapsed }"> - <div class="input-item"> - <label>棰勬祴鏁版嵁:</label> + <el-form + :class="{ hidden: isCollapsed }" + :model="forms" + class="details" + label-width="auto" + style="max-width: 600px" + > + <el-form-item label="棰勬祴鏁版嵁:"> <el-select - v-model="selectedForecastData" + v-model="forms.prediction" placeholder="璇烽�夋嫨" popper-class="mySelectStyle" > @@ -18,40 +23,48 @@ v-for="item in ForecastData" :key="item.id" :label="item.name" - :value="item.id" + :value="item.name" ></el-option> </el-select> - </div> - <div class="input-item"> - <label>鏂规鍚嶇О:</label> + </el-form-item> + <el-form-item label="闄嶉洦鏁版嵁:" v-show="forms.prediction == '闄嶉洦鍦烘'"> + <el-select + v-model="forms.showRainFall" + placeholder="璇烽�夋嫨" + popper-class="mySelectStyle" + > + <el-option + v-for="item in rainFall" + :key="item.rainfallId" + :label="item.rainfallName" + :value="item.rainfallName" + ></el-option> + </el-select> + </el-form-item> + <el-form-item label="鏂规鍚嶇О:"> <el-input - v-model="schemeName" + v-model="forms.schemeName" type="text" placeholder="璇疯緭鍏�" ></el-input> - </div> - <div class="input-item" style="margin-bottom: 10px"> - <label>闄嶉洦闆ㄩ噺:</label> + </el-form-item> + <el-form-item label="闄嶉洦闆ㄩ噺:"> + <el-input v-model="forms.rainfall" type="number" placeholder="璇疯緭鍏�"> + <template #append>mm</template></el-input + > + </el-form-item> + <el-form-item label="闄嶉洦寮哄害:"> <el-input - v-model="totalRainfall" + v-model="forms.rainfallIntensity" type="number" placeholder="璇疯緭鍏�" - ></el-input> - <span>mm</span> - </div> - <div class="input-item" style="margin-bottom: 10px"> - <label>闄嶉洦寮哄害:</label> - <el-input - v-model="rainfallIntensity" - type="number" - placeholder="璇疯緭鍏�" - ></el-input> - <span>mm/h</span> - </div> - <div class="input-item"> - <label>闄嶉洦妯″紡:</label> + > + <template #append>mm/h</template></el-input + > + </el-form-item> + <el-form-item label="闄嶉洦妯″紡:"> <el-select - v-model="selectedRainfallPatterns" + v-model="forms.mode" placeholder="璇烽�夋嫨" popper-class="mySelectStyle" > @@ -62,60 +75,31 @@ :value="item.id" ></el-option> </el-select> - </div> - <div class="input-item"> - <label>棰勮鏃堕暱:</label> - <el-input - v-model="rainfallDuration" - type="number" - placeholder="璇疯緭鍏�" - ></el-input> - <span>h</span> - </div> - <!-- <div> - <label>浠跨湡鍙傛暟:</label> - <div style="width: 100%; height: 43px; background-color: #fff;"></div> - </div> --> - </div> + </el-form-item> + <el-form-item label="棰勮鏃堕暱:"> + <el-input v-model="forms.duration" type="number" placeholder="璇疯緭鍏�" + ><template #append>h</template></el-input + > + </el-form-item> + </el-form> <div class="buttons"> <el-button type="primary" @click="openPlan">鎵撳紑鏂规</el-button> <el-button type="primary" @click="openSaveDialog">淇濆瓨鏂规</el-button> <el-button type="success" @click="startPlay">寮�濮嬫ā鎷�</el-button> </div> - - <!-- 淇濆瓨鏂规瀵硅瘽妗� --> - <el-dialog - v-model="saveDialogVisible" - title="淇濆瓨鏂规" - width="50%" - :before-close="handleClose" - custom-class="custom-dialog" - > - <div class="dialog-content"> - <p><strong>鏂规鍚嶇О锛�</strong>{{ schemeName }}</p> - <p><strong>鎵�閫夐噸鐐规矡锛�</strong>{{ props.selectedArea }}</p> - <p><strong>妯℃嫙绫诲瀷锛�</strong>棰勬祴妯℃嫙</p> - <p><strong>棰勬祴鏁版嵁锛�</strong>{{ selectedForecastDataName }}</p> - <p><strong>闄嶉洦闆ㄩ噺锛�</strong>{{ totalRainfall }} mm</p> - <p><strong>闄嶉洦寮哄害锛�</strong>{{ rainfallIntensity }} mm/h</p> - <p><strong>闄嶉洦妯″紡锛�</strong>{{ selectedRainfallPatternsName }}</p> - <p><strong>棰勮鏃堕暱锛�</strong>{{ rainfallDuration }} h</p> - </div> - <template #footer> - <span class="dialog-footer"> - <el-button @click="saveDialogVisible = false">鍙栨秷</el-button> - <el-button type="primary" @click="confirmSave">纭畾淇濆瓨</el-button> - </span> - </template> - </el-dialog> </div> </template> <script setup> -import { ref, computed, inject } from "vue"; +import { ref, computed, inject, reactive, watch, onMounted } from "vue"; import { ElMessage } from "element-plus"; import { initeWaterPrimitiveView } from "@/utils/water"; import { useSimStore } from "@/store/simulation.js"; // 寮曞叆 Store import { SimAPIStore } from "@/store/simAPI"; +import { getRainfallData } from "@/api/hpApi"; + +onMounted(() => { + getRain(); +}); // 鑾峰彇 Store 瀹炰緥 const simStore = SimAPIStore(); @@ -140,12 +124,6 @@ // 鏁版嵁缁戝畾 const isCollapsed = ref(false); // 鎺у埗灞曞紑/鏀惰捣鐘舵�� -const totalRainfall = ref(50); // 闄嶉洦闆ㄩ噺 -const schemeName = ref("鏂规鍚嶇О"); // 鏂规鍚嶇О -const rainfallIntensity = ref(70); // 闄嶉洦寮哄害 -const rainfallDuration = ref(5); // 棰勮鏃堕暱 -const selectedForecastData = ref("4"); // 榛樿閫変腑鈥滆嚜瀹氫箟鍙傛暟鈥� -const selectedRainfallPatterns = ref("1"); // 榛樿閫変腑鈥滄鎬佸垎甯冣�� const saveDialogVisible = ref(false); // 鎺у埗淇濆瓨鏂规瀵硅瘽妗嗙殑鏄剧ず鐘舵�� // 棰勬祴鏁版嵁閫夐」 @@ -164,22 +142,25 @@ { id: "4", name: "鎸佺画涓婂崌" }, ]; - -// 璁$畻灞炴�э細鑾峰彇褰撳墠閫変腑鐨勯娴嬫暟鎹悕绉� -const selectedForecastDataName = computed(() => { - const selected = ForecastData.find( - (item) => item.id === selectedForecastData.value - ); - return selected ? selected.name : ""; +const forms = reactive({ + rainfall: 50, + schemeName: "", + rainfallIntensity: 70, + duration: 5, + prediction: "闄嶉洦鍦烘", + mode: "姝f�佸垎甯�", + showRainFall: "", }); -// 璁$畻灞炴�э細鑾峰彇褰撳墠閫変腑鐨勯檷闆ㄦā寮忓悕绉� -const selectedRainfallPatternsName = computed(() => { - const selected = RainfallPatterns.find( - (item) => item.name === selectedRainfallPatterns.value - ); - return selected ? selected.name : ""; -}); +// 闄嶉洦鍦烘閫夋嫨 +const rainFall = ref({}); + +const getRain = () => { + getRainfallData().then((res) => { + rainFall.value = res.data.pageData; + console.log(res.data, "res"); + }); +}; // 鍒囨崲璇︽儏鏄剧ず const toggleDetails = () => { @@ -188,40 +169,38 @@ // 鎵撳紑淇濆瓨鏂规瀵硅瘽妗� const openSaveDialog = async () => { - const forms = { - name: schemeName.value, + const params = { + name: forms.schemeName, geom: props.selectedArea, type: 1, - rainfall: totalRainfall.value, - duration: rainfallDuration.value, - intensity: rainfallIntensity.value, - mode: selectedRainfallPatterns.value, - prediction: selectedForecastDataName.value, + rainfall: forms.rainfall, + duration: forms.duration, + intensity: forms.rainfallIntensity, + mode: forms.mode, + prediction: forms.prediction, }; - await simStore.addSimCheme(forms); + await simStore.addSimCheme(params); }; - -// 鍏抽棴淇濆瓨鏂规瀵硅瘽妗� -const handleClose = () => { - saveDialogVisible.value = false; -}; - // 鎵撳紑鏂规 const openPlan = () => { + // getRain(); console.log("鎵撳紑鏂规鎸夐挳琚偣鍑�"); }; </script> -<style scoped> +<style lang="less" scoped> .history-simulation { margin-bottom: 20px; } .details { - margin-top: 10px; - transition: height 0.3s ease, opacity 0.3s ease; - overflow: hidden; + width: 100%; + height: 100%; + padding: 0px 10px 0px 0px; + box-sizing: border-box; + width: 100%; + height: 100%; } .hidden { @@ -231,6 +210,7 @@ .buttons { margin-top: 10px; + margin-right: 10px; display: flex; gap: 10px; } @@ -274,4 +254,18 @@ .custom-dialog { z-index: 3000 !important; /* 纭繚瀵硅瘽妗嗚鐩栧叾浠栧厓绱� */ } +/deep/ .el-input-group__append, +.el-input-group__prepend { + background-color: #084b42; + color: #fff; +} +/deep/ .el-form-item__label { + color: #61f7d4 !important; +} +/deep/ .el-select { + margin-bottom: 0px !important; +} +/deep/ .el-form-item { + margin-top: 10px; +} </style> diff --git a/src/views/mnfz.vue b/src/views/mnfz.vue index b7981b6..9b9c042 100644 --- a/src/views/mnfz.vue +++ b/src/views/mnfz.vue @@ -132,10 +132,10 @@ }); dataSources.length = 0; } -// 閬块櫓鐐癸紝缁胯壊瀵屾枃鏈� +// 閬块櫓鍦烘墍锛岀豢鑹插瘜鏂囨湰 function addTetrahedron(visible) { const emergencyAreaList = []; - // 杩欓噷鏄坊鍔犻伩闄╃偣搴曞眰闈㈢墖 + // 杩欓噷鏄坊鍔犻伩闄╁満鎵�搴曞眰闈㈢墖 loadAreaPolygon("/json/emergency_area.geojson", true).then((entities) => { emergencyAreaList.push(...entities); }); @@ -161,10 +161,10 @@ // altitude: 528, // }, ]; - // 杩欓噷鏄坊鍔犻伩闄╃偣瀵屾枃鏈珮浜樉绀� + // 杩欓噷鏄坊鍔犻伩闄╁満鎵�瀵屾枃鏈珮浜樉绀� list.forEach((item) => { let point = earthCtrl.factory.createRichTextPoint( - "閬块櫓鐐�", + "閬块櫓鍦烘墍", [item.longitude, item.latitude, item.altitude - 10], { distanceDisplayCondition: @@ -177,11 +177,11 @@ console.log("point", point); emergencyAreaList.push(point); }); - treeMap.set("閬块櫓鐐�", emergencyAreaList); + treeMap.set("閬块櫓鍦烘墍", emergencyAreaList); } -// 鍒犻櫎閬块櫓鐐圭殑瀵屾枃鏈疄浣� +// 鍒犻櫎閬块櫓鍦烘墍鐨勫瘜鏂囨湰瀹炰綋 function removeEmergencyPoints() { - const emergencyAreaList = treeMap.get("閬块櫓鐐�"); // 鑾峰彇瀛樺偍鐨勯伩闄╃偣瀹炰綋鍒楄〃 + const emergencyAreaList = treeMap.get("閬块櫓鍦烘墍"); // 鑾峰彇瀛樺偍鐨勯伩闄╁満鎵�瀹炰綋鍒楄〃 if (emergencyAreaList && emergencyAreaList.length > 0) { emergencyAreaList.forEach((entity) => { if (entity && typeof entity.deleteObject === "function") { @@ -195,7 +195,7 @@ earthCtrl.coreMap.entities.remove(entity); } }); - treeMap.set("閬块櫓鐐�", []); // 娓呯┖瀛樺偍鐨勯伩闄╃偣鍒楄〃 + treeMap.set("閬块櫓鍦烘墍", []); // 娓呯┖瀛樺偍鐨勯伩闄╁満鎵�鍒楄〃 } } @@ -233,7 +233,7 @@ if (showDebuffDetail.value) { return; } - checkedKeys.value = ["閬块櫓鐐�"]; + checkedKeys.value = ["閬块櫓鍦烘墍"]; showDebuffDetail.value = true; getTimeMarkers(); addTetrahedron(); -- Gitblit v1.9.3