From 0fb0e7f41f6f6231b4dcb510e6178936618d4eb3 Mon Sep 17 00:00:00 2001 From: ZhangYong Date: Tue, 18 Nov 2025 10:34:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=A7=E5=93=81=E6=95=B0=E9=87=8F=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../moneyManage/receiveDetail/receiveService.vue | 26 +++++++++++++++++++++- .../receiveDetail/utils/recriveFormRules.js | 5 ----- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/views/moneyManage/receiveDetail/receiveService.vue b/src/views/moneyManage/receiveDetail/receiveService.vue index 5e54dd3..958212b 100644 --- a/src/views/moneyManage/receiveDetail/receiveService.vue +++ b/src/views/moneyManage/receiveDetail/receiveService.vue @@ -200,7 +200,7 @@ - +
@@ -667,6 +667,18 @@ const handleAddForm = async () => { ElMessage.error(testGold().message); return; } + //单独校验产品数量 + if (!isGold.value) { + if (!addFormData.value.goodNum) { + ElMessage.error('请输入产品数量'); + return; + } + const positiveIntReg = /^[1-9]\d*$/; + if (!positiveIntReg.test(addFormData.value.goodNum)) { + ElMessage.error('产品数量必须为正整数'); + return; + } + } // 处理时间格式 if (addFormData.value.payTime) { addFormData.value.payTime = moment(addFormData.value.payTime).format('YYYY-MM-DD HH:mm:ss') @@ -704,6 +716,18 @@ const handleEditForm = async () => { ElMessage.error(testGold().message); return; } + //单独校验产品数量 + if (!isGold.value) { + if (!addFormData.value.goodNum) { + ElMessage.error('请输入产品数量'); + return; + } + const positiveIntReg = /^[1-9]\d*$/; + if (!positiveIntReg.test(addFormData.value.goodNum)) { + ElMessage.error('产品数量必须为正整数'); + return; + } + } // 处理时间格式 if (addFormData.value.payTime) { addFormData.value.payTime = moment(addFormData.value.payTime).format('YYYY-MM-DD HH:mm:ss') diff --git a/src/views/moneyManage/receiveDetail/utils/recriveFormRules.js b/src/views/moneyManage/receiveDetail/utils/recriveFormRules.js index 9e8f4b1..23ca657 100644 --- a/src/views/moneyManage/receiveDetail/utils/recriveFormRules.js +++ b/src/views/moneyManage/receiveDetail/utils/recriveFormRules.js @@ -23,11 +23,6 @@ export const addFormRule = { // 产品数量:0-100纯数字 goodNum: [ { required: true, message: '请输入产品数量', trigger: 'blur' }, - { - pattern: /^[1-9]\d*$/, - message: '请输入正整数', - trigger: 'blur' - } ], // 付款币种:必填 paymentCurrency: [