From 4f45341e4095d469ce4a8c9b4237fdccfbe861c4 Mon Sep 17 00:00:00 2001 From: qin <a@163.com> Date: 星期二, 01 四月 2025 10:30:49 +0800 Subject: [PATCH] 能效等级计算页面加导航 --- src/views/GB19762-2025.vue | 78 ++++++++++++++++++++++++++------------ 1 files changed, 53 insertions(+), 25 deletions(-) diff --git a/src/views/GB19762-2025.vue b/src/views/GB19762-2025.vue index 0ba8919..5a5020b 100644 --- a/src/views/GB19762-2025.vue +++ b/src/views/GB19762-2025.vue @@ -3,6 +3,12 @@ </div> --> <div class="container mx-auto px-4 py-8 bg-white industrial-soft-style" style="margin-top: 20px; padding-top: 15px"> <div class="w-100 h-100" style="background-color: #fff"> + <div class="mb-6 text-gray-500"> + <el-breadcrumb separator="/"> + <el-breadcrumb-item :to="{ path: '/' }">棣栭〉</el-breadcrumb-item> + <el-breadcrumb-item>鑳芥晥绛夌骇璁$畻</el-breadcrumb-item> + </el-breadcrumb> + </div> <!-- 椤堕儴鍒嗙被鑿滃崟 --> <div class="rounded-lg shadow" style="background-color: #f6f7f9; margin-bottom: 10px"> <div class="border-b p-4 border-bottom-dashed-1 box-border" style="padding: 10px"> @@ -73,15 +79,17 @@ <el-button @click="clear" type="info">娓呯┖</el-button> <span style="margin-left: 85px;">鍙傝�冨浗鏍囨枃浠讹細</span> <span style="color:dodgerblue;cursor: pointer;font-weight: bold;"> - <a href="/src/assets/pdf/GB19762-2025.pdf" target="_blank"> + <a :href="`${SERVE_URL}files/pdf/GB19762-2025.pdf`" target="_blank"> 绂诲績娉佃兘鏁堥檺瀹氬�煎強鑳芥晥绛夌骇 GB+19762-2025</a> </span> </div> </div> </div> - <div class="grid grid-cols-4 gap-4" style="padding: 15px 10px; min-height: 30px"> - <img style="width:78px;height: 30px;" v-if="calcResult != null" :src="getImgUrl()"> + <div class="grid" style="padding: 15px 10px; min-height: 30px"> + <img v-if="level > -1" style="width:78px;height: 30px;" :src="getImgUrl()"><span v-if="level > -1">{{ + calcResult }}</span> + <!-- <span v-if="level == 0">鏈绠楀嚭鑳芥晥绛夌骇锛岃妫�鏌ヨ緭鍏ユ暟鎹�!</span> --> </div> </div> </div> @@ -90,6 +98,7 @@ import { onMounted, ref, computed } from 'vue'; import { useRouter, useRoute } from 'vue-router'; import { ElMessage } from 'element-plus'; +import { SERVE_URL } from '@/constants'; const router = useRouter(); const route = useRoute(); @@ -196,19 +205,42 @@ }, ]; const clear = () => { - MaxFlow.value = 0; - MaxHead.value = 0; - Speed.value = 0; - Efficiency.value = 0; + MaxFlow.value = ''; + MaxHead.value = ''; + Speed.value = ''; + Efficiency.value = ''; typeSelect.value = 1; calcResult.value = null; + level.value = 0; } const getImgUrl = () => { - return "/src/assets/icons/" + calcResult.value + ".png"; + return `${SERVE_URL}static/img/calc-icons/${level.value}.png`; } // 璁$畻 const Calc = () => { + + if (MaxFlow.value == null) { + ElMessage.error("璇疯緭鍏ユ湁鏁堟祦閲忔暟鎹�!"); + return; + } + if (MaxHead.value == null) { + ElMessage.error("璇疯緭鍏ユ湁鏁堟壃绋嬫暟鎹�!"); + return; + } + if (Speed.value == null) { + ElMessage.error("璇疯緭鍏ユ湁鏁堣浆閫熸暟鎹�!"); + return; + } + if (Efficiency.value == null) { + ElMessage.error("璇疯緭鍏ユ湁鏁堟晥鐜囨暟鎹�!"); + return; + } + if (Efficiency.value < 0 || Efficiency.value > 100) { + ElMessage.error("璇疯緭鍏ユ湁鏁堟晥鐜囨暟鎹��0-100銆�!"); + return; + } + let pump = type.filter((c) => { return c.tag == typeSelect.value }) if (pump[0].pumpid == 1) CalcClearWaterPump(pump[0]) @@ -242,7 +274,7 @@ } let level = GetEnergyLevel(c1V, c2V, c3V); - calcResult.value = level; + //calcResult.value = level; } const GetEnergyLevel = (c1V: number, c2V: number, c3V: number) => { @@ -251,13 +283,16 @@ { level: 2, min: c2V, max: c1V }, { level: 3, min: c3V, max: c2V } ] - let level = 5; + let levelV = 0; for (const range of levelDic) { if (Efficiency.value >= range.min && Efficiency.value <= range.max) { - level = range.level; + levelV = range.level; } } - return level; + calcResult.value = "璁$畻缁撴灉锛�1绾ф晥鐜囧�� " + c1V.toFixed(2) + "%锛�2绾ф晥鐜囧�� " + c2V.toFixed(2) + "%锛�3绾ф晥鐜囧�� " + c3V.toFixed(2) + "%"; + + level.value = levelV; + return levelV; } //鐭虫补鍖栧伐绂诲績娉佃绠� @@ -308,7 +343,7 @@ c2V = oV + cv[0].c2; c3V = oV + cv[0].c3; let level = GetEnergyLevel(c1V, c2V, c3V); - calcResult.value = level; + //calcResult.value = level; } //issingle: 鏄惁鍗曠骇,isdouble: 鏄惁鍙屽惛 @@ -324,26 +359,19 @@ // 閫変腑鐘舵�� const typeSelect = ref(1); const pumpSelect = ref(1); -const MaxFlow = ref(0); -const MaxHead = ref(0) -const Speed = ref(0); -const Efficiency = ref(0); +const MaxFlow = ref(null); +const MaxHead = ref(null) +const Speed = ref(null); +const Efficiency = ref(null); const calcResult = ref(null); +const level = ref(-1) //鐩戝惉绫诲瀷閫夋嫨绛涢�� const changeSelectType = (tag: number) => { typeSelect.value = tag; - MaxFlow.value = 0; - MaxHead.value = 0; - Speed.value = 0; - Efficiency.value = 0; }; const changeSelectPumpType = (tag: number) => { pumpSelect.value = tag; typeSelect.value = type.filter((c) => { return c.pumpid == tag })[0].tag; - MaxFlow.value = 0; - MaxHead.value = 0; - Speed.value = 0; - Efficiency.value = 0; }; </script> <style lang="scss" scoped> -- Gitblit v1.9.3