From 0ed3eb7a436d722191ad41165408bbbb10adaa32 Mon Sep 17 00:00:00 2001
From: guonan <guonan201020@163.com>
Date: 星期四, 01 五月 2025 13:09:57 +0800
Subject: [PATCH] 修改

---
 src/views/left/CitySim.vue |   28 +++++++++++-----------------
 1 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/src/views/left/CitySim.vue b/src/views/left/CitySim.vue
index cc75ab4..193cdd5 100644
--- a/src/views/left/CitySim.vue
+++ b/src/views/left/CitySim.vue
@@ -187,22 +187,16 @@
 const forms = reactive({
   name: "",
   geom: "",
-  rainfall: "",
-  duration: "",
-  intensity: "",
+  rainfall: null,
+  duration: null,
+  intensity: null,
   fileList: [],
   type: 3,
   rainFallList: [],
-  hours: "",
+  hours: null,
 });
 
-// 璁$畻绱鏃堕暱
-const calculateHoursDifference = (val) => {
-  if (!val || val.length !== 2) return 0;
-  const [startDate, endDate] = val;
-  const diffInHours = dayjs(endDate).diff(dayjs(startDate), "hour", true); // true 琛ㄧず杩斿洖娴偣鏁�
-  return diffInHours;
-};
+const { calculateHoursDifference } = inject("calculateHours");
 
 const change = (val) => {
   forms.duration = calculateHoursDifference(val);
@@ -216,12 +210,12 @@
 const resetForm = () => {
   forms.geom = "";
   forms.eares = "瀛欒儭娌�";
-  forms.rainfall = "";
-  forms.duration = "";
-  forms.intensity = "";
+  forms.rainfall = null;
+  forms.duration = null;
+  forms.intensity = null;
   forms.fileList = [];
   forms.rainFallList = [];
-  forms.hours = "";
+  forms.hours = null;
 };
 
 // 璁$畻灞炴�э細鑾峰彇涓婁紶鏂囦欢鐨勫悕绉板垪琛�
@@ -273,8 +267,8 @@
 const transformKeys = (data) => {
   return data.map((item) => ({
     time: item["鏃堕棿"], // "鏃堕棿" 鈫� "time"
-    intensity: item["灏忔椂闆ㄥ己mm/h"], // "灏忔椂闆ㄥ己mm/h" 鈫� "intensity"
-    total: item["绱闆ㄩ噺"], // "绱闆ㄩ噺" 鈫� "total"
+    intensity: parseFloat(item["灏忔椂闆ㄥ己mm/h"]), // 杞负娴偣鏁�
+    total: parseFloat(item["绱闆ㄩ噺"]), // 杞负娴偣鏁�
   }));
 };
 

--
Gitblit v1.9.3