mirror of
https://github.com/dataease/dataease.git
synced 2025-02-24 11:32:57 +08:00
Merge pull request #10052 from dataease/pr@dev-v2@fix_threshold_validate
fix(图表): 修复仪表盘和水波图阈值区间校验规则错误
This commit is contained in:
commit
9fe10c02bd
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user