From 43a517b80f2803e0dcf6658113520c4a14c8c17f Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 22 五月 2023 18:21:52 +0800 Subject: [PATCH] 2023-05-22 --- src/utils/utils.js | 27 +++------------------------ 1 files changed, 3 insertions(+), 24 deletions(-) diff --git a/src/utils/utils.js b/src/utils/utils.js index 630fc57..cf01abb 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -982,33 +982,12 @@ } }) } - } else if (/^int/ig.test(col.type)) { + } else if (/^Decimal/ig.test(col.type) || /^int/ig.test(col.type)) { if (!val && val !== 0) { errors.push(_position + '鍐呭涓嶅彲涓虹┖') } else { - let _val = val + '' - - if (!/^(([^0][0-9]+|0)$)|^(([1-9]+)$)/.test(_val)) { // 妫�楠屾槸鍚︿负鏁存暟 - errors.push(_position + '鍐呭搴斾负鏁存暟') - } else if ((col.min || col.min === 0) && val < col.min) { // 鏈�灏忓�兼楠� - errors.push(_position + '灏忎簬鏈�灏忓��') - } else if ((col.max || col.max === 0) && val > col.max) { // 鏈�澶у�兼楠� - errors.push(_position + '澶т簬鏈�澶у��') - } - } - } else if (/^Decimal/ig.test(col.type)) { - if (!val && val !== 0) { - errors.push(_position + '鍐呭涓嶅彲涓虹┖') - } else { - let _val = val + '' - let _vals = _val.split('.') - - if (!/^(([^0][0-9]+|0)\.([0-9]+)$)|^(([^0][0-9]+|0)$)|^(([1-9]+)\.([0-9]+)$)|^(([1-9]+)$)/.test(_val)) { // 妫�楠屾槸鍚︿负娴偣鏁� - errors.push(_position + '鍐呭搴斾负娴偣鏁�') - } else if (_vals[0].length > 18) { // 妫�楠屾暣鏁颁綅 - errors.push(_position + '鏁存暟浣嶈秴鍑鸿寖鍥�') - } else if (_vals[1] && _vals[1].length > col.limit) { // 鏈�灏忓�兼楠� - errors.push(_position + '灏忔暟浣嶈秴鍑鸿寖鍥�') + if (!/^(([^0][0-9]+|0)\.([0-9]+)$)|^(([^0][0-9]+|0)$)|^(([1-9]+)\.([0-9]+)$)|^(([1-9]+)$)/.test(val)) { // 妫�楠屾槸鍚︿负娴偣鏁� + errors.push(_position + '鍐呭搴斾负鏁板��') } else if ((col.min || col.min === 0) && val < col.min) { // 鏈�灏忓�兼楠� errors.push(_position + '灏忎簬鏈�灏忓��') } else if ((col.max || col.max === 0) && val > col.max) { // 鏈�澶у�兼楠� -- Gitblit v1.8.0