From 4df576843a8f0cf4990b95c77a4644d5d86f003e Mon Sep 17 00:00:00 2001 From: wisonic-s Date: Mon, 3 Jun 2024 18:29:54 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=9B=BE=E8=A1=A8):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E4=BB=AA=E8=A1=A8=E7=9B=98=E5=92=8C=E6=B0=B4=E6=B3=A2=E5=9B=BE?= =?UTF-8?q?=E9=98=88=E5=80=BC=E5=8C=BA=E9=97=B4=E6=A0=A1=E9=AA=8C=E8=A7=84?= =?UTF-8?q?=E5=88=99=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../editor/editor-senior/components/Threshold.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/core-frontend/src/views/chart/components/editor/editor-senior/components/Threshold.vue b/core/core-frontend/src/views/chart/components/editor/editor-senior/components/Threshold.vue index 91157a90b7..2047acb07b 100644 --- a/core/core-frontend/src/views/chart/components/editor/editor-senior/components/Threshold.vue +++ b/core/core-frontend/src/views/chart/components/editor/editor-senior/components/Threshold.vue @@ -64,10 +64,15 @@ const changeThreshold = () => { const changeSplitThreshold = (threshold: string) => { // check input if (threshold) { + const regex = /^(\d+)(,\d+)*$/ + if (!regex.test(threshold)) { + ElMessage.error(t('chart.gauge_threshold_format_error')) + return + } const arr = threshold.split(',') for (let i = 0; i < arr.length; i++) { const ele = arr[i] - if (parseFloat(ele).toString() === 'NaN' || parseFloat(ele) <= 0 || parseFloat(ele) >= 100) { + if (parseFloat(ele) <= 0 || parseFloat(ele) >= 100) { ElMessage.error(t('chart.gauge_threshold_format_error')) return }