src/views/left/KGSimOption/HistorySimulation.vue
@@ -52,8 +52,23 @@
          <span>mm/h</span>
        </div>
        <div class="input-item">
          <label>选择时间:</label>
          <el-date-picker
            v-model="hours"
            type="datetimerange"
            start-placeholder="开始时间"
            end-placeholder="结束时间"
            format="YYYY-MM-DD HH:mm:ss"
            date-format="YYYY/MM/DD ddd"
            time-format="A hh:mm:ss"
            @change="change"
          />
          <span>h</span>
        </div>
        <div class="input-item">
          <label>降雨时长:</label>
          <el-input
            disabled
            v-model="rainfallDuration"
            type="number"
            placeholder="请输入"
@@ -105,6 +120,7 @@
import { useSimStore } from "@/store/simulation.js"; // 引入 Store
import { getRainfallData } from "@/api/hpApi.js";
import { SimAPIStore } from "@/store/simAPI";
import { EventBus } from "@/eventBus"; // 引入事件总线
// 获取 Store 实例
const simStore = SimAPIStore();
@@ -123,7 +139,7 @@
// 定义 Props
const props = defineProps({
  selectedArea: {
    type: String,
    type: Object,
    required: true,
  },
});
@@ -133,7 +149,8 @@
const totalRainfall = ref(50); // 降雨总量
const schemeName = ref("方案名称"); // 方案名称
const rainfallIntensity = ref(70); // 降雨强度
const rainfallDuration = ref(5); // 降雨时长
const hours = ref(null);
const rainfallDuration = ref(null); // 降雨时长
const isCollapsed = ref(false); // 控制详情的展开/收起状态
const saveDialogVisible = ref(false); // 控制保存方案对话框的显示状态
@@ -159,6 +176,12 @@
  isCollapsed.value = !isCollapsed.value;
};
const { calculateHoursDifference } = inject("calculateHours");
const change = (val) => {
  rainfallDuration.value = calculateHoursDifference(val);
};
// 打开保存方案对话框
const openSaveDialog = async () => {
  const forms = {
@@ -171,6 +194,7 @@
    history: rainfallHistory.value,
  };
  await simStore.addSimCheme(forms);
  EventBus.emit("close-selectArea");
};
// 关闭保存方案对话框