src/api/trApi.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/components/menu/Device.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/components/menu/Location.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/components/menu/TimeLine.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/components/monifangzhen/echartInfo.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/components/monifangzhen/schemeCard.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/components/tools/Message copy.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/store/simAPI.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/store/simulation.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/utils/tools.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/views/GisView.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/views/left/CitySim.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/api/trApi.js
@@ -122,6 +122,7 @@ throw new Error(`HTTP error! status: ${response.status}`); } const jsonData = await response.json(); // è§£æ JSON æ°æ® console.log(jsonData,'jsonjsonjsonjson') return parseWaterSimulationData(jsonData); // è°ç¨è§£æå½æ° } catch (error) { console.error("è¯·æ±æè§£ææ°æ®æ¶åºé:", error); src/components/menu/Device.vue
@@ -6,12 +6,28 @@ <div class="left-content device-content"> <div style="margin-left: 5px"> <span style="color: white">éç¹æ²ï¼</span> <el-select @change="handleChange" v-model="selectValue" placeholder="Select" size="large" style="width: 240px"> <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" /> <el-select @change="handleChange" v-model="selectValue" placeholder="Select" size="large" style="width: 240px" > <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" /> </el-select> </div> <el-tree :data="deviceTree" node-key="deviceId" :props="treeProps" @node-click="handleTreeNodeClick" class="device-tree"> <el-tree :data="deviceTree" node-key="deviceId" :props="treeProps" @node-click="handleTreeNodeClick" class="device-tree" > <template #default="{ node, data }"> <span v-if="!data.children" class="device-tree-item"> <!-- <div class="device-item-icon"></div> --> @@ -27,21 +43,23 @@ </template> <script setup> import { ref, computed, onMounted, watch, onBeforeUnmount, } from "vue"; import { useRoute, onBeforeRouteUpdate } from 'vue-router'; import { ref, computed, onMounted, watch, onBeforeUnmount } from "vue"; import { useRoute, onBeforeRouteUpdate } from "vue-router"; import { createPoint, removeEntities } from "@/utils/map"; import { deviceDictList, getDictName } from "@/constant/dict.js"; import { getDeviceInfo } from "@/api/hpApi"; import { initeWaterPrimitiveView } from "@/utils/water"; //ç¸æºflyTo彿°ï¼åç»optionsåè¡¨ä¸æå¯¹åºç»çº¬åº¦åå¼ç¨ import { useSimStore } from "@/store/simulation"; const simStore = useSimStore(); onMounted(() => { onMounted(async () => { // å è½½ææç鿣ç¹ä¿¡æ¯ await getData(); loadDeviceList("åè¡æ²"); initeWaterPrimitiveView() initeWaterPrimitiveView(); }); onBeforeRouteUpdate((to, from, next) => { if (to.path !== '/zhjc') { if (to.path !== "/zhjc") { handleCleanup(); } next(); @@ -49,24 +67,27 @@ const route = useRoute(); onBeforeUnmount(() => { if (route.path !== '/zhjc') { if (route.path !== "/zhjc") { handleCleanup(); } }); watch(() => simStore.DeviceShowSwitch, (newValue, oldValue) => { watch( () => simStore.DeviceShowSwitch, (newValue, oldValue) => { if (newValue) { initializeDevicePoints(); } else { handleCleanup() handleCleanup(); } }); } ); const deviceListAll = ref([]); const deviceEntities = ref([]); const handleCleanup = () => { deviceListAll.value.forEach(item => { deviceListAll.value.forEach((item) => { removeEntities(item.deviceId); }); } }; const initializeDevicePoints = () => { const list = []; deviceListAll.value.forEach((item, index) => { @@ -82,13 +103,18 @@ }); deviceEntities.value = list; }; const allDevices = ref([]); const getData = async () => { const res = await getDeviceInfo(); allDevices.value = res.data.pageData; }; // æ ¹æ®åºååç§°å 载设å¤å表 const loadDeviceList = async (areaName) => { try { handleCleanup() const res = await getDeviceInfo(); const allDevices = res.data.pageData; const devicesInArea = allDevices.filter((item) => handleCleanup(); // const res = await getDeviceInfo(); // const allDevices = res.data.pageData; const devicesInArea = allDevices.value.filter((item) => item.deviceName?.includes(areaName) ); deviceListAll.value = devicesInArea; @@ -98,6 +124,7 @@ console.error("å 载设å¤ä¿¡æ¯å¤±è´¥", error); } }; // å¤çåºåååäºä»¶ const handleChange = (item) => { if (!item) { src/components/menu/Location.vue
@@ -205,7 +205,7 @@ left: 0px; right: 0px; bottom: 10px; background-color: rgba(236, 233, 233, 0.5); background-color: rgba(47, 44, 44, 0.5); /* åéæé®ç½© */ display: flex; align-items: center; 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> @@ -25,18 +35,33 @@ <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" /> <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> <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> @@ -45,20 +70,36 @@ <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 class="date-part">{{ time.split(' ')[0] }}</div> <div class="time-part">{{ time.split(' ')[1] }}</div> <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> <div> <ratelevel ref="ratelevelRef" :playing-time="sendCurrentPlayingTime" @finish-calculation="handleFinishCalculation" style="margin-top: 12px; margin-left: 28px; margin-right: 10px;justify-content: flex-end;"></ratelevel> <el-button @click="handleBack" style="margin-top: 3px; margin-left: 30px; margin-right: 10px">ç»ææ¨¡æ</el-button> <ratelevel ref="ratelevelRef" :playing-time="sendCurrentPlayingTime" @finish-calculation="handleFinishCalculation" style=" margin-top: 12px; margin-left: 28px; margin-right: 10px; justify-content: flex-end; " ></ratelevel> <el-button @click="handleBack" style="margin-top: 3px; margin-left: 30px; margin-right: 10px" >ç»ææ¨¡æ</el-button > </div> </div> </template> @@ -71,7 +112,7 @@ defineProps, onBeforeUnmount, inject, reactive reactive, } from "vue"; import ratelevel from "@/components/menu/flowRate_waterLevel.vue"; @@ -94,7 +135,12 @@ const simStore = useSimStore(); const { selectedScheme } = storeToRefs(simStore); const emit = defineEmits(["timeUpdate", "isPlaying", "playbackFinished", "isColorRender"]); const emit = defineEmits([ "timeUpdate", "isPlaying", "playbackFinished", "isColorRender", ]); // å®ä¹props const props = defineProps({ waterSimulateParams: { @@ -127,7 +173,7 @@ rainSize: 0.5, rainSpeed: 50, rainColor: "#99B3CC", rainDensity: 30 // é¨çå¯åº¦ rainDensity: 30, // é¨çå¯åº¦ }); // 计ç®å±æ§ const progressPercentage = computed( @@ -157,7 +203,7 @@ baseUrl: `/simu/${serviceInfo}`, // baseUrl: `/simu/c2h1dc`, interval: intervalMap[playbackRate.value], colorRender: isColorRenderEnabled.value colorRender: isColorRenderEnabled.value, }); isWaterPrimitiveCreated.value = true; } else { @@ -191,8 +237,8 @@ return; // 黿¢åç»é»è¾æ§è¡ } if (isWaterPrimitiveCreated.value) { console.log('å½åæ¯å¦å¼å¯ä¸é¢æ¸²æï¼', enabled); emit("isColorRender", enabled) console.log("å½åæ¯å¦å¼å¯ä¸é¢æ¸²æï¼", enabled); emit("isColorRender", enabled); toggleWaterColorRender(enabled); } }; @@ -246,100 +292,109 @@ // 注æï¼ææ¶ data å¯è½æ¯ä¸ä¸ªå符串ï¼ä¾å¦ JSON åç¬¦ä¸²ï¼ let data = selectedScheme.value.data; // 妿æ¯å符串ï¼åå°è¯è§£ææå¯¹è±¡ if (typeof data === 'string') { if (typeof data === "string") { try { data = JSON.parse(data); console.log('è§£æåçé鍿°æ®ï¼', data); console.log("è§£æåçé鍿°æ®ï¼", data); } catch (e) { console.error("data 䏿¯ææç JSON å符串"); return; } } // æå°éé¨å¼ºåº¦çåä½ console.log('éé¨å¼ºåº¦çå使¯ï¼', data.intensityUnit); 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 åä½ï¼æ æ³è¿è¡è½¬æ¢'); 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); console.log("æç»ç rainfallList:", rainfallList); // æå intensity å¼ rainFallValues.value = rainfallList.map(r => r.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); console.log( "å½åæ¹æ¡ä¸æå°é¨éåæå¤§é¨éï¼", minRainValue.value, maxRainValue.value ); } // å®ä¹éé¨ç级åå ¶å¯¹åºçè§è§åæ° const rainLevels = [ { name: 'å°é¨', name: "å°é¨", min: 0.1, max: 9.9, size: 0.5, // 鍿»´å¤§å°ï¼æ´å° speed: 20, // ä¸è½éåº¦ï¼æ´æ ¢ density: 15, // 鍿»´å¯åº¦ï¼æ´ç¨ç color: '#ADD8E6' // æµ èè²ï¼è±¡å¾è½»æçå°é¨ color: "#ADD8E6", // æµ èè²ï¼è±¡å¾è½»æçå°é¨ }, { name: 'ä¸é¨', name: "ä¸é¨", min: 10, max: 24.9, size: 0.7, speed: 40, density: 35, color: '#ADD8E6' color: "#ADD8E6", }, { name: '大é¨', name: "大é¨", min: 25, max: 49.9, size: 1.0, speed: 70, density: 60, color: '#ADD8E6' color: "#ADD8E6", }, { name: 'æ´é¨', name: "æ´é¨", min: 50, max: 99.9, size: 1.3, speed: 90, density: 80, color: '#ADD8E6' color: "#ADD8E6", }, { name: '大æ´é¨', name: "大æ´é¨", min: 100, size: 1.6, speed: 110, density: 100, color: '#ADD8E6' } color: "#ADD8E6", }, ]; // æ ¹æ®éé¨éè¿å对åºçé¨å½¢é ç½® function getRainLevel(rainValue) { for (let level of rainLevels) { if (level.min <= rainValue && (level.max === undefined || rainValue <= level.max)) { if ( level.min <= rainValue && (level.max === undefined || rainValue <= level.max) ) { return level; } } // é»è®¤æ é¨ç¶æ return { name: 'æ é¨', size: 0.5, speed: 30, density: 20, color: '#F0F8FF' }; return { name: "æ é¨", size: 0.5, speed: 30, density: 20, color: "#F0F8FF" }; } // æ ¹æ®ææ¾è¿åº¦æ´æ°å¤©æ°ææï¼å·²ä¼åï¼ let lastUsedIndex = -1; // ç¼åä¸ä¸æ¬¡ä½¿ç¨çç´¢å¼ï¼é²æ¢é夿´æ° let lastRainValue = null; function updateWeatherByProgress() { if (rainFallValues.value.length === 0) return; console.log(`æ¶é´è½´æ»æ¶é¿: ${duration.value}, å½åæ¶é´: ${currentTime.value}`); // æå°æ¶é´è½´ä¿¡æ¯ console.log( `æ¶é´è½´æ»æ¶é¿: ${duration.value}, å½åæ¶é´: ${currentTime.value}` ); // æå°æ¶é´è½´ä¿¡æ¯ const progress = currentTime.value / duration.value; const floatIndex = progress * (rainFallValues.value.length - 1); const index = Math.floor(floatIndex); // å½åç´¢å¼ @@ -353,7 +408,7 @@ // console.log(`æ£å¨å¤ççé¨éæ°æ®ç¹: å½å=${currentRain}, ä¸ä¸ä¸ª=${nextRain}, æå¼å=${rainValue.toFixed(2)}, ç´¢å¼=${index}`); // 妿å½åç´¢å¼æªåå䏿å¼å·®å¼ä¸å¤§ï¼è·³è¿é夿´æ° if (index === lastUsedIndex && Math.abs(rainValue - lastRainValue) < 0.1) { console.log('ç±äºæ°æ®æ æ¾èååï¼è·³è¿æ¬æ¬¡æ´æ°'); console.log("ç±äºæ°æ®æ æ¾èååï¼è·³è¿æ¬æ¬¡æ´æ°"); return; } @@ -363,10 +418,10 @@ // è·å对åºçé¨å½¢é ç½® const rainLevel = getRainLevel(rainValue); if (rainLevel.name === 'æ é¨') { if (rainLevel.name === "æ é¨") { // æ é¨ç¶æï¼æ¸ é¤é¨æ mapUtils.delRain(); console.log('æ§è¡äºæ é¨ç¶æï¼æ¸ é¤äºé¨æ'); console.log("æ§è¡äºæ é¨ç¶æï¼æ¸ é¤äºé¨æ"); return; } @@ -375,9 +430,9 @@ rainSize: rainLevel.size, rainSpeed: rainLevel.speed, rainDensity: rainLevel.density, rainColor: rainLevel.color rainColor: rainLevel.color, }; console.log('å½åé¨éæ°æ®ï¼', rainValue, 'å½åé¨å½¢ï¼', rainLevel); console.log("å½åé¨éæ°æ®ï¼", rainValue, "å½åé¨å½¢ï¼", rainLevel); // è°ç¨å·¥å ·æ¹æ³æ´æ°é¨æ mapUtils.toggleRain(rainParams, true); } @@ -414,7 +469,7 @@ // è®¾ç½®ææ¾éç const setPlaybackRate = (rate) => { isColorRenderEnabled.value = false isColorRenderEnabled.value = false; playbackRate.value = rate; showSpeedMenu.value = false; // 忢å½åææ¾ @@ -454,7 +509,8 @@ // ç´æ¥æ¾å°æè¿ç timestamp ç´¢å¼ const closestIndex = findClosestTimestampIndex(targetTime); const baseTimestamp = waterTimestamps.value[0]; currentTime.value = (waterTimestamps.value[closestIndex] - baseTimestamp) / 1000; currentTime.value = (waterTimestamps.value[closestIndex] - baseTimestamp) / 1000; // æ´æ°æ°´ä½æ¨¡ææ¶é´ setTimeForWaterSimulation(closestIndex); @@ -486,7 +542,7 @@ () => selectedScheme.value, (newVal) => { if (newVal) { console.log('é䏿¹æ¡å·²æ¹å:', newVal) console.log("é䏿¹æ¡å·²æ¹å:", newVal); } } ); @@ -499,7 +555,9 @@ .valueOf(); // ä½¿ç¨ valueOf() è·ååå§æ¶é´æ³ // æ´æ° currentPlayingTime æ ¼å¼ååçæ¶é´å符串 currentPlayingTime.value = dayjs(sendCurrentPlayingTime.value).format("YYYY-MM-DD HH:mm:ss"); currentPlayingTime.value = dayjs(sendCurrentPlayingTime.value).format( "YYYY-MM-DD HH:mm:ss" ); EventBus.emit("time-update", currentPlayingTime.value); } } @@ -534,15 +592,17 @@ const schemeInfo = selectedScheme.value; serviceInfo = schemeInfo.serviceName; // console.log('è·åå°ç serviceName:', serviceInfo); getRainfallData() getRainfallData(); // æ ¹æ®layer.jsonå»è·åæ¶é´è½´ä¿¡æ¯ const { waterTimestamps: timestamps } = await fetchWaterSimulationData(serviceInfo); const { waterTimestamps: timestamps } = await fetchWaterSimulationData( serviceInfo ); // ç°å¨æ¯æç §æ»å ±æå¤å°ä¸ªç¹æ¥æ¸²ææ¶é´è½´ if (timestamps) { waterTimestamps.value = timestamps; updateTimelineRange(); timeMarkers.value = generateTimeMarkers(timestamps); sendCurrentPlayingTime.value = timestamps[0] sendCurrentPlayingTime.value = timestamps[0]; currentPlayingTime.value = dayjs(timestamps[0]).format( "YYYY-MM-DD HH:mm:ss" ); @@ -574,6 +634,7 @@ const { endSimulate } = inject("simulateActions"); function handleBack() { endSimulate(); EventBus.emit("close-selectArea"); isWaterPrimitiveCreated.value = false; if (ratelevelRef.value) { ratelevelRef.value.endCalculation(); src/components/monifangzhen/echartInfo.vue
@@ -107,7 +107,7 @@ import dayjs from "dayjs"; import { useSimStore } from "@/store/simulation"; const simStore = useSimStore(); const { rainFalls } = simStore; const { rainFalls, intensityUnit } = simStore; let dataIntervalId = null; // è¡¨æ ¼å®æ¶å¨ ID const jsonData = ref([]); // JSON æ°æ® @@ -226,11 +226,7 @@ // 触åäºä»¶ï¼å°å½åè¡ç ID åéå°å°å¾ç»ä»¶ EventBus.emit("row-clicked", row.id); } // const listData = cityData.listData; // const data = ref([ // 8.16, 15.38, 13.94, 9.46, 86.42, 71.32, 28.52, 25.9, 13.74, 14.54, 15.53, // 9.17, 0, 0.09, 0.86, 8.15, 44.8, 21.86, 6.2, 4.98, 2.82, 2.36, 3.1, 1.06, // ]); const rainChangeShow = ref(false); const tableContainer = ref(null); @@ -298,8 +294,6 @@ }; const debuffClick = () => { // Assuming you have access to parent components in a different way in Vue 3 // You might need to use provide/inject or props/emits instead console.log("Debuff click"); }; @@ -312,61 +306,14 @@ // æ¶é´è½´æ¶é´æªåå¤ç const syncTimeWithTimeline = () => { // 2025-05-24 00:25 // // å°æ¶é´å符串转æ¢ä¸ºåéæ° (æ ¼å¼: "YYYY-MM-DD mm:ss") if (nowTime.value) { const timeParts = nowTime.value.split(" "); const timeOnly = timeParts[1]; // è·å "mm:ss" é¨å console.log(nowTime.value, "nowTime.valuenowTime.value"); return timeOnly; } }; // ææ¶å ä¸ç¨ï¼ä¸»è¦åè½ä¸ºä¸åéæå¼å åä¸ªæ°æ® // function processData(originalData) { // const processedData = []; // let currentTotal = 0; // å¨æç´¯å ç total // for (let i = 0; i < originalData.length; i++) { // const current = originalData[i]; // const targetIntensity = current.intensity; // let remainingIntensity = targetIntensity; // å©ä½éè¦åé ç intensity // // çæ60个ç¹ï¼å¨æéæºå¡«å ï¼å 许åºç°ä½å¼åé«å¼ï¼ // for (let j = 0; j < 60; j++) { // // 1. å¨æçæ intensityï¼éæºï¼ä½æåä¸ç¹è¡¥è¶³å©ä½å¼ï¼ // let intensity; // if (j === 59) { // intensity = remainingIntensity; // æåä¸ç¹å¼ºå¶ç¨å®å©ä½å¼ // } else { // // éæºçæä¸ä¸ªæ¯ä¾ï¼0.1~0.5ä¹é´ç使¦ç + å¶å°é«å¼ï¼ // const isLowValue = Math.random() < 0.7; // 70%æ¦ççæä½å¼ // const maxAllowed = remainingIntensity / (60 - j); // ç¡®ä¿ä¸è¶ å©ä½å¼ // intensity = isLowValue // ? Math.random() * maxAllowed * 0.3 // ä½å¼èå´ // : Math.random() * maxAllowed * 1.5; // å¶å°é«å¼ // } // remainingIntensity -= intensity; // // 2. 宿¶ç´¯å total // currentTotal += intensity; // processedData.push({ // time: current.time, // intensity: intensity, // total: currentTotal, // }); // } // // éªè¯å½åæ®µçæ» intensity æ¯å¦å¹é åå§æ°æ® // console.log( // `Segment ${i}: Generated intensity sum = ${( // targetIntensity - remainingIntensity // ).toFixed(2)}, Original = ${targetIntensity}` // ); // } // return processedData; // } // 设置éé¨å¾è¡¨ const setEcharts1 = () => { const chartDom = document.getElementById("echarts1"); const myChart1 = echarts.init(chartDom); @@ -392,17 +339,27 @@ // å è½½JSONæ°æ® const loadJsonData = async () => { try { // è¿ä¸ªresultæ¯ç¨çä¸è¿°çæå¼ï¼ææ¶å ä¸ç¨ï¼ // const result = processData(simStore.rainFalls); const result = simStore.rainFalls; if (result?.length) { rainfallData.value = result; // 夿 intensityUnit æ¯å¦ä¸º mm/15min if (rainfallData.value.length > 0) { // data1.value = [rainfallData.value[0].intensity]; // data2.value = [rainfallData.value[0].total]; // é»è®¤åå§ä»0å¼å§ç // å¦ææ¯ mm/15minï¼åå°ææ intensity * 60 if (intensityUnit === "mm/15min") { rainfallData.value = rainfallData.value.map((item) => ({ ...item, intensity: item.intensity * 60, })); } // åå§å data1 å data2ï¼ä» 0 å¼å§ï¼ data1.value = [0]; data2.value = [0]; // 使ç¨ç¬¬ä¸ä¸ªæ°æ®é¡¹ç time ä½ä¸ºåå§å¼ xAxisData.value = [rainfallData.value[0]?.time || "00:00"]; updateChart(); } } @@ -416,10 +373,7 @@ const option = { animation: false, tooltip: { trigger: "axis" }, // // è°æ´gridå¸å±è§£å³Yè½´æ ç¾æ¾ç¤ºé®é¢ grid: { // left: "1%", // å·¦ä¾§çæ´å¤ç©ºé´ // right: "1%", // å³ä¾§çæ´å¤ç©ºé´ bottom: "1%", containLabel: false, }, @@ -427,7 +381,6 @@ data: ["é鍿°æ®", "累计é¨é"], textStyle: { color: "#fff" }, right: "10px", // æ·»å legendç¹å»äºä»¶å¤ç selected: { é鍿°æ®: true, 累计é¨é: true, @@ -448,7 +401,6 @@ ...getDynamicYAxis(data1.value), axisLabel: { color: "#fff" }, splitLine: { show: false }, // ç¡®ä¿åç§°æ¾ç¤ºå®æ´ nameTextStyle: { color: "#fff", }, @@ -468,13 +420,13 @@ series: [ { name: "é鍿°æ®", type: "bar", // æç¡®æå®ç±»å type: "bar", data: data1.value, itemStyle: { color: "#3268fe" }, }, { name: "累计é¨é", type: "line", // æç¡®æå®ç±»å type: "line", yAxisIndex: 1, data: data2.value, lineStyle: { color: "#ffb637" }, @@ -484,13 +436,13 @@ myChart1.setOption(option, true); }; // æ°æ®æ´æ° // æ°æ®æ´æ° - æ¯æ¬¡æ·»å 䏿¡æ°æ® const updateData = () => { if (dataIndex.value < rainfallData.value.length) { const item = rainfallData.value[dataIndex.value]; data1.value.push(item.intensity); data2.value.push(item.total); xAxisData.value.push(syncTimeWithTimeline()); xAxisData.value.push(item.time); // â æ¹ç¨ item.time dataIndex.value++; updateChart(); } else { @@ -498,28 +450,45 @@ } }; // æ§å¶æ¹æ³ const startUpdating = (interval = 60000) => { if (!updateInterval) { updateInterval = setInterval(updateData, interval); // æ§å¶æ¹æ³ï¼ç²¾ç¡®æ§å¶å¨ç»æ¶é´ï¼æåä¸å¸§å¨ç¬¬ 90 ç§ const startUpdating = () => { if (updateInterval || dataIndex.value >= rainfallData.value.length) return; const totalDuration = 90000; // 90ç§ const totalPoints = rainfallData.value.length; const startTime = Date.now(); const animate = (index = 0) => { if (index >= totalPoints) { stopUpdating(); return; } const now = Date.now(); const expectedTime = (index / (totalPoints - 1)) * totalDuration; const delay = Math.max(0, startTime + expectedTime - now); updateInterval = setTimeout(() => { dataIndex.value = index + 1; // å 为æ¯ä» 0 å¼å§ push ç updateData(); animate(index + 1); }, delay); }; animate(dataIndex.value); }; const stopUpdating = () => { clearInterval(updateInterval); clearTimeout(updateInterval); updateInterval = null; }; const resetLoading = () => { stopUpdating(); dataIndex.value = 0; data1.value = []; data2.value = []; xAxisData.value = ["00:00"]; if (rainfallData.value.length) { data1.value = [rainfallData.value[0].intensity]; data2.value = [rainfallData.value[0].total]; } data1.value = [0]; data2.value = [0]; xAxisData.value = [rainfallData.value[0]?.time || "00:00"]; updateChart(); }; src/components/monifangzhen/schemeCard.vue
@@ -113,10 +113,22 @@ simStore.setSelectedScheme(item); console.log("ææå¡åç§°"); } const flyHeight = ref(100000); const shouldShowFill = false; // æ±è§£å¨æ±è§£å®æä¹åæå¯ä»¥æ¾ç¤ºæ¶é´è½´ if (item.status == 10) { // åªæè¡æ¿åºåæ§è¡ if (item.areaType == 1) { flyHeight.value = 100000; EventBus.emit("select-geom", { geom: item.geom, flyHeight: flyHeight.value, shouldShowFill: shouldShowFill, }); } else { // åè¡æ²åºå跳转è§è§ initeWaterPrimitiveView(); } currentScheme.value = item; schemeInfoShow.value = true; emit("closeBtn", false); src/components/tools/Message copy.vue
ÎļþÒÑɾ³ý src/store/simAPI.js
@@ -76,10 +76,11 @@ mode: forms.mode, gauges: forms.gauges, rainfalls: forms.rainFallList, intensityUnit: forms.intensityUnit // intensityUnit: forms.intensityUnit intensityUnit: forms.intensityUnit || 'mm/15min' }) } console.log(params) console.log(params, 'ä¿åæ¹æ¡åæ°') const res = await createSimData(params) ElMessage.success('æ¹æ¡ä¿åæå') return res @@ -104,8 +105,9 @@ confirmButtonText: 'ç¡®å®', cancelButtonText: 'åæ¶', }) // ç¨æ·ç¡®è®¤åæ§è¡ä¿å await saveScheme(forms) // ç¨æ·ç¡®è®¤åæ§è¡ä¿åï¼å¹¶è¿åç»æ const res = await saveScheme(forms); // æ§è¡ä¿åå¹¶æ¥æ¶ç»æ return res; // è¿åä¿åçç»æ } catch (error) { if (error !== 'cancel') { console.error('ä¿ååºé:', error) src/store/simulation.js
@@ -31,10 +31,12 @@ const backToHome = ref(false) const selectedScheme = ref(null) const rainFalls = ref() const intensityUnit = ref() const setSelectedScheme = (scheme) => { selectedScheme.value = scheme rainFalls.value = JSON.parse(scheme.data).rainfalls console.log(rainFalls.value, 'shceme') intensityUnit.value = JSON.parse(scheme.data).intensityUnit console.log(intensityUnit.value, 'shceme') } const clearSelectedScheme = () => { selectedScheme.value = null @@ -148,6 +150,7 @@ schemCard, backToHome, rainFalls, intensityUnit, DangerPoint, DeviceShowSwitch, DangerShowSwitch, src/utils/tools.js
@@ -170,7 +170,6 @@ CreateLabel(pic, show) { if (show) { earthCtrl.factory.createSimpleGraphic(pic, {}, function (entity) { console.log(entity.polyline.positions.getValue(), "entity"); window.Viewer = earthCtrl.viewer; //å¼å¯ç¼è¾å¹¶å¯ç¨å±æ§å¼¹çª earthCtrl.factory.SimpleGraphic.edit(true, { src/views/GisView.vue
@@ -58,10 +58,13 @@ const MULTIPOLYGON_COORDS = ref([]); let previousEntities = []; // ç¨äºåå¨ä¹åå建çå®ä½ const flyToHeight = ref(null); const ShowFill = ref(true); // ç嬿°å»ºæ¹æ¡éæ©çåºåèå´ EventBus.on("select-geom", ({ geom, flyHeight }) => { EventBus.on("select-geom", ({ geom, flyHeight, shouldShowFill }) => { flyToHeight.value = flyHeight; ShowFill.value = shouldShowFill; console.log(ShowFill.value, "ShowFill.valueShowFill.value"); const coordsStr = geom .replace("MULTIPOLYGON(((", "") // 廿å¼å¤´ .replace(")))", ""); // 廿ç»å°¾ @@ -87,7 +90,7 @@ // æ¸ é¤ä¹åçææå®ä½ clearPreviousEntities(); // éä¸åºåæ è² addCustomPolygon(); addCustomPolygon(ShowFill.value); }); // æ¸ é¤ä¹åçææå®ä½ @@ -127,25 +130,27 @@ }; } function addCustomPolygon() { function addCustomPolygon(ShowFill = true) { // å° MULTIPOLYGON_COORDS.value 转æ¢ä¸º GeoJSON æ ¼å¼ const geoJson = convertToGeoJson(MULTIPOLYGON_COORDS.value); const center = geoJson.properties.center; // å建å¤è¾¹å½¢å®ä½ // å建å¤è¾¹å½¢å®ä½ï¼å¹¶æ ¹æ® ShowFill åæ°å³å®æ¯å¦æ¾ç¤ºå¡«å é¢è² const polygonEntity = viewer.entities.add({ // name: "èªå®ä¹åºå", polygon: { hierarchy: Cesium.Cartesian3.fromDegreesArray( geoJson.geometry.coordinates[0][0].flat() ), material: Cesium.Color.RED.withAlpha(0.3), // åéæçº¢è²å¡«å material: ShowFill ? Cesium.Color.RED.withAlpha(0.3) // åéæçº¢è²å¡«å : new Cesium.ColorMaterialProperty(Cesium.Color.TRANSPARENT), // 妿ä¸éè¦å¡«å ï¼å使ç¨éææè´¨ outline: true, outlineColor: Cesium.Color.RED, // 红è²è¾¹æ¡ outlineWidth: 5, clampToGround: true, // è´´å°æ¾ç¤º }, }); previousEntities.push(polygonEntity); // é£åä¸å¿ç¹ @@ -154,14 +159,13 @@ center.lon, center.lat, flyToHeight.value ), // æé«å° 100000ç±³é«åº¦ ), // æé«å°æå®é«åº¦ orientation: { heading: Cesium.Math.toRadians(0), // æ£åæ¹å pitch: Cesium.Math.toRadians(-90), // åä¸å¾æ90度ï¼åç´ä¿¯è§ï¼ roll: 0.0, }, }); } EventBus.on("close-selectArea", () => { src/views/left/CitySim.vue
@@ -378,10 +378,6 @@ console.log(intensityColumn, "intensityColumnintensityColumnintensityColumn"); // 3. æå第äºåçåä½ï¼å¦ "(mm/h)" â "mm/h"ï¼ const intensityUnit = extractUnitFromHeader(intensityColumn); console.log( intensityUnit, "intensityUnitintensityUnitintensityUnitintensityUnit" ); forms.intensityUnit = intensityUnit; // åå¨åä½ï¼å¯éï¼ // 4. å¦ææ ¡éªéè¿ï¼ç»§ç»å¤çæ°æ® @@ -499,7 +495,7 @@ }); } catch (error) { console.error("å¯å¨æ¨¡æè¿ç¨ä¸åçé误ï¼", error); ElMessage.error("å¯å¨æ¨¡æå¤±è´¥ï¼è¯·ç¨ååè¯"); // ElMessage.error("å¯å¨æ¨¡æå¤±è´¥ï¼è¯·ç¨ååè¯"); } } </script>