From 2ed69e9acd66d5c79bba58df6efefcbb437c224e Mon Sep 17 00:00:00 2001 From: yufei_wang <2267742828@qq.com> Date: Mon, 11 Nov 2024 14:26:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=AA=E4=BF=9D=E7=95=99=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E9=80=97=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/qms/inspectionRecordFirst/addForm.vue | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/views/qms/inspectionRecordFirst/addForm.vue b/src/views/qms/inspectionRecordFirst/addForm.vue index c5a92cfdb..c05c87a1f 100644 --- a/src/views/qms/inspectionRecordFirst/addForm.vue +++ b/src/views/qms/inspectionRecordFirst/addForm.vue @@ -1408,7 +1408,15 @@ const boxList = ref() // }) // } const inputChange = (val,cur) => { - cur.inspectionValue = cur.inspectionValue.replace(/[^0-9.]/g, '') + cur.inspectionValue = cur.inspectionValue.replace(/[^0-9.]/g, '').replace(/\./, '#').replace(/\./, '').replace(/#/, '\.') // 只保留第一个小数点 + // cur.inspectionValue = + // cur.inspectionValue + // .replace(/[^\d^\.^-]+/g, '') // 把不是数字,不是小数点的过滤掉 + // .replace(/^0+(\d)/, '$1') // 以0开头,0后面为数字,则过滤掉,取后面的数字 + // .replace(/^-0+(\d)/, '-$1') // 以-0开头,0后面为数字,则过滤掉,取后面的数字 + // .replace(/-/g, (match: any, offset: number) => offset === 0 ? '-' : '') // 只允许第一个是负号- + // .replace(/\./, '#').replace(/\./, '').replace(/#/, '\.') // 只保留第一个小数点 + } const inspectionValueInput = (item, cur) => { for (