From 4ae2f36049f575b60e6f9b8316dc39f2b5608652 Mon Sep 17 00:00:00 2001 From: dmy Date: Mon, 2 Mar 2026 21:17:34 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=B0=86=E9=A2=9D=E5=AE=9A=E7=94=B5?= =?UTF-8?q?=E5=8E=8B=E8=BE=93=E5=85=A5=E6=94=B9=E4=B8=BA=E4=B8=8B=E6=8B=89?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将额定电压从数字输入改为预定义选项的下拉选择框,支持常见的电压等级 --- webui/src/components/ParameterForm.vue | 12 ++++++++---- webui/src/types/index.ts | 2 +- webview_app.py | 4 +++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/webui/src/components/ParameterForm.vue b/webui/src/components/ParameterForm.vue index 208718a..f84a3ed 100644 --- a/webui/src/components/ParameterForm.vue +++ b/webui/src/components/ParameterForm.vue @@ -26,12 +26,11 @@
-
@@ -313,7 +312,7 @@ import LogComponent from './Log.vue' // 默认参数 const defaultParams: AllParameters = { parameter: { - rated_voltage: 750, + rated_voltage: '500kV', h_c_sag: 14.43, h_g_sag: 11.67, insulator_c_len: 7.02, @@ -342,6 +341,11 @@ const result = ref(null) const error = ref(null) const logRef = ref | null>(null) +const voltageOptions = [ + '110kV', '220kV', '330kV', '500kV', '750kV','1000kV', + '±500kV', '±660kV', '±800kV', '±1100kV' +] + // 数组操作函数 const addHArm = () => { const last = params.parameter.h_arm[params.parameter.h_arm.length - 1] || 100 diff --git a/webui/src/types/index.ts b/webui/src/types/index.ts index 03576e1..18d6553 100644 --- a/webui/src/types/index.ts +++ b/webui/src/types/index.ts @@ -2,7 +2,7 @@ export interface Parameter { // 基本参数 - rated_voltage: number // 额定电压等级 (kV) + rated_voltage: string // 额定电压等级 (kV) h_c_sag: number // 导线弧垂 (m) h_g_sag: number // 地线弧垂 (m) insulator_c_len: number // 导线串子绝缘长度 (m) diff --git a/webview_app.py b/webview_app.py index 0df6908..165ad74 100644 --- a/webview_app.py +++ b/webview_app.py @@ -101,7 +101,9 @@ class EGMWebApp: ] para.h_arm = list(parameter_data.get('h_arm', [150, 130])) para.altitude = int(parameter_data.get('altitude', 1000)) - para.rated_voltage = float(parameter_data.get('rated_voltage', 750)) + # 解析电压等级字符串,如 "500kV" -> 500 + rated_voltage_str = str(parameter_data.get('rated_voltage', '500kV')) + para.rated_voltage = float(rated_voltage_str.replace('kV', '').replace('±', '')) para.ng = float(advance_data.get('ng', -1)) para.Ip_a = float(advance_data.get('Ip_a', -1))