Merge pull request #10052 from dataease/pr@dev-v2@fix_threshold_validate

fix(图表): 修复仪表盘和水波图阈值区间校验规则错误
This commit is contained in:
wisonic-s
2024-06-03 18:30:53 +08:00
committed by GitHub

View File

@@ -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
}