| | |
| | | ? dayjs(forms.hours[0]).format("YYYY-MM-DD HH:mm:ss") |
| | | : dayjs(forms.hours).format("YYYY-MM-DD HH:mm:ss"), |
| | | type: forms.type, |
| | | total: forms.rainfall, |
| | | duration: forms.duration, |
| | | intensity: forms.intensity, |
| | | total: parseFloat(forms.rainfall), |
| | | duration: parseFloat(forms.duration), |
| | | intensity: parseFloat(forms.intensity), |
| | | prediction: forms.prediction, |
| | | history: forms.history, |
| | | mode: forms.mode, |
| | |
| | | rainfalls: forms.rainFallList |
| | | }) |
| | | } |
| | | console.log(params) |
| | | const res = await createSimData(params) |
| | | ElMessage.success('方案保存成功') |
| | | return res |
| | | // return res |
| | | } catch (error) { |
| | | console.error('保存失败:', error) |
| | | ElMessage.error('保存失败: ' + (error.message || '请稍后重试')) |
| | |
| | | }) |
| | | // 用户确认后执行保存 |
| | | await saveScheme(forms) |
| | | console.log(forms, 'ffffffffff') |
| | | } catch (error) { |
| | | if (error !== 'cancel') { |
| | | console.error('保存出错:', error) |
| | |
| | | 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); |
| | |
| | | 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; |
| | | }; |
| | | |
| | | // 计算属性:获取上传文件的名称列表 |
| | |
| | | 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["累计雨量"]), // 转为浮点数 |
| | | })); |
| | | }; |
| | | |
| | |
| | | <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="请输入" |
| | |
| | | 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); // 控制保存方案对话框的显示状态 |
| | | |
| | |
| | | isCollapsed.value = !isCollapsed.value; |
| | | }; |
| | | |
| | | const { calculateHoursDifference } = inject("calculateHours"); |
| | | |
| | | const change = (val) => { |
| | | rainfallDuration.value = calculateHoursDifference(val); |
| | | }; |
| | | |
| | | // 打开保存方案对话框 |
| | | const openSaveDialog = async () => { |
| | | const forms = { |
| | |
| | | v-for="item in RainfallPatterns" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | :value="item.name" |
| | | ></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="选择时间:"> |
| | | <el-date-picker |
| | | v-model="forms.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" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="预计时长:"> |
| | | <el-input v-model="forms.duration" type="number" placeholder="请输入" |
| | | <el-input |
| | | disabled |
| | | v-model="forms.duration" |
| | | type="number" |
| | | placeholder="请输入" |
| | | ><template #append>h</template></el-input |
| | | > |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="openPlan">打开方案</el-button> |
| | | <el-button type="primary" @click="openSaveDialog">保存方案</el-button> |
| | | <el-button type="success" @click="startPlay">开始模拟</el-button> |
| | | </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> |
| | | </div> |
| | | </template> |
| | | <script setup> |
| | |
| | | rainfall: 50, |
| | | schemeName: "", |
| | | rainfallIntensity: 70, |
| | | duration: 5, |
| | | duration: null, |
| | | prediction: "降雨场次", |
| | | mode: "正态分布", |
| | | showRainFall: "", |
| | | hours: null, |
| | | }); |
| | | |
| | | // 降雨场次选择 |
| | |
| | | isCollapsed.value = !isCollapsed.value; |
| | | }; |
| | | |
| | | const { calculateHoursDifference } = inject("calculateHours"); |
| | | |
| | | const change = (val) => { |
| | | forms.duration = calculateHoursDifference(val); |
| | | }; |
| | | |
| | | // 打开保存方案对话框 |
| | | const openSaveDialog = async () => { |
| | | const params = { |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, defineEmits } from "vue"; |
| | | import { ref, defineEmits, provide } from "vue"; |
| | | import citySim from "./CitySim.vue"; |
| | | import kgSim from "./KGSim.vue"; |
| | | import dayjs from 'dayjs'; |
| | | |
| | | import { SimAPIStore } from "@/store/simAPI"; |
| | | |
| | |
| | | const goBack = () => { |
| | | emits("back", clickValue.value); |
| | | }; |
| | | |
| | | // 计算累计时长 |
| | | 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; |
| | | }; |
| | | |
| | | provide("calculateHours", { calculateHoursDifference }); |
| | | </script> |
| | | |
| | | <style lang="less" scoped> |
| | |
| | | hot: true, |
| | | proxy: { |
| | | '/api': { |
| | | target: 'http://192.168.56.107:8077', |
| | | // target: 'http://192.168.56.107:8077', |
| | | target: 'http://192.168.1.104:8078', |
| | | changeOrigin: true, |
| | | // pathRewrite: { |
| | | // '^/api': '' |