From b1398528bd9f5245f580285681cca6abc192c651 Mon Sep 17 00:00:00 2001 From: wangjuncheng <1> Date: 星期五, 16 五月 2025 16:00:43 +0800 Subject: [PATCH] change --- src/components/monifangzhen/schemeInfo.vue | 185 ++++++++-------- src/utils/water.js | 15 src/components/tools/Legend_mnfz.vue | 8 src/api/trApi.js | 4 src/components/menu/TimeLine.vue | 78 ++++-- src/components/tools/DebuffDetail.vue | 283 ++++++++++++++----------- src/components/tools/Message.vue | 4 src/views/mnfz.vue | 2 src/components/menu/flowRate_waterLevel.vue | 29 ++ src/components/monifangzhen/schemeCard.vue | 16 10 files changed, 354 insertions(+), 270 deletions(-) diff --git a/src/api/trApi.js b/src/api/trApi.js index 2e2566d..7588136 100644 --- a/src/api/trApi.js +++ b/src/api/trApi.js @@ -94,8 +94,8 @@ // 閫氳繃鎺ュ彛鍘昏姹俲son锛屽皢璇锋眰鐨刯son瑙f瀽鑾峰彇娉ョ煶娴佸弬鏁� export async function fetchWaterSimulationData(serviceInfo) { try { - const response = await fetch(`/simu/${serviceInfo}/layer.json`); // 鍙戣捣璇锋眰 - // const response = await fetch(`/simu/c2h1dc/layer.json`); // 鍙戣捣璇锋眰 + // const response = await fetch(`/simu/${serviceInfo}/layer.json`); // 鍙戣捣璇锋眰 + const response = await fetch(`/simu/c2h1dc/layer.json`); // 鍙戣捣璇锋眰 if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } diff --git a/src/components/menu/TimeLine.vue b/src/components/menu/TimeLine.vue index c2fad40..8856a3d 100644 --- a/src/components/menu/TimeLine.vue +++ b/src/components/menu/TimeLine.vue @@ -28,10 +28,11 @@ <div v-for="(date, index) in visibleDates" :key="index" class="date-label"> <!-- {{ formatDate(date) }} --> </div> - <!-- 涓撻娓叉煋: - <el-switch v-model="isColorRenderEnabled" @change="handleColorRenderChange" style="margin-top:-3px" - :disabled="!isPlaying || !isWaterPrimitiveCreated" /> --> - <!-- active-text="寮�" inactive-text="鍏�" --> + <div>涓撻娓叉煋: + <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> @@ -87,10 +88,12 @@ import { fetchWaterSimulationData } from "@/api/trApi.js"; import { EventBus } from "@/eventBus"; import { ElMessage } from "element-plus"; +// 鐘舵�佺鐞嗗櫒 import { useSimStore } from "@/store/simulation"; import { storeToRefs } from "pinia"; const simStore = useSimStore(); const { selectedScheme } = storeToRefs(simStore); + const emit = defineEmits(["timeUpdate", "isPlaying", "playbackFinished", "isColorRender"]); // 瀹氫箟props const props = defineProps({ @@ -137,6 +140,7 @@ ); // 鎾斁鎺у埗 const togglePlay = () => { + // 杩欓噷搴旇鍐嶈瀹氬嚑涓檺鍒讹紝濡傛灉缂哄皯浠�涔堟暟鎹紝鏃犳硶杩涜浠跨湡 if (!isPlaying.value && currentTime.value >= duration.value) currentTime.value = 0; @@ -147,10 +151,11 @@ startPlayback(); if (!isWaterPrimitiveCreated.value) { - console.log(serviceInfo, '杩欓噷鏄綋鍓嶆柟妗堢殑鏈嶅姟淇℃伅锛�'); + // console.log(serviceInfo, '杩欓噷鏄綋鍓嶆柟妗堢殑鏈嶅姟淇℃伅锛�'); // 杩欓噷閫氳繃water.js涓幓鍙戦�佽姹傝幏鍙栨按闈㈡ā鎷� createWaterPrimitive({ - baseUrl: `/simu/${serviceInfo}`, + // baseUrl: `/simu/${serviceInfo}`, + baseUrl: `/simu/c2h1dc`, interval: intervalMap[playbackRate.value], colorRender: isColorRenderEnabled.value }); @@ -237,18 +242,33 @@ if (typeof data === 'string') { try { data = JSON.parse(data); - console.log('瑙f瀽鍚庣殑 data:', data); + console.log('瑙f瀽鍚庣殑闄嶉洦鏁版嵁锛�', data); } catch (e) { console.error("data 涓嶆槸鏈夋晥鐨� JSON 瀛楃涓�"); return; } } + // 鎵撳嵃闄嶉洦寮哄害鐨勫崟浣� + console.log('闄嶉洦寮哄害鐨勫崟浣嶆槸锛�', data.intensityUnit); + // 鏍规嵁 intensityUnit 璋冩暣 rainfalls 涓殑 intensity 鍊� + if (data.intensityUnit === 'mm/min') { + data.rainfalls.forEach(r => r.intensity *= 60); + console.log('灏� mm/min 杞崲涓� mm/h 鍚庣殑 rainfalls:', data.rainfalls); + } else if (data.intensityUnit === 'mm/5min') { + data.rainfalls.forEach(r => r.intensity *= 12); + console.log('灏� mm/5min 杞崲涓� mm/h 鍚庣殑 rainfalls:', data.rainfalls); + } else if (data.intensityUnit !== 'mm/h') { + console.warn('鏈煡鐨� intensity 鍗曚綅锛屾棤娉曡繘琛岃浆鎹�'); + } + const rainfallList = data.rainfalls; + console.log('鏈�缁堢殑 rainfallList:', rainfallList); + // 鎻愬彇 intensity 鍊� rainFallValues.value = rainfallList.map(r => r.intensity); minRainValue.value = Math.min(...rainFallValues.value); maxRainValue.value = Math.max(...rainFallValues.value); - console.log(minRainValue.value, maxRainValue.value, 'min and max rain values'); + console.log('褰撳墠鏂规涓嬫渶灏忛洦閲忓拰鏈�澶ч洦閲忥細', minRainValue.value, maxRainValue.value); } // 瀹氫箟闄嶉洦绛夌骇鍙婂叾瀵瑰簲鐨勮瑙夊弬鏁� const rainLevels = [ @@ -268,7 +288,7 @@ size: 0.7, speed: 40, density: 35, - color: '#ADD8E6' // 澶╄摑鑹诧紝璞″緛鎸佺画鐨勪腑闆� + color: '#ADD8E6' }, { name: '澶ч洦', @@ -277,7 +297,7 @@ size: 1.0, speed: 70, density: 60, - color: '#ADD8E6' // 娣辫摑鑹诧紝璞″緛瀵嗛泦鐨勫ぇ闆� + color: '#ADD8E6' }, { name: '鏆撮洦', @@ -286,7 +306,7 @@ size: 1.3, speed: 90, density: 80, - color: '#ADD8E6' // 娣辫摑榛戣壊锛岃薄寰佸己闄嶉洦 + color: '#ADD8E6' }, { name: '澶ф毚闆�', @@ -294,7 +314,7 @@ size: 1.6, speed: 110, density: 100, - color: '#ADD8E6' // 榛戣壊锛岃薄寰佹瀬绔毚闆� + color: '#ADD8E6' } ]; // 鏍规嵁闄嶉洦閲忚繑鍥炲搴旂殑闆ㄥ舰閰嶇疆 @@ -323,8 +343,7 @@ const alpha = floatIndex - index; const rainValue = currentRain + (nextRain - currentRain) * alpha; // 鎵撳嵃褰撳墠澶勭悊鐨勯洦閲忔暟鎹� - console.log(`姝e湪澶勭悊鐨勯洦閲忔暟鎹偣: 褰撳墠=${currentRain}, 涓嬩竴涓�=${nextRain}, 鎻掑�煎悗=${rainValue.toFixed(2)}, 绱㈠紩=${index}`); - + // console.log(`姝e湪澶勭悊鐨勯洦閲忔暟鎹偣: 褰撳墠=${currentRain}, 涓嬩竴涓�=${nextRain}, 鎻掑�煎悗=${rainValue.toFixed(2)}, 绱㈠紩=${index}`); // 濡傛灉褰撳墠绱㈠紩鏈彉鍖栦笖鎻掑�煎樊寮備笉澶э紝璺宠繃閲嶅鏇存柊 if (index === lastUsedIndex && Math.abs(rainValue - lastRainValue) < 0.1) { console.log('鐢变簬鏁版嵁鏃犳樉钁楀彉鍖栵紝璺宠繃鏈鏇存柊'); @@ -351,9 +370,7 @@ rainDensity: rainLevel.density, rainColor: rainLevel.color }; - - console.log('褰撳墠闆ㄩ噺鏁版嵁锛�', rainValue); - console.log('褰撳墠闆ㄥ舰锛�', rainLevel); + console.log('褰撳墠闆ㄩ噺鏁版嵁锛�', rainValue, '褰撳墠闆ㄥ舰锛�', rainLevel); // 璋冪敤宸ュ叿鏂规硶鏇存柊闆ㄦ晥 mapUtils.toggleRain(rainParams, true); } @@ -421,6 +438,8 @@ dayjs(waterTimestamps.value[closestIndex]).format("YYYY-MM-DD HH:mm:ss") ); // 璋冪敤璺宠浆鎺ュ彛锛屼紶閫掔储寮曞�� + console.log(closestIndex,'鏈�杩戠殑绱㈠紩鍊�'); + setTimeForWaterSimulation(closestIndex); // 濡傛灉褰撳墠鏄殏鍋滅姸鎬侊紝璋冪敤 pauseWaterSimulation @@ -498,7 +517,7 @@ // 褰撳墠鏂规鐨勬墍鏈変俊鎭� const schemeInfo = selectedScheme.value; serviceInfo = schemeInfo.serviceName; - console.log('鑾峰彇鍒扮殑 serviceName:', serviceInfo); + // console.log('鑾峰彇鍒扮殑 serviceName:', serviceInfo); getRainfallData() // 鏍规嵁layer.json鍘昏幏鍙栨椂闂磋酱淇℃伅 const { waterTimestamps: timestamps } = await fetchWaterSimulationData(serviceInfo); @@ -513,6 +532,10 @@ } } catch (error) { console.error("Error loading water simulation data:", error); + ElMessage({ + message: "闄嶉洦鏁版嵁鍑洪敊锛岃閲嶆柊鏂板缓妯℃嫙鏂规锛�", + type: "warning", + }); } }); @@ -527,10 +550,10 @@ 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, + // }); } } @@ -541,6 +564,8 @@ const { endSimulate } = inject("simulateActions"); function handleBack() { + endSimulate(); + isWaterPrimitiveCreated.value = false; if (ratelevelRef.value) { ratelevelRef.value.endCalculation(); } @@ -548,11 +573,9 @@ setTimeout(() => { mapUtils.delRain(); }, 3000); - ElMessage({ message: "妯℃嫙杩涚▼姝e湪鍏抽棴涓�...", type: "success" }); // 鏄剧ず娑堟伅閫氱煡鐢ㄦ埛妯℃嫙杩涚▼姝e湪鍏抽棴 - endSimulate(); - isWaterPrimitiveCreated.value = false; destoryWaterPrimitive(); EventBus.emit("hide-schemeInfo"); + ElMessage({ message: "妯℃嫙杩涚▼姝e湪鍏抽棴涓�...", type: "success" }); } </script> <style scoped> @@ -669,6 +692,7 @@ position: relative; cursor: pointer; } + .timeline-progress { height: 100%; background-color: #4a90e2; @@ -677,6 +701,7 @@ top: 0; left: 0; } + .timeline-cursor { width: 12px; height: 12px; @@ -687,6 +712,7 @@ transform: translate(-50%, -50%); z-index: 2; } + .time-markers { position: absolute; width: 100%; @@ -706,6 +732,7 @@ flex-direction: column; align-items: center; } + /* .date-part { margin-bottom: 2px; } */ @@ -713,6 +740,7 @@ font-size: 11px; opacity: 0.8; } + .current-date { margin-bottom: 5px; font-size: 15px; diff --git a/src/components/menu/flowRate_waterLevel.vue b/src/components/menu/flowRate_waterLevel.vue index 297c445..ec7c52e 100644 --- a/src/components/menu/flowRate_waterLevel.vue +++ b/src/components/menu/flowRate_waterLevel.vue @@ -66,18 +66,24 @@ position: point.cartesian, label: { text: `娴嬮噺鐐� ${index + 1}\n缁忓害: ${point.longitude.toFixed(6)}\n绾害: ${point.latitude.toFixed(6)}\n鏃堕棿: ${displayTime}`, - font: '14pt monospace', // 鍑忓皬瀛椾綋澶у皬 + font: '14pt monospace', style: Cesium.LabelStyle.FILL_AND_OUTLINE, fillColor: Cesium.Color.YELLOW, outlineColor: Cesium.Color.BLACK, - outlineWidth: 2, // 鍑忓皬杞粨瀹藉害 + outlineWidth: 2, verticalOrigin: Cesium.VerticalOrigin.CENTER, horizontalOrigin: Cesium.HorizontalOrigin.CENTER, backgroundColor: Cesium.Color.fromCssColorString('rgba(0,0,0,0.7)'), - backgroundPadding: new Cesium.Cartesian2(10, 10), // 鍑忓皬鑳屾櫙濉厖 + backgroundPadding: new Cesium.Cartesian2(10, 10), showBackground: true, - scale: 1, // 璁剧疆缂╂斁姣斾緥 - maximumScale: 1.5, // 璁剧疆鏈�澶х缉鏀炬瘮渚� + scale: 1, + distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 5000), // 璺濆湴闈�5000绫冲唴鏄剧ず + pixelOffsetScaleByDistance: new Cesium.NearFarScalar( + 100, // Near 璺濈 (鐩告満绂诲湴100绫�) + 1.0, // 鍦ㄨ繎澶勶紝鏀惧ぇ鍊嶆暟涓�1.0锛堟甯革級 + 5000, // Far 璺濈 (鐩告満绂诲湴5000绫�) + 0.3 // 鍦ㄨ繙澶勶紝缂╁皬鍒�0.3鍊� + ) } }); @@ -89,7 +95,16 @@ material: new Cesium.PolylineOutlineMaterialProperty({ outlineWidth: 4, outlineColor: Cesium.Color.WHITE - }) + }), + distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 5000), // 璺濆湴闈�5000绫冲唴鏄剧ず + pixelOffsetScaleByDistance: new Cesium.NearFarScalar( + 100, // Near 璺濈 (鐩告満绂诲湴100绫�) + 1.0, // 鍦ㄨ繎澶勶紝鏀惧ぇ鍊嶆暟涓�1.0锛堟甯革級 + 5000, // Far 璺濈 (鐩告満绂诲湴5000绫�) + 0.3 // 鍦ㄨ繙澶勶紝缂╁皬鍒�0.3鍊� + ) + + } }); @@ -178,7 +193,7 @@ } function endCalculation() { - ElMessage.success('娓呴櫎鎵�鏈夋祴閲忕偣锛�'); + // ElMessage.success('娓呴櫎鎵�鏈夋祴閲忕偣锛�'); pickedPoints.value = []; viewer.entities.removeAll(); // currentTime.value = 0; diff --git a/src/components/monifangzhen/schemeCard.vue b/src/components/monifangzhen/schemeCard.vue index 875157c..413eb16 100644 --- a/src/components/monifangzhen/schemeCard.vue +++ b/src/components/monifangzhen/schemeCard.vue @@ -89,14 +89,14 @@ // alert("褰撳墠鏂规灏氭湭瀹屾垚锛屾棤娉曡繘鍏ユā鎷燂紒"); // return; // } - if (!item.serviceName) { - ElMessage({ - message: "serviceName 涓嶅瓨鍦紝鏃犳硶缁х画锛�", - type: "warning", - }); - return; // 闃绘鍚庣画閫昏緫鎵ц - } - // console.log(item,'iteeeeeeeem'); + // if (!item.serviceName) { + // ElMessage({ + // message: "serviceName 涓嶅瓨鍦紝鏃犳硶缁х画锛�", + // type: "warning", + // }); + // return; // 闃绘鍚庣画閫昏緫鎵ц + // } + console.log(item,'iteeeeeeeem'); simStore.setSelectedScheme(item); currentScheme.value = item; diff --git a/src/components/monifangzhen/schemeInfo.vue b/src/components/monifangzhen/schemeInfo.vue index d03fcde..df5c387 100644 --- a/src/components/monifangzhen/schemeInfo.vue +++ b/src/components/monifangzhen/schemeInfo.vue @@ -1,15 +1,15 @@ <template> <div class="listCard"> <div class="top"><span>鏂规璇︽儏</span> - <!-- <div @click="togglePick" :class="['pick-button', { active: isPickingActive }]"> - {{ isPickingActive ? '杩涜璁$畻' : '寮�濮嬫嬀鍙�' }} - </div> --> </div> <div class="details"> <div v-if="formattedData.length" class="input-group"> <div v-for="(item, index) in formattedData" :key="index" class="input-item"> <label>{{ item.name }}</label> - <span>{{ item.value }}</span> + <span :class="{ 'clickable': item.isClickable }" + @click="item.isClickable ? openGaugeDialog(item.gauges) : null"> + {{ item.value }} + </span> </div> </div> <div v-else> @@ -21,12 +21,31 @@ </div> </div> <Message @close="close" class="mess" v-show="messageShow" :mesData="mesData" /> + <!-- 娣诲姞闆ㄩ噺璁″脊绐� --> + <div class="dialoog"> + <el-dialog v-model="dialogVisible" title="闆ㄩ噺璁¤鎯�" width="50%" :before-close="handleClose"> + <div class="table-container"> + <el-table :data="gaugesData" border stripe height="100%"> + <el-table-column prop="name" label="鍚嶇О"></el-table-column> + <el-table-column prop="x" label="缁忓害(X)"></el-table-column> + <el-table-column prop="y" label="绾害(Y)"></el-table-column> + <el-table-column prop="r" label="鍗婂緞(r)"></el-table-column> + </el-table> + </div> + <!-- <template #footer> + <span class="dialog-footer"> + <el-button @click="dialogVisible = false">鍏抽棴</el-button> + </span> + </template> --> + </el-dialog> + </div> + </template> <script setup> import { defineProps, defineEmits, inject, ref, watch } from "vue"; +import { ElDialog, ElTable, ElTableColumn, ElButton ,ElMessage} from "element-plus"; import dayjs from "dayjs"; - // 鍏叡渚濊禆 const props = defineProps({ selectedScheme: { type: Object, default: null } }); const emit = defineEmits(["back"]); @@ -69,20 +88,32 @@ const parsed = JSON.parse(dataStr); const fields = { total: "闄嶉洦鎬婚噺锛坢m锛夛細", - duration: "闄嶉洦鏃堕暱锛堝垎閽燂級锛�", + duration: "闄嶉洦鏃堕暱锛堝皬鏃讹級锛�", intensity: "闄嶉洦寮哄害锛坢m/灏忔椂锛夛細", prediction: "闄嶉洦鍦烘锛�", model: "闄嶉洦妯″紡锛�", - history: "鍘嗗彶闄嶉洦锛�", - gauges: "闆ㄩ噺璁″垪琛細" + history: "鍘嗗彶闄嶉洦锛�" }; - return Object.entries(parsed) + const result = Object.entries(parsed) .filter(([k]) => fields[k]) .map(([k, v]) => ({ name: fields[k], - value: Array.isArray(v) ? v.join(", ") : v || "鏃�" + value: v || "鏃�" })); + + // 澶勭悊闆ㄩ噺璁℃暟鎹� + if (parsed.gauges && Array.isArray(parsed.gauges)) { + const gaugeNames = parsed.gauges.map(g => g.name).join(", ") || "鏃�"; + result.push({ + name: "闆ㄩ噺璁″垪琛細", + value: '鏌ョ湅闆ㄩ噺璁″垪琛�', + isClickable: true, + gauges: parsed.gauges + }); + } + + return result; } catch (e) { return [{ name: "鏁版嵁锛�", value: dataStr || "鏃�" }]; } @@ -104,6 +135,8 @@ const entries = Object.entries(newScheme); const areaType = newScheme.areaType; + + console.log(newScheme, 'news'); const result = entries.reduce((acc, [key, value]) => { if (skipKeys.includes(key)) return acc; @@ -146,90 +179,31 @@ }, { immediate: true } ); -// const pickedPoints = ref([]); -// const handler = ref(null); -// const isPickingActive = ref(false); -// // 鎷惧彇鐩稿叧閫昏緫 -// const viewer = window.viewer; +const dialogVisible = ref(false); +const gaugesData = ref([]); -// function getPickPosition(windowPosition) { -// if (!viewer) return null; -// viewer.scene.globe.depthTestAgainstTerrain = true; -// const cartesian = viewer.scene.pickPosition(windowPosition); -// if (!cartesian) return null; +// 鎵撳紑闆ㄩ噺璁″脊绐� +function openGaugeDialog(gauges) { + if (Array.isArray(gauges) && gauges.length > 0) { + gaugesData.value = gauges.map(g => ({ + name: g.name || "鏈煡", + x: g.x != null ? g.x.toFixed(2) : "-", + y: g.y != null ? g.y.toFixed(2) : "-", + r: g.r || "-" + })); + dialogVisible.value = true; + } else { + ElMessage({ + message: "闆ㄩ噺璁℃暟鎹嚭閿欙紝璇烽噸鏂版柊寤烘ā鎷熸柟妗堬紒", + type: "warning", + }); + } +} -// const cartographic = Cesium.Cartographic.fromCartesian(cartesian); - -// // 鍦ㄥ師鏈夐珮搴︿笂澧炲姞300绫� -// cartographic.height += 80.0; - -// return { -// cartesian: Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, cartographic.height), -// longitude: Cesium.Math.toDegrees(cartographic.longitude), -// latitude: Cesium.Math.toDegrees(cartographic.latitude), -// height: cartographic.height -// }; -// } - -// function addPointToViewer(point, index) { -// const entity = viewer.entities.add({ -// position: point.cartesian, -// billboard: { -// // image: '../path/to/your/icon.png', // 鏇挎崲涓轰綘鐨勫浘鏍囪矾寰� -// width: 32, // 鍥炬爣瀹藉害 -// height: 32, // 鍥炬爣楂樺害 -// verticalOrigin: Cesium.VerticalOrigin.BOTTOM -// }, -// label: { -// text: `Point ${index + 1}\n缁忓害: ${point.longitude.toFixed(6)}\n绾害: ${point.latitude.toFixed(6)}`, -// font: '14pt monospace', -// style: Cesium.LabelStyle.FILL_AND_OUTLINE, -// outlineWidth: 2, -// verticalOrigin: Cesium.VerticalOrigin.TOP, -// pixelOffset: new Cesium.Cartesian2(0, -40), // 璋冩暣鏍囩鐩稿浜庡浘鏍囩殑鍋忕Щ閲� -// fillColor: Cesium.Color.WHITE, -// outlineColor: Cesium.Color.BLACK -// } -// }); - -// // 鍙�夛細瀛樺偍瀹炰綋寮曠敤浠ヤ究鍚庣画鎿嶄綔 -// pickedPoints.value.push(entity); -// } - -// function initPickHandler() { -// if (!viewer?.scene?.canvas) return; -// handler.value = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas); - -// handler.value.setInputAction((movement) => { -// const position = getPickPosition(movement.position); -// if (position) { -// const index = pickedPoints.value.length; -// pickedPoints.value.push(position); -// addPointToViewer(position, index); -// } -// }, Cesium.ScreenSpaceEventType.LEFT_CLICK); -// } - -// function togglePick() { -// isPickingActive.value ? stopPicking() : startPicking(); -// } - -// function startPicking() { -// pickedPoints.value = []; -// viewer.entities.removeAll(); -// !handler.value && initPickHandler(); -// isPickingActive.value = true; -// } - -// function stopPicking() { -// if (handler.value) { -// handler.value.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK); -// handler.value.destroy(); -// handler.value = null; -// } - -// isPickingActive.value = false; -// } +// 鍏抽棴寮圭獥 +function handleClose(done) { + done(); +} </script> <style lang="less" scoped> @@ -312,4 +286,31 @@ letter-spacing: 2px; font-weight: bolder; } + +.clickable { + color: #5bc0de; + cursor: pointer; + text-decoration: underline; +} + +.dialoog { + ::v-deep .el-dialog__title { + color: #fff !important; + } + + ::v-deep .el-dialog { + background-color: rgb(5, 75, 69) !important; + } + + .el-dialog__body { + padding-top: 10px; + padding-bottom: 10px; + } + + .table-container .el-table { + font-size: 14px; + border-radius: 4px; + box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1); + } +} </style> diff --git a/src/components/tools/DebuffDetail.vue b/src/components/tools/DebuffDetail.vue index b973957..a8f6bf4 100644 --- a/src/components/tools/DebuffDetail.vue +++ b/src/components/tools/DebuffDetail.vue @@ -13,139 +13,178 @@ </template> <script> - export default { - name: "detail", - components: {}, - props: { - areaName: { - type: String, - default: "灏瑰瑗挎矡", - }, +// 鐘舵�佺鐞嗗櫒 +import { useSimStore } from "@/store/simulation"; +import { storeToRefs } from "pinia"; +const simStore = useSimStore(); +const { selectedScheme } = storeToRefs(simStore); + +export default { + name: "detail", + components: {}, + props: { + areaName: { + type: String, + default: "灏瑰瑗挎矡", }, - data() { - return { - show: false, - detailList: [ - { - name: "鏈�澶ч洦寮猴細", - value: Number(Math.random() * 100).toFixed(2) + " mm/h", - }, - { - name: "骞冲潎闆ㄥ己锛�", - value: Number(Math.random() * 10).toFixed(2) + " mm/h", - }, - { - name: "鏈�澶ф按娣憋細", - value: "1.86 m", - }, - { - name: "骞冲潎姘存繁锛�", - value: "0.29 m", - }, - { - name: "鏈�澶ф祦閫燂細", - value: "7 m/s", - }, - { - name: "濞佽儊鎴垮眿锛�", - value: "406 闂�", - }, - { - name: "濞佽儊浜哄彛锛�", - value: "145 鎴�", - }, - { - name: "濞佽儊璐骇锛�", - value: "4872 涓囧厓", - }, - ], + }, + data() { + return { + show: false, + detailList: [ + { + name: "鏈�澶ч洦寮猴細", + value: Number(Math.random() * 100).toFixed(2) + " mm/h", + }, + { + name: "骞冲潎闆ㄥ己锛�", + value: Number(Math.random() * 10).toFixed(2) + " mm/h", + }, + { + name: "鏈�澶ф按娣憋細", + value: "1.86 m", + }, + { + name: "鏈�澶ф祦閫燂細", + value: "7 m/s", + }, + { + name: "濞佽儊鎴垮眿锛�", + value: "406 闂�", + }, + { + name: "濞佽儊浜哄彛锛�", + value: "145 鎴�", + }, + { + name: "濞佽儊璐骇锛�", + value: "4872 涓囧厓", + }, + ], + } + }, + mounted() { + this.getRainfallData(); // 缁勪欢鎸傝浇鍚庢墽琛岃幏鍙栭洦閲忔暟鎹� + }, + methods: { + getRainfallData() { + if (!selectedScheme.value || !selectedScheme.value.data) { + console.warn("selectedScheme 鎴� data 涓嶅瓨鍦�"); + return; } + let data = selectedScheme.value.data; + // 濡傛灉鏄瓧绗︿覆锛屽垯灏濊瘯瑙f瀽鎴愬璞� + if (typeof data === 'string') { + try { + data = JSON.parse(data); + } catch (e) { + console.error("data 涓嶆槸鏈夋晥鐨� JSON 瀛楃涓�"); + return; + } + } + const rainfallList = data.rainfalls; + + // 鎻愬彇 intensity 鍊� + const rainValues = rainfallList.map(r => r.intensity); + const minRain = Math.min(...rainValues); + const maxRain = Math.max(...rainValues); + const avgRain = rainValues.reduce((sum, val) => sum + val, 0) / rainValues.length; + + // 鏇存柊 detailList 涓殑鈥滄渶澶ч洦寮衡�濆拰鈥滃钩鍧囬洦寮衡�� + this.detailList[0].value = maxRain.toFixed(2) + " mm/h"; // 鏈�澶ч洦寮� + this.detailList[1].value = avgRain.toFixed(2) + " mm/h"; // 骞冲潎闆ㄥ己 + + console.log('褰撳墠鏂规涓嬫渶灏忛洦閲忋�佹渶澶ч洦閲忋�佸钩鍧囬洦閲忥細', + minRain.toFixed(2), + maxRain.toFixed(2), + avgRain.toFixed(2) + ); }, - methods: { - closeMsg() { - this.$emit("close") - }, - showMsg() { - this.$emit("open") - }, + closeMsg() { + this.$emit("close") }, - } + showMsg() { + this.$emit("open") + }, + }, +} </script> <style lang="less" scoped> - .detail { - background: url("@/assets/img/tools/messagebg.png"); - background-size: 100% 100%; - width: 391px; - height: 420px; - position: absolute; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - z-index: 99; - } +.detail { + background: url("@/assets/img/tools/messagebg.png"); + background-size: 100% 100%; + width: 391px; + height: 420px; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + z-index: 99; +} - .detail-top { - position: absolute; - top: 5px; - left: 20px; - font-weight: 700; - font-size: 18px; - font-weight: 700; - color: #fff; - line-height: 40px; - width: 270px; - cursor: pointer; - } +.detail-top { + position: absolute; + top: 5px; + left: 20px; + font-weight: 700; + font-size: 18px; + font-weight: 700; + color: #fff; + line-height: 40px; + width: 270px; + cursor: pointer; +} - .detail-close { - position: absolute; - right: 3px; - top: 10px; - width: 20px; - height: 20px; - text-align: center; - line-height: 20px; - text-align: center; +.detail-close { + position: absolute; + right: 3px; + top: 10px; + width: 20px; + height: 20px; + text-align: center; + line-height: 20px; + text-align: center; - font-weight: 700; - font-size: 18px; - font-weight: 700; - color: #fff; - cursor: pointer; - } + font-weight: 700; + font-size: 18px; + font-weight: 700; + color: #fff; + cursor: pointer; +} - .detail-context { - position: absolute; - top: 40px; - left: 20px; - width: 350px; - } +.detail-context { + position: absolute; + top: 40px; + left: 20px; + width: 350px; +} - .detail-item { - height: 23px; - margin-top: 15px; - margin-left: 10px; - } - .detail-name { - float: left; - font-weight: 700; - color: #94e0c4; - } +.detail-item { + height: 23px; + margin-top: 15px; + margin-left: 10px; +} - .detail-value { - float: left; - color: #e1eee9; - } +.detail-name { + float: left; + font-weight: 700; + color: #94e0c4; +} - .detail-btn { - background: url("@/assets/img/tools/messagebtn.png") no-repeat; - position: absolute; - bottom: 60px; - right: 60px; - width: 105px; - height: 26px; - text-align: center; - color: #fff; - cursor: pointer; - } +.detail-value { + float: left; + color: #e1eee9; +} + +.detail-btn { + background: url("@/assets/img/tools/messagebtn.png") no-repeat; + position: absolute; + bottom: 60px; + right: 60px; + width: 105px; + height: 26px; + text-align: center; + color: #fff; + cursor: pointer; +} </style> diff --git a/src/components/tools/Legend_mnfz.vue b/src/components/tools/Legend_mnfz.vue index eb1f228..6f0c41c 100644 --- a/src/components/tools/Legend_mnfz.vue +++ b/src/components/tools/Legend_mnfz.vue @@ -31,7 +31,7 @@ <style lang="less" scoped> .legend-container { - padding: 1rem; + padding: 0.8rem; border: 1px solid #ddd; border-radius: 8px; max-width: 100%; @@ -40,6 +40,7 @@ } .legend-title { + margin-bottom: 8px; width: 100%; text-align: center; letter-spacing: 2px; @@ -61,9 +62,10 @@ } .legend-color-box { - width: 60px; - height: 10px; + width: 4rem; + height: 1rem; margin-right: 0.5rem; + margin-left: 0.5rem; display: inline-block; } diff --git a/src/components/tools/Message.vue b/src/components/tools/Message.vue index 898e7a9..43fad94 100644 --- a/src/components/tools/Message.vue +++ b/src/components/tools/Message.vue @@ -24,11 +24,11 @@ <el-table-column prop="r" label="鍗婂緞(r)"></el-table-column> </el-table> </div> - <template #footer> + <!-- <template #footer> <span class="dialog-footer"> <el-button @click="dialogVisible = false">鍏� 闂�</el-button> </span> - </template> + </template> --> </el-dialog> </div> </template> diff --git a/src/utils/water.js b/src/utils/water.js index 22723c3..fc1c05d 100644 --- a/src/utils/water.js +++ b/src/utils/water.js @@ -43,7 +43,7 @@ colorRender, // 鎺у埗鏄惁鍚敤棰滆壊娓叉煋 }); - console.log(`Water simulation started with baseUrl: ${baseUrl}, interval: ${interval}ms, colorRender: ${colorRender}`); + console.log(`浠跨湡妯℃嫙鍙傛暟锛� 璇锋眰璺緞 ${baseUrl}, 甯ч棿闂撮殧 ${interval}ms, 鏄惁寮�鍚笓棰樻覆鏌� ${colorRender}`); } /** * 鍒濆鍖栨按浣撴ā鎷熻鍥� @@ -62,7 +62,7 @@ }, }; viewer.scene.camera.flyTo(view); - console.log("Camera view initialized for water simulation."); + // console.log("Camera view initialized for water simulation."); } /** @@ -71,7 +71,7 @@ export function pauseWaterSimulation() { if (water) { water.pause(); - console.log("Water simulation paused."); + console.log("鏆傚仠浠跨湡"); } else { console.warn("No water simulation to pause."); } @@ -83,7 +83,7 @@ export function resumeWaterSimulation() { if (water) { water.resume(); - console.log("Water simulation resumed."); + console.log("缁х画浠跨湡"); } else { console.warn("No water simulation to resume."); } @@ -101,9 +101,8 @@ console.warn("No timestamps available for water simulation."); return; } - - const idx = Math.floor(Math.random() * imageList.length); - console.log(`Jumping to timestamp: count:[${imageList.length}], index:[${closestIndex}]`); + // const idx = Math.floor(Math.random() * imageList.length); //闅忔満绱㈠紩璺宠浆锛屽疄闄呬腑鐢ㄤ笉鍒帮紝鍙敤浣滄紨绀� + // console.log(`Jumping to timestamp: count:[${imageList.length}], index:[${closestIndex}]`); water.setTime(imageList[closestIndex]); } else { console.warn("No water simulation to set time for."); @@ -117,7 +116,7 @@ export function toggleWaterColorRender(enabled) { if (water) { water.colorRender = enabled; - console.log(`Water color render set to: ${enabled}`); + console.log(`鏄惁寮�鍚笓棰樻覆鏌� ${enabled}`); } else { console.warn("No water simulation to toggle color rendering."); } diff --git a/src/views/mnfz.vue b/src/views/mnfz.vue index ccc9563..c8abe82 100644 --- a/src/views/mnfz.vue +++ b/src/views/mnfz.vue @@ -74,8 +74,8 @@ clearTrailLine(); removeEmergencyPoints(); removeDataSources(); + showWaterSimulate.value = false; setTimeout(() => { - showWaterSimulate.value = false; isDynamicMode.value = false; // 娓呴櫎濞佽儊瀵硅薄琛ㄦ牸鍐呭 EventBus.emit("reset-table"); -- Gitblit v1.9.3