From d5b4f923a873820d0ba01b73da629e4ca8456457 Mon Sep 17 00:00:00 2001 From: wangjuncheng <1> Date: 星期二, 15 四月 2025 10:42:14 +0800 Subject: [PATCH] change --- src/views/left/CitySim.vue | 303 +++++++++++++++++++++++++------------------------- 1 files changed, 153 insertions(+), 150 deletions(-) diff --git a/src/views/left/CitySim.vue b/src/views/left/CitySim.vue index 788cb29..111e02f 100644 --- a/src/views/left/CitySim.vue +++ b/src/views/left/CitySim.vue @@ -8,20 +8,6 @@ </div> <div class="forms"> <el-form :model="forms" label-width="auto" style="max-width: 600px"> - <el-form-item label="琛屾斂鍖哄煙:" v-if="disForm == '琛屾斂鍖哄垝浠跨湡'"> - <el-select - v-model="forms.eare" - placeholder="Select" - style="max-width: 600px" - > - <el-option - v-for="item in cityOptions" - :key="item.value" - :label="item.label" - :value="item.value" - /> - </el-select> - </el-form-item> <el-form-item label="涓婁紶鍙傛暟"> <el-upload v-model:file-list="forms.fileList" @@ -40,6 +26,21 @@ <template #append>mm/h</template> </el-upload> </el-form-item> + <el-form-item label="琛屾斂鍖哄煙:" v-if="disForm == '琛屾斂鍖哄垝浠跨湡'"> + <el-select + v-model="forms.eare" + placeholder="Select" + style="max-width: 600px" + > + <el-option + v-for="item in cityOptions" + :key="item.value" + :label="item.label" + :value="item.value" + /> + </el-select> + </el-form-item> + <el-form-item label="閲嶇偣鍖哄煙" v-if="disForm == '閲嶇偣鍖哄煙浠跨湡'"> <el-select v-model="forms.eares" @@ -85,133 +86,149 @@ <el-form-item label="浠跨湡鍙傛暟:"> </el-form-item> </el-form> <div style="display: flex; justify-content: flex-end"> - <el-button>淇濆瓨鏂规</el-button> - <el-button @click="startPlay">寮�濮嬫ā鎷�</el-button> + <el-button type="primary" @click="openSaveDialog">淇濆瓨鏂规</el-button> + <el-button type="success" @click="startPlay">寮�濮嬫ā鎷�</el-button> </div> </div> + + <!-- 淇濆瓨鏂规瀵硅瘽妗� --> + <el-dialog + v-model="saveDialogVisible" + :title="dialogTitle" + width="50%" + :before-close="handleClose" + custom-class="custom-dialog" + > + <div class="dialog-content"> + <p><strong>妯℃嫙绫诲瀷锛�</strong>{{ dialogTitle }}</p> + <p v-if="disForm === '琛屾斂鍖哄垝浠跨湡'"><strong>琛屾斂鍖哄煙锛�</strong>{{ forms.eare }}</p> + <p v-if="disForm === '閲嶇偣鍖哄煙浠跨湡'"><strong>閲嶇偣鍖哄煙锛�</strong>{{ forms.eares }}</p> + <p><strong>闄嶉洦閲忥細</strong>{{ forms.rainfall }} mm</p> + <p><strong>闄嶉洦鏃堕暱锛�</strong>{{ forms.duration }} h</p> + <p><strong>闄嶉洦寮哄害锛�</strong>{{ forms.intensity }} mm/h</p> + <p><strong>涓婁紶鏂囦欢锛�</strong>{{ uploadedFilesText }}</p> + </div> + <template #footer> + <span class="dialog-footer"> + <el-button @click="saveDialogVisible = false">鍙栨秷</el-button> + <el-button type="primary" @click="confirmSave">纭畾淇濆瓨</el-button> + </span> + </template> + </el-dialog> </div> </template> + <script setup> -import { reactive, ref, watch, inject } from "vue"; -import { initeWaterPrimitiveView } from "@/utils/water"; +import { reactive, ref, computed ,watch} from "vue"; +import { ElMessage, ElMessageBox } from "element-plus"; -// 娉ㄥ叆鐖剁粍浠舵彁渚涚殑鏂规硶 -const { startSimulate, endSimulate } = inject("simulateActions"); - -// const emit = defineEmits(["start", "end"]); -// function endPlay() { -// emit("end"); -// } - -function startPlay() { - initeWaterPrimitiveView(); - startSimulate(); -} - -const value = ref(""); - -const cityOptions = [ - { - value: "鍖椾含甯�", - label: "鍖椾含甯�", - }, - { - value: "涓滃煄鍖�", - label: "涓滃煄鍖�", - }, - { - value: "瑗垮煄鍖�", - label: "瑗垮煄鍖�", - }, - { - value: "鏈濋槼鍖�", - label: "鏈濋槼鍖�", - }, - { - value: "娴锋穩鍖�", - label: "娴锋穩鍖�", - }, - { - value: "涓板彴鍖�", - label: "涓板彴鍖�", - }, - { - value: "鐭虫櫙灞卞尯", - label: "鐭虫櫙灞卞尯", - }, - { - value: "闂ㄥご娌熷尯", - label: "闂ㄥご娌熷尯", - }, - { - value: "鎴垮北鍖�", - label: "鎴垮北鍖�", - }, - { - value: "閫氬窞鍖�", - label: "閫氬窞鍖�", - }, - { - value: "椤轰箟鍖�", - label: "椤轰箟鍖�", - }, - { - value: "鏄屽钩鍖�", - label: "鏄屽钩鍖�", - }, - { - value: "澶у叴鍖�", - label: "澶у叴鍖�", - }, - { - value: "鎬�鏌斿尯", - label: "鎬�鏌斿尯", - }, - { - value: "骞宠胺鍖�", - label: "骞宠胺鍖�", - }, - { - value: "瀵嗕簯鍖�", - label: "瀵嗕簯鍖�", - }, - { - value: "寤跺簡鍖�", - label: "寤跺簡鍖�", - }, -]; -const earesOptions = [ - { - value: "瀛欒儭娌�", - label: "瀛欒儭娌�", - }, - { - value: "楸兼按娲炲悗娌�", - label: "楸兼按娲炲悗娌�", - }, - { - value: "浜庡瑗挎矡", - label: "浜庡瑗挎矡", - }, - { - value: "鍖楁渤娌�", - label: "鍖楁渤娌�", - }, - { - value: "榫欐硥宄潙", - label: "榫欐硥宄潙", - }, -]; - -const forms = reactive({ - eare: "鍖椾含甯�", - eares: "瀛欒儭娌�", - rainfall: "50", - duration: "5", - intensity: "70", - fileList: [], +// 瀹氫箟 Props +const props = defineProps({ + clickValue: String, }); +// 鏁版嵁缁戝畾 +const disForm = ref(""); // 褰撳墠鏄剧ず鐨勮〃鍗曠被鍨� +const saveDialogVisible = ref(false); // 鎺у埗淇濆瓨鏂规瀵硅瘽妗嗙殑鏄剧ず鐘舵�� +const forms = reactive({ + eare: "鍖椾含甯�", // 琛屾斂鍖哄煙 + eares: "瀛欒儭娌�", // 閲嶇偣鍖哄煙 + rainfall: "50", // 闄嶉洦閲� + duration: "5", // 闄嶉洦鏃堕暱 + intensity: "70", // 闄嶉洦寮哄害 + fileList: [], // 涓婁紶鐨勬枃浠跺垪琛� +}); + +// 琛屾斂鍖哄煙閫夐」 +const cityOptions = [ + { value: "鍖椾含甯�", label: "鍖椾含甯�" }, + { value: "涓滃煄鍖�", label: "涓滃煄鍖�" }, + { value: "瑗垮煄鍖�", label: "瑗垮煄鍖�" }, + { value: "鏈濋槼鍖�", label: "鏈濋槼鍖�" }, + { value: "娴锋穩鍖�", label: "娴锋穩鍖�" }, + { value: "涓板彴鍖�", label: "涓板彴鍖�" }, + { value: "鐭虫櫙灞卞尯", label: "鐭虫櫙灞卞尯" }, + { value: "闂ㄥご娌熷尯", label: "闂ㄥご娌熷尯" }, + { value: "鎴垮北鍖�", label: "鎴垮北鍖�" }, + { value: "閫氬窞鍖�", label: "閫氬窞鍖�" }, + { value: "椤轰箟鍖�", label: "椤轰箟鍖�" }, + { value: "鏄屽钩鍖�", label: "鏄屽钩鍖�" }, + { value: "澶у叴鍖�", label: "澶у叴鍖�" }, + { value: "鎬�鏌斿尯", label: "鎬�鏌斿尯" }, + { value: "骞宠胺鍖�", label: "骞宠胺鍖�" }, + { value: "瀵嗕簯鍖�", label: "瀵嗕簯鍖�" }, + { value: "寤跺簡鍖�", label: "寤跺簡鍖�" }, +]; + +// 閲嶇偣鍖哄煙閫夐」 +const earesOptions = [ + { value: "瀛欒儭娌�", label: "瀛欒儭娌�" }, + { value: "楸兼按娲炲悗娌�", label: "楸兼按娲炲悗娌�" }, + { value: "浜庡瑗挎矡", label: "浜庡瑗挎矡" }, + { value: "鍖楁渤娌�", label: "鍖楁渤娌�" }, + { value: "榫欐硥宄潙", label: "榫欐硥宄潙" }, +]; + +// 璁$畻灞炴�э細鑾峰彇瀵硅瘽妗嗘爣棰� +const dialogTitle = computed(() => { + return disForm.value === "琛屾斂鍖哄垝浠跨湡" ? "琛屾斂鍖哄垝浠跨湡" : "閲嶇偣鍖哄煙浠跨湡"; +}); + +// 璁$畻灞炴�э細鑾峰彇涓婁紶鏂囦欢鐨勫悕绉板垪琛� +const uploadedFilesText = computed(() => { + return forms.fileList.map(file => file.name).join(", ") || "鏃�"; +}); + +// 鐩戝惉 Props 鍙樺寲锛屾洿鏂板綋鍓嶈〃鍗曠被鍨� +watch( + () => props.clickValue, + (newValue) => { + disForm.value = newValue || "琛屾斂鍖哄垝浠跨湡"; + }, + { immediate: true, deep: true } +); + +// 鎵撳紑淇濆瓨鏂规瀵硅瘽妗� +const openSaveDialog = () => { + if ( + !forms.rainfall || + !forms.duration || + !forms.intensity || + (disForm.value === "琛屾斂鍖哄垝浠跨湡" && !forms.eare) || + (disForm.value === "閲嶇偣鍖哄煙浠跨湡" && !forms.eares) + ) { + ElMessage.warning("璇峰厛濉啓鎵�鏈夊繀濉」"); + return; + } + saveDialogVisible.value = true; +}; + +// 鍏抽棴淇濆瓨鏂规瀵硅瘽妗� +const handleClose = () => { + saveDialogVisible.value = false; +}; + +// 纭淇濆瓨 +const confirmSave = () => { + console.log('淇濆瓨鏂规鎴愬姛', { + 妯℃嫙绫诲瀷: dialogTitle.value, + 琛屾斂鍖哄煙: disForm.value === "琛屾斂鍖哄垝浠跨湡" ? forms.eare : null, + 閲嶇偣鍖哄煙: disForm.value === "閲嶇偣鍖哄煙浠跨湡" ? forms.eares : null, + 闄嶉洦閲�: `${forms.rainfall} mm`, + 闄嶉洦鏃堕暱: `${forms.duration} h`, + 闄嶉洦寮哄害: `${forms.intensity} mm/h`, + // 涓婁紶鏂囦欢: forms.fileList.map(file => file.name), + }); + ElMessage.success('鏂规宸蹭繚瀛�'); + saveDialogVisible.value = false; +}; + +// 寮�濮嬫ā鎷� +function startPlay() { + console.log("寮�濮嬫ā鎷熸寜閽鐐瑰嚮"); +} + +// 鏂囦欢涓婁紶鐩稿叧鏂规硶 function handleRemove(file, uploadFiles) { console.log(file, uploadFiles); } @@ -227,6 +244,7 @@ } totally` ); } + const beforeUpload = (file) => { const allowedTypes = [ "application/vnd.ms-excel", @@ -259,23 +277,8 @@ () => false ); } - -const disForm = ref(""); - -// 瀹氫箟 Props -const props = defineProps({ - clickValue: String, -}); - -// 鐩戝惉 Props 鍙樺寲 -watch( - () => props.clickValue, - (newValue) => { - disForm.value = newValue || "琛屾斂鍖哄垝浠跨湡"; - }, - { immediate: true, deep: true } -); </script> + <style lang="less" scoped> .forms { background: url("@/assets/img/screen/leftbg.png"); @@ -293,4 +296,4 @@ /deep/ .el-form-item__label { color: #61f7d4 !important; } -</style> +</style> \ No newline at end of file -- Gitblit v1.9.3